Check-in [7c7e9cf4fc]
Overview
Comment:Better work towards a Chrome plugin
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7c7e9cf4fc72ec3587bbce88336b6c522010665c
User & Date: rkeene on 2016-02-04 17:36:44
Other Links: manifest | tags
Context
2016-02-04
17:50
Refer to correct PC/SC headers and link to zlib in final target check-in: 88d2f36ad4 user: rkeene tags: trunk
17:36
Better work towards a Chrome plugin check-in: 7c7e9cf4fc user: rkeene tags: trunk
2016-02-03
18:57
Updated to support building static archives and to check a cache variable regarding PC/SC working check-in: a708a36250 user: rkeene tags: trunk
Changes

Modified .fossil-settings/ignore-glob from [e1c6eee148] to [b482ef6532].

     8      8   config.log
     9      9   config.status
    10     10   config.sub
    11     11   configure
    12     12   install-sh
    13     13   libcackey_g.so
    14     14   libcackey.so
           15  +libcackey_g.dll
           16  +libcackey.dll
           17  +libcackey_g.a
           18  +libcackey.a
    15     19   libcackey.syms
    16     20   build/certs
    17     21   test
    18     22   test-afl
    19     23   test-afl.data
    20     24   build/chrome/archive
    21     25   build/chrome/workdir-*
           26  +build/chrome/libcackey.a
           27  +build/chrome/cackey-chrome.o
           28  +build/chrome/cackey-chrome.pexe

Added build/chrome/Makefile version [b979ca24ac].

            1  +CC       = pnacl-clang
            2  +CXX      = pnacl-clang++
            3  +AR       = pnacl-ar
            4  +RANLIB   = pnacl-ranlib
            5  +FINALIZE = pnacl-finalize
            6  +
            7  +CACKEY_LIBS = -Llib -lcackey
            8  +PCSC_LIBS   = -Llib -lpcsc -L${NACL_SDK_ROOT}/lib/pnacl/Release -lppapi -lppapi_cpp
            9  +LIBS        = $(CACKEY_LIBS) $(PCSC_LIBS)
           10  +CFLAGS      = -Wall -I${NACL_SDK_ROOT}/include
           11  +CXXFLAGS    = $(CFLAGS)
           12  +
           13  +PATH += :${NACL_SDK_ROOT}/toolchain/linux_pnacl/bin
           14  +export PATH
           15  +
           16  +all: cackey.pexe
           17  +
           18  +cackey.pexe: cackey-chrome.o cackey-chrome-init.o lib/libcackey.a lib/libpcsc.a
           19  +	$(CXX) -o cackey.pexe.new cackey-chrome.o cackey-chrome-init.o $(LIBS)
           20  +	$(FINALIZE) cackey.pexe.new
           21  +	mv cackey.pexe.new cackey.pexe
           22  +
           23  +lib/libcackey.a: build-deps
           24  +	mkdir -p lib
           25  +	rm -f lib/libcackey.a
           26  +	rm -rf workdir-*
           27  +	./build-deps
           28  +	cd lib && ln -s ../workdir-*.inst/lib/libcackey.a .
           29  +
           30  +lib/libpcsc.a: lib/libcackey.a
           31  +	mkdir -p lib
           32  +	rm -f lib/libpcsc.a
           33  +	cd lib && ln -s ../workdir-*.inst/lib/libpcsc.a .
           34  +
           35  +cackey-chrome.o: cackey-chrome.c
           36  +cackey-chrome-init.o: cackey-chrome-init.cc
           37  +
           38  +clean:
           39  +	rm -rf workdir-*
           40  +	rm -f lib/libcackey.a lib/libpcsc.a
           41  +	-rmdir lib
           42  +	rm -f cackey-chrome.o cackey-chrome-init.o
           43  +	rm -f cackey.pexe
           44  +
           45  +distclean: clean
           46  +
           47  +.PHONY: all clean distclean

