OLD | NEW |
1 # Copyright (c) 2013 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2013 The Native Client Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 export ac_cv_func_gethostbyname=yes | 5 export ac_cv_func_gethostbyname=yes |
6 export ac_cv_func_getaddrinfo=no | 6 export ac_cv_func_getaddrinfo=no |
7 export ac_cv_func_connect=yes | 7 export ac_cv_func_connect=yes |
8 export LIBS="-lnacl_io -pthread -l${NACL_CXX_LIB}" | 8 export LIBS="${NACL_CLI_MAIN_LIB} -l${NACL_CXX_LIB}" |
9 | 9 |
10 if [ "${NACL_LIBC}" = "newlib" ]; then | 10 if [ "${NACL_LIBC}" = "newlib" ]; then |
11 LIBS+=" -lglibc-compat" | 11 LIBS+=" -lglibc-compat" |
12 fi | 12 fi |
13 | 13 |
14 EXECUTABLES="src/curl${NACL_EXEEXT}" | 14 EXECUTABLES="src/curl${NACL_EXEEXT}" |
| 15 NACLPORTS_CPPFLAGS+=" -Dmain=nacl_main" |
| 16 |
15 if [ "${NACL_DEBUG}" = "1" ]; then | 17 if [ "${NACL_DEBUG}" = "1" ]; then |
16 CFLAGS+=" -DDEBUGBUILD" | 18 NACLPORTS_CPPFLAGS+=" -DDEBUGBUILD" |
17 EXTRA_CONFIGURE_ARGS="--enable-debug --disable-curldebug" | 19 EXTRA_CONFIGURE_ARGS="--enable-debug --disable-curldebug" |
18 fi | 20 fi |
19 | 21 |
20 BuildStep() { | 22 InstallStep() { |
21 # Run the build twice, initially to build the sel_ldr version | 23 DefaultInstallStep |
22 # and secondly to build the PPAPI version based on nacl_io. | 24 MakeDir ${DESTDIR}${PREFIX}/share/curl |
23 # Remove curl-tool_main.o between builds to ensure it gets | 25 LogExecute ${SRC_DIR}/lib/mk-ca-bundle.pl \ |
24 # rebuilt. This is the only object that depends on the PPAPI | 26 ${DESTDIR}${PREFIX}/share/curl/ca-bundle.crt |
25 # define and therefore will differ between PPAPI and sel_ldr | |
26 # versions. | |
27 Remove src/curl-tool_main.o | |
28 DefaultBuildStep | |
29 | |
30 Banner "Build curl_ppapi" | |
31 Remove src/curl-tool_main.o | |
32 sed -i.bak "s/CFLAGS = /CFLAGS = -DPPAPI /" src/Makefile | |
33 sed -i.bak "s/curl\$(EXEEXT)/curl_ppapi\$(EXEEXT)/" src/Makefile | |
34 local sedlibs="-lppapi_simple,-lcli_main,-lnacl_spawn,-lnacl_io,-lppapi" | |
35 sedlibs="-Wl,--start-group,$sedlibs,--end-group -l${NACL_CXX_LIB}" | |
36 sed -i.bak "s/LIBS = \$(BLANK_AT_MAKETIME)/LIBS = ${sedlibs}/" src/Makefile | |
37 DefaultBuildStep | |
38 } | 27 } |
39 | 28 |
40 PublishStep() { | 29 PublishStep() { |
41 if [ "${NACL_SHARED}" = "1" ]; then | 30 if [ "${NACL_SHARED}" = "1" ]; then |
42 EXECUTABLE_DIR=.libs | 31 EXECUTABLE_DIR=.libs |
43 else | 32 else |
44 EXECUTABLE_DIR=. | 33 EXECUTABLE_DIR=. |
45 fi | 34 fi |
46 | 35 |
47 if [ "${NACL_ARCH}" = "pnacl" ]; then | 36 if [ "${NACL_ARCH}" = "pnacl" ]; then |
48 # Just set up the x86-64 version for now. | 37 # Just set up the x86-64 version for now. |
49 local pexe="${EXECUTABLE_DIR}/curl${NACL_EXEEXT}" | 38 local pexe="${EXECUTABLE_DIR}/curl${NACL_EXEEXT}" |
50 (cd src; | 39 (cd src; |
51 TranslateAndWriteLauncherScript ${pexe} x86-64 curl.x86-64.nexe curl | 40 TranslateAndWriteLauncherScript ${pexe} x86-64 curl.x86-64.nexe curl |
52 ) | 41 ) |
53 fi | 42 fi |
54 | 43 |
55 MakeDir ${PUBLISH_DIR} | 44 MakeDir ${PUBLISH_DIR} |
56 | 45 |
57 local exe=${PUBLISH_DIR}/curl_ppapi_${NACL_ARCH}${NACL_EXEEXT} | 46 local exe=${PUBLISH_DIR}/curl_${NACL_ARCH}${NACL_EXEEXT} |
58 | 47 |
59 LogExecute mv src/${EXECUTABLE_DIR}/curl_ppapi${NACL_EXEEXT} ${exe} | 48 LogExecute cp ${DESTDIR}${PREFIX}/share/curl/ca-bundle.crt . |
| 49 LogExecute cp src/${EXECUTABLE_DIR}/curl${NACL_EXEEXT} ${exe} |
60 if [ "${NACL_ARCH}" = "pnacl" ]; then | 50 if [ "${NACL_ARCH}" = "pnacl" ]; then |
61 LogExecute ${PNACLFINALIZE} ${exe} | 51 LogExecute ${PNACLFINALIZE} ${exe} |
62 fi | 52 fi |
63 | 53 |
64 pushd ${PUBLISH_DIR} | 54 pushd ${PUBLISH_DIR} |
65 ${SRC_DIR}/lib/mk-ca-bundle.pl | |
66 LogExecute python ${NACL_SDK_ROOT}/tools/create_nmf.py \ | 55 LogExecute python ${NACL_SDK_ROOT}/tools/create_nmf.py \ |
67 ${PUBLISH_DIR}/curl_ppapi*${NACL_EXEEXT} \ | 56 ${PUBLISH_DIR}/curl*${NACL_EXEEXT} \ |
68 -L${DESTDIR_LIB} \ | 57 -L${DESTDIR_LIB} \ |
69 -s . \ | 58 -s . \ |
70 -o curl.nmf | 59 -o curl.nmf |
71 popd | 60 popd |
72 | 61 |
73 InstallNaClTerm ${PUBLISH_DIR} | 62 InstallNaClTerm ${PUBLISH_DIR} |
74 LogExecute cp ${START_DIR}/index.html ${PUBLISH_DIR} | 63 LogExecute cp ${START_DIR}/index.html ${PUBLISH_DIR} |
75 LogExecute cp ${START_DIR}/curl.js ${PUBLISH_DIR} | 64 LogExecute cp ${START_DIR}/curl.js ${PUBLISH_DIR} |
76 } | 65 } |
OLD | NEW |