Diff

Differences From Artifact [d401f36a65]:

To Artifact [ab96518e6b]:


    14     14   pkg="$(echo "$1" | sed 's@/*$@@;s@^\.*/*@@')"
    15     15   
    16     16   if [ -z "${pkg}" ]; then
    17     17   	echo "Usage: build [--cpio] <package>" 2>&1
    18     18   
    19     19   	exit 1
    20     20   fi
           21  +
           22  +function verifyRequiredPackages() {
           23  +	local pkg pkgdomain pkgversion
           24  +	local pkgdir pkgconfigdir pkgfound
           25  +
           26  +	for pkg in "${require[@]}"; do
           27  +		pkgdomain=''
           28  +		pkgversion=''
           29  +
           30  +		case "${pkg}" in
           31  +			*/*@*)
           32  +				pkgdomain="$(echo "${pkg}" | cut -f 2 -d '@')"
           33  +				pkgversion="$(echo "${pkg}" | cut -f 2 -d '/' | cut -f 1 -d '@')"
           34  +				pkg="$(echo "${pkg}" | cut -f 1 -d '/')"
           35  +				;;
           36  +			*/*)
           37  +				pkgversion="$(echo "${pkg}" | cut -f 2 -d '/')"
           38  +				pkg="$(echo "${pkg}" | cut -f 1 -d '/')"
           39  +				;;
           40  +			*@*)
           41  +				pkgdomain="$(echo "${pkg}" | cut -f 2 -d '@')"
           42  +				pkg="$(echo "${pkg}" | cut -f 1 -d '@')"
           43  +				;;
           44  +		esac
           45  +
           46  +		if [ -z "${pkgdomain}" ]; then
           47  +			pkgdomain="${domain}"
           48  +		fi
           49  +
           50  +		pkgfound='0'
           51  +		for pkgdir in "/opt/appfs/${pkgdomain}/${pkg}/platform"/${pkgversion:-*}; do
           52  +			pkgconfigdir="${pkgdir}/lib/pkgconfig"
           53  +
           54  +			if [ -d "${pkgdir}" ]; then
           55  +				pkgfound='1'
           56  +			fi
           57  +
           58  +			CFLAGS="${CFLAGS} -I${pkgdir}/include"
           59  +			CPPFLAGS="${CPPFLAGS} -I${pkgdir}/include"
           60  +			LDFLAGS="${LDFLAGS} -L${pkgdir}/lib"
           61  +			export CFLAGS CPPFLAGS LDFLAGS
           62  +
           63  +			if [ -d "${pkgconfigdir}" ]; then
           64  +				PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${pkgconfigdir}"
           65  +				export PKG_CONFIG_PATH
           66  +			fi
           67  +
           68  +		done
           69  +
           70  +		if [ "${pkgfound}" = '0' ]; then
           71  +			die "Package ${pkg}/${pkgversion:-*}@${pkgdomain} not found."
           72  +		fi
           73  +	done
           74  +}
           75  +
           76  +function verifyPrerequisites() {
           77  +	:
           78  +}
    21     79   
    22     80   function determineOsArch() {
    23     81   	os="$(uname -s | dd conv=lcase 2>/dev/null)"
    24     82   	arch="$(uname -m | dd conv=lcase 2>/dev/null)"
    25     83   
    26     84   	case "${arch}" in
    27     85   		i?86)
................................................................................
    53    111   	glibcdir="/opt/appfs/core.appfs.rkeene.org/glibc/platform/${glibcvers}"
    54    112   	dynlinker="$(ls "${glibcdir}"/lib/ld-linux*.so.* | tail -n 1)"
    55    113   
    56    114   	if [ ! -d "${glibcdir}" ]; then
    57    115   		die 'glibc directory is not available (appfs running/working?)'
    58    116   	fi
    59    117   
    60         -	CFLAGS="-I${glibcdir}/include"
    61         -	CPPFLAGS="-I${glibcdir}/include"
    62         -	LDFLAGS="-Wl,--rpath,${glibcdir}/lib -Wl,--dynamic-linker,${dynlinker}"
    63         -	export CFLAGS CPPFLAGS LDFLAGS
          118  +	CFLAGS="${CFLAGS} -I${glibcdir}/include"
          119  +	CPPFLAGS="${CPPFLAGS} -I${glibcdir}/include"
          120  +	LDFLAGS="${LDFLAGS} -Wl,--rpath,${glibcdir}/lib -Wl,--dynamic-linker,${dynlinker}"
          121  +	PKG_CONFIG_LIBDIR="${glibcdir}/lib/pkgconfig"
          122  +	export CFLAGS CPPFLAGS LDFLAGS PKG_CONFIG_LIBDIR
    64    123   
    65    124   	./configure --prefix="${prefix}" --sysconfdir=/etc --localstatedir=/var
    66    125   }
    67    126   
    68    127   function prebuild() {
    69    128   	:
    70    129   }
................................................................................
   210    269   
   211    270   # If we just have one directory, use that directory
   212    271   dir="$(echo *)"
   213    272   if [ -e "${dir}" ]; then
   214    273   	mv "${dir}"/* .
   215    274   fi
   216    275   
          276  +# Verify pre-requisites are met
          277  +verifyRequiredPackages || die 'Required packages missing'
          278  +verifyPrerequisites || die 'Prerequisities failed'
          279  +
   217    280   # Start logging
   218    281   set -x
   219    282   
   220    283   # Determine properties
   221    284   determinePrefix
   222    285   
   223    286   # Start the build