Diff

Differences From Artifact [93232701c1]:

To Artifact [c94a1830f2]:


   225    225   
   226    226   	(
   227    227   		cd "${workdir}" || exit 1
   228    228   
   229    229   		# Copy out PC/SC headers for later use
   230    230   		mkdir -p "${instdir}/include/PCSC" || exit 1
   231    231   		cp third_party/pcsc-lite/src/src/PCSC/*.h "${instdir}/include/PCSC" || exit 1
          232  +
          233  +		# Copy out extra headers
          234  +		cat << \_EOF_ > "${instdir}/include/PCSC/pcsc-nacl.h"
          235  +#ifndef PCSC_NACL_H
          236  +#define PCSC_NACL_H 1
          237  +#ifdef __cplusplus
          238  +#include <ppapi/cpp/core.h>
          239  +#include <ppapi/cpp/instance.h>
          240  +
          241  +void pcscNaClInit(pp::Instance *instance, pp::Core *core);
          242  +#endif
          243  +#endif
          244  +_EOF_
   232    245   
   233    246   		# Copy out JavaScript files for later use
   234    247   		mkdir "${instdir}/js" || exit 1
          248  +		cp common-utils/*.js "${instdir}/js" || exit 1
   235    249   		cp third_party/pcsc-lite/client-side/*.js "${instdir}/js" || exit 1
   236    250   
   237    251   		# Build libpcsc
   238    252   		## Assemble all the files into a single tree
   239    253   		for file in logging.h scard_structs_serialization.h dom_requests_manager.h thread_safe_string_pool.h \
   240    254   		    pp_var_utils.cc pp_var_utils.h scard_structs_serialization.cc dom_requests_manager.cc logging.cc; do
   241    255   			find . -type f -name "${file}" -exec cp '{}' third_party/pcsc-lite/client-side/ ';'
................................................................................
   243    257   
   244    258   		## Create Makefile
   245    259   		cat << \_EOF_ > third_party/pcsc-lite/client-side/Makefile || exit 1
   246    260   CFLAGS   += -Wall -std=gnu++11
   247    261   CXXFLAGS += -Wall -std=gnu++11
   248    262   CPPFLAGS += -I../src/src/PCSC
   249    263   
   250         -OBJS = pcsc_nacl.o pcsc_nacl_global.o scard_structs_serialization.o pp_var_utils.o logging.o dom_requests_manager.o
          264  +OBJS = pcsc_nacl.o pcsc_nacl_global.o scard_structs_serialization.o pp_var_utils.o logging.o dom_requests_manager.o pcsc_nacl_init.o
   251    265   
   252    266   all: libpcsc.a
   253    267   
   254    268   libpcsc.a: $(OBJS)
   255    269   	rm -f libpcsc.a
   256    270   	$(AR) rc libpcsc.a $(OBJS)
   257    271   	-$(RANLIB) libpcsc.a
          272  +
          273  +pcsc_nacl_init.o: pcsc_nacl_init.cc pcsc_nacl_global.h dom_requests_manager.h pcsc_nacl.h
   258    274   
   259    275   pcsc_nacl.o: pcsc_nacl.cc pcsc_nacl.h logging.h pp_var_utils.h scard_structs_serialization.h
   260    276   pcsc_nacl.h: dom_requests_manager.h thread_safe_string_pool.h
   261    277   
   262    278   pcsc_nacl_global.o: pcsc_nacl_global.cc pcsc_nacl_global.h logging.h
   263    279   pcsc_nacl_global.h: pcsc_nacl.h
   264    280   
................................................................................
   276    292   	rm -f $(OBJS)
   277    293   	rm -f libpcsc.a
   278    294   
   279    295   distclean: clean
   280    296   
   281    297   .PHONY: all clean distclean
   282    298   _EOF_
          299  +
          300  +		## Create initialization procedure, since it lacks one
          301  +		cat << \_EOF_ > third_party/pcsc-lite/client-side/pcsc_nacl_init.cc
          302  +#include <ppapi/cpp/core.h>
          303  +#include <ppapi/cpp/instance.h>
          304  +
          305  +#include <stdio.h>
          306  +
          307  +#include "pcsc_nacl_global.h"
          308  +#include "dom_requests_manager.h"
          309  +#include "pcsc_nacl.h"
          310  +
          311  +void pcscNaClInit(pp::Instance *instance, pp::Core *core) {
          312  +	DomRequestsManager::PpDelegateImpl *drmDelegateImpl;
          313  +	PcscNacl *pcsc_nacl;
          314  +
          315  +	fprintf(stderr, "Called pcscNaClInit()\n");
          316  +
          317  +	drmDelegateImpl = new DomRequestsManager::PpDelegateImpl(instance, core);
          318  +
          319  +	pcsc_nacl = new PcscNacl(new DomRequestsManager("pcsc-nacl", drmDelegateImpl), "nahamlodapjneockbbogcleglpoillcn", "client");
          320  +
          321  +	fprintf(stderr, "New PcscNacl object = %p\n", pcsc_nacl);
          322  +
          323  +	if (!pcsc_nacl->Initialize()) {
          324  +		fprintf(stderr, "PcscNacl->Initialize() failed !");
          325  +
          326  +		return;
          327  +	}
          328  +
          329  +	fprintf(stderr, "Global instance set to %p\n", pcsc_nacl);
          330  +
          331  +	SetPcscNaclGlobalInstance(pcsc_nacl);
          332  +
          333  +	fprintf(stderr, "Returning.\n");
          334  +
          335  +	return;
          336  +}
          337  +_EOF_
   283    338   
   284    339   		## Make it
   285    340   		make -C third_party/pcsc-lite/client-side || exit 1
   286    341   
   287    342   		# Install the built libpcsc
   288    343   		mkdir -p "${instdir}/lib" || exit 1
   289    344   		cp third_party/pcsc-lite/client-side/libpcsc.a "${instdir}/lib" || exit 1