From d4754ce42ee66c15a4b9e8182115cc25acd6f8cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz=20=28arab=2C=20vx?= =?UTF-8?q?p=29?= Date: Tue, 31 Jan 2017 19:23:12 +0100 Subject: vars/gcc.vars, subr/build.subr: cleanup. --- vars/gcc.vars | 395 ++++++++++++++++------------------------------------------ 1 file changed, 105 insertions(+), 290 deletions(-) (limited to 'vars') diff --git a/vars/gcc.vars b/vars/gcc.vars index b62ccebd..9fba3fd8 100644 --- a/vars/gcc.vars +++ b/vars/gcc.vars @@ -4,23 +4,15 @@ # Order: stage1_x86_64_w64_mingw32, native_x86_64_w64_mingw32 # -pkg_gcc_stage1_all() { - PKG_GCC_VERSION="${PKG_GCC_STAGE1_VERSION}"; +pkgp_gcc_setup_env() { export MAKE="make LIBTOOL=slibtool"; - # GCC, stage1. - if ! is_build_script_done fetch; then - fetch_git cbb-gcc-${PKG_GCC_VERSION} \ - ${GITROOT}/cbb/cbb-gcc-${PKG_GCC_VERSION}; - set_build_script_done fetch -configure; - fi; - set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross; export cbb_ldflags_for_target=--sysroot=${PKG_PREFIX} \ cbb_sysroot_for_libgcc=${PKG_PREFIX} \ cbb_target=${PKG_TARGET} \ cbb_neutral_libiberty=no \ cbb_xgcc_for_specs=${WORKDIR}/${PKG_BUILD_DIR}/gcc/xgcc; GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}"; - GCCFLAGS="${CFLAGS:+${CFLAGS} }--include $(readlink -f ${WORKDIR}/cbb-gcc-${PKG_GCC_VERSION}/libc/cbb-musl-pe.h)"; + GCCFLAGS="${CFLAGS:+${CFLAGS} }--include $(readlink -f ${WORKDIR}/cbb-gcc-${1}/libc/cbb-musl-pe.h)"; for __ in CFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS CXXFLAGS_FOR_BUILD; do export "${__}=${GCCFLAGS}"; done; @@ -31,41 +23,75 @@ pkg_gcc_stage1_all() { export "${__}=${CFLAGS_FOR_BUILD}" ; done; export CFLAGS CXXFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET; +}; + +pkgp_gcc_configure() { + secure_rm ${PKG_BUILD_DIR}; + insecure_mkdir ${PKG_BUILD_DIR}; + secure_cd ${PKG_BUILD_DIR}; + ../cbb-gcc-${PKG_GCC_VERSION}/configure "${@}" \ + --disable-bootstrap \ + --disable-libmudflap \ + --disable-multilib \ + --disable-nls \ + --disable-obsolete \ + --disable-symvers \ + --enable-__cxa_atexit \ + --enable-canonical-system-headers \ + --enable-debug \ + --enable-gnu-indirect-function \ + --enable-gnu-unique-object \ + --enable-initfini-array \ + --enable-languages=c,c++,objc,lto \ + --enable-libstdcxx-debug \ + --enable-lto \ + --enable-multiarch \ + --enable-secureplt \ + --enable-shared \ + --enable-threads=posix \ + --target=${PKG_TARGET} \ + --with-fpmath=sse; + set_build_script_done configure clean -build; +}; + +pkg_gcc_stage1_x86_64_w64_mingw32_all() { + pkg_gcc_stage1_all "${@}"; +}; + +pkg_gcc_stage1_all() { + if [ "${PKG_TARGET}" = "x86_64-w64-mingw32" ]; then + PKG_GCC_VERSION="${PKG_GCC_STAGE1_X86_64_W64_MINGW32_VERSION}"; + else + PKG_GCC_VERSION="${PKG_GCC_STAGE1_VERSION}"; + fi; + # GCC, stage1. + if ! is_build_script_done fetch; then + fetch_git cbb-gcc-${PKG_GCC_VERSION} \ + ${GITROOT}/cbb/cbb-gcc-${PKG_GCC_VERSION}; + set_build_script_done fetch -configure; + fi; + if [ "${PKG_TARGET}" = "x86_64-w64-mingw32" ]; then + set_build_dir cbb-gcc-${PKG_GCC_VERSION}_${PKG_TARGET} cross; + else + set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross; + fi; + pkgp_gcc_setup_env "${PKG_GCC_VERSION}"; if ! is_build_script_done configure; then insecure_mkdir ${PKG_PREFIX}/include; [ \! -d ${PKG_PREFIX}/usr ] && \ ln -s -- . ${PKG_PREFIX}/usr; - _configure_args=" \ - --disable-sjlj-exceptions \ - --prefix=${PREFIX} \ - --with-sysroot=${PREFIX}/${PKG_TARGET}"; - secure_rm ${PKG_BUILD_DIR}; - insecure_mkdir ${PKG_BUILD_DIR}; - secure_cd ${PKG_BUILD_DIR}; - ../cbb-gcc-${PKG_GCC_VERSION}/configure \ - --disable-bootstrap \ - --disable-libmudflap \ - --disable-multilib \ - --disable-nls \ - --disable-obsolete \ - --disable-symvers \ - --enable-canonical-system-headers \ - --enable-__cxa_atexit \ - --enable-debug \ - --enable-gnu-indirect-function \ - --enable-gnu-unique-object \ - --enable-initfini-array \ - --enable-languages=c,c++,objc,lto \ - --enable-libstdcxx-debug \ - --enable-lto \ - --enable-multiarch \ - --enable-secureplt \ - --enable-shared \ - --enable-threads=posix \ - --target=${PKG_TARGET} \ - --with-fpmath=sse \ - ${_configure_args}; - set_build_script_done configure clean -build; + if [ "${PKG_TARGET}" = "x86_64-w64-mingw32" ]; then + pkgp_gcc_configure \ + --enable-sjlj-exceptions \ + --prefix=${PREFIX} \ + --with-sysroot=${PREFIX}/${PKG_TARGET} \ + --without-headers; + else + pkgp_gcc_configure \ + --disable-sjlj-exceptions \ + --prefix=${PREFIX} \ + --with-sysroot=${PREFIX}/${PKG_TARGET}; + fi; else cd ${PKG_BUILD_DIR}; fi; @@ -89,9 +115,8 @@ pkg_gcc_stage1_all() { }; pkg_gcc_runtime_all() { - PKG_GCC_VERSION="${PKG_GCC_RUNTIME_VERSION}"; export MAKE="make LIBTOOL=slibtool"; - set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross; + set_build_dir cbb-gcc-${PKG_GCC_RUNTIME_VERSION} cross; cd ${PKG_BUILD_DIR}; # GCC, compiler runtime. if ! is_build_script_done build; then @@ -105,9 +130,8 @@ pkg_gcc_runtime_all() { }; pkg_gcc_libstdcpp_v3_all() { - PKG_GCC_VERSION="${PKG_GCC_LIBSTDCPP_V3_VERSION}"; export MAKE="make LIBTOOL=slibtool"; - set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross; + set_build_dir cbb-gcc-${PKG_GCC_LIBSTDCPP_V3_VERSION} cross; cd ${PKG_BUILD_DIR}; # GCC, libstdc++-v3. if ! is_build_script_done build; then @@ -121,9 +145,8 @@ pkg_gcc_libstdcpp_v3_all() { }; pkg_gcc_full_all() { - PKG_GCC_VERSION="${PKG_GCC_FULL_VERSION}"; export MAKE="make LIBTOOL=slibtool"; - set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross; + set_build_dir cbb-gcc-${PKG_GCC_FULL_VERSION} cross; cd ${PKG_BUILD_DIR}; # GCC, everything else. if ! is_build_script_done build; then @@ -136,260 +159,52 @@ pkg_gcc_full_all() { fi; }; -pkg_gcc_native_all() { - PKG_GCC_VERSION="${PKG_GCC_NATIVE_VERSION}"; - export MAKE="make LIBTOOL=slibtool"; - # GCC, native. - set_build_dir cbb-gcc-${PKG_GCC_VERSION} native; - export cbb_ldflags_for_target=--sysroot=${PKG_PREFIX} \ - cbb_sysroot_for_libgcc=${PKG_PREFIX} \ - cbb_target=${PKG_TARGET} \ - cbb_xgcc_for_specs=${PKG_TARGET}-gcc \ - sysroot_headers_suffix=${PKG_PREFIX}; - GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}"; - GCCFLAGS="${CFLAGS:+${CFLAGS} }--include $(readlink -f ${WORKDIR}/cbb-gcc-${PKG_GCC_VERSION}/libc/cbb-musl-pe.h)"; - for __ in CFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS CXXFLAGS_FOR_BUILD; do - export "${__}=${GCCFLAGS}"; - done; - for __ in CFLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET; do - export "${__}=${GCCTARGET_FLAGS}"; - done; - for __ in cbb_cflags_for_stage1 cbb_cflags_for_stage2 cbb_cflags_for_stage3 cbb_cflags_for_stage4; do - export "${__}=${CFLAGS_FOR_BUILD}" ; - done; - export CFLAGS CXXFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET; - if ! is_build_script_done configure; then - insecure_mkdir ${PKG_PREFIX}/${PKG_TARGET}; - if [ \! -d ${PKG_PREFIX}/${PKG_TARGET}/usr ]; then - ln -s -- . ${PKG_PREFIX}/${PKG_TARGET}/usr; - fi; - if [ "${ARCH}" = nt32 ]; then - _configure_args="--host=i686-nt32-midipix"; - else - _configure_args="--host=x86_64-nt64-midipix"; - fi; - _configure_args="${_configure_args} \ - --disable-sjlj-exceptions \ - --prefix=/ \ - --with-elf=${PKG_PREFIX} \ - --with-gmp=${PKG_PREFIX} \ - --with-mpc=${PKG_PREFIX} \ - --with-mpfr=${PKG_PREFIX} \ - --with-sysroot="; - secure_rm ${PKG_BUILD_DIR}; - insecure_mkdir ${PKG_BUILD_DIR}; - secure_cd ${PKG_BUILD_DIR}; - ../cbb-gcc-${PKG_GCC_VERSION}/configure \ - --disable-bootstrap \ - --disable-libmudflap \ - --disable-multilib \ - --disable-nls \ - --disable-obsolete \ - --disable-symvers \ - --enable-canonical-system-headers \ - --enable-__cxa_atexit \ - --enable-debug \ - --enable-gnu-indirect-function \ - --enable-gnu-unique-object \ - --enable-initfini-array \ - --enable-languages=c,c++,objc,lto \ - --enable-libstdcxx-debug \ - --enable-lto \ - --enable-multiarch \ - --enable-secureplt \ - --enable-shared \ - --enable-threads=posix \ - --target=${PKG_TARGET} \ - --with-fpmath=sse \ - ${_configure_args}; - set_build_script_done configure clean -build; - else - cd ${PKG_BUILD_DIR}; - fi; - if ! is_build_script_done clean; then - make ${MAKEFLAGS} clean; - set_build_script_done clean -build; - fi; - if ! is_build_script_done build; then - make ${MAKEFLAGS} all-gcc; - make ${MAKEFLAGS} all-target-libgcc; - make ${MAKEFLAGS} all-target-libstdc++-v3; - make ${MAKEFLAGS} all; - set_build_script_done build -install; - fi; - if ! is_build_script_done install; then - make ${MAKEFLAGS} DESTDIR=${PKG_PREFIX} install; - set_build_script_done install finish; - fi; +pkg_gcc_native_x86_64_w64_mingw32_all() { + pkg_gcc_native_all "${@}"; }; -pkg_gcc_stage1_x86_64_w64_mingw32_all() { - if [ ! -L ${PREFIX}/${PKG_TARGET}/mingw ]; then - secure_rm ${PREFIX}/${PKG_TARGET}/mingw; - ln -sf . ${PREFIX}/${PKG_TARGET}/mingw; - fi; - if [ ! -d ${PREFIX}/${PKG_TARGET}/mingw/include ]; then - secure_rm ${PREFIX}/${PKG_TARGET}/mingw/include; - insecure_mkdir ${PREFIX}/${PKG_TARGET}/mingw/include; - fi; - PKG_GCC_VERSION="${PKG_GCC_STAGE1_X86_64_W64_MINGW32_VERSION}"; - export MAKE="make LIBTOOL=slibtool"; - # GCC, stage1. - if ! is_build_script_done fetch; then - fetch_git cbb-gcc-${PKG_GCC_VERSION} \ - ${GITROOT}/cbb/cbb-gcc-${PKG_GCC_VERSION}; - set_build_script_done fetch -configure; - fi; - set_build_dir cbb-gcc-${PKG_GCC_VERSION}_x86_64_w64_mingw32 cross; - export cbb_ldflags_for_target=--sysroot=${PKG_PREFIX} \ - cbb_sysroot_for_libgcc=${PKG_PREFIX} \ - cbb_target=${PKG_TARGET} \ - cbb_neutral_libiberty=no \ - cbb_xgcc_for_specs=${WORKDIR}/${PKG_BUILD_DIR}/gcc/xgcc; - GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}"; - GCCFLAGS="${CFLAGS:+${CFLAGS} }--include $(readlink -f ${WORKDIR}/cbb-gcc-${PKG_GCC_VERSION}/libc/cbb-musl-pe.h)"; - for __ in CFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS CXXFLAGS_FOR_BUILD; do - export "${__}=${GCCFLAGS}"; - done; - for __ in CFLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET; do - export "${__}=${GCCTARGET_FLAGS}"; - done; - for __ in cbb_cflags_for_stage1 cbb_cflags_for_stage2 cbb_cflags_for_stage3 cbb_cflags_for_stage4; do - export "${__}=${CFLAGS_FOR_BUILD}" ; - done; - export CFLAGS CXXFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET; - if ! is_build_script_done configure; then - insecure_mkdir ${PKG_PREFIX}/include; - [ \! -d ${PKG_PREFIX}/usr ] && \ - ln -s -- . ${PKG_PREFIX}/usr; - _configure_args=" \ - --enable-sjlj-exceptions \ - --prefix=${PREFIX} \ - --with-sysroot=${PREFIX}/${PKG_TARGET} \ - --without-headers"; - secure_rm ${PKG_BUILD_DIR}; - insecure_mkdir ${PKG_BUILD_DIR}; - secure_cd ${PKG_BUILD_DIR}; - ../cbb-gcc-${PKG_GCC_VERSION}/configure \ - --disable-bootstrap \ - --disable-libmudflap \ - --disable-multilib \ - --disable-nls \ - --disable-obsolete \ - --disable-symvers \ - --enable-canonical-system-headers \ - --enable-__cxa_atexit \ - --enable-debug \ - --enable-gnu-indirect-function \ - --enable-gnu-unique-object \ - --enable-initfini-array \ - --enable-languages=c,c++,objc,lto \ - --enable-libstdcxx-debug \ - --enable-lto \ - --enable-multiarch \ - --enable-secureplt \ - --enable-shared \ - --enable-threads=posix \ - --target=${PKG_TARGET} \ - --with-fpmath=sse \ - ${_configure_args}; - set_build_script_done configure clean -build; +pkg_gcc_native_all() { + if [ "${PKG_TARGET}" = "x86_64-w64-mingw32" ]; then + PKG_GCC_VERSION="${PKG_GCC_NATIVE_X86_W64_MINGW32_VERSION}"; else - cd ${PKG_BUILD_DIR}; - fi; - if ! is_build_script_done clean; then - make ${MAKEFLAGS} clean; - set_build_script_done clean -build; + PKG_GCC_VERSION="${PKG_GCC_NATIVE_VERSION}"; fi; - if ! is_build_script_done build; then - make ${MAKEFLAGS} all-gcc; - set_build_script_done build -install; - fi; - if ! is_build_script_done install; then - make ${MAKEFLAGS} install-gcc; - __="$(uname -s)"; - if [ "${__#*CYGWIN*}" != "${__}" ]; then - ln -s -- ${PREFIX}/libexec/gcc/${PKG_TARGET}/${PKG_GCC_VERSION}/liblto_plugin.dll.a \ - ln -s -- ${PREFIX}/libexec/gcc/${PKG_TARGET}/${PKG_GCC_VERSION}/liblto_plugin.so; - fi; - set_build_script_done install finish; - fi; -}; - -pkg_gcc_native_x86_64_w64_mingw32_all() { - if [ ! -L ${PREFIX}/${PKG_TARGET}/mingw ]; then - secure_rm ${PREFIX}/${PKG_TARGET}/mingw; - ln -sf . ${PREFIX}/${PKG_TARGET}/mingw; - fi; - if [ ! -d ${PREFIX}/${PKG_TARGET}/mingw/include ]; then - secure_rm ${PREFIX}/${PKG_TARGET}/mingw/include; - insecure_mkdir ${PREFIX}/${PKG_TARGET}/mingw/include; - fi; - PKG_GCC_VERSION="${PKG_GCC_NATIVE_X86_W64_MINGW32_VERSION}"; export MAKE="make LIBTOOL=slibtool"; # GCC, native. - set_build_dir cbb-gcc-${PKG_GCC_VERSION}_x86_64_w64_mingw32 native; - export cbb_ldflags_for_target=--sysroot=${PKG_PREFIX} \ - cbb_sysroot_for_libgcc=${PKG_PREFIX} \ - cbb_target=${PKG_TARGET} \ - cbb_xgcc_for_specs=${PKG_TARGET}-gcc \ - sysroot_headers_suffix=${PKG_PREFIX}; - GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}"; - GCCFLAGS="${CFLAGS:+${CFLAGS} }--include $(readlink -f ${WORKDIR}/cbb-gcc-${PKG_GCC_VERSION}/libc/cbb-musl-pe.h)"; - for __ in CFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS CXXFLAGS_FOR_BUILD; do - export "${__}=${GCCFLAGS}"; - done; - for __ in CFLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET; do - export "${__}=${GCCTARGET_FLAGS}"; - done; - for __ in cbb_cflags_for_stage1 cbb_cflags_for_stage2 cbb_cflags_for_stage3 cbb_cflags_for_stage4; do - export "${__}=${CFLAGS_FOR_BUILD}" ; - done; - export CFLAGS CXXFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET; + if [ "${PKG_TARGET}" = "x86_64-w64-mingw32" ]; then + set_build_dir cbb-gcc-${PKG_GCC_VERSION}_${PKG_TARGET} native; + else + set_build_dir cbb-gcc-${PKG_GCC_VERSION} native; + fi; + pkgp_gcc_setup_env "${PKG_GCC_VERSION}"; if ! is_build_script_done configure; then insecure_mkdir ${PKG_PREFIX}/${PKG_TARGET}; if [ \! -d ${PKG_PREFIX}/${PKG_TARGET}/usr ]; then ln -s -- . ${PKG_PREFIX}/${PKG_TARGET}/usr; fi; - _configure_args="${_configure_args} \ - --build=x86_64-unknown-linux-gnu\ - --host=x86_64-nt64-midipix \ - --without-headers \ - --enable-sjlj-exceptions \ - --prefix=/ \ - --with-elf=${PKG_PREFIX} \ - --with-gmp=${PKG_PREFIX} \ - --with-mpc=${PKG_PREFIX} \ - --with-mpfr=${PKG_PREFIX} \ - --with-sysroot="; - patch -b -d ${PKG_SUBDIR} -p1 < ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch; - secure_rm ${PKG_BUILD_DIR}; - insecure_mkdir ${PKG_BUILD_DIR}; - secure_cd ${PKG_BUILD_DIR}; - ../cbb-gcc-${PKG_GCC_VERSION}/configure \ - --disable-bootstrap \ - --disable-libmudflap \ - --disable-multilib \ - --disable-nls \ - --disable-obsolete \ - --disable-symvers \ - --enable-canonical-system-headers \ - --enable-__cxa_atexit \ - --enable-debug \ - --enable-gnu-indirect-function \ - --enable-gnu-unique-object \ - --enable-initfini-array \ - --enable-languages=c,c++,objc,lto \ - --enable-libstdcxx-debug \ - --enable-lto \ - --enable-multiarch \ - --enable-secureplt \ - --enable-shared \ - --enable-threads=posix \ - --target=${PKG_TARGET} \ - --with-fpmath=sse \ - ${_configure_args}; - set_build_script_done configure clean -build; + if [ "${PKG_TARGET}" = "x86_64-w64-mingw32" ]; then + patch -b -d ${PKG_SUBDIR} -p1 < ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch; + pkgp_gcc_configure \ + --build=x86_64-unknown-linux-gnu \ + --enable-sjlj-exceptions \ + --host=x86_64-nt64-midipix \ + --prefix=/ \ + --with-elf=${PKG_PREFIX} \ + --with-gmp=${PKG_PREFIX} \ + --with-mpc=${PKG_PREFIX} \ + --with-mpfr=${PKG_PREFIX} \ + --with-sysroot= \ + --without-headers; + else + pkgp_gcc_configure \ + --disable-sjlj-exceptions \ + --prefix=/ \ + --with-elf=${PKG_PREFIX} \ + --with-gmp=${PKG_PREFIX} \ + --with-mpc=${PKG_PREFIX} \ + --with-mpfr=${PKG_PREFIX} \ + --with-sysroot=; + fi; else cd ${PKG_BUILD_DIR}; fi; -- cgit v1.2.3