Check-in [3b6f2236c8]
Overview
Comment:Migrated yajltcl to simplified build system
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3b6f2236c8e0e1541ca8abe51215ad573dc2a629
User & Date: rkeene on 2016-09-06 07:31:36
Other Links: manifest | tags
Context
2016-09-06
07:47
Added TUAPI and tDOM check-in: 36d65f9f09 user: rkeene tags: trunk
07:31
Migrated yajltcl to simplified build system check-in: 3b6f2236c8 user: rkeene tags: trunk
07:07
Updated ignores check-in: 55b6fd56f1 user: rkeene tags: trunk
Changes

Modified yajltcl/build.sh from [efe0f47413] to [fd907b16f4].

     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
     5         -
     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         -YAJLTCLVERS="1.5"
    15         -YAJLVERS='2.1.0'
    16         -SRC="src/yajltcl-${YAJLTCLVERS}.tar.gz"
    17         -YAJLSRC="src/yajl-${YAJLVERS}.tar.gz"
    18         -SRCURL="https://github.com/flightaware/yajl-tcl/archive/v${YAJLTCLVERS}.tar.gz"
    19         -SRCHASH='-'
    20         -YAJLSRCURL="http://github.com/lloyd/yajl/tarball/${YAJLVERS}"
    21         -YAJLSRCHASH='-'
    22         -BUILDDIR="$(pwd)/build/yajl-tcl-${YAJLTCLVERS}"
    23         -YAJLBUILDDIR="$(pwd)/build/lloyd-yajl-66cb08c"
    24         -OUTDIR="$(pwd)/out"
    25         -INSTDIR="$(pwd)/inst"
    26         -PATCHDIR="$(pwd)/patches"
    27         -export YAJLTCLVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR
            3  +# BuildCompatible: KitCreator
            4  +
            5  +version="1.5"
            6  +url="https://github.com/flightaware/yajl-tcl/archive/v${version}.tar.gz"
            7  +sha256='-'
            8  +
            9  +function buildYAJL() {
           10  +	local version url hash
           11  +	local archive yajlbuilddir
           12  +
           13  +	version='2.1.0'
           14  +	url="http://github.com/lloyd/yajl/tarball/${version}"
           15  +	hash='-'
           16  +
           17  +	yajlbuilddir="$(pwd)/lloyd-yajl-66cb08c"
           18  +	archive="${pkgdir}/src/yajl-${version}.tar.gz"
           19  +
           20  +	echo " *** Building YAJL v${version}" >&2
    28     21   
    29         -# Set configure options for this sub-project
    30         -LDFLAGS="${LDFLAGS} ${KC_YAJLTCL_LDFLAGS}"
    31         -CFLAGS="${CFLAGS} ${KC_YAJLTCL_CFLAGS}"
    32         -CPPFLAGS="${CPPFLAGS} ${KC_YAJLTCL_CPPFLAGS}"
    33         -LIBS="${LIBS} ${KC_YAJLTCL_LIBS}"
    34         -export LDFLAGS CFLAGS CPPFLAGS LIBS
    35         -
    36         -rm -rf 'build' 'out' 'inst'
    37         -mkdir 'build' 'out' 'inst' || exit 1
    38         -
    39         -if [ ! -d 'buildsrc' ]; then
    40         -	mkdir 'src' >/dev/null 2>/dev/null
    41         -
    42         -	if [ ! -f "${SRC}" ]; then
    43         -		download "${SRCURL}" "${SRC}" "${SRCHASH}" || exit 1
           22  +	if [ ! -e "${pkgdir}/${archive}" ]; then
           23  +		"${_download}" "${url}" "${archive}" "${hash}" || return 1
    44     24   	fi
    45     25   
    46         -	if [ ! -f "${YAJLSRC}" ]; then
    47         -		download "${YAJLSRCURL}" "${YAJLSRC}" "${YAJLSRCHASH}" || exit 1
    48         -	fi
    49         -fi
           26  +	(
           27  +		gzip -dc "${archive}" | tar -xf - || exit 1
           28  +		cd "${yajlbuilddir}" || exit 1
           29  +
           30  +		./configure -p "$(pwd)/INST" || exit 1
    50     31   
    51         -(
    52         -	cd 'build' || exit 1
           32  +		${MAKE:-make} || exit 1
    53     33   
    54         -	if [ ! -d '../buildsrc' ]; then
    55         -		gzip -dc "../${SRC}" | tar -xf -
    56         -		gzip -dc "../${YAJLSRC}" | tar -xf -
    57         -	else    
    58         -		cp -rp ../buildsrc/* './'
    59         -	fi
           34  +		${MAKE:-make} install || exit 1
    60     35   
    61         -	# Build YAJL
    62         -	(
    63         -		cd "${YAJLBUILDDIR}" || exit 1
    64         -		./configure -p "$(pwd)/INST" || exit 1
    65         -		make install || exit 1
    66     36   		rm -f INST/lib/*.so*
    67     37   		mv INST/lib/libyajl_s.a INST/lib/libyajl.a || exit 1
    68         -	) || exit 1
           38  +	) || return 1
    69     39   
    70     40   	# Include YAJL's build in our pkg-config path
    71         -	PKG_CONFIG_PATH="${YAJLBUILDDIR}/INST/share/pkgconfig"
    72         -	YAJL_CFLAGS="-I${YAJLBUILDDIR}/INST/include -I${YAJLBUILDDIR}/INST/include/yajl"
           41  +	PKG_CONFIG_PATH="${yajlbuilddir}/INST/share/pkgconfig"
           42  +	YAJL_CFLAGS="-I${yajlbuilddir}/INST/include -I${YAJLBUILDDIR}/INST/include/yajl"
    73     43   	export PKG_CONFIG_PATH YAJL_CFLAGS
           44  +}
    74     45   
    75         -	# Build YAJL-TCL
    76         -	cd "${BUILDDIR}" || exit 1
           46  +function preconfigure() {
           47  +	# Build YAJL
           48  +	buildYAJL || return 1
    77     49   
    78     50   	# YAJLTCL releases are incomplete -- they lack a configure script
    79     51   	autoconf || exit 1
           52  +}
    80     53   
    81         -	# Try to build as a shared object if requested
    82         -	if [ "${STATICYAJLTCL}" = "0" ]; then
    83         -		tryopts="--enable-shared --disable-shared"
    84         -	elif [ "${STATICYAJLTCL}" = "-1" ]; then
    85         -		tryopts="--enable-shared"
    86         -	else
    87         -		tryopts="--disable-shared"
    88         -	fi
           54  +function postinstall() {
           55  +	local file dir
    89     56   
    90         -	SAVE_CFLAGS="${CFLAGS}"
    91         -	for tryopt in $tryopts __fail__; do
    92         -		if [ "${tryopt}" = "__fail__" ]; then
    93         -			exit 1
    94         -		fi
    95         -		# Clean up, if needed
    96         -		make distclean >/dev/null 2>/dev/null
    97         -		rm -rf "${INSTDIR}"
    98         -		mkdir "${INSTDIR}"
    99         -
   100         -		if [ "${tryopt}" == "--enable-shared" ]; then
   101         -			isshared="1"
   102         -		else
   103         -			isshared="0"
   104         -		fi
   105         -
   106         -		# If build a static YAJLTCL for KitDLL, ensure that we use PIC
   107         -		# so that it can be linked into the shared object
   108         -		if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then
   109         -			CFLAGS="${SAVE_CFLAGS} -fPIC"
   110         -		else
   111         -			CFLAGS="${SAVE_CFLAGS}"
   112         -		fi
   113         -		export CFLAGS
   114         -
   115         -		if [ "${isshared}" = '0' ]; then
   116         -			sed 's@USE_TCL_STUBS@XXX_TCL_STUBS@g' configure > configure.new
   117         -		else
   118         -			sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new
   119         -		fi
   120         -		cat configure.new > configure
   121         -		rm -f configure.new
   122         -
   123         -		(
   124         -			echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}"
   125         -			./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA}
   126         -
   127         -			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\""
   128         -			${MAKE:-make} tcllibdir="${INSTDIR}/lib" || exit 1
   129         -
   130         -			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" install"
   131         -			${MAKE:-make} tcllibdir="${INSTDIR}/lib" install || exit 1
   132         -		) || continue
   133         -
   134         -		if [ "${isshared}" = '0' ]; then
   135         -			# Copy static libyajl to INSTDIR
   136         -			mkdir -p "${INSTDIR}/lib/deps"
   137         -			cp "${YAJLBUILDDIR}/INST/lib/libyajl.a" "${INSTDIR}/lib/zz-libyajl.a" || exit 1
   138         -		fi
   139         -
   140         -		break
           57  +	find "${installdir}" -type f -name '*.a' | head -n 1 | sed 's@/[^/]*$@@' | while IFS='' read -r dir; do
           58  +		find "${workdir}" -type f -name 'libyajl.a' | while IFS='' read -r file; do
           59  +			cp "${file}" "${dir}/zz-$(basename "${file}")" || return 1
           60  +		done
   141     61   	done
   142         -
   143         -	# Create pkgIndex if needed
   144         -	if [ ! -e "${INSTDIR}/lib/yajltcl${YAJLTCLVERS}/pkgIndex.tcl" ]; then
   145         -		cat << _EOF_ > "${INSTDIR}/lib/yajltcl${YAJLTCLVERS}/pkgIndex.tcl"
   146         -package ifneeded yajltcl ${YAJLTCLVERS} \
   147         -    "[list load {} yajltcl]; \
   148         -    [list source [file join \$dir yajl.tcl]]"
   149         -_EOF_
   150         -	fi
   151         -
   152         -	# Install files needed by installation
   153         -	cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1
   154         -	find "${OUTDIR}" -name '*.a' -type f | xargs -n 1 rm -f --
   155         -
   156         -	exit 0
   157         -) || exit 1
   158         -
   159         -exit 0
           62  +}