Check-in [79bd6dfe51]
Overview
Comment:Updated TLS package to use new simplified build system, requiring further refinement as well
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:79bd6dfe5157169bf5e1cb95aaaa50aa04b41bea
User & Date: rkeene on 2016-09-06 05:18:25
Other Links: manifest | tags
Context
2016-09-06
05:28
Added support for applying patches to new build system check-in: b949baf854 user: rkeene tags: trunk
05:18
Updated TLS package to use new simplified build system, requiring further refinement as well check-in: 79bd6dfe51 user: rkeene tags: trunk
04:43
Upgraded to latest version of tcllib check-in: 5ccf6eac7a user: rkeene tags: trunk
Changes

Modified common/common.sh from [7543705ff9] to [dbcc3cc417].

   211    211   }
   212    212   
   213    213   function preinstall() {
   214    214   	:
   215    215   }
   216    216   
   217    217   function install() {
   218         -	local installlibdir
   219         -	local installpkgdir
   220         -	local pkglibfile
   221         -
   222    218   	mkdir -p "${installdir}/lib" || return 1
   223    219   	${MAKE:-make} tcllibdir="${installdir}/lib" "${make_extra[@]}" install || return 1
          220  +}
          221  +
          222  +function postinstall() {
          223  +	:
          224  +}
          225  +
          226  +function createruntime() {
          227  +	local runtimelibdir
          228  +	local runtimepkgdir
          229  +	local pkglibfile
          230  +	local file
          231  +
          232  +	# Install files needed by installation
          233  +	cp -r "${installdir}/lib" "${runtimedir}" || return 1
   224    234   
   225         -	# Create pkgIndex if needed
          235  +	# Create pkgIndex files if needed
   226    236   	if [ -z "${tclpkg}" ]; then
   227    237   		tclpkg="${pkg}"
   228    238   	fi
   229    239   
   230    240   	if [ -z "${tclpkgversion}" ]; then
   231    241   		tclpkgversion="${version}"
   232    242   	fi
   233    243   
   234         -	installlibdir="${installdir}/lib"
          244  +	runtimelibdir="${runtimedir}/lib"
   235    245   
   236    246   	if [ "${pkg_configure_shared_build}" = '0' ]; then
   237         -		find "${installlibdir}" -name '*.a' | sed 's@/[^/]*\.a$@@' | head -n 1 | while IFS='' read -r installpkgdir; do
   238         -			if [ ! -e "${installpkgdir}/pkgIndex.tcl" ]; then
   239         -				cat << _EOF_ > "${installpkgdir}/pkgIndex.tcl"
          247  +		find "${runtimelibdir}" -name '*.a' | sed 's@/[^/]*\.a$@@' | head -n 1 | while IFS='' read -r runtimepkgdir; do
          248  +			if [ ! -e "${runtimepkgdir}/pkgIndex.tcl" ]; then
          249  +				cat << _EOF_ > "${runtimepkgdir}/pkgIndex.tcl"
   240    250   package ifneeded ${tclpkg} ${tclpkgversion} [list load {} ${tclpkg}]
   241    251   _EOF_
   242    252   			fi
   243    253   		done
   244    254   	elif [ "${pkg_configure_shared_build}" = '1' ]; then
   245         -		find "${installlibdir}" -name '*.so' -o -name '*.dylib' -o -name '*.dll' -o -name '*.shlib' | sed 's@/[^/]*$@@' | head -n 1 | while IFS='' read -r installpkgdir; do
   246         -			if [ ! -e "${installpkgdir}/pkgIndex.tcl" ]; then
   247         -				cat << _EOF_ > "${installpkgdir}/pkgIndex.tcl"
          255  +		find "${runtimelibdir}" -name '*.so' -o -name '*.dylib' -o -name '*.dll' -o -name '*.shlib' | head -n 1 | while IFS='' read -r pkglibfile; do
          256  +			runtimepkgdir="$(echo "${pkglibfile}" | sed 's@/[^/]*$@@')"
          257  +			pkglibfile="$(echo "${pkglibfile}" | sed 's@^.*/@@')"
          258  +			if [ ! -e "${runtimepkgdir}/pkgIndex.tcl" ]; then
          259  +				cat << _EOF_ > "${runtimepkgdir}/pkgIndex.tcl"
   248    260   package ifneeded ${tclpkg} ${tclpkgversion} [list load [file join \$dir ${pkglibfile}]]
   249    261   _EOF_
   250    262   			fi
   251    263   		done
   252    264   	fi
   253         -}
   254    265   
   255         -function postinstall() {
   256         -	:
   257         -}
   258         -
   259         -function createruntime() {
   260         -	local file
   261         -
   262         -	# Install files needed by installation
   263         -	cp -r "${installdir}/lib" "${runtimedir}" || return 1
   264         -
          266  +	# Remove link-only files from the runtime directory
   265    267   	find "${runtimedir}" '(' -name '*.a' -o -name '*.a.linkadd' ')' -type f | while IFS='' read -r file; do
   266    268   		rm -f "${file}"
   267    269   	done
   268    270   
   269    271   	# Ensure that some files were installed
   270    272   	if ! find "${runtimedir}" -type f 2>/dev/null | grep '^' >/dev/null; then
   271    273   		return 1

Modified kitcreator from [6465223bf6] to [9196d0a46c].

   266    266   						preinstall || die 'preinstall failed'
   267    267   						install || die 'install failed'
   268    268   						postinstall || die 'postinstall failed'
   269    269   
   270    270   						createruntime || die 'createruntime failed'
   271    271   
   272    272   						set +x
   273         -
   274         -						rm -rf "${workdir}"
   275    273   					) 3>&1 4>&2 >> build.log 2>&1 || exit 1
   276    274   				else
   277    275   					"${build_script}" 3>&1 4>&2 >> build.log 2>&1 || exit 1
   278    276   				fi
   279    277   
   280    278   				call_pkg_init='0'
   281    279   			done

