| Index: ports/mingn/build.sh
|
| diff --git a/ports/mingn/build.sh b/ports/mingn/build.sh
|
| index 4c28f0ca4f3b749d907ca2a8de0cf893abae8a9c..3e5bff030c34a0472a379b6fc054a1a7462004cf 100644
|
| --- a/ports/mingn/build.sh
|
| +++ b/ports/mingn/build.sh
|
| @@ -7,63 +7,18 @@ BuildStep() {
|
| return
|
| }
|
|
|
| -CreateMingnPackage() {
|
| - local package_name="$1.${2:-${NACL_ARCH}}"
|
| - echo "CreateMingnPackage ${package_name}"
|
| - local stamp="$(date)"
|
| - MakeDir mingn/stamp
|
| - echo "INSTALLED=\"${stamp}\"" > "mingn/stamp/${package_name}"
|
| - MakeDir ${PUBLISH_DIR}/tarballs
|
| - LogExecute rm -f ${PUBLISH_DIR}/tarballs/${package_name}.zip
|
| - LogExecute zip -qr ${PUBLISH_DIR}/tarballs/${package_name}.zip mingn
|
| - MakeDir "${PUBLISH_DIR}/stamp"
|
| - echo "LATEST=\"${stamp}\"" > "${PUBLISH_DIR}/stamp/${package_name}"
|
| -}
|
| -
|
| InstallStep() {
|
| - MakeDir ${PUBLISH_DIR}
|
| -
|
| - # Create another archive which contains executables.
|
| - MakeDir ${SRC_DIR}/${NACL_ARCH}/bin
|
| - ChangeDir ${SRC_DIR}/${NACL_ARCH}/bin
|
| -
|
| - local BINUTILS_DIR=${NACL_PACKAGES_PUBLISH}/binutils/${TOOLCHAIN}
|
| - local GCC_DIR=${NACL_PACKAGES_PUBLISH}/gcc/${TOOLCHAIN}
|
| -
|
| - local TOOLCHAIN_OUT_DIR=mingn/toolchain/nacl_x86_glibc
|
| - local bin_dir=${TOOLCHAIN_OUT_DIR}/bin
|
| - local libexec_dir=${TOOLCHAIN_OUT_DIR}/libexec/gcc/x86_64-nacl/4.4.3
|
| -
|
| - MakeDir ${bin_dir}
|
| - MakeDir ${libexec_dir}
|
| - BINARIES="\
|
| - ${GCC_DIR}/*_${NACL_ARCH}.nexe \
|
| - ${BINUTILS_DIR}/*_${NACL_ARCH}.nexe"
|
| -
|
| - for binary in ${BINARIES}; do
|
| - name=$(basename ${binary} | sed "s/_${NACL_ARCH}.nexe//")
|
| - if [ ${name} = "cc1" -o ${name} = "cc1plus" -o ${name} = "collect2" ]; then
|
| - LogExecute cp ${binary} ${libexec_dir}/${name}
|
| - else
|
| - LogExecute cp ${binary} ${bin_dir}/${name}
|
| - fi
|
| - done
|
| -
|
| - CreateMingnPackage base
|
| + MakeDir ${INSTALL_DIR}${PREFIX}
|
| + ChangeDir ${INSTALL_DIR}${PREFIX}
|
|
|
| # Create an archive which contains include files and shared objects.
|
| - MakeDir ${SRC_DIR}/lib
|
| - ChangeDir ${SRC_DIR}/lib
|
|
|
| - # Copy files from $NACL_SDK_ROOT to the package.
|
| + # Copy files (for now just headers) from $NACL_SDK_ROOT to the package.
|
| local dirs="
|
| -toolchain/${OS_SUBDIR}_x86_glibc/lib/gcc/x86_64-nacl
|
| -toolchain/${OS_SUBDIR}_x86_glibc/x86_64-nacl/lib32
|
| -toolchain/${OS_SUBDIR}_x86_glibc/x86_64-nacl/lib
|
| toolchain/${OS_SUBDIR}_x86_glibc/x86_64-nacl/include
|
| "
|
| for d in ${dirs}; do
|
| - local o=$(echo mingn/${d} | sed "s/${OS_SUBDIR}_/nacl_/")
|
| + local o=$(echo ${d} | sed "s/toolchain\/${OS_SUBDIR}_x86_glibc\///")
|
| echo "Copying libs from: ${d} -> ${o}"
|
| MakeDir ${o}
|
| if [ -d ${NACL_SDK_ROOT}/${d} ]; then
|
| @@ -73,12 +28,22 @@ toolchain/${OS_SUBDIR}_x86_glibc/x86_64-nacl/include
|
| fi
|
| done
|
|
|
| + # Create libmingn.so ldscripts.
|
| + MakeDir lib
|
| + cat <<EOF > lib/libmingn.so
|
| +GROUP(-lcli_main -lnacl_spawn -lppapi_simple -lnacl_io -lppapi -lstdc++ -lm)
|
| +EXTERN(PSUserMainGet)
|
| +EOF
|
| +
|
| # Remove unnecessary files to reduce the size of the archive.
|
| - LogExecute rm -f ${TOOLCHAIN_OUT_DIR}/x86_64-nacl/lib/32
|
| - LogExecute rm -fr ${TOOLCHAIN_OUT_DIR}/x86_64-nacl/lib*/{gconv,libgfortran*}
|
| + LogExecute rm -fr x86_64-nacl/lib*/{gconv,libgfortran*}
|
| + # These headers gome from the 'gcc' package
|
| + LogExecute rm -fr x86_64-nacl/include/c++/
|
| + # These scripts come from the 'binutils' package
|
| + LogExecute rm -fr x86_64-nacl/lib/ldscripts/
|
|
|
| # Resolve all symlinks as nacl_io does not support symlinks.
|
| - for i in $(find mingn -type l); do
|
| + for i in $(find . -type l); do
|
| if [ ! -d ${i} ]; then
|
| cp ${i} ${i}.tmp
|
| rm ${i}
|
| @@ -86,61 +51,21 @@ toolchain/${OS_SUBDIR}_x86_glibc/x86_64-nacl/include
|
| fi
|
| done
|
|
|
| - # Create a directory for additional libraries.
|
| - for arch in i686 x86_64; do
|
| - local usr_lib_dir=${TOOLCHAIN_OUT_DIR}/${arch}-nacl/usr/lib
|
| - local usr_lib_ports=${NACL_TOOLCHAIN_ROOT}/${arch}-nacl/usr/lib
|
| -
|
| - mkdir -p ${usr_lib_dir}
|
| - mkdir -p ${usr_lib_dir}/debug
|
| -
|
| - # Copy libz, libncurses, libnacl-spawn, and libcli_main.
|
| - if ! cp -f \
|
| - ${usr_lib_ports}/libz.so* \
|
| - ${usr_lib_ports}/libncurses.so* \
|
| - ${usr_lib_ports}/libcli_main.a \
|
| - ${usr_lib_ports}/libnacl_spawn.* \
|
| - ${usr_lib_dir}; then
|
| - # They may not exist when we are building only for a single arch.
|
| - if [ ${NACL_ARCH} = ${arch} ]; then
|
| - echo "Failed to copy ${usr_lib_ports}"
|
| - exit 1
|
| - fi
|
| - fi
|
| + # Remove shared objects which are symlinked after we resolve them.
|
| + find . -name '*.so.*.*' -exec rm -f {} \;
|
|
|
| - local arch_alt=${arch}
|
| - if [ ${arch_alt} = "i686" ]; then
|
| - arch_alt="x86_32"
|
| - local ld_format="elf32-i386-nacl"
|
| - else
|
| - local ld_format="elf64-x86-64-nacl"
|
| - fi
|
| + MakeDir lib
|
| + # Copy core libraries
|
| + LogExecute cp -r ${NACL_SDK_LIB}/*.a lib/
|
| + LogExecute cp -r ${NACL_SDK_LIB}/*.o lib/
|
|
|
| - # Merge libraries made from native_client_sdk so that you do not
|
| - # need to specify -L option for them.
|
| - cp ${NACL_SDK_ROOT}/lib/glibc_${arch_alt}/Release/* ${usr_lib_dir}
|
| - # But also copy the debug ones.
|
| - cp ${NACL_SDK_ROOT}/lib/glibc_${arch_alt}/Debug/* ${usr_lib_dir}/debug
|
| -
|
| - # Create libmingn.so ldscripts.
|
| - cat <<EOF > ${TOOLCHAIN_OUT_DIR}/${arch}-nacl/usr/lib/libmingn.so
|
| -OUTPUT_FORMAT(${ld_format})
|
| -GROUP(-lcli_main -lnacl_spawn -lppapi_simple -lnacl_io -lppapi -lstdc++ -lm)
|
| -EXTERN(PSUserMainGet)
|
| -EOF
|
| - done
|
| + # Copy SDK libs
|
| + LogExecute cp -r ${NACL_SDK_LIBDIR}/*.a lib/
|
| + LogExecute rm -fr lib/libgtest.*a
|
| + LogExecute rm -fr lib/libgmock.*a
|
|
|
| # Copy in SDK includes.
|
| - LogExecute cp -r ${NACL_SDK_ROOT}/include mingn/
|
| -
|
| - # Remove shared objects which are symlinked after we resolve them.
|
| - find mingn -name '*.so.*.*' -exec rm -f {} \;
|
| -
|
| - # Modify GCC's specs file. E.g.,
|
| - # /path/to/nacl_sdk/pepper_canary/toolchain/linux_x86_glibc
|
| - # => /mingn/toolchain/nacl_x86_glibc.
|
| - sed -i.bak 's@/\S*/pepper_[^/]*/toolchain/[^/]*_x86_glibc@/mingn/toolchain/nacl_x86_glibc@g' \
|
| - ${TOOLCHAIN_OUT_DIR}/lib/gcc/x86_64-nacl/4.4.3/specs
|
| -
|
| - CreateMingnPackage lib all
|
| + LogExecute cp -r ${NACL_SDK_ROOT}/include ./
|
| + LogExecute rm -fr include/gtest
|
| + LogExecute rm -fr include/gmock
|
| }
|
|
|