Modified build/chrome/build-deps from [f83599ae85] to [cf02f45fdc].

    21     21   
    22     22   if [ ! -d "${NACL_SDK_ROOT}/toolchain" ]; then
    23     23   	echo "error: Invalid NACL_SDK_ROOT, not found: ${NACL_SDK_ROOT}/toolchain" >&2
    24     24   
    25     25   	exit 1
    26     26   fi
    27     27   
           28  +# Setup cross-compiler toolchain
           29  +## Set path to include the tools
           30  +PATH="${PATH}:${NACL_SDK_ROOT}/toolchain/linux_pnacl/bin"
           31  +export PATH
           32  +
           33  +## Set variables needed by projects
           34  +HOST_CC="$(which "${CC:-cc}")"
           35  +BUILD_CC="${HOST_CC}"
           36  +CC_FOR_BUILD="${HOST_CC}"
           37  +AR=pnacl-ar
           38  +AS=pnacl-as
           39  +LD=pnacl-ld
           40  +CC=pnacl-clang
           41  +CXX=pnacl-clang++
           42  +RANLIB=pnacl-ranlib
           43  +STRIP=pnacl-strip
           44  +OBJCOPY=pnacl-objcopy
           45  +export HOST_CC BUILD_CC CC_FOR_BUILD AR AS LD CC CXX RANLIB STRIP OBJCOPY
           46  +
           47  +## Set some CFLAGS that the compiler fails to internally set
           48  +CFLAGS="-I${NACL_SDK_ROOT}/include"
           49  +CXXFLAGS="${CFLAGS}"
           50  +CPPFLAGS="${CFLAGS}"
           51  +export CFLAGS CXXFLAGS CPPFLAGS
           52  +
           53  +# Function to download files from the interwebs and verify them
    28     54   function download() {
    29     55   	local url file hash
    30     56   	local hashMethod
    31     57   	local chkHash
    32     58   
    33     59   	url="$1"
    34     60   	file="$2"
................................................................................
    56     82   	fi
    57     83   
    58     84   	mv "${file}.new" "${file}"
    59     85   
    60     86   	return 0
    61     87   }
    62     88   
           89  +# Extract an archive into a directory, stripping the top-level directory
           90  +# if that is all that it contains
    63     91   function extract() {
    64     92   	local file directory
    65     93   
    66     94   	file="$1"
    67     95   	directory="$2"
    68     96   
    69     97   	if [ ! -f "${file}" ]; then
................................................................................
    84    112   				;;
    85    113   			*.tar.gz|*.tgz)
    86    114   				gzip -dc | tar -xf - || exit 1
    87    115   				;;
    88    116   			*.tar.xz|*.txz)
    89    117   				xz -dc | tar -xf - || exit 1
    90    118   				;;
          119  +			*.zip)
          120  +				cat > x.zip || exit 1
          121  +				unzip x.zip || exit 1
          122  +				rm -f x.zip
          123  +				;;
    91    124   			*)
    92    125   				echo "error: Don't know what to do with \"${file}\"" >&2
    93    126   
    94    127   				exit 1
    95    128   				;;
    96    129   		esac
    97    130   
