| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | |
| 6 | |
| 7 # nacl-zlib-1.2.3.sh | |
| 8 # | |
| 9 # usage: nacl-zlib-1.2.3.sh | |
| 10 # | |
| 11 # this script downloads, patches, and builds zlib for Native Client | |
| 12 # | |
| 13 | 5 |
| 14 source pkg_info | 6 source pkg_info |
| 15 source ../../build_tools/common.sh | 7 source ../../build_tools/common.sh |
| 16 | 8 |
| 17 | 9 |
| 18 CustomConfigureStep() { | 10 CustomConfigureStep() { |
| 19 Banner "Configuring ${PACKAGE_NAME}" | 11 Banner "Configuring ${PACKAGE_NAME}" |
| 20 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME} | 12 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME} |
| 21 # TODO: side-by-side install | 13 # TODO: side-by-side install |
| 22 CC=${NACLCC} AR="${NACLAR} -r" RANLIB=${NACLRANLIB} CFLAGS="-Dunlink=puts" ./c
onfigure\ | 14 local CONFIGURE_ARGS="--prefix=${NACLPORTS_PREFIX}" |
| 23 --prefix=${NACLPORTS_PREFIX} | 15 local CFLAGS="-Dunlink=puts" |
| 16 if [ "${NACL_GLIBC}" = "1" -a $# -gt 0 ]; then |
| 17 CONFIGURE_ARGS="${CONFIGURE_ARGS} --shared" |
| 18 CFLAGS="${CFLAGS} -fPIC" |
| 19 fi |
| 20 CC=${NACLCC} AR="${NACLAR} -r" RANLIB=${NACLRANLIB} CFLAGS="${CFLAGS}" \ |
| 21 LogExecute ./configure ${CONFIGURE_ARGS} |
| 22 if [ ${NACL_ARCH} = "pnacl" ]; then |
| 23 export MAKEFLAGS="EXE=.pexe" |
| 24 EXECUTABLES="minigzip.pexe example.pexe" |
| 25 else |
| 26 export MAKEFLAGS="EXE=.nexe" |
| 27 EXECUTABLES="minigzip.nexe example.nexe" |
| 28 fi |
| 24 } | 29 } |
| 25 | 30 |
| 26 | 31 |
| 32 TestStep() { |
| 33 if [ $NACL_ARCH = "arm" ]; then |
| 34 # no sel_ldr for arm |
| 35 return |
| 36 fi |
| 37 |
| 38 if [ "${NACL_GLIBC}" = "1" ]; then |
| 39 # Tests do not currently run on GLIBC due to fdopen() not working |
| 40 # TODO(sbc): Remove this once glibc is fixed: |
| 41 # https://code.google.com/p/nativeclient/issues/detail?id=3362 |
| 42 return |
| 43 fi |
| 44 |
| 45 if [ $NACL_ARCH = "pnacl" ]; then |
| 46 WriteSelLdrScript minigzip minigzip.pexe.x86-64.nexe |
| 47 WriteSelLdrScript example example.pexe.x86-64.nexe |
| 48 else |
| 49 WriteSelLdrScript minigzip minigzip.nexe |
| 50 WriteSelLdrScript example example.nexe |
| 51 fi |
| 52 export LD_LIBRARY_PATH=. |
| 53 if echo "hello world" | ./minigzip | ./minigzip -d; then |
| 54 echo ' *** minigzip test OK ***' ; \ |
| 55 else |
| 56 echo ' *** minigzip test FAILED ***' ; \ |
| 57 exit 1 |
| 58 fi |
| 59 |
| 60 # This second test does not yet work on nacl (gzopen fails) |
| 61 #if ./example; then \ |
| 62 #echo ' *** zlib test OK ***'; \ |
| 63 #else \ |
| 64 #echo ' *** zlib test FAILED ***'; \ |
| 65 #exit 1 |
| 66 #fi |
| 67 } |
| 68 |
| 69 |
| 27 CustomPackageInstall() { | 70 CustomPackageInstall() { |
| 28 DefaultPreInstallStep | 71 DefaultPreInstallStep |
| 29 DefaultDownloadStep | 72 DefaultDownloadStep |
| 30 DefaultExtractStep | 73 DefaultExtractStep |
| 31 # zlib doesn't need patching, so no patch step | 74 # zlib doesn't need patching, so no patch step |
| 32 CustomConfigureStep | 75 CustomConfigureStep |
| 33 DefaultBuildStep | 76 DefaultBuildStep |
| 77 DefaultTranslateStep |
| 78 DefaultValidateStep |
| 79 TestStep |
| 34 DefaultInstallStep | 80 DefaultInstallStep |
| 81 if [ "${NACL_GLIBC}" = "1" ]; then |
| 82 CustomConfigureStep shared |
| 83 DefaultBuildStep |
| 84 Validate libz.so.1 |
| 85 DefaultValidateStep |
| 86 TestStep |
| 87 DefaultInstallStep |
| 88 fi |
| 35 DefaultCleanUpStep | 89 DefaultCleanUpStep |
| 36 } | 90 } |
| 37 | 91 |
| 38 | 92 |
| 39 CustomPackageInstall | 93 CustomPackageInstall |
| 40 exit 0 | 94 exit 0 |
| OLD | NEW |