Diff

Differences From Artifact [93232701c1]:

To Artifact [c94a1830f2]:


225
226
227
228
229
230
231













232
233
234

235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250

251
252
253
254
255
256
257


258
259
260
261
262
263
264
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263

264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280







+
+
+
+
+
+
+
+
+
+
+
+
+



+















-
+







+
+








	(
		cd "${workdir}" || exit 1

		# Copy out PC/SC headers for later use
		mkdir -p "${instdir}/include/PCSC" || exit 1
		cp third_party/pcsc-lite/src/src/PCSC/*.h "${instdir}/include/PCSC" || exit 1

		# Copy out extra headers
		cat << \_EOF_ > "${instdir}/include/PCSC/pcsc-nacl.h"
#ifndef PCSC_NACL_H
#define PCSC_NACL_H 1
#ifdef __cplusplus
#include <ppapi/cpp/core.h>
#include <ppapi/cpp/instance.h>

void pcscNaClInit(pp::Instance *instance, pp::Core *core);
#endif
#endif
_EOF_

		# Copy out JavaScript files for later use
		mkdir "${instdir}/js" || exit 1
		cp common-utils/*.js "${instdir}/js" || exit 1
		cp third_party/pcsc-lite/client-side/*.js "${instdir}/js" || exit 1

		# Build libpcsc
		## Assemble all the files into a single tree
		for file in logging.h scard_structs_serialization.h dom_requests_manager.h thread_safe_string_pool.h \
		    pp_var_utils.cc pp_var_utils.h scard_structs_serialization.cc dom_requests_manager.cc logging.cc; do
			find . -type f -name "${file}" -exec cp '{}' third_party/pcsc-lite/client-side/ ';'
		done

		## Create Makefile
		cat << \_EOF_ > third_party/pcsc-lite/client-side/Makefile || exit 1
CFLAGS   += -Wall -std=gnu++11
CXXFLAGS += -Wall -std=gnu++11
CPPFLAGS += -I../src/src/PCSC

OBJS = pcsc_nacl.o pcsc_nacl_global.o scard_structs_serialization.o pp_var_utils.o logging.o dom_requests_manager.o
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

all: libpcsc.a

libpcsc.a: $(OBJS)
	rm -f libpcsc.a
	$(AR) rc libpcsc.a $(OBJS)
	-$(RANLIB) libpcsc.a

pcsc_nacl_init.o: pcsc_nacl_init.cc pcsc_nacl_global.h dom_requests_manager.h pcsc_nacl.h

pcsc_nacl.o: pcsc_nacl.cc pcsc_nacl.h logging.h pp_var_utils.h scard_structs_serialization.h
pcsc_nacl.h: dom_requests_manager.h thread_safe_string_pool.h

pcsc_nacl_global.o: pcsc_nacl_global.cc pcsc_nacl_global.h logging.h
pcsc_nacl_global.h: pcsc_nacl.h

276
277
278
279
280
281
282







































283
284
285
286
287
288
289
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







	rm -f $(OBJS)
	rm -f libpcsc.a

distclean: clean

.PHONY: all clean distclean
_EOF_

		## Create initialization procedure, since it lacks one
		cat << \_EOF_ > third_party/pcsc-lite/client-side/pcsc_nacl_init.cc
#include <ppapi/cpp/core.h>
#include <ppapi/cpp/instance.h>

#include <stdio.h>

#include "pcsc_nacl_global.h"
#include "dom_requests_manager.h"
#include "pcsc_nacl.h"

void pcscNaClInit(pp::Instance *instance, pp::Core *core) {
	DomRequestsManager::PpDelegateImpl *drmDelegateImpl;
	PcscNacl *pcsc_nacl;

	fprintf(stderr, "Called pcscNaClInit()\n");

	drmDelegateImpl = new DomRequestsManager::PpDelegateImpl(instance, core);

	pcsc_nacl = new PcscNacl(new DomRequestsManager("pcsc-nacl", drmDelegateImpl), "nahamlodapjneockbbogcleglpoillcn", "client");

	fprintf(stderr, "New PcscNacl object = %p\n", pcsc_nacl);

	if (!pcsc_nacl->Initialize()) {
		fprintf(stderr, "PcscNacl->Initialize() failed !");

		return;
	}

	fprintf(stderr, "Global instance set to %p\n", pcsc_nacl);

	SetPcscNaclGlobalInstance(pcsc_nacl);

	fprintf(stderr, "Returning.\n");

	return;
}
_EOF_

		## Make it
		make -C third_party/pcsc-lite/client-side || exit 1

		# Install the built libpcsc
		mkdir -p "${instdir}/lib" || exit 1
		cp third_party/pcsc-lite/client-side/libpcsc.a "${instdir}/lib" || exit 1