From 3e25518abbf2e11a53f62f9e9ea13f897dabb3ad Mon Sep 17 00:00:00 2001 From: Roy Keene Date: Wed, 10 Oct 2018 15:31:55 -0500 Subject: [PATCH] Build prep enhancements (#1286) --- .gitignore | 3 + .gitlab-ci.yml | 16 ++-- docker/node/Dockerfile | 7 +- util/build_prep/bootstrap_boost.sh | 24 +++-- util/build_prep/common.sh | 94 ++++++++++++++++-- util/build_prep/macosx/prep.sh | 147 ----------------------------- util/build_prep/macosx/prep.sh.in | 130 +++++++++++++++++++++++++ util/build_prep/ubuntu/prep.sh | 122 ------------------------ util/build_prep/ubuntu/prep.sh.in | 70 ++++++++++++++ util/build_prep/update-common | 26 ++++- 10 files changed, 337 insertions(+), 302 deletions(-) delete mode 100755 util/build_prep/macosx/prep.sh create mode 100644 util/build_prep/macosx/prep.sh.in delete mode 100755 util/build_prep/ubuntu/prep.sh create mode 100644 util/build_prep/ubuntu/prep.sh.in diff --git a/.gitignore b/.gitignore index e1ee4b6f..57336fae 100644 --- a/.gitignore +++ b/.gitignore @@ -69,3 +69,6 @@ CTestTestfile.cmake install_manifest.txt Makefile Testing + +# Autogenerated Build Prep artifacts +util/build_prep/*/prep.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 57b874e1..d0f17cb4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,7 +51,7 @@ Arch Linux: FLAVOR: trusty before_script: - - ./util/build_prep/ubuntu/prep.sh + - ./util/build_prep/update_common && ./util/build_prep/ubuntu/prep.sh Ubuntu Linux Artful: @@ -62,7 +62,7 @@ Ubuntu Linux Artful: FLAVOR: artful before_script: - - ./util/build_prep/ubuntu/prep.sh + - ./util/build_prep/update_common && ./util/build_prep/ubuntu/prep.sh Ubuntu Linux Xenial: <<: *linux_cfg @@ -72,7 +72,7 @@ Ubuntu Linux Xenial: FLAVOR: xenial before_script: - - ./util/build_prep/ubuntu/prep.sh + - ./util/build_prep/update_common && ./util/build_prep/ubuntu/prep.sh Ubuntu Linux Xenial Beta: <<: *linux_cfg @@ -83,7 +83,7 @@ Ubuntu Linux Xenial Beta: BETA: 1 before_script: - - ./util/build_prep/ubuntu/prep.sh + - ./util/build_prep/update_common && ./util/build_prep/ubuntu/prep.sh Xenial OPTIMIZED: <<: *linux_cfg @@ -94,7 +94,7 @@ Xenial OPTIMIZED: SIMD: 1 before_script: - - ./util/build_prep/ubuntu/prep.sh + - ./util/build_prep/update_common && ./util/build_prep/ubuntu/prep.sh Artful OPTIMIZED: <<: *linux_cfg @@ -105,7 +105,7 @@ Artful OPTIMIZED: SIMD: 1 before_script: - - ./util/build_prep/ubuntu/prep.sh + - ./util/build_prep/update_common && ./util/build_prep/ubuntu/prep.sh # DISABLED for now @@ -117,7 +117,7 @@ Artful OPTIMIZED: FLAVOR: zesty_asan before_script: - - ./util/build_prep/ubuntu/prep.sh + - ./util/build_prep/update_common && ./util/build_prep/ubuntu/prep.sh @@ -130,7 +130,7 @@ Artful OPTIMIZED: FLAVOR: zesty_tsan before_script: - - ./util/build_prep/ubuntu/prep.sh + - ./util/build_prep/update_common && ./util/build_prep/ubuntu/prep.sh diff --git a/docker/node/Dockerfile b/docker/node/Dockerfile index 68c48130..81fe522d 100644 --- a/docker/node/Dockerfile +++ b/docker/node/Dockerfile @@ -7,12 +7,7 @@ ENV BOOST_ROOT=/tmp/boost_install ADD ci /tmp/ci ADD util /tmp/util -RUN apt-get update -qq && apt-get install -yqq \ - build-essential \ - cmake \ - g++ \ - wget && \ - /tmp/util/build_prep/bootstrap_boost.sh -m +RUN /tmp/util/build_prep/update-common && /tmp/util/build_prep/ubuntu/prep.sh ADD ./ /tmp/src diff --git a/util/build_prep/bootstrap_boost.sh b/util/build_prep/bootstrap_boost.sh index d14a93c9..21bf7d95 100755 --- a/util/build_prep/bootstrap_boost.sh +++ b/util/build_prep/bootstrap_boost.sh @@ -5,7 +5,8 @@ set -o xtrace bootstrapArgs=() useClang='false' -while getopts 'mc' OPT; do +keepArchive='false' +while getopts 'mck' OPT; do case "${OPT}" in m) bootstrapArgs+=('--with-libraries=thread,log,filesystem,program_options') @@ -13,6 +14,9 @@ while getopts 'mc' OPT; do c) useClang='true' ;; + k) + keepArchive='true' + ;; esac done @@ -45,13 +49,19 @@ if [ ! -f "${BOOST_ARCHIVE}" ]; then exit 1 fi mv "${BOOST_ARCHIVE}.new" "${BOOST_ARCHIVE}" || exit 1 +else + keepArchive='true' fi -rm -rf ${BOOST_BASENAME} +rm -rf "${BOOST_BASENAME}" tar xf "${BOOST_ARCHIVE}" -cd ${BOOST_BASENAME} + +pushd "${BOOST_BASENAME}" ./bootstrap.sh "${bootstrapArgs[@]}" -./b2 -d0 --prefix=${BOOST_ROOT} link=static install -cd .. -rm -rf ${BOOST_BASENAME} -rm -f "${BOOST_ARCHIVE}" +./b2 -d0 --prefix="${BOOST_ROOT}" link=static install +popd + +rm -rf "${BOOST_BASENAME}" +if [ "${keepArchive}" != 'true' ]; then + rm -f "${BOOST_ARCHIVE}" +fi diff --git a/util/build_prep/common.sh b/util/build_prep/common.sh index 90bffd06..8695a35b 100644 --- a/util/build_prep/common.sh +++ b/util/build_prep/common.sh @@ -1,10 +1,14 @@ -scriptDirectory="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit 1 +KEEP_AROUND_DIRECTORY="${HOME:-/dev/null}/.cache/nanocurrency-build" + +function _cpp () { + "${CC:-cc}" -I"${BOOST_ROOT:-/usr/local/boost}"/include -E "$@" +} function boost_version () { local boost_version boost_version="$( set -o pipefail - echo $'#include \nBOOST_LIB_VERSION' | cc -I/usr/local/boost/include -E - 2>/dev/null | tail -n 1 | sed 's@"@@g;s@_@.@g' + echo $'#include \nBOOST_LIB_VERSION' | _cpp - 2>/dev/null | tail -n 1 | sed 's@"@@g;s@_@.@g' )" || boost_version='' echo "${boost_version}" @@ -35,7 +39,7 @@ function check_create_boost () { return 0 ;; '--install-prefix') - echo '#include ' | cc -v -E - 2>/dev/null | grep '/version.hpp' | sed 's@^[^"]*"@@;s@/version\.hpp".*$@@' + echo '#include ' | _cpp -v - 2>/dev/null | grep '/version.hpp' | sed 's@^[^"]*"@@;s@/boost/version\.hpp".*$@@' return 0 ;; esac @@ -56,22 +60,94 @@ function have () { } function version_min () { - local version_command below_min_version - local check_version + local version_command below_min_version above_max_version + local detected_version check_version version_command="$1" - below_min_version="$2" + below_min_version="${2:-0}" + above_max_version="${3:-2147483648}" + + detected_version="$(eval "${version_command}" | awk '{ print $NF }' | grep '^[0-9]' | head -n 1)" check_version="$( ( - eval "${version_command}" | awk '{ print $NF }' | grep '^[0-9]' echo "${below_min_version}" - ) | sort -rV | head -n 1 + echo "${detected_version}" + echo "${above_max_version}" + ) | sort -rV | tail -n 2 | head -n 1 )" - if [ "${check_version}" = "${below_min_version}" ]; then + if [ "${check_version}" != "${detected_version}" ]; then return 1 fi return 0 } + +function wrap_compilers () { + local tool tool_check tool_add tool_wrapper_file + local prep_common_workdir_bin + + if [ -z "${wrap_compilers_add_options[*]}" ]; then + return + fi + + prep_common_workdir_bin="${prep_common_workdir}/bin" + mkdir -p "${prep_common_workdir_bin}" || return 1 + + tool_add=() + for tool in cc c++ clang clang++ gcc g++; do + tool_check="$(type -f "${tool}")" || tool_check='' + if [ -n "${tool_check}" ]; then + tool_add+=("${tool}") + fi + done + + for tool in "${tool_add[@]}"; do + tool_wrapper_file="${prep_common_workdir_bin}/${tool}" + if [ -e "${tool_wrapper_file}" ]; then + continue + fi + + ( + echo '#! /usr/bin/env bash' + echo '' + set | grep '^tool=' + set | grep '^wrap_compilers_add_options=' + set | grep '^prep_common_workdir=' + echo '' + cat << \_EOF_ + +NEW_PATH='/dev/null' +while read -r -d ':' element; do + case "${element}" in + "${prep_common_workdir}"|"${prep_common_workdir}"/*) + continue + ;; + esac + + NEW_PATH="${NEW_PATH}:${element}" +done <<<"${PATH}" +PATH="${NEW_PATH}" +export PATH + +exec "${tool}" "${wrap_compilers_add_options[@]}" "$@" +_EOF_ + ) > "${tool_wrapper_file}" + + chmod +x "${tool_wrapper_file}" + done + + PATH="${prep_common_workdir_bin}:${PATH}" + export PATH +} + +function common_cleanup () { + if [ -n "${prep_common_workdir}" ]; then + rm -rf "${prep_common_workdir}" + fi +} + +trap common_cleanup EXIT + +prep_common_workdir="$(mktemp -d)" diff --git a/util/build_prep/macosx/prep.sh b/util/build_prep/macosx/prep.sh deleted file mode 100755 index 0b700bb4..00000000 --- a/util/build_prep/macosx/prep.sh +++ /dev/null @@ -1,147 +0,0 @@ -#! /usr/bin/env bash - -# -----BEGIN COMMON.SH----- -# DO NOT EDIT THIS SECTION, INSTEAD EDIT ../common.sh -scriptDirectory="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit 1 - -function boost_version () { - local boost_version - boost_version="$( - set -o pipefail - echo $'#include \nBOOST_LIB_VERSION' | cc -I/usr/local/boost/include -E - 2>/dev/null | tail -n 1 | sed 's@"@@g;s@_@.@g' - )" || boost_version='' - - echo "${boost_version}" -} - -function check_create_boost () { - local boost_version - boost_version="$(boost_version)" - - if [ -n "${boost_version}" ]; then - function boost () { - local arg - local version - - arg="$1" - - version="$(boost_version)" - if [ -z "${version}" ]; then - return 1 - fi - - case "${arg}" in - '') - return 0 - ;; - '--version') - echo "${version}" - return 0 - ;; - '--install-prefix') - echo '#include ' | cc -v -E - 2>/dev/null | grep '/version.hpp' | sed 's@^[^"]*"@@;s@/version\.hpp".*$@@' - return 0 - ;; - esac - - return 1 - } - fi -} - -function have () { - local program - - program="$1" - - check_create_boost - - type -t "${program}" >/dev/null 2>/dev/null -} - -function version_min () { - local version_command below_min_version - local check_version - - version_command="$1" - below_min_version="$2" - - check_version="$( - ( - eval "${version_command}" | awk '{ print $NF }' | grep '^[0-9]' - echo "${below_min_version}" - ) | sort -rV | head -n 1 - )" - - if [ "${check_version}" = "${below_min_version}" ]; then - return 1 - fi - - return 0 -} -# -----END COMMON.SH----- - -# Ensure we have a new enough CMake -if ! have cmake; then - brew install cmake || exit 1 - brew link cmake || exit 1 -fi - -if ! have cmake; then - echo "Unable to install cmake" >&2 - - exit 1 -fi - -if ! version_min 'cmake --version' 3.3.999; then - echo "cmake version too low (3.4+ required)" >&2 - - exit 1 -fi - -# Ensure we have a new enough Boost -if ! have boost; then - brew install boost --without-single || exit 1 - brew link boost || exit 1 -fi - -if ! have boost; then - echo "Unable to install boost" >&2 - - exit 1 -fi - -if ! version_min 'boost --version' 1.65.999; then - echo "boost version too low (1.66.0+ required)" >&2 - - exit 1 -fi -boost_dir="$(boost --install-prefix)" - -# Ensure we have a new enough Qt5 -PATH="${PATH}:/usr/local/opt/qt/bin" -export PATH -if ! have qtpaths; then - brew install qt5 || exit 1 -fi - -if ! have qtpaths; then - echo "Unable to install qt5" >&2 - - exit 1 -fi - -if ! version_min 'qtpaths --qt-version' 4.999; then - echo "qt5 version too low (5.0+ required)" >&2 - - exit 1 -fi -qt5_dir="$(qtpaths --install-prefix)" - -echo "All verified." -echo "" -echo "Next steps:" -echo " cmake -DBOOST_ROOT=${boost_dir} -DRAIBLOCKS_GUI=ON -DQt5_DIR=${qt5_dir}/lib/cmake/Qt5 " -echo " cpack -G \"DragNDrop\"" - -exit 0 diff --git a/util/build_prep/macosx/prep.sh.in b/util/build_prep/macosx/prep.sh.in new file mode 100644 index 00000000..d7063324 --- /dev/null +++ b/util/build_prep/macosx/prep.sh.in @@ -0,0 +1,130 @@ +#! /usr/bin/env bash + +macosx_version='10.11' + +# -----BEGIN COMMON.SH----- +# -----END COMMON.SH----- + +# Ensure we have a new enough CMake +if ! have cmake; then + brew install cmake || exit 1 + brew link cmake || exit 1 +fi + +if ! have cmake; then + echo "Unable to install cmake" >&2 + + exit 1 +fi + +if ! version_min 'cmake --version' 3.3.999; then + echo "cmake version too low (3.4+ required)" >&2 + + exit 1 +fi + +# Install a native "xz" command, in case it is later needed +if ! have xz; then + brew install xz +fi + +# Setup compiler wrappers to specify the minimum +# Mac OS X version and SDK +## XXX:TODO: Find this SDK directory +macosx_sdk_directory="/Library/Developer/CommandLineTools/SDKs/MacOSX${macosx_version}.sdk" +wrap_compilers_add_options=(-mmacosx-version-min="${macosx_version}" -isysroot "${macosx_sdk_directory}") +wrap_compilers + +# Ensure we have a new enough Boost +if ! have boost; then + BOOST_ROOT="${KEEP_AROUND_DIRECTORY}/boost" + + if ! have boost; then + bootstrap_boost -m -c -k + fi +fi + +if ! have boost; then + echo "Unable to install boost" >&2 + + exit 1 +fi + +if ! version_min 'boost --version' 1.65.999; then + echo "boost version too low (1.66.0+ required)" >&2 + + exit 1 +fi +boost_dir="$(boost --install-prefix)" + +# Ensure we have a new enough Qt5 +PATH="${PATH}:/usr/local/opt/qt/bin:${KEEP_AROUND_DIRECTORY}/qt/bin" +export PATH +if ! have qtpaths; then + ( + qt5_version='5.11.2' + qt5_url="https://download.qt.io/archive/qt/$(echo "${qt5_version}" | cut -f 1-2 -d .)/${qt5_version}/single/qt-everywhere-src-${qt5_version}.tar.xz" + qt5_sha256='c6104b840b6caee596fa9a35bc5f57f67ed5a99d6a36497b6fe66f990a53ca81' + qt5_archive="qt5-${qt5_version}.tar.xz" + qt5_dir="qt-everywhere-src-${qt5_version}" + + cd "${KEEP_AROUND_DIRECTORY}" || exit 1 + + rm -rf "${qt5_dir}" + + if [ ! -f "${qt5_archive}" ]; then + rm -f "${qt5_archive}.new" + wget -O "${qt5_archive}.new" "${qt5_url}" || rm -f "${qt5_archive}.new" + qt5_download_sha256="$(openssl dgst -sha256 "${qt5_archive}.new" | sed 's@^.*= *@@')" + if [ "${qt5_download_sha256}" != "${qt5_sha256}" ]; then + echo "Failed to download Qt5. Got SHA256 ${qt5_download_sha256}, expected ${qt5_sha256}" >&2 + + exit 1 + fi + + mv "${qt5_archive}.new" "${qt5_archive}" || exit 1 + fi + + xz -dc "${qt5_archive}" | tar -xf - || exit 1 + + ( + cd "${qt5_dir}" || exit 1 + + CC="$(type -p clang)" + CXX="$(type -p clang++)" + QMAKE_CC="${CC}" + QMAKE_CXX="${CXX}" + export CC CXX QMAKE_CC QMAKE_CXX + + yes | ./configure -verbose -opensource -rpath -framework -prefix "${KEEP_AROUND_DIRECTORY}/qt" || exit 1 + make || exit 1 + make install || exit 1 + ) || exit 1 + + rm -rf "${qt5_dir}" + ) +fi + +if ! have qtpaths; then + echo "Unable to install qt5" >&2 + + exit 1 +fi + +if ! version_min 'qtpaths --qt-version' 5.8.999 5.11.999; then + echo "qt5 version not in range (version range: [5.9+, 5.12-))" >&2 + + exit 1 +fi +qt5_dir="$(qtpaths --install-prefix)/lib/cmake/Qt5" + +echo "All verified." +echo "" +echo "Next steps:" +echo " CC='${CC:-cc} ${wrap_compilers_add_options[*]}'" +echo " CXX='${CXX:-c++} ${wrap_compilers_add_options[*]}'" +echo " export CC CXX" +echo " cmake -DBOOST_ROOT=${boost_dir} -DRAIBLOCKS_GUI=ON -DQt5_DIR=${qt5_dir} " +echo " cpack -G \"DragNDrop\"" + +exit 0 diff --git a/util/build_prep/ubuntu/prep.sh b/util/build_prep/ubuntu/prep.sh deleted file mode 100755 index fe8b47fe..00000000 --- a/util/build_prep/ubuntu/prep.sh +++ /dev/null @@ -1,122 +0,0 @@ -#! /usr/bin/env bash - -# -----BEGIN COMMON.SH----- -# DO NOT EDIT THIS SECTION, INSTEAD EDIT ../common.sh -scriptDirectory="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit 1 - -function boost_version () { - local boost_version - boost_version="$( - set -o pipefail - echo $'#include \nBOOST_LIB_VERSION' | cc -I/usr/local/boost/include -E - 2>/dev/null | tail -n 1 | sed 's@"@@g;s@_@.@g' - )" || boost_version='' - - echo "${boost_version}" -} - -function check_create_boost () { - local boost_version - boost_version="$(boost_version)" - - if [ -n "${boost_version}" ]; then - function boost () { - local arg - local version - - arg="$1" - - version="$(boost_version)" - if [ -z "${version}" ]; then - return 1 - fi - - case "${arg}" in - '') - return 0 - ;; - '--version') - echo "${version}" - return 0 - ;; - '--install-prefix') - echo '#include ' | cc -v -E - 2>/dev/null | grep '/version.hpp' | sed 's@^[^"]*"@@;s@/version\.hpp".*$@@' - return 0 - ;; - esac - - return 1 - } - fi -} - -function have () { - local program - - program="$1" - - check_create_boost - - type -t "${program}" >/dev/null 2>/dev/null -} - -function version_min () { - local version_command below_min_version - local check_version - - version_command="$1" - below_min_version="$2" - - check_version="$( - ( - eval "${version_command}" | awk '{ print $NF }' | grep '^[0-9]' - echo "${below_min_version}" - ) | sort -rV | head -n 1 - )" - - if [ "${check_version}" = "${below_min_version}" ]; then - return 1 - fi - - return 0 -} -# -----END COMMON.SH----- - -export DEBIAN_FRONTEND=noninteractive - -set -euo pipefail - -apt-get update --yes -apt-get --yes install git cmake ninja-build autotools-dev \ - build-essential g++ clang python-dev \ - libicu-dev libbz2-dev \ - locales wget curl apt-utils \ - lsb-release -apt-get --yes install xorg xvfb xauth xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic -apt-get --yes install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler -apt remove --yes libboost-all-dev -apt autoremove --yes - -if ! have boost; then - "${scriptDirectory}/../bootstrap_boost.sh" -m -fi - -if ! have boost; then - echo "Unable to install boost" >&2 - - exit 1 -fi - -if ! version_min 'boost --version' 1.65.999; then - echo "boost version too low (1.66.0+ required)" >&2 - exit 1 -fi - -boost_dir="$(boost --install-prefix)" - -echo "All verified." -echo "" -echo "Next steps:" -echo " cmake -DBOOST_ROOT=${boost_dir} -DRAIBLOCKS_GUI=ON " -echo " cpack -G \"TBZ2\"" - -exit 0 diff --git a/util/build_prep/ubuntu/prep.sh.in b/util/build_prep/ubuntu/prep.sh.in new file mode 100644 index 00000000..8f71e592 --- /dev/null +++ b/util/build_prep/ubuntu/prep.sh.in @@ -0,0 +1,70 @@ +#! /usr/bin/env bash + +# -----BEGIN COMMON.SH----- +# -----END COMMON.SH----- + +export DEBIAN_FRONTEND=noninteractive + +set -euo pipefail + +apt-get update --yes +apt-get --yes install git cmake ninja-build autotools-dev \ + build-essential g++ clang python-dev \ + libicu-dev libbz2-dev \ + locales wget curl apt-utils \ + lsb-release +apt-get --yes install xorg xvfb xauth xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic +apt-get --yes install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler +apt remove --yes libboost-all-dev +apt autoremove --yes + +# Ensure we have a new enough Boost +if ! have boost; then + bootstrap_boost -m -k +fi + +if ! have boost; then + echo "Unable to install boost" >&2 + + exit 1 +fi + +if ! version_min 'boost --version' 1.65.999; then + echo "boost version too low (1.66.0+ required)" >&2 + exit 1 +fi +boost_dir="$(boost --install-prefix)" + +# Ensure we have a new enough Qt5 +if ! have qtpaths; then + echo "Unable to install qt5" >&2 + + exit 1 +fi + +if ! version_min 'qtpaths --qt-version 2>/dev/null' 5.2.999 5.8.999; then + if ! version_min 'qtpaths -- --qt-version' 5.2.999 5.8.999; then + echo "qt5 version not in range (version range: [5.3+, 5.9-))" >&2 + + exit 1 + fi +fi +qt5_dir="$(qtpaths --install-prefix)/lib/cmake/Qt5" + +if [ ! -d "${qt5_dir}" ]; then + qt5_dir='' +fi + +# Determine how to call cmake +cmake_add='' +if [ -n "${qt5_dir}" ]; then + cmake_add="${cmake_add} -DQt5_DIR=${qt5_dir}" +fi + +echo "All verified." +echo "" +echo "Next steps:" +echo " cmake -DBOOST_ROOT=${boost_dir} -DRAIBLOCKS_GUI=ON ${cmake_add} " +echo " cpack -G \"TBZ2\"" + +exit 0 diff --git a/util/build_prep/update-common b/util/build_prep/update-common index bf024f7b..71e888e5 100755 --- a/util/build_prep/update-common +++ b/util/build_prep/update-common @@ -2,14 +2,15 @@ cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1 -for file in */prep.sh; do +for file in */prep.sh.in; do + outfile="$(echo "${file}" | sed 's@\.in$@@')" if ! grep '^#* *-----BEGIN COMMON\.SH-----$' "${file}" >/dev/null 2>/dev/null; then echo "Skipping \"${file}\"..." continue fi - echo "Updating \"${file}\"..." + echo "Updating \"${outfile}\"..." rm -f "${file}.new" awk -v insideCommon=0 ' @@ -25,6 +26,20 @@ for file in */prep.sh; do # Print out a notification to not edit the # individual scripts print "# DO NOT EDIT THIS SECTION, INSTEAD EDIT ../common.sh"; + print "" + + # Print out the bootstrap_boost + print "function bootstrap_boost () {" + print "\t(" + print "\t\tmkdir -p \"${KEEP_AROUND_DIRECTORY}\" || exit 1" + print "\t\tcd \"${KEEP_AROUND_DIRECTORY}\" || exit 1" + while (getline <"bootstrap_boost.sh") { + print; + } + close("bootstrap_boost.sh"); + print "\t)" + print "}" + print "" # Print out the common script while (getline <"common.sh") { @@ -46,6 +61,11 @@ for file in */prep.sh; do print; } ' < "${file}" > "${file}.new" - cat "${file}.new" > "${file}" + + rm -f "${outfile}" + + cat "${file}.new" > "${outfile}" rm -f "${file}.new" + + chmod 755 "${outfile}" done