| 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-dosbox-0.74.sh | 7 # nacl-dosbox-0.74.sh |
| 8 # | 8 # |
| 9 # usage: nacl-dosbox-0.74.sh | 9 # usage: nacl-dosbox-0.74.sh |
| 10 # | 10 # |
| 11 # this script downloads, patches, and builds dosbox for Native Client. | 11 # this script downloads, patches, and builds dosbox 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 DOSBOX_EXAMPLE_DIR=${NACL_SRC}/examples/systems/dosbox-0.74 | 17 DOSBOX_EXAMPLE_DIR=${NACL_SRC}/examples/systems/dosbox-0.74 |
| 18 EXECUTABLES=src/dosbox |
| 18 | 19 |
| 19 CustomConfigureStep() { | 20 CustomConfigureStep() { |
| 20 Banner "Configuring ${PACKAGE_NAME}" | 21 Banner "Configuring ${PACKAGE_NAME}" |
| 21 | 22 |
| 22 # export the nacl tools | 23 # export the nacl tools |
| 23 export CC=${NACLCC} | 24 export CC=${NACLCC} |
| 24 export CXX=${NACLCXX} | 25 export CXX=${NACLCXX} |
| 25 # NOTE: non-standard flag NACL_LDFLAGS because of some more hacking below | 26 # NOTE: non-standard flag NACL_LDFLAGS because of some more hacking below |
| 26 export CXXFLAGS="${NACLPORTS_CFLAGS} -O2 -g -I${NACL_SDK_ROOT}/include" | 27 export CXXFLAGS="${NACLPORTS_CFLAGS} -O2 -g -I${NACL_SDK_ROOT}/include" |
| 27 export NACL_LDFLAGS="${NACLPORTS_LDFLAGS}" | 28 export NACL_LDFLAGS="${NACLPORTS_LDFLAGS}" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 --prefix=${NACLPORTS_PREFIX} \ | 45 --prefix=${NACLPORTS_PREFIX} \ |
| 45 --exec-prefix=${NACLPORTS_PREFIX} \ | 46 --exec-prefix=${NACLPORTS_PREFIX} \ |
| 46 --libdir=${NACLPORTS_LIBDIR} \ | 47 --libdir=${NACLPORTS_LIBDIR} \ |
| 47 --oldincludedir=${NACLPORTS_INCLUDE} \ | 48 --oldincludedir=${NACLPORTS_INCLUDE} \ |
| 48 --with-sdl-prefix=${NACLPORTS_PREFIX} \ | 49 --with-sdl-prefix=${NACLPORTS_PREFIX} \ |
| 49 --with-sdl-exec-prefix=${NACLPORTS_PREFIX}" | 50 --with-sdl-exec-prefix=${NACLPORTS_PREFIX}" |
| 50 | 51 |
| 51 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME} | 52 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME} |
| 52 ./autogen.sh | 53 ./autogen.sh |
| 53 | 54 |
| 54 Remove ${PACKAGE_NAME}-build | 55 Remove build-nacl |
| 55 MakeDir ${PACKAGE_NAME}-build | 56 MakeDir build-nacl |
| 56 cd ${PACKAGE_NAME}-build | 57 cd build-nacl |
| 57 ../configure ${CONFIG_FLAGS} | 58 ../configure ${CONFIG_FLAGS} |
| 58 | 59 |
| 59 # TODO(clchiou): Sadly we cannot export LIBS and LDFLAGS to configure, which | 60 # TODO(clchiou): Sadly we cannot export LIBS and LDFLAGS to configure, which |
| 60 # would fail due to multiple definitions of main and missing pp::CreateModule. | 61 # would fail due to multiple definitions of main and missing pp::CreateModule. |
| 61 # So we patch auto-generated Makefile after running configure. | 62 # So we patch auto-generated Makefile after running configure. |
| 62 # | 63 # |
| 63 # XXX To avoid symbol conflicts after revision r490, which switches SDL video | 64 # XXX To avoid symbol conflicts after revision r490, which switches SDL video |
| 64 # driver to MainThreadRunner, move -lnacl-mounts to the end of PPAPI_LIBS. | 65 # driver to MainThreadRunner, move -lnacl-mounts to the end of PPAPI_LIBS. |
| 65 # This somehow works for me. | 66 # This somehow works for me. |
| 66 PPAPI_LIBS="-Wl,--whole-archive \ | 67 PPAPI_LIBS="-Wl,--whole-archive \ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 83 SED_PREPEND_LIBS="s|^LIBS = \(.*$\)|LIBS = ${PPAPI_LIBS} \1 ${MAYBE_NOSYS}|" | 84 SED_PREPEND_LIBS="s|^LIBS = \(.*$\)|LIBS = ${PPAPI_LIBS} \1 ${MAYBE_NOSYS}|" |
| 84 SED_REPLACE_LDFLAGS="s|^LDFLAGS = .*$|LDFLAGS = ${LDFLAGS}|" | 85 SED_REPLACE_LDFLAGS="s|^LDFLAGS = .*$|LDFLAGS = ${LDFLAGS}|" |
| 85 | 86 |
| 86 find . -name Makefile -exec cp {} {}.bak \; \ | 87 find . -name Makefile -exec cp {} {}.bak \; \ |
| 87 -exec sed -i.bak "${SED_PREPEND_LIBS}" {} \; \ | 88 -exec sed -i.bak "${SED_PREPEND_LIBS}" {} \; \ |
| 88 -exec sed -i.bak "${SED_REPLACE_LDFLAGS}" {} \; | 89 -exec sed -i.bak "${SED_REPLACE_LDFLAGS}" {} \; |
| 89 } | 90 } |
| 90 | 91 |
| 91 CustomInstallStep(){ | 92 CustomInstallStep(){ |
| 92 DOSBOX_DIR=${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME} | 93 DOSBOX_DIR=${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME} |
| 93 DOSBOX_BUILD=${DOSBOX_DIR}/${PACKAGE_NAME}-build | 94 DOSBOX_BUILD=${DOSBOX_DIR}/build-nacl |
| 94 PUBLISH_DIR="${NACL_PACKAGES_PUBLISH}/${PACKAGE_NAME}" | 95 PUBLISH_DIR="${NACL_PACKAGES_PUBLISH}/${PACKAGE_NAME}" |
| 95 MakeDir ${PUBLISH_DIR} | 96 MakeDir ${PUBLISH_DIR} |
| 96 install ${START_DIR}/dosbox.html ${PUBLISH_DIR} | 97 install ${START_DIR}/dosbox.html ${PUBLISH_DIR} |
| 97 install ${START_DIR}/dosbox.nmf ${PUBLISH_DIR} | 98 install ${START_DIR}/dosbox.nmf ${PUBLISH_DIR} |
| 98 install ${DOSBOX_BUILD}/src/dosbox \ | 99 install ${DOSBOX_BUILD}/src/dosbox ${PUBLISH_DIR}/dosbox_${NACL_ARCH}.nexe |
| 99 ${PUBLISH_DIR}/dosbox_${NACL_ARCH}.nexe | |
| 100 DefaultTouchStep | 100 DefaultTouchStep |
| 101 } | 101 } |
| 102 | 102 |
| 103 CustomPackageInstall() { | 103 CustomPackageInstall() { |
| 104 DefaultPreInstallStep | 104 DefaultPreInstallStep |
| 105 DefaultDownloadStep | 105 DefaultDownloadStep |
| 106 DefaultExtractStep | 106 DefaultExtractStep |
| 107 DefaultPatchStep | 107 DefaultPatchStep |
| 108 CustomConfigureStep | 108 CustomConfigureStep |
| 109 DefaultBuildStep | 109 DefaultBuildStep |
| 110 if [ ${NACL_ARCH} = "pnacl" ] ; then | 110 DefaultTranslateStep |
| 111 DefaultTranslateStep ${PACKAGE_NAME} ${PACKAGE_NAME}-build/src/dosbox | 111 DefaultValidateStep |
| 112 fi | |
| 113 CustomInstallStep | 112 CustomInstallStep |
| 114 DefaultCleanUpStep | 113 DefaultCleanUpStep |
| 115 } | 114 } |
| 116 | 115 |
| 117 CustomPackageInstall | 116 CustomPackageInstall |
| 118 exit 0 | 117 exit 0 |
| OLD | NEW |