................................................................................
    99    132   			mv */* . >/dev/null 2>/dev/null
   100    133   		fi
   101    134   	) < "${file}" || return 1
   102    135   
   103    136   	return 0
   104    137   }
   105    138   
          139  +# User-overridable "make"
   106    140   function make() {
   107    141   	"${MAKE:-$(which make)}" "$@"
   108    142   }
   109    143   
   110         -function buildLibUSB() {
          144  +# Build "zlib"
          145  +function buildZlib() {
   111    146   	local version url pkg sha256 configure_extra
   112         -	local archive workdir instdir
          147  +	local archive workdir
   113    148   
   114         -	pkg='libusb'
   115         -	version='1.0.9'
   116         -	url="http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-${version}/libusb-${version}.tar.bz2"
   117         -	sha256='e920eedc2d06b09606611c99ec7304413c6784cba6e33928e78243d323195f9b'
   118         -	configure_extra=(--disable-shared --enable-static --with-pic "${global_configure_extra[@]}")
          149  +	pkg='zlib'
          150  +	version='1.2.8'
          151  +	url="http://zlib.net/zlib-${version}.tar.gz"
          152  +	sha256='36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d'
   119    153   
   120         -	archive="archive/${pkg}-${version}.tar.bz2"
          154  +	archive="archive/${pkg}-${version}.tar.gz"
   121    155   	workdir="workdir-${RANDOM}${RANDOM}${RANDOM}${RANDOM}.build"
   122         -	instdir="workdir-${RANDOM}${RANDOM}${RANDOM}${RANDOM}.inst"
   123    156   
   124    157   	download "${url}" "${archive}" "${sha256}" || return 1
   125    158   	extract "${archive}" "${workdir}" || return 1
   126    159   
   127    160   	(
   128         -		mkdir "${instdir}"
   129         -
   130         -		instdir="$(cd "${instdir}" && pwd)" || exit 1
   131         -
   132    161   		cd "${workdir}" || exit 1
   133    162   
   134         -		./configure --prefix='' "${configure_extra[@]}" || exit 1
   135         -		make V=1 || exit 1
   136         -		make V=1 DESTDIR="${instdir}" install || exit 1
          163  +		./configure --prefix=/ --libdir=/lib --static || exit 1
          164  +		make || exit 1
          165  +		make DESTDIR="${instdir}" install || exit 1
   137    166   	) || return 1
   138    167   
   139    168   	rm -rf "${workdir}"
   140    169   
   141         -	cackeyChromeExtLibUSBDir="$(cd "${instdir}" && pwd)" || return 1
   142         -	export LIBUSB_LIBS="-L${cackeyChromeExtLibUSBDir}/lib -lusb-1.0 -lrt -pthread"
   143         -	export LIBUSB_CFLAGS="-I${cackeyChromeExtLibUSBDir}/include/libusb-1.0"
   144         -
   145    170   	return 0
   146    171   }
   147    172   
   148         -function buildCCID() {
          173  +# Build "boost"
          174  +function buildBoost() {
   149    175   	local version url pkg sha256 configure_extra
   150         -	local archive workdir instdir
          176  +	local archive workdir
   151    177   
   152         -	pkg='ccid'
   153         -	version='1.4.22'
   154         -	url="https://alioth.debian.org/frs/download.php/file/4162/ccid-${version}.tar.bz2"
   155         -	sha256='9c5c8be465b6d33316be7a7ea720c24a776e2d76be9072116d28fc9adf58c106'
   156         -	configure_extra=(
   157         -		--with-pic
   158         -		--disable-shared --enable-static --enable-usb
   159         -		--enable-usbdropdir=/drivers
   160         -		"${global_configure_extra[@]}"
   161         -	)
          178  +	pkg='boost'
          179  +	version='1.57.0'
          180  +	url="http://downloads.sourceforge.net/project/boost/boost/${version}/boost_`echo ${version} | sed 's_\._\__g'`.tar.bz2"
          181  +	sha256='910c8c022a33ccec7f088bd65d4f14b466588dda94ba2124e78b8c57db264967'
   162    182   
   163    183   	archive="archive/${pkg}-${version}.tar.bz2"
   164    184   	workdir="workdir-${RANDOM}${RANDOM}${RANDOM}${RANDOM}.build"
   165         -	instdir="workdir-${RANDOM}${RANDOM}${RANDOM}${RANDOM}.inst"
   166    185   
   167    186   	download "${url}" "${archive}" "${sha256}" || return 1
   168    187   	extract "${archive}" "${workdir}" || return 1
   169    188   
   170    189   	(
   171         -		mkdir "${instdir}"
   172         -
   173         -		instdir="$(cd "${instdir}" && pwd)" || exit 1
   174         -
   175    190   		cd "${workdir}" || exit 1
   176    191   
   177         -		./configure --prefix='' "${configure_extra[@]}" || exit 1
          192  +		./bootstrap.sh --prefix="${instdir}" --with-python=false --show-libraries
   178    193   
   179         -		make V=1 || exit 1
          194  +		./bootstrap.sh --prefix="${instdir}" --with-python=false --without-libraries='atomic,chrono,container,context,coroutine,date_time,exception,filesystem,graph,graph_parallel,iostreams,locale,log,math,mpi,program_options,python,random,regex,serialization,signals,system,test,thread,timer,wave' || exit 1
   180    195   
   181         -		mkdir "${instdir}/lib"
   182         -		cp src/.libs/libccid.a "${instdir}/lib"
          196  +		echo "using gcc : pnacl : ${CXX} ;" >> project-config.jam
   183    197   
   184         -		mkdir "${instdir}/include"
   185         -		./src/create_Info_plist.pl ./readers/supported_readers.txt src/Info.plist.src --target=libccid.so --version=1.0.0 | \
   186         -			sed '/<key>ifdDriverOptions/ {n;c \'$'\n''<string>0x0004</string>'$'\n''p}' | \
   187         -			od -t x1 -v | sed 's@^[^ ]* @@;s@ @@g;s@..@\\x&@g;$ d;s@^@"@;s@$@"@' > "${instdir}/include/Info.plist.h"
          198  +		./b2 --debug-configuration toolset=gcc-pnacl target-os=linux link=static runtime-link=static || exit 1
          199  +
          200  +		./bjam install || exit 1
   188    201   	) || return 1
   189    202   
   190    203   	rm -rf "${workdir}"
   191    204   
   192         -	cackeyChromeExtCCIDDir="$(cd "${instdir}" && pwd)" || return 1
   193         -
   194    205   	return 0
   195    206   }
   196    207   
   197         -function buildPCSCLite() {
          208  +# Build the libpcsc we need
          209  +function buildPCSC() {
   198    210   	local version url pkg sha256 configure_extra
   199         -	local archive workdir instdir
          211  +	local archive workdir
   200    212   
   201         -	buildLibUSB || return 1
          213  +	buildBoost || return 1
   202    214   
   203         -	pkg='pcsc-lite'
   204         -	version='1.8.15'
   205         -	url="https://alioth.debian.org/frs/download.php/file/4157/pcsc-lite-${version}.tar.bz2"
   206         -	sha256='ad8b1f3d2c59d3a966cb203fc74588629c4a5fa30f8ad9005e06ef7aa445d341'
   207         -	configure_extra=(
   208         -		--disable-shared --enable-static --enable-usb --disable-libudev --disable-polkit --with-pic
   209         -		"${global_configure_extra[@]}"
   210         -	)
          215  +	pkg='smart-card-client-c-example-app-sources'
          216  +	version='0.0.0'
          217  +	sha256='68970c6dc4b55d24a453bcfe5768af2b877f553a92a390be7f935db6223d4bc5'
   211    218   
   212         -	archive="archive/${pkg}-${version}.tar.bz2"
          219  +	archive="archive/${pkg}.zip"
   213    220   	workdir="workdir-${RANDOM}${RANDOM}${RANDOM}${RANDOM}.build"
   214         -	instdir="workdir-${RANDOM}${RANDOM}${RANDOM}${RANDOM}.inst"
   215    221   
   216         -	download "${url}" "${archive}" "${sha256}" || return 1
   217    222   	extract "${archive}" "${workdir}" || return 1
   218    223   
   219    224   	(
   220         -		mkdir "${instdir}"
   221         -
   222         -		instdir="$(cd "${instdir}" && pwd)" || exit 1
   223         -
   224    225   		cd "${workdir}" || exit 1
   225    226   
   226         -		./configure --prefix='' --sbindir="/bin" "${configure_extra[@]}" || exit 1
   227         -		make V=1 || exit 1
   228         -		make V=1 DESTDIR="${instdir}" install || exit 1
   229         -	) || return 1
   230         -
   231         -	cackeyChromeExtPCSCLiteDir="$(cd "${instdir}" && pwd)"
   232         -	export PCSC_CFLAGS="-I${cackeyChromeExtPCSCLiteDir}/include/PCSC"
   233         -	export PCSC_LIBS="-L${cackeyChromeExtPCSCLiteDir}/lib -lpcsclite -pthread"
   234         -
   235         -	buildCCID || return 1
   236         -
   237         -	rm -rf "${instdir}"
   238         -	unset PCSC_CFLAGS PCSC_LIBS cackeyChromeExtPCSCLiteDir
   239         -
   240         -	rm -rf "${workdir}"
   241         -	extract "${archive}" "${workdir}" || return 1
   242         -
   243         -	(
   244         -		mkdir "${instdir}"
   245         -
   246         -		instdir="$(cd "${instdir}" && pwd)" || exit 1
   247         -
   248         -		cd "${workdir}" || exit 1
   249         -
   250         -		sed -i 's@^pcscd_LDFLAGS[[:space:]]*=@& -all-static @' src/Makefile.in
   251         -
   252         -		for patchFile in "${patchDir}"/pcsc-lite-*.diff; do
   253         -			if [ ! -f "${patchFile}" ]; then
   254         -				continue
   255         -			fi
   256         -
   257         -			patch -p1 < "${patchFile}" || exit 1
          227  +		# Copy out PC/SC headers for later use
          228  +		mkdir -p "${instdir}/include/PCSC" || exit 1
          229  +		cp third_party/pcsc-lite/src/src/PCSC/*.h "${instdir}/include/PCSC" || exit 1
          230  +
          231  +		# Copy out JavaScript files for later use
          232  +		mkdir "${instdir}/js" || exit 1
          233  +		cp third_party/pcsc-lite/client-side/*.js "${instdir}/js" || exit 1
          234  +
          235  +		# Build libpcsc
          236  +		## Assemble all the files into a single tree
          237  +		for file in logging.h scard_structs_serialization.h dom_requests_manager.h thread_safe_string_pool.h \
          238  +		    pp_var_utils.cc pp_var_utils.h scard_structs_serialization.cc dom_requests_manager.cc logging.cc; do
          239  +			find . -type f -name "${file}" -exec cp '{}' third_party/pcsc-lite/client-side/ ';'
   258    240   		done
   259    241   
   260         -		cp "${cackeyChromeExtCCIDDir}/include/Info.plist.h" src/ || exit 1
          242  +		## Create Makefile
          243  +		cat << \_EOF_ > third_party/pcsc-lite/client-side/Makefile || exit 1
          244  +CFLAGS   += -Wall -std=gnu++11
          245  +CXXFLAGS += -Wall -std=gnu++11
          246  +CPPFLAGS += -I../src/src/PCSC
   261    247   
   262         -		extraDefines='-DPCSCLITE_STATIC_DRIVER -DIFDHANDLERv3'
          248  +OBJS = pcsc_nacl.o pcsc_nacl_global.o scard_structs_serialization.o pp_var_utils.o logging.o dom_requests_manager.o
   263    249   
   264         -		./configure --prefix='' --sbindir="/bin" "${configure_extra[@]}" CFLAGS="${CFLAGS} ${extraDefines}" CPPFLAGS="${CPPFLAGS} ${extraDefines}" LIBS="${LIBS} -L${cackeyChromeExtCCIDDir}/lib -lccid" || exit 1
   265         -		make V=1 || exit 1
   266         -		make V=1 DESTDIR="${instdir}" install || exit 1
          250  +all: libpcsc.a
          251  +
          252  +libpcsc.a: $(OBJS)
          253  +	rm -f libpcsc.a
          254  +	$(AR) rc libpcsc.a $(OBJS)
          255  +	-$(RANLIB) libpcsc.a
          256  +
          257  +pcsc_nacl.o: pcsc_nacl.cc pcsc_nacl.h logging.h pp_var_utils.h scard_structs_serialization.h
          258  +pcsc_nacl.h: dom_requests_manager.h thread_safe_string_pool.h
          259  +
          260  +pcsc_nacl_global.o: pcsc_nacl_global.cc pcsc_nacl_global.h logging.h
          261  +pcsc_nacl_global.h: pcsc_nacl.h
          262  +
          263  +pp_var_utils.o: pp_var_utils.cc pp_var_utils.h logging.h
          264  +pp_var_utils.h: logging.h
          265  +
          266  +scard_structs_serialization.o: scard_structs_serialization.cc scard_structs_serialization.h pp_var_utils.h
          267  +scard_structs_serialization.h: pp_var_utils.h
          268  +
          269  +dom_requests_manager.o: dom_requests_manager.cc dom_requests_manager.h logging.h pp_var_utils.h
          270  +
          271  +logging.o: logging.cc logging.h
          272  +
          273  +clean:
          274  +	rm -f $(OBJS)
          275  +	rm -f libpcsc.a
          276  +
          277  +distclean: clean
          278  +
          279  +.PHONY: all clean distclean
          280  +_EOF_
          281  +
          282  +		## Make it
          283  +		make -C third_party/pcsc-lite/client-side || exit 1
          284  +
          285  +		# Install the built libpcsc
          286  +		mkdir -p "${instdir}/lib" || exit 1
          287  +		cp third_party/pcsc-lite/client-side/libpcsc.a "${instdir}/lib" || exit 1
   267    288   	) || return 1
   268    289   
   269         -	rm -rf "${cackeyChromeExtLibUSBDir}"
   270         -	unset LIBUSB_LIBS LIBUSB_CFLAGS
   271         -
   272         -	rm -rf "${cackeyChromeExtCCIDDir}"
   273    290   	rm -rf "${workdir}"
   274    291   
   275         -	cackeyChromeExtPCSCLiteDir="$(cd "${instdir}" && pwd)"
   276         -	export PCSC_CFLAGS="-I${cackeyChromeExtPCSCLiteDir}/include/PCSC"
   277         -	export PCSC_LIBS="-L${cackeyChromeExtPCSCLiteDir}/lib/dummy -lpcsclite"
   278         -
   279         -	# Create dummy PC/SC library -- just enough to past CACKey linking test
   280         -	mkdir "${cackeyChromeExtPCSCLiteDir}/lib/dummy" || return 1
   281         -	echo 'void SCardEstablishContext(void) { return; }; void SCardConnect(void) { return; }' | gcc -x c - -fPIC -shared -o "${cackeyChromeExtPCSCLiteDir}/lib/dummy/libpcsclite.so"
   282         -
   283         -	# Copy statically linked "pcscd" out
   284         -	cp "${cackeyChromeExtPCSCLiteDir}/bin/pcscd" "${outdir}" || return 1
   285         -
   286    292   	return 0
   287    293   }
   288    294   
          295  +# Build our CACKey
   289    296   function buildCACKey() {
   290    297   	local platform
   291    298   	local file copied
   292    299   	local targets
   293    300   
   294         -	platform="$1"
   295         -	shift
   296         -
   297         -	if [ -z "${platform}" ]; then
   298         -		echo 'error: Platform not specified' >&2
   299         -
   300         -		return 1
   301         -	fi
          301  +	buildZlib || return 1
          302  +	buildPCSC || return 1
   302    303   
   303    304   	(
   304    305   		cd ../.. || exit 1
   305    306   
   306    307   		make distclean
   307    308   
   308         -		./configure --with-pcsc-headers="${cackeyChromeExtPCSCLiteDir}/include/PCSC" --with-pcsc-libs="${PCSC_LIBS}" "$@" || exit 1
          309  +		./configure --host=nacl --with-pcsc-libs="-lpcsc" cackey_cv_pcsc_works=okay || exit 1
   309    310   		make || exit 1
   310    311   	) || return 1
   311    312   
   312         -	copied='0'
   313         -	for file in ../../libcackey{,_g}.{so,dll,dylib,a}; do
   314         -		if [ -f "${file}" ]; then
   315         -			mkdir -p "${outdir}/${platform}"
   316         -
   317         -			cp "${file}" "${outdir}/${platform}"
   318         -			copied='1'
   319         -		fi
   320         -	done
   321         -
   322         -	if [ "${copied}" = '0' ]; then
   323         -		echo "error: Unable to copy built libcackey to local directory" >&2
   324         -
   325         -		return 1
   326         -	fi
          313  +	mkdir -p "${instdir}/lib"
          314  +	cp ../../libcackey.a ../../libcackey_g.a "${instdir}/lib" || return 1
   327    315   
   328    316   	return 0
   329    317   }
   330    318   
   331         -function cleanup() {
   332         -	if [ -n "${cackeyChromeExtPCSCLiteDir}" ]; then
   333         -		rm -rf "${cackeyChromeExtPCSCLiteDir}"
   334         -		unset PCSC_CFLAGS PCSC_LIBS
   335         -	fi
          319  +instdir="workdir-${RANDOM}${RANDOM}${RANDOM}${RANDOM}.inst"
          320  +rm -rf "${instdir}"
          321  +mkdir "${instdir}" || exit 1
          322  +instdir="$(cd "${instdir}" && pwd)" || exit 1
   336    323   
   337         -	if [ -n "${cackeyChromeExtLibUSBDir}" ]; then
   338         -		rm -rf "${cackeyChromeExtLibUSBDir}"
   339         -		unset LIBUSB_LIBS LIBUSB_CFLAGS
   340         -	fi
   341         -}
          324  +CFLAGS="${CFLAGS} -I${instdir}/include"
          325  +CPPFLAGS="${CPPFLAGS} -I${instdir}/include"
          326  +CXXFLAGS="${CXXFLAGS} -I${instdir}/include"
          327  +LDFLAGS="${LDFLAGS} -L${instdir}/lib"
          328  +export CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
   342    329   
   343         -outdir="workdir-${RANDOM}${RANDOM}${RANDOM}${RANDOM}.out"
   344         -rm -rf "${outdir}"
   345         -mkdir "${outdir}" || exit 1
   346         -
   347         -buildPCSCLite || exit 1
   348         -
   349         -buildCACKey build || exit 1
   350         -
   351         -PATH="${PATH}:${NACL_SDK_ROOT}/toolchain/linux_pnacl/bin" buildCACKey pnacl --host="nacl" CC=pnacl-clang LD=pnacl-ld OBJCOPY=pnacl-objcopy STRIP=pnacl-strip AR=pnacl-ar RANLIB=pnacl-ranlib cackey_cv_pcsc_works=okay || exit 1
   352         -
   353         -cleanup
          330  +buildCACKey || exit 1
   354    331   
   355    332   exit 0

Added build/chrome/cackey-chrome-init.cc version [5c1f40635b].

            1  +#include "ppapi/cpp/module.h"
            2  +
            3  +class CACKeyModule : public pp::Module {
            4  +	public:
            5  +		CACKeyModule(): pp::Module() {}
            6  +		virtual ~CACKeyModule() {}
            7  +
            8  +		virtual pp::Instance *CreateInstance(PP_Instance instance) {
            9  +			return(NULL);
           10  +		}
           11  +};
           12  +
           13  +namespace pp {
           14  +	Module *CreateModule() {
           15  +		return(NULL);
           16  +	}
           17  +}

Added build/chrome/cackey-chrome.c version [5afb8e1152].

            1  +void C_GetFunctionList(void);
            2  +int main(int argc, char **argv) {
            3  +	C_GetFunctionList();
            4  +}

Deleted build/chrome/patches/pcsc-lite-1.8.15-hotplugstaticccid.diff version [856f9b4aaa].

     1         -diff --no-dereference -uNr pcsc-lite-1.8.15.orig/src/hotplug_libusb.c pcsc-lite-1.8.15-hotplugstaticccid/src/hotplug_libusb.c
     2         ---- pcsc-lite-1.8.15.orig/src/hotplug_libusb.c	2015-11-06 02:39:51.000000000 -0600
     3         -+++ pcsc-lite-1.8.15-hotplugstaticccid/src/hotplug_libusb.c	2016-02-02 23:05:02.738140506 -0600
     4         -@@ -128,21 +128,10 @@
     5         - static LONG HPReadBundleValues(void)
     6         - {
     7         - 	LONG rv;
     8         --	DIR *hpDir;
     9         --	struct dirent *currFP = NULL;
    10         - 	char fullPath[FILENAME_MAX];
    11         - 	char fullLibPath[FILENAME_MAX];
    12         - 	int listCount = 0;
    13         - 
    14         --	hpDir = opendir(PCSCLITE_HP_DROPDIR);
    15         --
    16         --	if (hpDir == NULL)
    17         --	{
    18         --		Log1(PCSC_LOG_ERROR, "Cannot open PC/SC drivers directory: " PCSCLITE_HP_DROPDIR);
    19         --		Log1(PCSC_LOG_ERROR, "Disabling USB support for pcscd.");
    20         --		return -1;
    21         --	}
    22         --
    23         - 	/* allocate a first array */
    24         - 	driverTracker = calloc(DRIVER_TRACKER_SIZE_STEP, sizeof(*driverTracker));
    25         - 	if (NULL == driverTracker)
    26         -@@ -158,12 +147,8 @@
    27         - 	{ \
    28         - 		Log2(PCSC_LOG_ERROR, "Value/Key not defined for " key " in %s", \
    29         - 			fullPath); \
    30         --		continue; \
    31         - 	}
    32         - 
    33         --	while ((currFP = readdir(hpDir)) != 0)
    34         --	{
    35         --		if (strstr(currFP->d_name, ".bundle") != 0)
    36         - 		{
    37         - 			unsigned int alias;
    38         - 			list_t plist, *values;
    39         -@@ -171,24 +156,16 @@
    40         - 			char *libraryPath;
    41         - 			int ifdCapabilities;
    42         - 
    43         --			/*
    44         --			 * The bundle exists - let's form a full path name and get the
    45         --			 * vendor and product ID's for this particular bundle
    46         --			 */
    47         --			snprintf(fullPath, sizeof(fullPath), "%s/%s/Contents/Info.plist",
    48         --				PCSCLITE_HP_DROPDIR, currFP->d_name);
    49         --			fullPath[sizeof(fullPath) - 1] = '\0';
    50         --
    51         --			rv = bundleParse(fullPath, &plist);
    52         -+			rv = bundleParse("", &plist);
    53         - 			if (rv)
    54         --				continue;
    55         -+				return -1;
    56         - 
    57         - 			/* get CFBundleExecutable */
    58         - 			GET_KEY(PCSCLITE_HP_LIBRKEY_NAME, &values)
    59         - 			libraryPath = list_get_at(values, 0);
    60         - 			(void)snprintf(fullLibPath, sizeof(fullLibPath),
    61         - 				"%s/%s/Contents/%s/%s",
    62         --				PCSCLITE_HP_DROPDIR, currFP->d_name, PCSC_ARCH,
    63         -+				PCSCLITE_HP_DROPDIR, "", PCSC_ARCH,
    64         - 				libraryPath);
    65         - 			fullLibPath[sizeof(fullLibPath) - 1] = '\0';
    66         - 
    67         -@@ -215,7 +192,7 @@
    68         - 				driverTracker[listCount].readerName = strdup(list_get_at(readerNames, alias));
    69         - 
    70         - 				/* constant entries for a same driver */
    71         --				driverTracker[listCount].bundleName = strdup(currFP->d_name);
    72         -+				driverTracker[listCount].bundleName = strdup("");
    73         - 				driverTracker[listCount].libraryPath = strdup(fullLibPath);
    74         - 				driverTracker[listCount].ifdCapabilities = ifdCapabilities;
    75         - 
    76         -@@ -240,7 +217,6 @@
    77         - 					{
    78         - 						Log1(PCSC_LOG_CRITICAL, "Not enough memory");
    79         - 						driverSize = -1;
    80         --						closedir(hpDir);
    81         - 						return -1;
    82         - 					}
    83         - 
    84         -@@ -258,10 +234,8 @@
    85         - 			}
    86         - 			bundleRelease(&plist);
    87         - 		}
    88         --	}
    89         - 
    90         - 	driverSize = listCount;
    91         --	closedir(hpDir);
    92         - 
    93         - 	rv = TRUE;
    94         - 	if (driverSize == 0)
    95         -diff --no-dereference -uNr pcsc-lite-1.8.15.orig/src/parser.h pcsc-lite-1.8.15-hotplugstaticccid/src/parser.h
    96         ---- pcsc-lite-1.8.15.orig/src/parser.h	2015-11-06 02:39:51.000000000 -0600
    97         -+++ pcsc-lite-1.8.15-hotplugstaticccid/src/parser.h	2016-02-02 14:04:35.619279091 -0600
    98         -@@ -48,6 +48,7 @@
    99         - 
   100         - int LTPBundleFindValueWithKey(list_t *l, const char *key, list_t **values);
   101         - int bundleParse(const char *fileName, list_t *l);
   102         -+int bundleParseContents(const char *plistContents, list_t *l);
   103         - void bundleRelease(list_t *l);
   104         - 
   105         - #endif
   106         -diff --no-dereference -uNr pcsc-lite-1.8.15.orig/src/pcscdaemon.c pcsc-lite-1.8.15-hotplugstaticccid/src/pcscdaemon.c
   107         ---- pcsc-lite-1.8.15.orig/src/pcscdaemon.c	2015-11-06 02:39:51.000000000 -0600
   108         -+++ pcsc-lite-1.8.15-hotplugstaticccid/src/pcscdaemon.c	2016-02-02 13:45:36.214210985 -0600
   109         -@@ -641,7 +641,7 @@
   110         - 	(void)signal(SIGHUP, SIG_IGN);	/* needed for Solaris. The signal is sent
   111         - 				 * when the shell is existed */
   112         - 
   113         --#if !defined(PCSCLITE_STATIC_DRIVER) && defined(USE_USB)
   114         -+#if defined(USE_USB)
   115         - 	/*
   116         - 	 * Set up the search for USB/PCMCIA devices
   117         - 	 */
   118         -diff --no-dereference -uNr pcsc-lite-1.8.15.orig/src/tokenparser.l pcsc-lite-1.8.15-hotplugstaticccid/src/tokenparser.l
   119         ---- pcsc-lite-1.8.15.orig/src/tokenparser.l	2015-11-06 02:39:51.000000000 -0600
   120         -+++ pcsc-lite-1.8.15-hotplugstaticccid/src/tokenparser.l	2016-02-02 23:05:44.680142552 -0600
   121         -@@ -200,36 +200,51 @@
   122         -  */
   123         - int bundleParse(const char *fileName, list_t *l)
   124         - {
   125         --	FILE *file = NULL;
   126         -+	return(bundleParseContents(
   127         -+#include "Info.plist.h"
   128         -+		, l));
   129         -+}
   130         -+
   131         -+/**
   132         -+ * Parse a Info.plist file's contents as a string and return a list
   133         -+ *
   134         -+ * @param plistContents plist contents
   135         -+ * @param l list containing the results
   136         -+ * @retval -1 configuration file not found
   137         -+ * @retval 0 OK
   138         -+ */
   139         -+int bundleParseContents(const char *plistContents, list_t *l)
   140         -+{
   141         - 	int r;
   142         --#ifndef NDEBUG
   143         --	int i;
   144         --#endif
   145         -+	char *tmpBuffer;
   146         -+	size_t plistContentsLen;
   147         - 
   148         --	file = fopen(fileName, "r");
   149         --	if (!file)
   150         --	{
   151         --		Log3(PCSC_LOG_CRITICAL, "Could not open bundle file %s: %s",
   152         --			fileName, strerror(errno));
   153         --		return 1;
   154         -+	plistContentsLen = strlen(plistContents);
   155         -+
   156         -+	if (plistContentsLen == 0) {
   157         -+		return(-1);
   158         -+	}
   159         -+
   160         -+	tmpBuffer = strdup(plistContents);
   161         -+	if (tmpBuffer == NULL) {
   162         -+		return(-1);
   163         - 	}
   164         - 
   165         - 	r = list_init(l);
   166         - 	assert(r >= 0);
   167         --	(void)r;
   168         - 
   169         - 	ListKeys = l;
   170         --	yyin = file;
   171         - 
   172         --	do
   173         --	{
   174         --		(void)yylex();
   175         --	} while (!feof(file));
   176         --	yylex_destroy();
   177         -+	YY_BUFFER_STATE yyTmpBuffer = yy_scan_string(tmpBuffer); 
   178         -+	while (yylex() != 0) {
   179         -+		/**/
   180         -+	}
   181         -+	yy_delete_buffer(yyTmpBuffer);
   182         - 
   183         --	(void)fclose(file);
   184         -+	yylex_destroy();
   185         - 
   186         - #ifndef NDEBUG
   187         -+	int i;
   188         - 	printf("size: %d\n", list_size(l));
   189         - 	for (i=0; i < list_size(l); i++)
   190         - 	{