Index: tls/build.sh ================================================================== --- tls/build.sh +++ tls/build.sh @@ -95,11 +95,16 @@ # Disable SSLv2, newer SSL libraries drop support for it entirely CFLAGS="${CFLAGS} -DNO_SSL2=1" SAVE_CFLAGS="${CFLAGS}" + SAVE_LIBS="${LIBS}" for tryopt in $tryopts __fail__; do + CFLAGS="${SAVE_CFLAGS}" + LIBS="${SAVE_LIBS}" + export CFLAGS LIBS + # Clean up, if needed make distclean >/dev/null 2>/dev/null rm -rf "${INSTDIR}" mkdir "${INSTDIR}" @@ -110,19 +115,21 @@ if [ "${tryopt}" == "--enable-shared" ]; then isshared="1" else isshared="0" fi + + # If building a shared TLS, add the LINKADD libraries here + if [ "${isshared}" = '1' ]; then + LIBS="${LIBS} ${KC_TLS_LINKADD}" + fi # If build a static TLS for KitDLL, ensure that we use PIC # so that it can be linked into the shared object if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then - CFLAGS="${SAVE_CFLAGS} -fPIC" - else - CFLAGS="${SAVE_CFLAGS}" + CFLAGS="${CFLAGS} -fPIC" fi - export CFLAGS if [ "${isshared}" = '0' ]; then sed 's@USE_TCL_STUBS@XXX_TCL_STUBS@g' configure > configure.new else sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new @@ -157,24 +164,27 @@ [list load {} tls]" _EOF_ fi # Determine name of static object - LINKADDFILE="$(find "${INSTDIR}" -name '*.a' | head -n 1).linkadd" - - ## XXX: TODO: Determine what we actually need to link against - addlibs="-L${SSL_LIB_DIR:-/lib} -lssl -lcrypto ${KC_TLS_LINKADD}" - addlibs_staticOnly="" - if [ "${KC_TLS_LINKSSLSTATIC}" = '1' ]; then - echo "-Wl,-Bstatic ${addlibs} ${addlibs_staticOnly} -Wl,-Bdynamic" - else - echo "${addlibs}" - fi > "${LINKADDFILE}" + LINKADDFILE="$(find "${INSTDIR}" -name '*.a' | head -n 1)" + if [ -n "${LINKADDFILE}" ]; then + LINKADDFILE="${LINKADDFILE}.linkadd" + + ## XXX: TODO: Determine what we actually need to link against + addlibs="-L${SSL_LIB_DIR:-/lib} -lssl -lcrypto ${KC_TLS_LINKADD}" + addlibs_staticOnly="" + if [ "${KC_TLS_LINKSSLSTATIC}" = '1' ]; then + echo "-Wl,-Bstatic ${addlibs} ${addlibs_staticOnly} -Wl,-Bdynamic" + else + echo "${addlibs}" + fi > "${LINKADDFILE}" + fi # Install files needed by installation cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1 find "${OUTDIR}" -name '*.a' -type f | xargs -n 1 rm -f -- exit 0 ) || exit 1 exit 0 Index: tls/patches/all/tls-1.6.7-fixcrosscompile.diff ================================================================== --- tls/patches/all/tls-1.6.7-fixcrosscompile.diff +++ tls/patches/all/tls-1.6.7-fixcrosscompile.diff @@ -1,8 +1,20 @@ +diff -uNr tls1.6.7.orig/Makefile.in tls1.6.7-fixcrosscompile/Makefile.in +--- tls1.6.7.orig/Makefile.in 2010-08-11 20:28:06.000000000 -0500 ++++ tls1.6.7-fixcrosscompile/Makefile.in 2015-10-28 10:47:10.714214000 -0500 +@@ -229,7 +229,7 @@ + $(PKG_LIB_FILE): $(PKG_OBJECTS) + -rm -f $(PKG_LIB_FILE) + ${MAKE_LIB} +- $(RANLIB) $(PKG_LIB_FILE) ++ -$(RANLIB) $(PKG_LIB_FILE) + + #======================================================================== + # We need to enumerate the list of .c to .o lines here. diff -uNr tls1.6.7.orig/configure tls1.6.7-fixcrosscompile/configure --- tls1.6.7.orig/configure 2015-07-07 12:16:02.000000000 -0500 -+++ tls1.6.7-fixcrosscompile/configure 2015-10-28 09:59:25.414214000 -0500 ++++ tls1.6.7-fixcrosscompile/configure 2015-10-28 10:42:09.324214000 -0500 @@ -1387,7 +1387,9 @@ fi EXEEXT=".exe" - TEA_PLATFORM="windows" @@ -41,5 +53,14 @@ + TEA_PLATFORM="unix" + fi echo "$as_me:$LINENO: result: unix" >&5 echo "${ECHO_T}unix" >&6 ;; +@@ -10316,7 +10324,7 @@ + fi + if test -n "${OPENSSL}"; then + +- vars="ssleay32.lib libeay32.lib" ++ vars="ssl.lib crypto.lib" + for i in $vars; do + if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then + # Convert foo.lib to -lfoo for GCC. No-op if not *.lib