OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 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 # | 5 # |
6 | 6 |
7 # nacl-nethack-343.sh | 7 # nacl-nethack-343.sh |
8 # | 8 # |
9 # usage: nacl-nethack-343.sh | 9 # usage: nacl-nethack-343.sh |
10 # | 10 # |
11 # this script downloads, patches, and builds nethack for Native Client | 11 # this script downloads, patches, and builds nethack for Native Client |
12 # | 12 # |
13 | 13 |
14 source pkg_info | 14 source pkg_info |
15 source ../../../build_tools/common.sh | 15 source ../../../build_tools/common.sh |
16 | 16 |
17 | 17 |
18 set -x | 18 set -x |
19 | 19 |
20 | 20 |
21 CustomBuildStep() { | 21 CustomBuildStep() { |
22 Banner "Building ${PACKAGE_NAME}" | 22 Banner "Building ${PACKAGE_NAME}" |
23 # export the nacl tools | 23 # export the nacl tools |
24 export CC=${NACLCC} | 24 export CC=${NACLCC} |
25 export CXX=${NACLCXX} | 25 export CXX=${NACLCXX} |
26 # NOTE: we are using the non-standard vars NACL_CCFLAGS/NACL_LDFLAGS | 26 # NOTE: we are using the non-standard vars NACL_CCFLAGS/NACL_LDFLAGS |
27 # because we are not running ./configure and the Makefile was hacked | 27 # because we are not running ./configure and the Makefile was hacked |
28 export NACL_CCFLAGS="-O" | 28 export NACL_CCFLAGS="-O" |
29 export NACL_LDFLAGS="" | 29 export NACL_LDFLAGS="${NACLPORTS_LDFLAGS}" |
30 if [ ${NACL_ARCH} = "pnacl" ] ; then | 30 if [ ${NACL_ARCH} = "pnacl" ] ; then |
31 export NACL_CCFLAGS="-O3 -g" | 31 export NACL_CCFLAGS="-O3 -g" |
32 export NACL_LDFLAGS="-O0 -static" | 32 export NACL_LDFLAGS="-O0 -static" |
33 fi | 33 fi |
34 export AR=${NACLAR} | 34 export AR=${NACLAR} |
35 export RANLIB=${NACLRANLIB} | 35 export RANLIB=${NACLRANLIB} |
36 export PKG_CONFIG_PATH=${NACL_SDK_USR_LIB}/pkgconfig | 36 export PKG_CONFIG_PATH=${NACLPORTS_LIBDIR}/pkgconfig |
37 export PKG_CONFIG_LIBDIR=${NACL_SDK_USR_LIB} | 37 export PKG_CONFIG_LIBDIR=${NACLPORTS_LIBDIR} |
38 export PATH=${NACL_BIN_PATH}:${PATH}; | 38 export PATH=${NACL_BIN_PATH}:${PATH}; |
39 export WINTTYLIB="-Wl,--whole-archive" | 39 export WINTTYLIB="-Wl,--whole-archive" |
40 export WINTTYLIB="$WINTTYLIB -lnacl-mounts -lncurses -lppapi -lppapi_cpp" | 40 export WINTTYLIB="$WINTTYLIB -lnacl-mounts -lncurses -lppapi -lppapi_cpp" |
41 export WINTTYLIB="$WINTTYLIB -Wl,--no-whole-archive" | 41 export WINTTYLIB="$WINTTYLIB -Wl,--no-whole-archive" |
42 export NACL_SDK_USR_INCLUDE | 42 export NACLPORTS_INCLUDE |
43 export STRNCMPI=1 | 43 export STRNCMPI=1 |
44 local PACKAGE_DIR="${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME}" | 44 local PACKAGE_DIR="${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME}" |
45 ChangeDir ${PACKAGE_DIR} | 45 ChangeDir ${PACKAGE_DIR} |
46 cp ${START_DIR}/nethack_pepper.cc ${PACKAGE_DIR}/src | 46 cp ${START_DIR}/nethack_pepper.cc ${PACKAGE_DIR}/src |
47 bash sys/unix/setup.sh | 47 bash sys/unix/setup.sh |
48 make | 48 make |
49 make install | 49 make install |
50 Banner "Installing ${PACKAGE_NAME}" | 50 Banner "Installing ${PACKAGE_NAME}" |
51 local PUBLISH_DIR="${NACL_PACKAGES_PUBLISH}/${PACKAGE_NAME}" | 51 local PUBLISH_DIR="${NACL_PACKAGES_PUBLISH}/${PACKAGE_NAME}" |
52 MakeDir ${PUBLISH_DIR} | 52 MakeDir ${PUBLISH_DIR} |
(...skipping 12 matching lines...) Expand all Loading... |
65 *.nexe \ | 65 *.nexe \ |
66 -L ${NACL_TOOLCHAIN_ROOT}/x86_64-nacl/lib32 \ | 66 -L ${NACL_TOOLCHAIN_ROOT}/x86_64-nacl/lib32 \ |
67 -L ${NACL_TOOLCHAIN_ROOT}/x86_64-nacl/lib64 \ | 67 -L ${NACL_TOOLCHAIN_ROOT}/x86_64-nacl/lib64 \ |
68 -D ${NACL_TOOLCHAIN_ROOT}/bin/x86_64-nacl-objdump \ | 68 -D ${NACL_TOOLCHAIN_ROOT}/bin/x86_64-nacl-objdump \ |
69 -s . \ | 69 -s . \ |
70 -o nethack.nmf | 70 -o nethack.nmf |
71 popd | 71 popd |
72 else | 72 else |
73 cp ${START_DIR}/nethack.nmf ${ASSEMBLY_DIR} | 73 cp ${START_DIR}/nethack.nmf ${ASSEMBLY_DIR} |
74 fi | 74 fi |
75 cp ${NACL_SDK_USR_LIB}/nacl-mounts/*.js ${ASSEMBLY_DIR} | 75 cp ${NACLPORTS_LIBDIR}/nacl-mounts/*.js ${ASSEMBLY_DIR} |
76 cp ${START_DIR}/manifest.json ${ASSEMBLY_DIR} | 76 cp ${START_DIR}/manifest.json ${ASSEMBLY_DIR} |
77 cp ${START_DIR}/icon_16.png ${ASSEMBLY_DIR} | 77 cp ${START_DIR}/icon_16.png ${ASSEMBLY_DIR} |
78 cp ${START_DIR}/icon_48.png ${ASSEMBLY_DIR} | 78 cp ${START_DIR}/icon_48.png ${ASSEMBLY_DIR} |
79 cp ${START_DIR}/icon_128.png ${ASSEMBLY_DIR} | 79 cp ${START_DIR}/icon_128.png ${ASSEMBLY_DIR} |
80 ChangeDir ${PUBLISH_DIR} | 80 ChangeDir ${PUBLISH_DIR} |
81 zip -r nethack-3.4.3.zip nethack | 81 zip -r nethack-3.4.3.zip nethack |
82 } | 82 } |
83 | 83 |
84 CustomPackageInstall() { | 84 CustomPackageInstall() { |
85 DefaultPreInstallStep | 85 DefaultPreInstallStep |
86 DefaultDownloadStep | 86 DefaultDownloadStep |
87 DefaultExtractStep | 87 DefaultExtractStep |
88 DefaultPatchStep | 88 DefaultPatchStep |
89 CustomBuildStep | 89 CustomBuildStep |
90 if [ ${NACL_ARCH} = "pnacl" ] ; then | 90 if [ ${NACL_ARCH} = "pnacl" ] ; then |
91 # NOTE: nethack does not use a build subdir | 91 # NOTE: nethack does not use a build subdir |
92 DefaultTranslateStep ${PACKAGE_NAME} src/nethack | 92 DefaultTranslateStep ${PACKAGE_NAME} src/nethack |
93 fi | 93 fi |
94 DefaultTouchStep | 94 DefaultTouchStep |
95 DefaultCleanUpStep | 95 DefaultCleanUpStep |
96 } | 96 } |
97 | 97 |
98 CustomPackageInstall | 98 CustomPackageInstall |
99 exit 0 | 99 exit 0 |
OLD | NEW |