aboutsummaryrefslogtreecommitdiff
path: root/update.sh
diff options
context:
space:
mode:
authorBrent Cook <busterb@gmail.com>2014-11-20 00:26:55 -0600
committerBrent Cook <bcook@openbsd.org>2014-12-03 17:02:29 -0600
commit58fcd3c39c73d83eb9782a8ef935498b18b5ae73 (patch)
tree523e55877fe8f38cc99ce8fdb633d9db9fe513e9 /update.sh
parent7f0646f612f61792bc3f922233c85bd205130216 (diff)
downloadportable-58fcd3c39c73d83eb9782a8ef935498b18b5ae73.tar.gz
portable-58fcd3c39c73d83eb9782a8ef935498b18b5ae73.tar.bz2
portable-58fcd3c39c73d83eb9782a8ef935498b18b5ae73.zip
Add conditional compilation for windows and posix functions.
This adds a Windows-specific versions of several symbols from libcrypto and openssl(1).
Diffstat (limited to 'update.sh')
-rwxr-xr-xupdate.sh49
1 files changed, 42 insertions, 7 deletions
diff --git a/update.sh b/update.sh
index 3a0edbb..80842cf 100755
--- a/update.sh
+++ b/update.sh
@@ -38,7 +38,11 @@ copy_src() {
38 mkdir -p $1 38 mkdir -p $1
39 rm -f $1/*.c 39 rm -f $1/*.c
40 for file in $3; do 40 for file in $3; do
41 $CP $2/src/$1/$file $1 41 if [ -e $2/src/$1/$file ]; then
42 $CP $2/src/$1/$file $1
43 else
44 $CP crypto/compat/$file $1
45 fi
42 done 46 done
43} 47}
44 48
@@ -128,7 +132,8 @@ copy_crypto bf "bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c bf_locl.h bf_p
128 132
129copy_crypto bio "bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c 133copy_crypto bio "bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c
130 bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_dump.c 134 bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_dump.c
131 b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c bss_dgram.c b_print.c" 135 b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c bss_dgram.c b_print.c
136 b_posix.c b_win.c"
132 137
133copy_crypto bn "bn_add.c bn_asm.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c 138copy_crypto bn "bn_add.c bn_asm.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c
134 bn_mod.c bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c bn_kron.c 139 bn_mod.c bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c bn_kron.c
@@ -262,7 +267,7 @@ copy_crypto ts "ts_err.c ts_req_utils.c ts_req_print.c ts_rsp_utils.c
262 267
263copy_crypto txt_db "txt_db.c" 268copy_crypto txt_db "txt_db.c"
264 269
265copy_crypto ui "ui_err.c ui_lib.c ui_openssl.c ui_util.c ui_locl.h" 270copy_crypto ui "ui_err.c ui_lib.c ui_openssl.c ui_openssl_win.c ui_util.c ui_locl.h"
266 271
267copy_crypto whrlpool "wp_block.c wp_dgst.c wp_locl.h" 272copy_crypto whrlpool "wp_block.c wp_dgst.c wp_locl.h"
268 273
@@ -373,6 +378,14 @@ crypto_excludes=(
373 chacha/chacha-merged.c 378 chacha/chacha-merged.c
374 poly1305/poly1305-donna.c 379 poly1305/poly1305-donna.c
375 ) 380 )
381crypto_posix_only=(
382 bio/b_posix.c
383 ui/ui_openssl.c
384 )
385crypto_win32_only=(
386 bio/b_win.c
387 ui/ui_openssl_win.c
388 )
376(cd crypto 389(cd crypto
377 sed -e "s/libcrypto-version/${libcrypto_version}/" Makefile.am.tpl > Makefile.am 390 sed -e "s/libcrypto-version/${libcrypto_version}/" Makefile.am.tpl > Makefile.am
378 for i in `ls -1 *.c|sort`; do 391 for i in `ls -1 *.c|sort`; do
@@ -385,10 +398,18 @@ crypto_excludes=(
385 echo >> Makefile.am 398 echo >> Makefile.am
386 echo "# ${subdir}" >> Makefile.am 399 echo "# ${subdir}" >> Makefile.am
387 for i in `ls -1 $subdir/*.c|sort`; do 400 for i in `ls -1 $subdir/*.c|sort`; do
388 if ! [[ ${crypto_excludes[*]} =~ $i ]]; then 401 if [[ ${crypto_excludes[*]} =~ $i ]]; then
389 echo "libcrypto_la_SOURCES += $i" >> Makefile.am
390 else
391 echo "EXTRA_libcrypto_la_SOURCES += $i" >> Makefile.am 402 echo "EXTRA_libcrypto_la_SOURCES += $i" >> Makefile.am
403 elif [[ ${crypto_posix_only[*]} =~ $i ]]; then
404 echo "if !HOST_WIN" >> Makefile.am
405 echo "libcrypto_la_SOURCES += ${i}" >> Makefile.am
406 echo "endif" >> Makefile.am
407 elif [[ ${crypto_win32_only[*]} =~ $i ]]; then
408 echo "if HOST_WIN" >> Makefile.am
409 echo "libcrypto_la_SOURCES += ${i}" >> Makefile.am
410 echo "endif" >> Makefile.am
411 else
412 echo "libcrypto_la_SOURCES += $i" >> Makefile.am
392 fi 413 fi
393 done 414 done
394 headers=`ls -1 $subdir/*.h 2>/dev/null |sort` 415 headers=`ls -1 $subdir/*.h 2>/dev/null |sort`
@@ -405,10 +426,24 @@ $CP $libc_src/stdlib/strtonum.c apps/
405apps_excludes=( 426apps_excludes=(
406 strtonum.c 427 strtonum.c
407 ) 428 )
429apps_posix_only=(
430 apps_posix.c
431 )
432apps_win32_only=(
433 apps_win.c
434 )
408(cd apps 435(cd apps
409 $CP Makefile.am.tpl Makefile.am 436 $CP Makefile.am.tpl Makefile.am
410 for i in `ls -1 *.c|sort`; do 437 for i in `ls -1 *.c|sort`; do
411 if ! [[ ${apps_excludes[*]} =~ $i ]]; then 438 if [[ ${apps_posix_only[*]} =~ $i ]]; then
439 echo "if !HOST_WIN" >> Makefile.am
440 echo "openssl_SOURCES += ${i}" >> Makefile.am
441 echo "endif" >> Makefile.am
442 elif [[ ${apps_win32_only[*]} =~ $i ]]; then
443 echo "if HOST_WIN" >> Makefile.am
444 echo "openssl_SOURCES += ${i}" >> Makefile.am
445 echo "endif" >> Makefile.am
446 elif ! [[ ${apps_excludes[*]} =~ $i ]]; then
412 echo "openssl_SOURCES += $i" >> Makefile.am 447 echo "openssl_SOURCES += $i" >> Makefile.am
413 fi 448 fi
414 done 449 done