From 570129106f694bef52e07a5fc08f6c63f7f54073 Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Jan 30 2017 23:09:41 +0000 Subject: build.sh: 2nd refactoring pt. I. build/{gcc,musl}.*.build: refactored into vars/{gcc,musl}.*.build. build/pkg.build: merged w/ build.sh (structurally) and refactored into subr/pkg_*.subr (implementations.) patches/gcc_native_x86_64_w64_mingw32.local.patch: fix wrong filename. subr/build.subr: merges source_scripts() into build.sh. subr/pkg.subr: accept either of ${PKG_..._{URL,VERSION}} when checking for missing entries in var/build.vars. vars/build.vars: adds vars for {gcc,musl}_*. vars/psxstub.vars: convert to pkg_..._all(); call pkg_fetch(). --- diff --git a/build.sh b/build.sh index 3448fac..0f3411c 100755 --- a/build.sh +++ b/build.sh @@ -81,7 +81,7 @@ for BUILD_TARGET_LC in $(subst_tgts ${BUILD_TARGETS_META}); do "$(get_var_unsafe PKG_${BUILD_PACKAGE}_URL)" \ "$(get_var_unsafe PKG_${BUILD_PACKAGE}_URL_TYPE)"; else - check_pkg_updates "${BUILD_PACKAGE_LC}" \ + check_pkg_updates "${BUILD_PACKAGE_LC}" \ "$(get_var_unsafe PKG_${BUILD_PACKAGE}_VERSION)" \ "$(get_var_unsafe PKG_${BUILD_PACKAGE}_URL)" \ "$(get_var_unsafe PKG_${BUILD_PACKAGE}_URL_TYPE)"; @@ -94,17 +94,48 @@ for BUILD_TARGET_LC in $(subst_tgts ${BUILD_TARGETS_META}); do log_msg vnfo "Skipped \`${BUILD_PACKAGE_LC}' (already built.)"; : $((BUILD_NSKIP+=1)); BUILD_SCRIPT_RC=0; continue; fi; - if [ -e build/${BUILD_PACKAGE_LC}.build ]; then - BUILD_SCRIPT_FNAME=build/${BUILD_PACKAGE_LC}.build; - else - BUILD_SCRIPT_FNAME=build/pkg.build; + if [ -n "${ARG_RESTART}" ]; then + log_msg vnfo "Forcing package \`${BUILD_PACKAGE_LC}'."; fi; - log_msg vnfo "Invoking build script \`${BUILD_SCRIPT_FNAME}'${ARG_RESTART:+ (forcibly)} for package \`${BUILD_PACKAGE_LC}'."; (set -o errexit -o noglob; - MIDIPIX_BUILD_PWD=$(pwd); PKG_BUILD=${BUILD}; PKG_TARGET=${TARGET}; - PKG_PREFIX=$(get_vars_unsafe ${BUILD_TARGET}_PREFIX \ - PKG_${BUILD_PACKAGE%%.*}_PREFIX); - cd ${WORKDIR}; source_scripts); + MIDIPIX_BUILD_PWD=$(pwd); + PKG_BUILD=${BUILD}; + PKG_PREFIX=$(get_vars_unsafe ${BUILD_TARGET}_PREFIX PKG_${BUILD_PACKAGE%%.*}_PREFIX); + PKG_TARGET=${TARGET}; + cd ${WORKDIR}; + for SCRIPT_SOURCE in vars/${BUILD_PACKAGE_LC%.*}.vars; do + if [ -f ${MIDIPIX_BUILD_PWD}/${SCRIPT_SOURCE} ]; then + if [ ${ARG_DRYRUN:-0} -eq 1 ]; then + echo . ${MIDIPIX_BUILD_PWD}/${SCRIPT_SOURCE}; + else + . ${MIDIPIX_BUILD_PWD}/${SCRIPT_SOURCE}; + fi; + fi; + done; + parse_with_pkg_name ${BUILD_PACKAGE_LC%.*}; + for __ in all disabled fetch extract build_dir patch_pre autoconf patch setup \ + configure clean build install; do + case ${__} in + all) + if test_cmd pkg_${PKG_NAME}_all; then + pkg_${PKG_NAME}_all; exit 0; + fi; + ;; + disabled|build_dir|setup) + pkg_${__}; + ;; + *) if ! is_build_script_done ${__}; then + if test_cmd pkg_${PKG_NAME}_${__}; then + pkg_${PKG_NAME}_${__}; + else + pkg_${__}; + fi; + fi; + ;; + esac; + done; + set_build_script_done finish; + ); BUILD_SCRIPT_RC=${?}; case ${BUILD_SCRIPT_RC} in 0) log_msg succ "Finished \`${BUILD_PACKAGE_LC}' build."; : $((BUILD_NFINI+=1)); continue; ;; diff --git a/build/gcc.full.build b/build/gcc.full.build deleted file mode 100644 index ee59716..0000000 --- a/build/gcc.full.build +++ /dev/null @@ -1,198 +0,0 @@ -# -# . ./build.vars and set -o errexit -o noglob are assumed. -# - -if [ "${3}" = mingw_w64 ]; then - TARGET=x86_64-w64-mingw32; - PKG_TARGET=x86_64-w64-mingw32; - if [ ! -L ${PREFIX}/${TARGET}/mingw ]; then - secure_rm ${PREFIX}/${TARGET}/mingw; - ln -sf . ${PREFIX}/${TARGET}/mingw; - fi; -fi; - -# Order: stage1, runtime, full, native - -export MAKE="make LIBTOOL=slibtool"; -if [ "${2}" = runtime ]\ -|| [ "${2}" = libstdc++-v3 ]\ -|| [ "${2}" = full ]; then - set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross; - cd ${PKG_BUILD_DIR}; - if [ "${2}" = runtime ]; then - # GCC, compiler runtime. - if ! is_build_script_done build; then - make ${MAKEFLAGS} all-target-libgcc; - set_build_script_done build -install; - fi; - if ! is_build_script_done install; then - make ${MAKEFLAGS} install-target-libgcc; - set_build_script_done install finish; - fi; - elif [ "${2}" = libstdc++-v3 ]; then - # GCC, libstdc++-v3. - if ! is_build_script_done build; then - make ${MAKEFLAGS} all-target-libstdc++-v3; - set_build_script_done build -install; - fi; - if ! is_build_script_done install; then - make ${MAKEFLAGS} install-target-libstdc++-v3; - set_build_script_done install finish; - fi; - elif [ "${2}" = full ]; then - # GCC, everything else. - if ! is_build_script_done build; then - make ${MAKEFLAGS}; - set_build_script_done build -install; - fi; - if ! is_build_script_done install; then - make ${MAKEFLAGS} install; - set_build_script_done install finish; - fi; - fi; -else - if [ "${2}" = stage1 ]\ - || [ "${2}" = host ]; then - # 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=${TARGET} \ - cbb_neutral_libiberty=no \ - cbb_xgcc_for_specs=${WORKDIR}/${PKG_BUILD_DIR}/gcc/xgcc; - GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}"; - elif [ "${2}" = native ]; then - # 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=${TARGET} \ - cbb_xgcc_for_specs=${TARGET}-gcc \ - sysroot_headers_suffix=${PKG_PREFIX}; - GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}"; - fi; - 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 - if [ "${2}" = stage1 ]\ - || [ "${2}" = host ]; then - insecure_mkdir ${PKG_PREFIX}/include; - [ \! -d ${PKG_PREFIX}/usr ] && \ - ln -s -- . ${PKG_PREFIX}/usr; - _configure_args="--prefix=${PREFIX} --with-sysroot=${PKG_PREFIX}"; - elif [ "${2}" = native ]; then - insecure_mkdir ${PKG_PREFIX}/${TARGET}; - if [ \! -d ${PKG_PREFIX}/${TARGET}/usr ]; then - ln -s -- . ${PKG_PREFIX}/${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} \ - --prefix=/ \ - --with-elf=${PKG_PREFIX} \ - --with-gmp=${PKG_PREFIX} \ - --with-mpc=${PKG_PREFIX} \ - --with-mpfr=${PKG_PREFIX} \ - --with-sysroot="; - fi; - if [ "${TARGET#*mingw*}" != "${TARGET}" ]; then - _configure_args="${_configure_args} \ - --enable-sjlj-exceptions"; - if [ "${2}" != host ]; then - _configure_args="${_configure_args} \ - --host=${TARGET} \ - --without-headers"; - export AR=${PKG_TARGET}-ar; - export AS=${PKG_TARGET}-as; - export CC=${PKG_TARGET}-gcc; - export CXX=${PKG_TARGET}-c++; - export RANLIB=${PKG_TARGET}-ranlib; - fi; - else - _configure_args="${_configure_args} \ - --disable-sjlj-exceptions"; - fi; - if [ "${3}" = mingw_w64 ]\ - && [ -r ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.${2}.${3}.local.patch ]; then - patch -b -d ${PKG_SUBDIR} -p1 < ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.${2}.${3}.local.patch; - fi; - 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=${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 - if [ "${2}" = stage1 ]\ - || [ "${2}" = host ]; then - make ${MAKEFLAGS} all-gcc; - elif [ "${2}" = native ]; then - make ${MAKEFLAGS} all-gcc; - make ${MAKEFLAGS} all-target-libgcc; - make ${MAKEFLAGS} all-target-libstdc++-v3; - make ${MAKEFLAGS} all; - fi; - set_build_script_done build -install; - fi; - if ! is_build_script_done install; then - if [ "${2}" = stage1 ]\ - || [ "${2}" = host ]; then - make ${MAKEFLAGS} install-gcc; - __="$(uname -s)"; - if [ "${__#*CYGWIN*}" != "${__}" ]; then - ln -s -- ${PREFIX}/libexec/gcc/${TARGET}/${PKG_GCC_VERSION}/liblto_plugin.dll.a \ - ln -s -- ${PREFIX}/libexec/gcc/${TARGET}/${PKG_GCC_VERSION}/liblto_plugin.so; - fi; - elif [ "${2}" = native ]; then - make ${MAKEFLAGS} DESTDIR=${PKG_PREFIX} install; - fi; - set_build_script_done install finish; - fi; -fi; - -# vim:filetype=sh diff --git a/build/gcc.host.mingw_w64.build b/build/gcc.host.mingw_w64.build deleted file mode 120000 index b809d40..0000000 --- a/build/gcc.host.mingw_w64.build +++ /dev/null @@ -1 +0,0 @@ -gcc.full.build \ No newline at end of file diff --git a/build/gcc.libstdc++-v3.build b/build/gcc.libstdc++-v3.build deleted file mode 120000 index b809d40..0000000 --- a/build/gcc.libstdc++-v3.build +++ /dev/null @@ -1 +0,0 @@ -gcc.full.build \ No newline at end of file diff --git a/build/gcc.native.build b/build/gcc.native.build deleted file mode 120000 index b809d40..0000000 --- a/build/gcc.native.build +++ /dev/null @@ -1 +0,0 @@ -gcc.full.build \ No newline at end of file diff --git a/build/gcc.runtime.build b/build/gcc.runtime.build deleted file mode 120000 index b809d40..0000000 --- a/build/gcc.runtime.build +++ /dev/null @@ -1 +0,0 @@ -gcc.full.build \ No newline at end of file diff --git a/build/gcc.stage1.build b/build/gcc.stage1.build deleted file mode 120000 index b809d40..0000000 --- a/build/gcc.stage1.build +++ /dev/null @@ -1 +0,0 @@ -gcc.full.build \ No newline at end of file diff --git a/build/gcc.stage1.mingw_w64.build b/build/gcc.stage1.mingw_w64.build deleted file mode 120000 index b809d40..0000000 --- a/build/gcc.stage1.mingw_w64.build +++ /dev/null @@ -1 +0,0 @@ -gcc.full.build \ No newline at end of file diff --git a/build/musl.full.build b/build/musl.full.build deleted file mode 100644 index 35d1de2..0000000 --- a/build/musl.full.build +++ /dev/null @@ -1,68 +0,0 @@ -# -# . ./build.vars and set -o errexit -o noglob are assumed. -# - -# Order: no-complex, native - -# Git clone what we need. -fetch_git lazy ${GITROOT}/lazy; - -export lz_arch=${ARCH} lz_cflags_debug=-O2 lz_target=${TARGET}; - -if [ "${2}" = no-complex ]; then - # Musl: build (no-complex) - _install=install_no_complex; - set_build_dir musl-${PKG_MUSL_VERSION}-${2} cross; - if ! is_build_script_done fetch; then - fetch http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz \ - ${PKG_MUSL_SHA256SUM}; - secure_rm mmglue; - fetch_git mmglue ${GITROOT}/mmglue; - set_build_script_done fetch -extract; - fi; - if ! is_build_script_done extract; then - secure_rm musl-${PKG_MUSL_VERSION}; - tar -xf ${DLCACHEDIR}/musl-${PKG_MUSL_VERSION}.tar.gz; - set +o noglob; cp -R -- mmglue/* musl-${PKG_MUSL_VERSION}/; set -o noglob; - set_build_script_done extract -configure; - fi; -elif [ "${2}" = native ]; then - # Musl: build (full) - _install=install; - set_build_dir musl-${PKG_MUSL_VERSION} "${2}"; -elif [ "${2}" = full ]; then - # Musl: build (full) - _install=install; - set_build_dir musl-${PKG_MUSL_VERSION} cross; -fi; -if ! is_build_script_done configure; then - secure_rm ${PKG_BUILD_DIR}; - insecure_mkdir ${PKG_BUILD_DIR}; - secure_cd ${PKG_BUILD_DIR}; - env lz_cflags_cmdline="${PKG_MUSL_CFLAGS_CONFIGURE_EXTRA}" \ - lz_debug="yes" \ - ../lazy/lazy \ - -a ${ARCH} \ - -c gcc \ - -f ${PKG_PREFIX} \ - -n musl \ - -p ../musl-${PKG_MUSL_VERSION} \ - -t ${lz_target} \ - -x config; - 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 - ./lazy -e ${_install} \ - -x build; - [ "${2}" = native ] && \ - ln -sf -- ../lib/libc.so ${PKG_PREFIX}/bin/ldd; - set_build_script_done build finish; -fi; - -# vim:filetype=sh diff --git a/build/musl.native.build b/build/musl.native.build deleted file mode 120000 index 2ed15f0..0000000 --- a/build/musl.native.build +++ /dev/null @@ -1 +0,0 @@ -musl.full.build \ No newline at end of file diff --git a/build/musl.no-complex.build b/build/musl.no-complex.build deleted file mode 120000 index 2ed15f0..0000000 --- a/build/musl.no-complex.build +++ /dev/null @@ -1 +0,0 @@ -musl.full.build \ No newline at end of file diff --git a/build/pkg.build b/build/pkg.build deleted file mode 100644 index 029980b..0000000 --- a/build/pkg.build +++ /dev/null @@ -1,295 +0,0 @@ -# -# . ./build.vars and set -o errexit -o noglob are assumed. -# - -parse_with_pkg_name ${1}; -if [ ${PKG_DISABLED:-0} -eq 1 ]; then - exit 0; -elif ! is_build_script_done fetch; then - if test_cmd pkg_${PKG_NAME}_fetch; then - pkg_${PKG_NAME}_fetch; - else - if [ "${PKG_URL_TYPE:-wget}" = wget ]; then - fetch "${PKG_URL}" ${PKG_SHA256SUM}; - else - fetch_git ${PKG_SUBDIR} ${PKG_URL} ${PKG_GIT_BRANCH}; - fi; - fi; - if test_cmd pkg_${PKG_NAME}_fetch_post; then - pkg_${PKG_NAME}_fetch_post; - fi; - set_build_script_done fetch -extract; -fi; -if test_cmd pkg_${PKG_NAME}_finish; then - pkg_${PKG_NAME}_finish; exit 0; -elif [ "${PKG_URL_TYPE:-wget}" = wget ] &&\ -! is_build_script_done extract; then - secure_rm ${PKG_SUBDIR}; - if [ ${PKG_SUBDIR_CREATE:-0} -eq 1 ]; then - insecure_mkdir ${PKG_SUBDIR}; - fi; - if [ "${PKG_FNAME##*.tar.}" = "bz2" ]; then - bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; - elif [ "${PKG_FNAME##*.tar.}" = "gz" ]; then - gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; - elif [ "${PKG_FNAME##*.tar.}" = "xz" ]; then - xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; - elif [ "${PKG_FNAME##*.t}" = "bz2" ]; then - bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; - elif [ "${PKG_FNAME##*.t}" = "gz" ]; then - gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; - elif [ "${PKG_FNAME##*.t}" = "xz" ]; then - xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; - else - tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf ${DLCACHEDIR}/${PKG_FNAME}; - fi; - if test_cmd pkg_${PKG_NAME}_extract_post; then - pkg_${PKG_NAME}_extract_post; - fi; - set_build_script_done extract -build_dir; -fi; -if [ -z "${PKG_BUILD_DIR}" ]; then - set_build_dir ${PKG_SUBDIR} ${PKG_BUILD_TYPE:-native}; -fi; -if ! is_build_script_done build_dir; then - [ "${PKG_SUBDIR}" != "${PKG_BUILD_DIR}" ] &&\ - secure_rm ${PKG_BUILD_DIR}; - insecure_mkdir ${PKG_BUILD_DIR}; - set_build_script_done build_dir -patch_pre; -fi; -if ! is_build_script_done patch_pre; then - for __ in \ - ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local.patch \ - ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch \ - ${WORKDIR}/chainport/${PKG_SUBDIR}_pre.midipix.patch \ - ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local.patch \ - ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch; do - if [ -r "${__}" ]; then - patch -b -d ${PKG_SUBDIR} -p1 < ${__}; - fi; - done; unset __; - if test_cmd pkg_${PKG_NAME}_patch_pre_post; then - pkg_${PKG_NAME}_patch_pre_post; - fi; - set_build_script_done patch_pre -autoconf; -fi; -if [ -e ${PKG_SUBDIR}/configure -o \ - -e ${PKG_SUBDIR}/configure.ac -o \ - -e ${PKG_SUBDIR}/configure.in -o \ - -e ${PKG_SUBDIR}/config.guess ] \ -&& ! is_build_script_done autoconf; then - find ${PKG_SUBDIR} -name config.sub \ - -exec echo mv -- {} {}.orig \; \ - -exec mv -- {} {}.orig \; \ - -exec echo install -m 0700 ${MIDIPIX_BUILD_PWD}/etc/config.sub {} \; \ - -exec install -m 0700 ${MIDIPIX_BUILD_PWD}/etc/config.sub {} \;; - if [ -e ${PKG_SUBDIR}/configure.ac -a \ - ! -e ${PKG_SUBDIR}/configure ]; then - if [ -e ${PKG_SUBDIR}/autogen.sh ]; then - for __ in ${PKG_SUBDIR}/build-aux ${PKG_SUBDIR}; do - if [ -e ${__} ]; then - echo install -m 0700 \ - ${MIDIPIX_BUILD_PWD}/etc/config.sub \ - ${__}/config.sub; - install -m 0700 \ - ${MIDIPIX_BUILD_PWD}/etc/config.sub \ - ${__}/config.sub; - break; - fi; - done; - (cd ${PKG_SUBDIR} && ${SHELL} ./autogen.sh) || exit 1; - else - (cd ${PKG_SUBDIR} && autoconf) || exit 1; - fi; - fi; - for __ in ${PKG_BUILD_DIR} ${PKG_CONFIG_CACHE_EXTRA}; do - echo cp -- ${MIDIPIX_BUILD_PWD}/etc/config.cache ${__}/; - cp -- ${MIDIPIX_BUILD_PWD}/etc/config.cache ${__}/; - done; - set_build_script_done autoconf -patch; -fi; -if ! is_build_script_done patch; then - if [ -d ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME} ]; then - set +o noglob; - for __patch_fname in ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}/*.patch; do - patch -b -d ${PKG_SUBDIR} -p1 < ${__patch_fname}; - done; - set -o noglob; - fi; - for __patch_fname in \ - ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}.local.patch \ - ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}.local@${BUILD_HNAME}.patch \ - ${WORKDIR}/chainport/${PKG_SUBDIR}.midipix.patch \ - ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local.patch \ - ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch; do - if [ -r "${__patch_fname}" ]; then - patch -b -d ${PKG_SUBDIR} -p1 < ${__patch_fname}; - fi; - done; unset __patch_fname; - if test_cmd pkg_${PKG_NAME}_patch_post; then - pkg_${PKG_NAME}_patch_post; - fi; - set_build_script_done patch -configure; -fi; -PKG_SUBDIR_PATH=${PWD}/${PKG_SUBDIR#/}; -if [ -z "${PKG_CONFIGURE}" ]; then - PKG_CONFIGURE=${PKG_SUBDIR_PATH}/configure; -else - PKG_CONFIGURE=${PWD}/${PKG_CONFIGURE#/}; -fi; -cd ${PKG_BUILD_DIR}; -if [ "${PKG_BUILD_TYPE}" = "host" ]; then - export AR=ar; - export CC=gcc; - export CXX=g++; - export RANLIB=ranlib; -else - export AR=${PKG_TARGET}-ar; - export CC=${PKG_TARGET}-gcc; - export CXX=${PKG_TARGET}-g++; - export RANLIB=${PKG_TARGET}-ranlib; -fi; -if [ -x ${PKG_CONFIGURE} ]; then - export CFLAGS_FOR_BUILD="${HOST_TOOLCHAIN_CFLAGS_CONFIGURE_DEFAULT}"; -fi; -if [ -x ${PKG_CONFIGURE} ]\ -|| test_cmd pkg_${PKG_NAME}_configure\ -&& ! is_build_script_done configure; then - if test_cmd pkg_${PKG_NAME}_configure; then - pkg_${PKG_NAME}_configure; - else - if test_cmd pkg_${PKG_NAME}_configure_pre; then - pkg_${PKG_NAME}_configure_pre; - fi; - CFLAGS="${PKG_CFLAGS_CONFIGURE}${PKG_CFLAGS_CONFIGURE_EXTRA:+ ${PKG_CFLAGS_CONFIGURE_EXTRA}}"\ - LDFLAGS="${PKG_LDFLAGS_CONFIGURE}${PKG_LDFLAGS_CONFIGURE_EXTRA:+ ${PKG_LDFLAGS_CONFIGURE_EXTRA}}"\ - ${PKG_CONFIGURE} \ - ${PKG_CONFIGURE_ARGS} ${PKG_CONFIGURE_ARGS_EXTRA} ${PKG_CONFIGURE_ARGS_EXTRA_DEBUG}; - fi; - set_build_script_done configure clean -build; -else - __no_autoconf=1; - set_build_script_done clean -build; -fi; -if ! is_build_script_done clean; then - make clean; - set_build_script_done clean -build; -fi; -if ! is_build_script_done build; then - if test_cmd pkg_${PKG_NAME}_build; then - pkg_${PKG_NAME}_build; - elif [ -n "${PKG_BUILD_CMDLINE}" ]; then - ${PKG_BUILD_CMDLINE}; - elif [ ${PKG_NO_MAKE_BUILD:-0} -eq 0 ]; then - if [ "${PKG_SLIBTOOL}" != "default" ]; then - export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}"; - fi; - # N.B. We only specify CC= here if the current package does not use GNU - # autoconf as it often abuses it by appending -std={gnu99,...} to it - # instead of amending CFLAGS. - run_cmd_unsplit make \ - ${PKG_MAKEFLAGS_BUILD} \ - ${PKG_MAKEFLAGS_BUILD_EXTRA} \ - AR=${AR} ${__no_autoconf:+CC=${CC}} RANLIB=${RANLIB} \ - "${PKG_CFLAGS_BUILD:+CFLAGS=${PKG_CFLAGS_BUILD}}" \ - "${CFLAGS_FOR_BUILD:+CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD}}" \ - "${PKG_CFLAGS_BUILD_EXTRA:+CFLAGS+=${PKG_CFLAGS_BUILD_EXTRA}}" \ - "${PKG_LDFLAGS_BUILD:+LDFLAGS=${PKG_LDFLAGS_BUILD}}" \ - "${PKG_LDFLAGS_BUILD_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_BUILD_EXTRA}}"; - unset __no_autoconf; - fi; - set_build_script_done build -install; -fi; -if ! is_build_script_done install; then - if test_cmd pkg_${PKG_NAME}_install; then - pkg_${PKG_NAME}_install; - else - if [ ${PKG_NO_MAKE_INSTALL:-0} -eq 0 ]; then - run_cmd_unsplit make \ - ${PKG_MAKEFLAGS_INSTALL} \ - ${PKG_MAKEFLAGS_INSTALL_EXTRA} \ - AR=${AR} CC=${CC} RANLIB=${RANLIB} \ - "${PKG_CFLAGS_INSTALL:+CFLAGS=${PKG_CFLAGS_INSTALL}}" \ - "${PKG_CFLAGS_INSTALL_EXTRA:+CFLAGS+=${PKG_CFLAGS_INSTALL_EXTRA}}" \ - "${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}" \ - "${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}" \ - "${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}" \ - ${PKG_INSTALL_TARGET:=install}; - if [ -n "${PKG_PREFIX_EXTRA}" ]; then - run_cmd_unsplit make \ - ${PKG_MAKEFLAGS_INSTALL} \ - ${PKG_MAKEFLAGS_INSTALL_EXTRA} \ - AR=${AR} CC=${CC} RANLIB=${RANLIB} \ - "${PKG_CFLAGS_INSTALL:+CFLAGS=${PKG_CFLAGS_INSTALL}}" \ - "${PKG_CFLAGS_INSTALL_EXTRA:+CFLAGS+=${PKG_CFLAGS_INSTALL_EXTRA}}" \ - "${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}" \ - "${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}" \ - "${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}" \ - ${PKG_INSTALL_TARGET_EXTRA:=install} \ - DESTDIR=${PKG_PREFIX_EXTRA}; - fi; - fi; - if test_cmd pkg_${PKG_NAME}_install_post; then - pkg_${PKG_NAME}_install_post; - fi; - fi; - if [ -d ${PKG_PREFIX}/lib ]; then - for __ in $(find ${PKG_PREFIX}/lib -type f -name \*.la); do - secure_rm ${__}; - done; - fi; - if [ -n "${PKG_INSTALL_FILES}" ]; then - (set -- ${PKG_INSTALL_FILES}; - while [ ${#} -gt 0 ]; do - case "${1}" in - @*=*) - __ln_target="${1%=*}"; - __ln_target="${__ln_target#@}"; - __ln_fname="${1#*=}"; - echo ln -sf -- ${__ln_target} ${PKG_PREFIX}/${__ln_fname}; - ln -sf -- ${__ln_target} ${PKG_PREFIX}/${__ln_fname}; - ;; - /=*) - __mkdir_fname="${1#/=}"; - insecure_mkdir ${PKG_PREFIX}/${__mkdir_fname}; - ;; - *) - __file_fname_src="${1%=*}"; - __file_fname_dst="${1#*=}"; - echo cp -pP -- ${__file_fname_src} ${PKG_PREFIX}/${__file_fname_dst}; - cp -pP -- ${__file_fname_src} ${PKG_PREFIX}/${__file_fname_dst}; - ;; - esac; shift; - done); - fi; - if [ "${PKG_BUILD_TYPE}" != "host" ] \ - && test_cmd perk \ - && test_cmd ${PKG_TARGET}-dlltool; then - for __so_fname in \ - $(find \( -name "*.so" \ - -or -name "*.so.[0-9]" \ - -or -name "*.so.[0-9].[0-9]" \ - -or -name "*.so.[0-9].[0-9].[0-9]" \) -printf '%P\n'); - do - if [ \( -e ${__so_fname%.so}.lib.a \) -o \ - \( ! -e ${PKG_PREFIX}/lib/$(basename ${__so_fname}) \) ]; - then - continue; - else - __so_name="${__so_fname%.so}"; - echo perk -epdlltool ${__so_fname} \> ${__so_fname%.so}.def; - perk -epdlltool ${__so_fname} > ${__so_fname%.so}.def; - echo ${PKG_TARGET}-dlltool -l ${__so_fname%.so}.lib.a \ - -D ${__so_fname} -d ${__so_fname%.so}.def; - ${PKG_TARGET}-dlltool -l ${__so_fname%.so}.lib.a \ - -D ${__so_fname} -d ${__so_fname%.so}.def; - echo cp -- ${__so_fname%.so}.lib.a "${PKG_PREFIX}/lib"; - cp -- ${__so_fname%.so}.lib.a "${PKG_PREFIX}/lib"; - fi; - done; - fi; - set_build_script_done install -finish; -fi; -set_build_script_done finish; - -# vim:filetype=sh diff --git a/patches/gcc.stage1.mingw_w64.local.patch b/patches/gcc.stage1.mingw_w64.local.patch deleted file mode 100644 index ac886cf..0000000 --- a/patches/gcc.stage1.mingw_w64.local.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- cbb-gcc-4.6.4/libiberty/configure.ac.orig 2016-12-19 18:27:51.909364800 +0100 -+++ cbb-gcc-4.6.4/libiberty/configure.ac 2017-01-30 03:55:45.271150700 +0100 -@@ -683,7 +683,7 @@ - - # Figure out which version of pexecute to use. - case "${host}" in -- *-*-mingw* | *-*-winnt*) pexecute=pex-win32 ;; -+ *-*-winnt*) pexecute=pex-win32 ;; - *-*-msdosdjgpp*) pexecute=pex-djgpp ;; - *-*-msdos*) pexecute=pex-msdos ;; - *) pexecute=pex-unix ;; diff --git a/patches/gcc_native_x86_64_w64_mingw32.local.patch b/patches/gcc_native_x86_64_w64_mingw32.local.patch new file mode 100644 index 0000000..ac886cf --- /dev/null +++ b/patches/gcc_native_x86_64_w64_mingw32.local.patch @@ -0,0 +1,11 @@ +--- cbb-gcc-4.6.4/libiberty/configure.ac.orig 2016-12-19 18:27:51.909364800 +0100 ++++ cbb-gcc-4.6.4/libiberty/configure.ac 2017-01-30 03:55:45.271150700 +0100 +@@ -683,7 +683,7 @@ + + # Figure out which version of pexecute to use. + case "${host}" in +- *-*-mingw* | *-*-winnt*) pexecute=pex-win32 ;; ++ *-*-winnt*) pexecute=pex-win32 ;; + *-*-msdosdjgpp*) pexecute=pex-djgpp ;; + *-*-msdos*) pexecute=pex-msdos ;; + *) pexecute=pex-unix ;; diff --git a/subr/build.subr b/subr/build.subr index 1f67257..3020a00 100644 --- a/subr/build.subr +++ b/subr/build.subr @@ -121,23 +121,6 @@ init_build_vars() { BUILD_TIMES_SECS=$(command date +%s); }; -source_scripts() { - _ss_pkg_name="${BUILD_PACKAGE_LC%.*}"; - _ss_arg1="${BUILD_PACKAGE_LC#*.}"; - _ss_arg1="${_ss_arg1%%.*}"; - _ss_arg2="${BUILD_PACKAGE_LC##*.}"; - set -- ${_ss_pkg_name} ${_ss_arg1} ${_ss_arg2}; - for SCRIPT_SOURCE in vars/${BUILD_PACKAGE_LC}.vars ${BUILD_SCRIPT_FNAME}; do - if [ -f ${MIDIPIX_BUILD_PWD}/${SCRIPT_SOURCE} ]; then - if [ ${ARG_DRYRUN:-0} -eq 1 ]; then - echo . ${MIDIPIX_BUILD_PWD}/${SCRIPT_SOURCE}; - else - . ${MIDIPIX_BUILD_PWD}/${SCRIPT_SOURCE}; - fi; - fi; - done; -}; - source_vars() { for __ in ${HOME}/midipix_build.vars ../midipix_build.vars ./vars/build.vars; do [ -e ${__} ] && . ${__}; diff --git a/subr/pkg.subr b/subr/pkg.subr index 315bbfd..da36f35 100644 --- a/subr/pkg.subr +++ b/subr/pkg.subr @@ -92,7 +92,8 @@ log_env_vars() { parse_with_pkg_name() { PKG_NAME=${1}; shift; _pwpn_pkg_name_uc=$(echo ${PKG_NAME} | tr a-z A-Z); - if [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_URL)" ]; then + if [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_URL)" ]\ + && [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_VERSION)" ]; then unset _pwpn_pkg_name_uc; log_msg failexit "Error: package \`${PKG_NAME}' missing in build.vars."; else diff --git a/subr/pkg_all.subr b/subr/pkg_all.subr new file mode 100644 index 0000000..df96e00 --- /dev/null +++ b/subr/pkg_all.subr @@ -0,0 +1,10 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_all() { + :; +}; + +# vim:filetype=sh diff --git a/subr/pkg_autoconf.subr b/subr/pkg_autoconf.subr new file mode 100644 index 0000000..1896fc1 --- /dev/null +++ b/subr/pkg_autoconf.subr @@ -0,0 +1,43 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_autoconf() { + if [ -e ${PKG_SUBDIR}/configure -o \ + -e ${PKG_SUBDIR}/configure.ac -o \ + -e ${PKG_SUBDIR}/configure.in -o \ + -e ${PKG_SUBDIR}/config.guess ]; then + find ${PKG_SUBDIR} -name config.sub \ + -exec echo mv -- {} {}.orig \; \ + -exec mv -- {} {}.orig \; \ + -exec echo install -m 0700 ${MIDIPIX_BUILD_PWD}/etc/config.sub {} \; \ + -exec install -m 0700 ${MIDIPIX_BUILD_PWD}/etc/config.sub {} \;; + if [ -e ${PKG_SUBDIR}/configure.ac -a \ + ! -e ${PKG_SUBDIR}/configure ]; then + if [ -e ${PKG_SUBDIR}/autogen.sh ]; then + for __ in ${PKG_SUBDIR}/build-aux ${PKG_SUBDIR}; do + if [ -e ${__} ]; then + echo install -m 0700 \ + ${MIDIPIX_BUILD_PWD}/etc/config.sub \ + ${__}/config.sub; + install -m 0700 \ + ${MIDIPIX_BUILD_PWD}/etc/config.sub \ + ${__}/config.sub; + break; + fi; + done; + (cd ${PKG_SUBDIR} && ${SHELL} ./autogen.sh) || exit 1; + else + (cd ${PKG_SUBDIR} && autoconf) || exit 1; + fi; + fi; + for __ in ${PKG_BUILD_DIR} ${PKG_CONFIG_CACHE_EXTRA}; do + echo cp -- ${MIDIPIX_BUILD_PWD}/etc/config.cache ${__}/; + cp -- ${MIDIPIX_BUILD_PWD}/etc/config.cache ${__}/; + done; + fi; + set_build_script_done autoconf -patch; +}; + +# vim:filetype=sh diff --git a/subr/pkg_build.subr b/subr/pkg_build.subr new file mode 100644 index 0000000..d9b1e68 --- /dev/null +++ b/subr/pkg_build.subr @@ -0,0 +1,30 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_build() { + if [ -n "${PKG_BUILD_CMDLINE}" ]; then + ${PKG_BUILD_CMDLINE}; + elif [ ${PKG_NO_MAKE_BUILD:-0} -eq 0 ]; then + if [ "${PKG_SLIBTOOL}" != "default" ]; then + export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}"; + fi; + # N.B. We only specify CC= here if the current package does not use GNU + # autoconf as it often abuses it by appending -std={gnu99,...} to it + # instead of amending CFLAGS. + run_cmd_unsplit make \ + ${PKG_MAKEFLAGS_BUILD} \ + ${PKG_MAKEFLAGS_BUILD_EXTRA} \ + AR=${AR} ${__no_autoconf:+CC=${CC}} RANLIB=${RANLIB} \ + "${PKG_CFLAGS_BUILD:+CFLAGS=${PKG_CFLAGS_BUILD}}" \ + "${CFLAGS_FOR_BUILD:+CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD}}" \ + "${PKG_CFLAGS_BUILD_EXTRA:+CFLAGS+=${PKG_CFLAGS_BUILD_EXTRA}}" \ + "${PKG_LDFLAGS_BUILD:+LDFLAGS=${PKG_LDFLAGS_BUILD}}" \ + "${PKG_LDFLAGS_BUILD_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_BUILD_EXTRA}}"; + unset __no_autoconf; + fi; + set_build_script_done build -install; +}; + +# vim:filetype=sh diff --git a/subr/pkg_build_dir.subr b/subr/pkg_build_dir.subr new file mode 100644 index 0000000..1e46323 --- /dev/null +++ b/subr/pkg_build_dir.subr @@ -0,0 +1,16 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_build_dir() { + if [ -z "${PKG_BUILD_DIR}" ]; then + set_build_dir ${PKG_SUBDIR} ${PKG_BUILD_TYPE:-native}; + fi; + [ "${PKG_SUBDIR}" != "${PKG_BUILD_DIR}" ] &&\ + secure_rm ${PKG_BUILD_DIR}; + insecure_mkdir ${PKG_BUILD_DIR}; + set_build_script_done build_dir -patch_pre; +}; + +# vim:filetype=sh diff --git a/subr/pkg_clean.subr b/subr/pkg_clean.subr new file mode 100644 index 0000000..bd0e1d9 --- /dev/null +++ b/subr/pkg_clean.subr @@ -0,0 +1,11 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_clean() { + make clean; + set_build_script_done clean -build; +}; + +# vim:filetype=sh diff --git a/subr/pkg_configure.subr b/subr/pkg_configure.subr new file mode 100644 index 0000000..501ad71 --- /dev/null +++ b/subr/pkg_configure.subr @@ -0,0 +1,19 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_configure() { + if [ ${__no_autoconf:-0} -eq 0 ]; then + if test_cmd pkg_${PKG_NAME}_configure_pre; then + pkg_${PKG_NAME}_configure_pre; + fi; + CFLAGS="${PKG_CFLAGS_CONFIGURE}${PKG_CFLAGS_CONFIGURE_EXTRA:+ ${PKG_CFLAGS_CONFIGURE_EXTRA}}"\ + LDFLAGS="${PKG_LDFLAGS_CONFIGURE}${PKG_LDFLAGS_CONFIGURE_EXTRA:+ ${PKG_LDFLAGS_CONFIGURE_EXTRA}}"\ + ${PKG_CONFIGURE} \ + ${PKG_CONFIGURE_ARGS} ${PKG_CONFIGURE_ARGS_EXTRA} ${PKG_CONFIGURE_ARGS_EXTRA_DEBUG}; + fi; + set_build_script_done configure clean -build; +}; + +# vim:filetype=sh diff --git a/subr/pkg_disabled.subr b/subr/pkg_disabled.subr new file mode 100644 index 0000000..9fb3f2f --- /dev/null +++ b/subr/pkg_disabled.subr @@ -0,0 +1,12 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_disabled() { + if [ ${PKG_DISABLED:-0} -eq 1 ]; then + exit 0; + fi; +}; + +# vim:filetype=sh diff --git a/subr/pkg_extract.subr b/subr/pkg_extract.subr new file mode 100644 index 0000000..1bee883 --- /dev/null +++ b/subr/pkg_extract.subr @@ -0,0 +1,34 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_extract() { + if [ "${PKG_URL_TYPE:-wget}" = wget ]; then + secure_rm ${PKG_SUBDIR}; + if [ ${PKG_SUBDIR_CREATE:-0} -eq 1 ]; then + insecure_mkdir ${PKG_SUBDIR}; + fi; + if [ "${PKG_FNAME##*.tar.}" = "bz2" ]; then + bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + elif [ "${PKG_FNAME##*.tar.}" = "gz" ]; then + gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + elif [ "${PKG_FNAME##*.tar.}" = "xz" ]; then + xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + elif [ "${PKG_FNAME##*.t}" = "bz2" ]; then + bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + elif [ "${PKG_FNAME##*.t}" = "gz" ]; then + gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + elif [ "${PKG_FNAME##*.t}" = "xz" ]; then + xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + else + tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf ${DLCACHEDIR}/${PKG_FNAME}; + fi; + if test_cmd pkg_${PKG_NAME}_extract_post; then + pkg_${PKG_NAME}_extract_post; + fi; + fi; + set_build_script_done extract -build_dir; +}; + +# vim:filetype=sh diff --git a/subr/pkg_fetch.subr b/subr/pkg_fetch.subr new file mode 100644 index 0000000..705e493 --- /dev/null +++ b/subr/pkg_fetch.subr @@ -0,0 +1,18 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_fetch() { + if [ "${PKG_URL_TYPE:-wget}" = wget ]; then + fetch "${PKG_URL}" ${PKG_SHA256SUM}; + else + fetch_git ${PKG_SUBDIR} ${PKG_URL} ${PKG_GIT_BRANCH}; + fi; + if test_cmd pkg_${PKG_NAME}_fetch_post; then + pkg_${PKG_NAME}_fetch_post; + fi; + set_build_script_done fetch -extract; +}; + +# vim:filetype=sh diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr new file mode 100644 index 0000000..67df0fd --- /dev/null +++ b/subr/pkg_install.subr @@ -0,0 +1,97 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_install() { + if test_cmd pkg_${PKG_NAME}_install; then + pkg_${PKG_NAME}_install; + else + if [ ${PKG_NO_MAKE_INSTALL:-0} -eq 0 ]; then + run_cmd_unsplit make \ + ${PKG_MAKEFLAGS_INSTALL} \ + ${PKG_MAKEFLAGS_INSTALL_EXTRA} \ + AR=${AR} CC=${CC} RANLIB=${RANLIB} \ + "${PKG_CFLAGS_INSTALL:+CFLAGS=${PKG_CFLAGS_INSTALL}}" \ + "${PKG_CFLAGS_INSTALL_EXTRA:+CFLAGS+=${PKG_CFLAGS_INSTALL_EXTRA}}" \ + "${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}" \ + "${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}" \ + "${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}" \ + ${PKG_INSTALL_TARGET:=install}; + if [ -n "${PKG_PREFIX_EXTRA}" ]; then + run_cmd_unsplit make \ + ${PKG_MAKEFLAGS_INSTALL} \ + ${PKG_MAKEFLAGS_INSTALL_EXTRA} \ + AR=${AR} CC=${CC} RANLIB=${RANLIB} \ + "${PKG_CFLAGS_INSTALL:+CFLAGS=${PKG_CFLAGS_INSTALL}}" \ + "${PKG_CFLAGS_INSTALL_EXTRA:+CFLAGS+=${PKG_CFLAGS_INSTALL_EXTRA}}" \ + "${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}" \ + "${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}" \ + "${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}" \ + ${PKG_INSTALL_TARGET_EXTRA:=install} \ + DESTDIR=${PKG_PREFIX_EXTRA}; + fi; + fi; + if test_cmd pkg_${PKG_NAME}_install_post; then + pkg_${PKG_NAME}_install_post; + fi; + fi; + if [ -d ${PKG_PREFIX}/lib ]; then + for __ in $(find ${PKG_PREFIX}/lib -type f -name \*.la); do + secure_rm ${__}; + done; + fi; + if [ -n "${PKG_INSTALL_FILES}" ]; then + (set -- ${PKG_INSTALL_FILES}; + while [ ${#} -gt 0 ]; do + case "${1}" in + @*=*) + __ln_target="${1%=*}"; + __ln_target="${__ln_target#@}"; + __ln_fname="${1#*=}"; + echo ln -sf -- ${__ln_target} ${PKG_PREFIX}/${__ln_fname}; + ln -sf -- ${__ln_target} ${PKG_PREFIX}/${__ln_fname}; + ;; + /=*) + __mkdir_fname="${1#/=}"; + insecure_mkdir ${PKG_PREFIX}/${__mkdir_fname}; + ;; + *) + __file_fname_src="${1%=*}"; + __file_fname_dst="${1#*=}"; + echo cp -pP -- ${__file_fname_src} ${PKG_PREFIX}/${__file_fname_dst}; + cp -pP -- ${__file_fname_src} ${PKG_PREFIX}/${__file_fname_dst}; + ;; + esac; shift; + done); + fi; + if [ "${PKG_BUILD_TYPE}" != "host" ] \ + && test_cmd perk \ + && test_cmd ${PKG_TARGET}-dlltool; then + for __so_fname in \ + $(find \( -name "*.so" \ + -or -name "*.so.[0-9]" \ + -or -name "*.so.[0-9].[0-9]" \ + -or -name "*.so.[0-9].[0-9].[0-9]" \) -printf '%P\n'); + do + if [ \( -e ${__so_fname%.so}.lib.a \) -o \ + \( ! -e ${PKG_PREFIX}/lib/$(basename ${__so_fname}) \) ]; + then + continue; + else + __so_name="${__so_fname%.so}"; + echo perk -epdlltool ${__so_fname} \> ${__so_fname%.so}.def; + perk -epdlltool ${__so_fname} > ${__so_fname%.so}.def; + echo ${PKG_TARGET}-dlltool -l ${__so_fname%.so}.lib.a \ + -D ${__so_fname} -d ${__so_fname%.so}.def; + ${PKG_TARGET}-dlltool -l ${__so_fname%.so}.lib.a \ + -D ${__so_fname} -d ${__so_fname%.so}.def; + echo cp -- ${__so_fname%.so}.lib.a "${PKG_PREFIX}/lib"; + cp -- ${__so_fname%.so}.lib.a "${PKG_PREFIX}/lib"; + fi; + done; + fi; + set_build_script_done install -finish; +}; + +# vim:filetype=sh diff --git a/subr/pkg_patch.subr b/subr/pkg_patch.subr new file mode 100644 index 0000000..089c0c1 --- /dev/null +++ b/subr/pkg_patch.subr @@ -0,0 +1,30 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_patch() { + if [ -d ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME} ]; then + set +o noglob; + for __patch_fname in ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}/*.patch; do + patch -b -d ${PKG_SUBDIR} -p1 < ${__patch_fname}; + done; + set -o noglob; + fi; + for __patch_fname in \ + ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}.local.patch \ + ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}.local@${BUILD_HNAME}.patch \ + ${WORKDIR}/chainport/${PKG_SUBDIR}.midipix.patch \ + ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local.patch \ + ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch; do + if [ -r "${__patch_fname}" ]; then + patch -b -d ${PKG_SUBDIR} -p1 < ${__patch_fname}; + fi; + done; unset __patch_fname; + if test_cmd pkg_${PKG_NAME}_patch_post; then + pkg_${PKG_NAME}_patch_post; + fi; + set_build_script_done patch -setup; +}; + +# vim:filetype=sh diff --git a/subr/pkg_patch_pre.subr b/subr/pkg_patch_pre.subr new file mode 100644 index 0000000..2671d32 --- /dev/null +++ b/subr/pkg_patch_pre.subr @@ -0,0 +1,23 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_patch_pre() { + for __ in \ + ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local.patch \ + ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch \ + ${WORKDIR}/chainport/${PKG_SUBDIR}_pre.midipix.patch \ + ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local.patch \ + ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch; do + if [ -r "${__}" ]; then + patch -b -d ${PKG_SUBDIR} -p1 < ${__}; + fi; + done; unset __; + if test_cmd pkg_${PKG_NAME}_patch_pre_post; then + pkg_${PKG_NAME}_patch_pre_post; + fi; + set_build_script_done patch_pre -autoconf; +}; + +# vim:filetype=sh diff --git a/subr/pkg_setup.subr b/subr/pkg_setup.subr new file mode 100644 index 0000000..242541a --- /dev/null +++ b/subr/pkg_setup.subr @@ -0,0 +1,33 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_setup() { + PKG_SUBDIR_PATH=${PWD}/${PKG_SUBDIR#/}; + if [ -z "${PKG_CONFIGURE}" ]; then + PKG_CONFIGURE=${PKG_SUBDIR_PATH}/configure; + else + PKG_CONFIGURE=${PWD}/${PKG_CONFIGURE#/}; + fi; + cd ${PKG_BUILD_DIR}; + if [ "${PKG_BUILD_TYPE}" = "host" ]; then + export AR=ar; + export CC=gcc; + export CXX=g++; + export RANLIB=ranlib; + else + export AR=${PKG_TARGET}-ar; + export CC=${PKG_TARGET}-gcc; + export CXX=${PKG_TARGET}-g++; + export RANLIB=${PKG_TARGET}-ranlib; + fi; + if [ -x ${PKG_CONFIGURE} ]; then + export CFLAGS_FOR_BUILD="${HOST_TOOLCHAIN_CFLAGS_CONFIGURE_DEFAULT}"; + else + __no_autoconf=1; + fi; + set_build_script_done setup -configure; +}; + +# vim:filetype=sh diff --git a/vars/build.vars b/vars/build.vars index 13606a8..f7f84a0 100644 --- a/vars/build.vars +++ b/vars/build.vars @@ -87,7 +87,7 @@ INVARIANTS_PACKAGES="chainport"; HOST_TOOLCHAIN_BUILD_TYPE="host"; HOST_TOOLCHAIN_CFLAGS_CONFIGURE="${HOST_TOOLCHAIN_CFLAGS_CONFIGURE_DEFAULT}"; HOST_TOOLCHAIN_CONFIGURE_ARGS="-C --disable-nls --host=${TARGET} --prefix= --target=${TARGET}"; -HOST_TOOLCHAIN_PACKAGES="slibtool_host perk_host binutils_host gcc.stage1 psxstub musl.no-complex gcc.runtime musl.full gcc.libstdc++-v3 gcc.full pkgconf_host file_host binutils_host_mingw_w64 gcc.host.mingw_w64 mdso_host"; +HOST_TOOLCHAIN_PACKAGES="slibtool_host perk_host binutils_host binutils_host_x86_64_w64_mingw32 gcc_stage1_x86_64_w64_mingw32 gcc_stage1 psxstub musl_no_complex gcc_runtime musl_full gcc_libstdcpp_v3 gcc_full file_host mdso_host pkgconf_host"; HOST_TOOLCHAIN_PREFIX="${PREFIX_CROSS}"; : ${PKG_SLIBTOOL_HOST_URL:=${GITROOT}/slibtool}; : ${PKG_SLIBTOOL_HOST_URL_TYPE:=git}; @@ -104,29 +104,37 @@ HOST_TOOLCHAIN_PREFIX="${PREFIX_CROSS}"; : ${PKG_BINUTILS_HOST_URL:=ftp://sourceware.org/pub/binutils/snapshots/binutils-${PKG_BINUTILS_HOST_VERSION}.tar.bz2}; : ${PKG_BINUTILS_HOST_CONFIGURE_ARGS:=--disable-werror --prefix=${PREFIX} --target=${TARGET} --with-sysroot=${PREFIX_CROSS}}; : ${PKG_BINUTILS_HOST_SLIBTOOL:=slibtool-static}; -: ${PKG_BINUTILS_HOST_MINGW_W64_SHA256SUM:=250d3b2925c6b211fb16173b0b25bc091c58829fbcad3eb849645e0af52cf7fa}; -: ${PKG_BINUTILS_HOST_MINGW_W64_VERSION:=2.24.51}; -: ${PKG_BINUTILS_HOST_MINGW_W64_URL:=ftp://sourceware.org/pub/binutils/snapshots/binutils-${PKG_BINUTILS_HOST_MINGW_W64_VERSION}.tar.bz2}; -: ${PKG_BINUTILS_HOST_MINGW_W64_CONFIGURE_ARGS:=--disable-werror --prefix=${PREFIX} --target=x86_64-w64-mingw32 --with-sysroot=${PREFIX_CROSS}}; -: ${PKG_BINUTILS_HOST_MINGW_W64_SLIBTOOL:=slibtool-static}; -: ${PKG_BINUTILS_HOST_MINGW_W64_TARGET:=x86_64-w64-mingw32}; +: ${PKG_BINUTILS_HOST_X86_64_W64_MINGW32_SHA256SUM:=250d3b2925c6b211fb16173b0b25bc091c58829fbcad3eb849645e0af52cf7fa}; +: ${PKG_BINUTILS_HOST_X86_64_W64_MINGW32_VERSION:=2.24.51}; +: ${PKG_BINUTILS_HOST_X86_64_W64_MINGW32_URL:=ftp://sourceware.org/pub/binutils/snapshots/binutils-${PKG_BINUTILS_HOST_X86_64_W64_MINGW32_VERSION}.tar.bz2}; +: ${PKG_BINUTILS_HOST_X86_64_W64_MINGW32_CONFIGURE_ARGS:=--disable-werror --prefix=${PREFIX} --target=x86_64-w64-mingw32 --with-sysroot=${PREFIX_CROSS}}; +: ${PKG_BINUTILS_HOST_X86_64_W64_MINGW32_SLIBTOOL:=slibtool-static}; +: ${PKG_BINUTILS_HOST_X86_64_W64_MINGW32_TARGET:=x86_64-w64-mingw32}; +: ${PKG_GCC_STAGE1_VERSION:=4.6.4}; +: ${PKG_PSXSTUB_URL:=${GITROOT}/psxstub}; +: ${PKG_PSXSTUB_URL_TYPE:=git}; +: ${PKG_PSXSTUB_URL:=${GITROOT}/psxstub}; +: ${PKG_MUSL_NO_COMPLEX_VERSION:=1.1.12}; +: ${PKG_GCC_RUNTIME_VERSION:=4.6.4}; +: ${PKG_MUSL_FULL_VERSION:=1.1.12}; +: ${PKG_GCC_LIBSTDCPP_V3_VERSION:=4.6.4}; +: ${PKG_GCC_FULL_VERSION:=4.6.4}; +: ${PKG_GCC_STAGE1_X86_64_W64_MINGW32_VERSION:=4.6.4}; +: ${PKG_FILE_HOST_SHA256SUM:=ea661277cd39bf8f063d3a83ee875432cc3680494169f952787e002bdd3884c0}; +: ${PKG_FILE_HOST_VERSION:=5.29}; +: ${PKG_FILE_HOST_URL:=ftp://ftp.astron.com/pub/file/file-${PKG_FILE_HOST_VERSION}.tar.gz}; +: ${PKG_FILE_HOST_CONFIGURE_ARGS:="-C --prefix=${PREFIX}"}; : ${PKG_MDSO_HOST_URL:=${GITROOT}/mdso}; : ${PKG_MDSO_HOST_URL_TYPE:=git}; : ${PKG_MDSO_HOST_CONFIGURE_ARGS:="--prefix=/usr"}; : ${PKG_MDSO_HOST_INSTALL_FILES:="@mdso=bin/${TARGET}-mdso"}; : ${PKG_MDSO_HOST_MAKEFLAGS_INSTALL:="DESTDIR=${PREFIX}"}; : ${PKG_MDSO_HOST_PREFIX:=${PREFIX}}; -: ${PKG_PSXSTUB_URL:=${GITROOT}/psxstub}; -: ${PKG_PSXSTUB_URL_TYPE:=git}; : ${PKG_PKGCONF_HOST_SHA256SUM:=7ec8b516e655e247f4ba976837cee808134785819ab8f538f652fe919cc6c09f}; : ${PKG_PKGCONF_HOST_VERSION:=0.9.12}; : ${PKG_PKGCONF_HOST_URL:=https://github.com/pkgconf/pkgconf/releases/download/pkgconf-${PKG_PKGCONF_HOST_VERSION}/pkgconf-${PKG_PKGCONF_HOST_VERSION}.tar.bz2}; : ${PKG_PKGCONF_HOST_CONFIGURE_ARGS:="-C --prefix=${PREFIX_NATIVE}"}; : ${PKG_PKGCONF_HOST_MAKEFLAGS_INSTALL_EXTRA:=prefix=${PREFIX}}; -: ${PKG_FILE_HOST_SHA256SUM:=ea661277cd39bf8f063d3a83ee875432cc3680494169f952787e002bdd3884c0}; -: ${PKG_FILE_HOST_VERSION:=5.29}; -: ${PKG_FILE_HOST_URL:=ftp://ftp.astron.com/pub/file/file-${PKG_FILE_HOST_VERSION}.tar.gz}; -: ${PKG_FILE_HOST_CONFIGURE_ARGS:="-C --prefix=${PREFIX}"}; # # Build target native_toolchain @@ -134,7 +142,7 @@ HOST_TOOLCHAIN_PREFIX="${PREFIX_CROSS}"; NATIVE_TOOLCHAIN_CFLAGS_CONFIGURE="${NATIVE_TOOLCHAIN_CFLAGS_CONFIGURE_DEFAULT}"; NATIVE_TOOLCHAIN_CONFIGURE_ARGS="--disable-nls --host=${TARGET} --prefix=/ --target=${TARGET}"; NATIVE_TOOLCHAIN_MAKEFLAGS_INSTALL="DESTDIR=${PREFIX_NATIVE}"; -NATIVE_TOOLCHAIN_PACKAGES="slibtool perk pkgconf gmp mpfr mpc libelf binutils binutils_native_mingw_w64 musl.native gcc.native mdso gcc.stage1.mingw_w64"; +NATIVE_TOOLCHAIN_PACKAGES="slibtool perk pkgconf gmp mpfr mpc libelf binutils binutils_x86_64_w64_mingw32 musl_native gcc_native mdso"; NATIVE_TOOLCHAIN_PREFIX="${PREFIX_NATIVE}"; : ${PKG_SLIBTOOL_URL:=git://midipix.org/slibtool}; : ${PKG_SLIBTOOL_URL_TYPE:=git}; @@ -172,15 +180,15 @@ NATIVE_TOOLCHAIN_PREFIX="${PREFIX_NATIVE}"; : ${PKG_BINUTILS_URL:=ftp://sourceware.org/pub/binutils/snapshots/binutils-${PKG_BINUTILS_VERSION}.tar.bz2}; : ${PKG_BINUTILS_CONFIGURE_ARGS_EXTRA:=--with-libelf=${PREFIX_NATIVE} --with-gmp=${PREFIX_NATIVE} --with-mpc=${PREFIX_NATIVE} --with-mpfr=${PREFIX_NATIVE} --with-sysroot=/}; : ${PKG_BINUTILS_SLIBTOOL:=slibtool-static}; -: ${PKG_BINUTILS_NATIVE_MINGW_W64_SHA256SUM:=250d3b2925c6b211fb16173b0b25bc091c58829fbcad3eb849645e0af52cf7fa}; -: ${PKG_BINUTILS_NATIVE_MINGW_W64_VERSION:=2.24.51}; -: ${PKG_BINUTILS_NATIVE_MINGW_W64_URL:=ftp://sourceware.org/pub/binutils/snapshots/binutils-${PKG_BINUTILS_NATIVE_MINGW_W64_VERSION}.tar.bz2}; -: ${PKG_BINUTILS_NATIVE_MINGW_W64_CONFIGURE_ARGS:="--disable-nls --host=${TARGET} --prefix=/ --target=x86_64-w64-mingw32 --with-libelf=${PREFIX_NATIVE} --with-gmp=${PREFIX_NATIVE} --with-mpc=${PREFIX_NATIVE} --with-mpfr=${PREFIX_NATIVE} --with-sysroot=/"}; -: ${PKG_BINUTILS_NATIVE_MINGW_W64_SLIBTOOL:=slibtool-static}; -: ${PKG_MUSL_SHA256SUM:=720b83c7e276b4b679c0bffe9509340d5f81fd601508e607e708177df0d31c0e}; -: ${PKG_MUSL_VERSION:=1.1.12}; -: ${PKG_MUSL_URL:=http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz}; -: ${PKG_GCC_VERSION:=4.6.4}; +: ${PKG_BINUTILS_X86_64_W64_MINGW32_SHA256SUM:=250d3b2925c6b211fb16173b0b25bc091c58829fbcad3eb849645e0af52cf7fa}; +: ${PKG_BINUTILS_X86_64_W64_MINGW32_VERSION:=2.24.51}; +: ${PKG_BINUTILS_X86_64_W64_MINGW32_URL:=ftp://sourceware.org/pub/binutils/snapshots/binutils-${PKG_BINUTILS_X86_64_W64_MINGW32_VERSION}.tar.bz2}; +: ${PKG_BINUTILS_X86_64_W64_MINGW32_CONFIGURE_ARGS:="--disable-nls --host=${TARGET} --prefix=/ --target=x86_64-w64-mingw32 --with-libelf=${PREFIX_NATIVE} --with-gmp=${PREFIX_NATIVE} --with-mpc=${PREFIX_NATIVE} --with-mpfr=${PREFIX_NATIVE} --with-sysroot=/"}; +: ${PKG_BINUTILS_X86_64_W64_MINGW32_SLIBTOOL:=slibtool-static}; +: ${PKG_MUSL_NATIVE_SHA256SUM:=720b83c7e276b4b679c0bffe9509340d5f81fd601508e607e708177df0d31c0e}; +: ${PKG_MUSL_NATIVE_VERSION:=1.1.12}; +: ${PKG_MUSL_NATIVE_URL:=http://www.musl-libc.org/releases/musl-${PKG_MUSL_NATIVE_VERSION}.tar.gz}; +: ${PKG_GCC_NATIVE_VERSION:=4.6.4}; : ${PKG_MDSO_URL:=${GITROOT}/mdso}; : ${PKG_MDSO_URL_TYPE:=git}; : ${PKG_MDSO_CONFIGURE_ARGS:="--prefix=/usr --target=${TARGET}"}; diff --git a/vars/gcc.vars b/vars/gcc.vars new file mode 100644 index 0000000..b62cceb --- /dev/null +++ b/vars/gcc.vars @@ -0,0 +1,413 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# Order: stage1, runtime, libstdcpp_v3, full, native +# Order: stage1_x86_64_w64_mingw32, native_x86_64_w64_mingw32 +# + +pkg_gcc_stage1_all() { + PKG_GCC_VERSION="${PKG_GCC_STAGE1_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} 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=" \ + --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; + 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; + 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_runtime_all() { + PKG_GCC_VERSION="${PKG_GCC_RUNTIME_VERSION}"; + export MAKE="make LIBTOOL=slibtool"; + set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross; + cd ${PKG_BUILD_DIR}; + # GCC, compiler runtime. + if ! is_build_script_done build; then + make ${MAKEFLAGS} all-target-libgcc; + set_build_script_done build -install; + fi; + if ! is_build_script_done install; then + make ${MAKEFLAGS} install-target-libgcc; + set_build_script_done install finish; + fi; +}; + +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; + cd ${PKG_BUILD_DIR}; + # GCC, libstdc++-v3. + if ! is_build_script_done build; then + make ${MAKEFLAGS} all-target-libstdc++-v3; + set_build_script_done build -install; + fi; + if ! is_build_script_done install; then + make ${MAKEFLAGS} install-target-libstdc++-v3; + set_build_script_done install finish; + fi; +}; + +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; + cd ${PKG_BUILD_DIR}; + # GCC, everything else. + if ! is_build_script_done build; then + make ${MAKEFLAGS}; + set_build_script_done build -install; + fi; + if ! is_build_script_done install; then + make ${MAKEFLAGS} install; + set_build_script_done install finish; + 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_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; + 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; + 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 ! 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; + 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; +}; + +# vim:filetype=sh diff --git a/vars/gcc_full.vars b/vars/gcc_full.vars new file mode 120000 index 0000000..55c0ef1 --- /dev/null +++ b/vars/gcc_full.vars @@ -0,0 +1 @@ +gcc.vars \ No newline at end of file diff --git a/vars/gcc_libstdcpp_v3.vars b/vars/gcc_libstdcpp_v3.vars new file mode 120000 index 0000000..55c0ef1 --- /dev/null +++ b/vars/gcc_libstdcpp_v3.vars @@ -0,0 +1 @@ +gcc.vars \ No newline at end of file diff --git a/vars/gcc_native.vars b/vars/gcc_native.vars new file mode 120000 index 0000000..55c0ef1 --- /dev/null +++ b/vars/gcc_native.vars @@ -0,0 +1 @@ +gcc.vars \ No newline at end of file diff --git a/vars/gcc_native_x86_64_w64_mingw32.vars b/vars/gcc_native_x86_64_w64_mingw32.vars new file mode 120000 index 0000000..55c0ef1 --- /dev/null +++ b/vars/gcc_native_x86_64_w64_mingw32.vars @@ -0,0 +1 @@ +gcc.vars \ No newline at end of file diff --git a/vars/gcc_runtime.vars b/vars/gcc_runtime.vars new file mode 120000 index 0000000..55c0ef1 --- /dev/null +++ b/vars/gcc_runtime.vars @@ -0,0 +1 @@ +gcc.vars \ No newline at end of file diff --git a/vars/gcc_stage1.vars b/vars/gcc_stage1.vars new file mode 120000 index 0000000..55c0ef1 --- /dev/null +++ b/vars/gcc_stage1.vars @@ -0,0 +1 @@ +gcc.vars \ No newline at end of file diff --git a/vars/gcc_stage1_x86_64_w64_mingw32.vars b/vars/gcc_stage1_x86_64_w64_mingw32.vars new file mode 120000 index 0000000..55c0ef1 --- /dev/null +++ b/vars/gcc_stage1_x86_64_w64_mingw32.vars @@ -0,0 +1 @@ +gcc.vars \ No newline at end of file diff --git a/vars/musl.vars b/vars/musl.vars new file mode 100644 index 0000000..bec1e06 --- /dev/null +++ b/vars/musl.vars @@ -0,0 +1,111 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# Order: no_complex, native, full +# + +pkgp_musl_configure() { + secure_rm ${PKG_BUILD_DIR}; + insecure_mkdir ${PKG_BUILD_DIR}; + secure_cd ${PKG_BUILD_DIR}; + env lz_cflags_cmdline="" \ + lz_debug="yes" \ + ../lazy/lazy \ + -a ${ARCH} \ + -c gcc \ + -f ${PKG_PREFIX} \ + -n musl \ + -p ../musl-${PKG_MUSL_VERSION} \ + -t ${lz_target} \ + -x config; +}; + +pkg_musl_no_complex_all() { + PKG_MUSL_VERSION="${PKG_MUSL_NO_COMPLEX_VERSION}"; + # Git clone what we need. + fetch_git lazy ${GITROOT}/lazy; + export lz_arch=${ARCH} lz_cflags_debug=-O2 lz_target=${TARGET}; + # Musl: build (no-complex) + _install=install_no_complex; + set_build_dir musl-${PKG_MUSL_VERSION}-${2} cross; + if ! is_build_script_done fetch; then + fetch http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz \ + ${PKG_MUSL_NO_COMPLEX_SHA256SUM}; + secure_rm mmglue; + fetch_git mmglue ${GITROOT}/mmglue; + set_build_script_done fetch -extract; + fi; + if ! is_build_script_done extract; then + secure_rm musl-${PKG_MUSL_VERSION}; + tar -xf ${DLCACHEDIR}/musl-${PKG_MUSL_VERSION}.tar.gz; + set +o noglob; cp -R -- mmglue/* musl-${PKG_MUSL_VERSION}/; set -o noglob; + set_build_script_done extract -configure; + fi; + if ! is_build_script_done configure; then + pkgp_musl_configure; + 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 + ./lazy -e ${_install} \ + -x build; + set_build_script_done build finish; + fi; +}; + +pkg_musl_native_all() { + PKG_MUSL_VERSION="${PKG_MUSL_NATIVE_VERSION}"; + # Git clone what we need. + fetch_git lazy ${GITROOT}/lazy; + export lz_arch=${ARCH} lz_cflags_debug=-O2 lz_target=${TARGET}; + # Musl: build (full) + _install=install; + set_build_dir musl-${PKG_MUSL_VERSION} native; + if ! is_build_script_done configure; then + pkgp_musl_configure; + 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 + ./lazy -e ${_install} \ + -x build; + ln -sf -- ../lib/libc.so ${PKG_PREFIX}/bin/ldd; + set_build_script_done build finish; + fi; +}; + +pkg_musl_full_all() { + PKG_MUSL_VERSION="${PKG_MUSL_FULL_VERSION}"; + # Git clone what we need. + fetch_git lazy ${GITROOT}/lazy; + export lz_arch=${ARCH} lz_cflags_debug=-O2 lz_target=${TARGET}; + # Musl: build (full) + _install=install; + set_build_dir musl-${PKG_MUSL_VERSION} cross; + if ! is_build_script_done configure; then + pkgp_musl_configure; + 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 + ./lazy -e ${_install} \ + -x build; + set_build_script_done build finish; + fi; +}; + +# vim:filetype=sh diff --git a/vars/musl_full.vars b/vars/musl_full.vars new file mode 120000 index 0000000..aed756b --- /dev/null +++ b/vars/musl_full.vars @@ -0,0 +1 @@ +musl.vars \ No newline at end of file diff --git a/vars/musl_native.vars b/vars/musl_native.vars new file mode 120000 index 0000000..aed756b --- /dev/null +++ b/vars/musl_native.vars @@ -0,0 +1 @@ +musl.vars \ No newline at end of file diff --git a/vars/musl_no_complex.vars b/vars/musl_no_complex.vars new file mode 120000 index 0000000..aed756b --- /dev/null +++ b/vars/musl_no_complex.vars @@ -0,0 +1 @@ +musl.vars \ No newline at end of file diff --git a/vars/psxstub.vars b/vars/psxstub.vars index cf18c4b..2dad9c4 100644 --- a/vars/psxstub.vars +++ b/vars/psxstub.vars @@ -2,7 +2,8 @@ # . ./build.vars and set -o errexit -o noglob are assumed. # -pkg_psxstub_finish() { +pkg_psxstub_all() { + pkg_fetch; if ! is_build_script_done install; then if [ "${TARGET}" = i686-nt32-midipix ] \ || [ "${TARGET}" = x86_64-nt64-midipix ]; then