Check-in [482f4fa828]
Overview
SHA1:482f4fa8282d7111d672a1d38c594d64ca523679
Date: 2016-02-03 08:03:01
User: rkeene
Comment:Chrome extension cleanups
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2016-02-03
08:03
[378c58fb5a] Removed extra debugging symbols no longer needed (user: rkeene, tags: trunk)
08:03
[482f4fa828] Chrome extension cleanups (user: rkeene, tags: trunk)
07:11
[294977292d] Release building updates (user: rkeene, tags: trunk)
Changes

Modified build/chrome/build-deps from [9ef058ff69] to [f6aa807d46].

     8      8   
     9      9   	exit 1
    10     10   fi
    11     11   
    12     12   cd "$(dirname "${ourScript}")" || exit 1
    13     13   
    14     14   patchDir="$(pwd)/patches"
           15  +
           16  +if [ -z "${NACL_SDK_PEPPER}" ]; then
           17  +	echo "error: Please set NACL_SDK_PEPPER to the path of the current pepper target" >&2
           18  +
           19  +	exit 1
           20  +fi
    15     21   
    16     22   function download() {
    17     23   	local url file hash
    18     24   	local hashMethod
    19     25   	local chkHash
    20     26   
    21     27   	url="$1"
................................................................................
   258    264   	unset LIBUSB_LIBS LIBUSB_CFLAGS
   259    265   
   260    266   	rm -rf "${cackeyChromeExtCCIDDir}"
   261    267   	rm -rf "${workdir}"
   262    268   
   263    269   	cackeyChromeExtPCSCLiteDir="$(cd "${instdir}" && pwd)"
   264    270   	export PCSC_CFLAGS="-I${cackeyChromeExtPCSCLiteDir}/include/PCSC"
   265         -	export PCSC_LIBS="-L${cackeyChromeExtPCSCLiteDir}/lib -lpcsclite -pthread"
          271  +	export PCSC_LIBS="-L${cackeyChromeExtPCSCLiteDir}/lib/dummy -lpcsclite"
   266    272   
          273  +	# Create dummy PC/SC library -- just enough to past CACKey linking test
          274  +	mkdir "${cackeyChromeExtPCSCLiteDir}/lib/dummy" || return 1
          275  +	echo 'void SCardEstablishContext(void) { return; }; void SCardConnect(void) { return; }' | gcc -x c - -fPIC -shared -o "${cackeyChromeExtPCSCLiteDir}/lib/dummy/libpcsclite.so"
          276  +
          277  +	# Copy statically linked "pcscd" out
   267    278   	cp "${cackeyChromeExtPCSCLiteDir}/bin/pcscd" "${outdir}" || return 1
   268    279   
   269         -	mkdir "${outdir}/include" || return 1
   270         -	cp "${cackeyChromeExtPCSCLiteDir}/include/PCSC"/*.h "${outdir}/include" || return 1
   271         -
   272    280   	return 0
   273    281   }
   274    282   
   275    283   function buildCACKey() {
          284  +	local platform
   276    285   	local file copied
          286  +
          287  +	platform="$1"
          288  +	shift
          289  +
          290  +	if [ -z "${platform}" ]; then
          291  +		echo 'error: Platform not specified' >&2
          292  +
          293  +		return 1
          294  +	fi
   277    295   
   278    296   	(
   279    297   		cd ../.. || exit 1
   280    298   
   281    299   		make distclean
   282    300   
   283         -		./configure --with-pcsc-headers="${cackeyChromeExtPCSCLiteDir}/include/PCSC" --with-pcsc-libs="${PCSC_LIBS}" || exit 1
          301  +		./configure --with-pcsc-headers="${cackeyChromeExtPCSCLiteDir}/include/PCSC" --with-pcsc-libs="${PCSC_LIBS}" "$@" || exit 1
   284    302   		make || exit 1
   285    303   	) || return 1
   286    304   
   287    305   	copied='0'
   288    306   	for file in ../../libcackey{,_g}.{so,dll,dylib}; do
   289    307   		if [ -f "${file}" ]; then
   290         -			cp "${file}" "${outdir}"
          308  +			mkdir -p "${outdir}/${platform}"
          309  +
          310  +			cp "${file}" "${outdir}/${platform}"
   291    311   			copied='1'
   292    312   		fi
   293    313   	done
   294    314   
   295    315   	if [ "${copied}" = '0' ]; then
   296    316   		echo "error: Unable to copy built libcackey to local directory" >&2
   297    317   
   298    318   		return 1
   299    319   	fi
   300    320   
   301         -	rm -rf "${cackeyChromeExtPCSCLiteDir}"
   302         -	unset PCSC_CFLAGS PCSC_LIBS
   303         -
   304    321   	return 0
   305    322   }
          323  +
          324  +function cleanup() {
          325  +	if [ -n "${cackeyChromeExtPCSCLiteDir}" ]; then
          326  +		rm -rf "${cackeyChromeExtPCSCLiteDir}"
          327  +		unset PCSC_CFLAGS PCSC_LIBS
          328  +	fi
          329  +
          330  +	if [ -n "${cackeyChromeExtLibUSBDir}" ]; then
          331  +		rm -rf "${cackeyChromeExtLibUSBDir}"
          332  +		unset LIBUSB_LIBS LIBUSB_CFLAGS
          333  +	fi
          334  +}
   306    335   
   307    336   outdir="workdir-${RANDOM}${RANDOM}${RANDOM}${RANDOM}.out"
   308    337   rm -rf "${outdir}"
   309    338   mkdir "${outdir}" || exit 1
   310    339   
   311    340   buildPCSCLite || exit 1
   312    341   
   313         -buildCACKey || exit 1
          342  +buildCACKey build || exit 1
          343  +
          344  +buildOutputType="$(echo 'int main(int argc, char **argv) { return(0); }' | "${CC:-cc}" -x c - -o /dev/stdout | file -)" || exit 1
          345  +case "${buildOutputType}" in
          346  +	*x86-64*)
          347  +		naclTopDir='linux_x86_glibc'
          348  +		naclPlatform='x86_64-nacl'
          349  +		;;
          350  +	*)
          351  +		echo "error: Unrecognized platform output: \"${buildOutputType}\"" >&2
          352  +
          353  +		exit 1
          354  +		;;
          355  +esac
          356  +PATH="${PATH}:${NACL_SDK_PEPPER}/toolchain/${naclTopDir}/bin" buildCACKey "${naclPlatform}" --host="${naclPlatform}" CC=${naclPlatform}-gcc LD=${naclPlatform}-ld OBJCOPY=${naclPlatform}-objcopy STRIP=${naclPlatform}-strip || exit 1
          357  +
          358  +cleanup
   314    359   
   315    360   exit 0