Diff

Differences From Artifact [f6144b21a4]:

To Artifact [6f7681a2e1]:


     7      7   fi
     8      8   if [ -z "${TCLVERS}" ]; then
     9      9   	echo 'ERROR: The TCLVERS environment variable is not set' >&2
    10     10   
    11     11   	exit 1
    12     12   fi
    13     13   
    14         -TLSVERS="1.6"
           14  +TLSVERS="1.6.7"
    15     15   SRC="src/tls-${TLSVERS}.tar.gz"
    16     16   SRCURL="http://sourceforge.net/projects/tls/files/tls/${TLSVERS}/tls${TLSVERS}-src.tar.gz"
    17     17   BUILDDIR="$(pwd)/build/tls${TLSVERS}"
    18     18   OUTDIR="$(pwd)/out"
    19     19   INSTDIR="$(pwd)/inst"
    20     20   PATCHDIR="$(pwd)/patches"
    21     21   export TLSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR
................................................................................
    55     55   		cp -rp ../buildsrc/* './'
    56     56   	fi
    57     57   
    58     58   	# Determine SSL directory
    59     59   	if [ -z "${CPP}" ]; then
    60     60   		CPP="${CC} -E"
    61     61   	fi
    62         -	SSLDIR="$(echo '#include <openssl/ssl.h>' 2>/dev/null | ${CPP} - | awk '/# 1 "\/.*\/ssl\.h/{ print $3; exit }' | sed 's@^"@@;s@"$@@;s@/include/openssl/ssl\.h$@@')"
           62  +
           63  +	if [ -n "${KC_TLS_SSLDIR}" ]; then
           64  +		SSLDIR="${KC_TLS_SSLDIR}"
           65  +	else
           66  +		SSLDIR="$(echo '#include <openssl/ssl.h>' 2>/dev/null | ${CPP} - | awk '/# 1 "\/.*\/ssl\.h/{ print $3; exit }' | sed 's@^"@@;s@"$@@;s@/include/openssl/ssl\.h$@@')"
           67  +		if [ -z "${SSLDIR}" ]; then
           68  +			echo "Unable to find OpenSSL, aborting." >&2
           69  +
           70  +			exit 1
           71  +		fi
           72  +	fi
    63     73   
    64     74   	# Apply required patches
    65     75   	cd "${BUILDDIR}" || exit 1
    66     76   	for patch in "${PATCHDIR}/all"/tls-${TLSVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tls-${TLSVERS}-*.diff; do
    67     77   		if [ ! -f "${patch}" ]; then
    68     78   			continue
    69     79   		fi
................................................................................
   127    137   			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\""
   128    138   			${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" || exit 1
   129    139   
   130    140   			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\" install"
   131    141   			${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" install || exit 1
   132    142   		) || continue
   133    143   
          144  +		# Determine SSL library directory
          145  +		SSL_LIB_DIR="$(${MAKE:-make} --print-data-base | awk '/^SSL_LIB_DIR = /{ print }' | sed 's@^SSL_LIB_DIR = *@@')"
          146  +
          147  +		echo "SSL_LIB_DIR = ${SSL_LIB_DIR}"
          148  +
   134    149   		break
   135    150   	done
   136    151   
   137    152   	# Create pkgIndex if needed
   138    153   	if [ ! -e "${INSTDIR}/lib/tls${TLSVERS}/pkgIndex.tcl" ]; then
   139    154   		cat << _EOF_ > "${INSTDIR}/lib/tls${TLSVERS}/pkgIndex.tcl"
   140    155   package ifneeded tls ${TLSVERS} \
   141    156       "[list source [file join \$dir tls.tcl]] ; \
   142    157        [list load {} tls]"
   143    158   _EOF_
   144    159   	fi
   145    160   
          161  +	# Determine name of static object
          162  +	LINKADDFILE="$(find "${INSTDIR}" -name '*.a' | head -n 1).linkadd"
          163  +
   146    164   	## XXX: TODO: Determine what we actually need to link against
   147         -	addlibs="-lssl -lcrypto"
          165  +	addlibs="-L${SSL_LIB_DIR:-/lib} -lssl -lcrypto ${KC_TLS_LINKADD}"
          166  +	addlibs_staticOnly=""
   148    167   	if [ "${KC_TLS_LINKSSLSTATIC}" = '1' ]; then
   149         -		echo "-Wl,-Bstatic ${addlibs} -Wl,-Bdynamic"
          168  +		echo "-Wl,-Bstatic ${addlibs} ${addlibs_staticOnly} -Wl,-Bdynamic"
   150    169   	else
   151    170   		echo "${addlibs}"
   152         -	fi > "${INSTDIR}/lib/tls${TLSVERS}/libtls${TLSVERS}.a.linkadd"
          171  +	fi > "${LINKADDFILE}"
   153    172   
   154    173   	# Install files needed by installation
   155    174   	cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1
   156    175   	find "${OUTDIR}" -name '*.a' -type f | xargs -n 1 rm -f --
   157    176   
   158    177   	exit 0
   159    178   ) || exit 1
   160    179   
   161    180   exit 0