Modified tls/build.sh from [82518c6710] to [5e536572e7].

     1      1   #! /usr/bin/env bash
     2      2   
     3         -if [ ! -f 'build.sh' ]; then
     4         -	echo 'ERROR: This script must be run from the directory it is in' >&2
            3  +# BuildCompatible: KitCreator
     5      4   
     6         -	exit 1
     7         -fi
     8         -if [ -z "${TCLVERS}" ]; then
     9         -	echo 'ERROR: The TCLVERS environment variable is not set' >&2
    10         -
    11         -	exit 1
    12         -fi
    13         -
    14         -TLSVERS="1.6.7"
    15         -SRC="src/tls-${TLSVERS}.tar.gz"
    16         -SRCURL="http://sourceforge.net/projects/tls/files/tls/${TLSVERS}/tls${TLSVERS}-src.tar.gz"
    17         -SRCHASH='5119de3e5470359b97a8a00d861c9c48433571ee0167af0a952de66c99d3a3b8'
    18         -BUILDDIR="$(pwd)/build/tls${TLSVERS}"
    19         -OUTDIR="$(pwd)/out"
    20         -INSTDIR="$(pwd)/inst"
    21         -PATCHDIR="$(pwd)/patches"
    22         -export TLSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR
    23         -
    24         -# Set configure options for this sub-project
    25         -LDFLAGS="${LDFLAGS} ${KC_TLS_LDFLAGS}"
    26         -CFLAGS="${CFLAGS} ${KC_TLS_CFLAGS}"
    27         -CPPFLAGS="${CPPFLAGS} ${KC_TLS_CPPFLAGS}"
    28         -LIBS="${LIBS} ${KC_TLS_LIBS}"
    29         -export LDFLAGS CFLAGS CPPFLAGS LIBS
    30         -
    31         -rm -rf 'build' 'out' 'inst'
    32         -mkdir 'build' 'out' 'inst' || exit 1
    33         -
    34         -TCL_VERSION="unknown"
    35         -if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then
    36         -        source "${TCLCONFIGDIR}/tclConfig.sh"
    37         -fi
    38         -export TCL_VERSION
    39         -
    40         -if [ ! -f "${SRC}" ]; then
    41         -	mkdir 'src' >/dev/null 2>/dev/null
    42         -
    43         -	if [ ! -d 'buildsrc' ]; then
    44         -		download "${SRCURL}" "${SRC}" "${SRCHASH}" || exit 1
    45         -	fi
    46         -fi
            5  +version="1.6.7"
            6  +url="http://sourceforge.net/projects/tls/files/tls/${TLSVERS}/tls${TLSVERS}-src.tar.gz"
            7  +sha256='5119de3e5470359b97a8a00d861c9c48433571ee0167af0a952de66c99d3a3b8'
    47      8   
    48      9   function buildSSLLibrary() {
    49     10   	local version url hash
    50     11   	local archive
    51     12   
    52     13   	version='2.4.1'
    53     14   	url="http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${version}.tar.gz"
................................................................................
    54     15   	hash='121922b13169cd47a85e3e77f0bc129f8d04247193b42491cb1fab9074e80477'
    55     16   
    56     17   	archive="src/libressl-${version}.tar.gz"
    57     18   
    58     19   	echo " *** Building LibreSSL v${version}" >&2
    59     20   
    60     21   	if [ ! -e "../${archive}" ]; then
    61         -		download "${url}" "../${archive}" "${hash}" || return 1
           22  +		"${_download}" "${url}" "../${archive}" "${hash}" || return 1
    62     23   	fi
    63     24   
    64     25   	(
    65     26   		rm -rf libressl-*
    66     27   
    67     28   		gzip -dc "../${archive}" | tar -xf - || exit 1
    68     29   
................................................................................
    75     36   		${MAKE:-make} V=1 || exit 1
    76     37   
    77     38   		echo "Running: ${MAKE:-make} V=1 install" 
    78     39   		${MAKE:-make} V=1 install || exit 1
    79     40   	) || return 1
    80     41   
    81     42   	SSLDIR="$(pwd)/libressl-${version}/INST"
    82         -	addlibs="$(PKG_CONFIG_PATH="$(pwd)/libressl-${version}/INST/lib/pkgconfig" "${PKG_CONFIG:-pkg-config}" libssl libcrypto --libs --static)"
           43  +	addlibs_LOCALSSL="$(PKG_CONFIG_PATH="${SSLDIR}/lib/pkgconfig" "${PKG_CONFIG:-pkg-config}" libssl libcrypto --libs --static)"
    83     44   }
    84     45   
    85         -(
    86         -	cd 'build' || exit 1
    87         -
    88         -	if [ ! -d '../buildsrc' ]; then
    89         -		gzip -dc "../${SRC}" | tar -xf -
    90         -	else    
    91         -		cp -rp ../buildsrc/* './'
    92         -	fi
    93         -
           46  +function preconfigure() {
    94     47   	# Determine SSL directory
    95     48   	if [ -z "${CPP}" ]; then
    96     49   		CPP="${CC:-cc} -E"
    97     50   	fi
    98     51   
    99     52   	if [ -n "${KC_TLS_SSLDIR}" ]; then
   100     53   		SSLDIR="${KC_TLS_SSLDIR}"
................................................................................
   108     61   		if [ -z "${SSLDIR}" ]; then
   109     62   			buildSSLLibrary || SSLDIR=''
   110     63   		fi
   111     64   
   112     65   		if [ -z "${SSLDIR}" ]; then
   113     66   			echo "Unable to find OpenSSL, aborting." >&2
   114     67   
   115         -			exit 1
           68  +			return 1
   116     69   		fi
   117     70   	fi
   118     71   
   119         -	# Apply required patches
   120         -	cd "${BUILDDIR}" || exit 1
   121         -	for patch in "${PATCHDIR}/all"/tls-${TLSVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tls-${TLSVERS}-*.diff; do
   122         -		if [ ! -f "${patch}" ]; then
   123         -			continue
   124         -		fi
   125         -
   126         -		echo "Applying: ${patch}"
   127         -		${PATCH:-patch} -p1 < "${patch}"
   128         -	done
   129         -
   130         -	cd "${BUILDDIR}" || exit 1
   131         -
   132         -	# Try to build as a shared object if requested
   133         -	if [ "${STATICTLS}" = "0" ]; then
   134         -		tryopts="--enable-shared --disable-shared"
   135         -	elif [ "${STATICTLS}" = "-1" ]; then
   136         -		tryopts="--enable-shared"
   137         -	else
   138         -		tryopts="--disable-shared"
   139         -	fi
   140         -
   141     72   	# Disable SSLv2, newer SSL libraries drop support for it entirely
   142     73   	CFLAGS="${CFLAGS} -DNO_SSL2=1"
   143     74   
   144     75   	# Disable SSLv3, newer SSL libraries drop support for it entirely
   145     76   	CFLAGS="${CFLAGS} -DNO_SSL3=1"
   146     77   
   147         -	SAVE_CFLAGS="${CFLAGS}"
   148         -	SAVE_LIBS="${LIBS}"
   149         -	for tryopt in $tryopts __fail__; do
   150         -		CFLAGS="${SAVE_CFLAGS}"
   151         -		LIBS="${SAVE_LIBS}"
   152         -		export CFLAGS LIBS
           78  +}
   153     79   
   154         -		# Clean up, if needed
   155         -		make distclean >/dev/null 2>/dev/null
   156         -		rm -rf "${INSTDIR}"
   157         -		mkdir "${INSTDIR}"
   158         -
   159         -		if [ "${tryopt}" = "__fail__" ]; then
   160         -			exit 1
   161         -		fi
   162         -
   163         -		if [ "${tryopt}" == "--enable-shared" ]; then
   164         -			isshared="1"
   165         -		else
   166         -			isshared="0"
   167         -		fi
   168         -
   169         -		# If building a shared TLS, add the LINKADD libraries here
   170         -		if [ "${isshared}" = '1' ]; then
   171         -			LIBS="${LIBS} ${KC_TLS_LINKADD}"
   172         -		fi
   173         -
   174         -		# If build a static TLS for KitDLL, ensure that we use PIC
   175         -		# so that it can be linked into the shared object
   176         -		if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then
   177         -			CFLAGS="${CFLAGS} -fPIC"
   178         -		fi
   179         -
   180         -		if [ "${isshared}" = '0' ]; then
   181         -			sed 's@USE_TCL_STUBS@XXX_TCL_STUBS@g' configure > configure.new
   182         -		else
   183         -			sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new
   184         -		fi
   185         -		cat configure.new > configure
   186         -		rm -f configure.new
   187         -
   188         -		(
   189         -			echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" --with-ssl-dir=\"${SSLDIR}\" ${CONFIGUREEXTRA}"
   190         -			./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" --with-ssl-dir="${SSLDIR}" ${CONFIGUREEXTRA}
   191         -
   192         -			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\""
   193         -			${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" || exit 1
   194         -
   195         -			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\" install"
   196         -			${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" install || exit 1
   197         -		) || continue
           80  +function postconfigure() {
           81  +	local linkaddfile
           82  +	local addlibs
   198     83   
   199     84   		# Determine SSL library directory
   200     85   		SSL_LIB_DIR="$(${MAKE:-make} --print-data-base | awk '/^SSL_LIB_DIR = /{ print }' | sed 's@^SSL_LIB_DIR = *@@')"
   201     86   
   202     87   		echo "SSL_LIB_DIR = ${SSL_LIB_DIR}"
           88  +}
   203     89   
   204         -		break
   205         -	done
   206         -
           90  +function postinstall() {
   207     91   	# Create pkgIndex if needed
   208         -	if [ ! -e "${INSTDIR}/lib/tls${TLSVERS}/pkgIndex.tcl" ]; then
   209         -		cat << _EOF_ > "${INSTDIR}/lib/tls${TLSVERS}/pkgIndex.tcl"
   210         -package ifneeded tls ${TLSVERS} \
           92  +	if [ ! -e "${installdir}/lib/tls${version}/pkgIndex.tcl" ]; then
           93  +		cat << _EOF_ > "${installdir}/lib/tls${version}/pkgIndex.tcl"
           94  +package ifneeded tls ${version} \
   211     95       "[list source [file join \$dir tls.tcl]] ; \
   212     96        [list load {} tls]"
   213     97   _EOF_
   214     98   	fi
   215     99   
   216    100   	# Determine name of static object
   217         -	LINKADDFILE="$(find "${INSTDIR}" -name '*.a' | head -n 1)"
   218         -	if [ -n "${LINKADDFILE}" ]; then
   219         -		LINKADDFILE="${LINKADDFILE}.linkadd"
          101  +	linkaddfile="$(find "${installdir}" -name '*.a' | head -n 1)"
          102  +	if [ -n "${linkaddfile}" ]; then
          103  +		linkaddfile="${linkaddfile}.linkadd"
   220    104   
   221         -		## XXX: TODO: Determine what we actually need to link against
          105  +		if [ -n "${addlibs_LOCALSSL}" ]; then
          106  +			addlibs="${addlibs_LOCALSSL}"
          107  +		fi
          108  +
   222    109   		if [ -z "${addlibs}" ]; then
   223    110   			if [ "${KC_TLS_LINKSSLSTATIC}" = '1' ]; then
   224    111   				addlibs="$("${PKG_CONFIG:-pkg-config}" libssl libcrypto --libs --static)"
   225    112   			else
   226    113   				addlibs="$("${PKG_CONFIG:-pkg-config}" libssl libcrypto --libs)"
   227    114   			fi
   228    115   		fi
................................................................................
   234    121   
   235    122   		addlibs="${addlibs} ${KC_TLS_LINKADD}"
   236    123   
   237    124   		if [ "${KC_TLS_LINKSSLSTATIC}" = '1' ]; then
   238    125   			echo "-Wl,-Bstatic ${addlibs} ${addlibs_staticOnly} -Wl,-Bdynamic"
   239    126   		else
   240    127   			echo "${addlibs}"
   241         -		fi > "${LINKADDFILE}"
          128  +		fi > "${linkaddfile}"
   242    129   	fi
   243         -
   244         -	# Install files needed by installation
   245         -	cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1
   246         -	find "${OUTDIR}" -name '*.a' -type f | xargs -n 1 rm -f --
   247         -
   248         -	exit 0
   249         -) || exit 1
   250         -
   251         -exit 0
          130  +}