Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

788 lines (711 sloc) 25.328 kb
#!/bin/bash
#
# The BSD 3-Clause License. http://www.opensource.org/licenses/BSD-3-Clause
#
# This file is part of 'MinGW-W64' project.
# Copyright (c) 2011,2012,2013 by niXman (i dotty nixman doggy gmail dotty com)
# Copyright (c) 2012,2013 by Alexpux (alexpux doggy gmail dotty com)
# All rights reserved.
#
# Project: MinGW-W64 ( http://sourceforge.net/projects/mingw-w64/ )
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the distribution.
# - Neither the name of the 'MinGW-W64' nor the names of its contributors may
# be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# **************************************************************************
# Loading functions
source library/functions.sh
readonly ORIGINAL_PATH=$PATH
readonly TOP_DIR=$(func_simplify_path "$PWD")
# **************************************************************************
# Loading default configuration
source library/default_config.sh
# **************************************************************************
readonly RUN_ARGS="$@"
[[ $# == 1 && $1 == --help || $[ $# == 0 ] == 1 ]] && {
echo "usage:"
echo " ./${0##*/} --mode=[clang|gcc|python]-version --arch=<i686|x86_64> [OPTIONS]"
echo " help:"
echo " --buildroot=<path> - specifies the build root directory"
echo " --fetch-only - download sources without building"
echo " --update-sources - try to update sources from repositories before build"
echo " --exceptions=<type> - specifies exceptions model for GCC"
echo " available: dwarf, seh, sjlj"
echo " --use-lto - build with LTO using"
echo " --bootstrap - bootstraping GCC"
echo " --no-multilib - build GCC without multilib support"
echo " --no-strip - don't strip dll's & executables on install"
echo " --static-gcc - build static GCC"
echo " --dyn-deps - build GCC with dynamically dependencies"
echo " --jobs=N - specifies number of parallel make threads"
echo " --rt-version=<v3|v4|trunk> - specifies mingw-w64 runtime version to build"
echo " --rev=N - specifies number of the build revision"
echo " --threads=<model> - specifies the threads model for GCC/libstdc++"
echo " available: win32, posix"
echo " --arch=<i686|x86_64> - specifies the architecture"
echo " --mode=<[clang|gcc|python]-version> - specify building software with version"
echo " --with-testsuite - run testsuite for packages if possible"
echo " --version - print the version of the MinGW-W64 builds scripts"
echo " --mingw-compress - compressing MinGW"
echo " --src-compress - compressing sources"
echo " --mingw-upload - upload toolchain archives to sf-project"
echo " --src-upload - upload sources archive to sf-project"
echo " --sf-user=<username> - username to upload to sf-project"
echo " --sf-password=<user_pass> - password to upload to sf-project"
echo " --cflags='<flags>' - additional CFLAGS"
echo " --cxxflags='<flags>' - additional CXXFLAGS"
echo " --cppflags='<flags>' - additional CPPFLAGS"
echo " --ldflags='<flags>' - additional LDFLAGS"
echo " --march-x32='<arch>' - arch for x32 target"
echo " --mtume-x32='<arch>' - tune for x32 target"
echo " --march-x64='<arch>' - arch for x64 target"
echo " --mtume-x64='<arch>' - tune for x64 target"
echo " --enable-languages=<langs> - comma separated list(without spaces) of gcc"
echo " supported languages. available languages:"
echo " ada,c,c++,fortran,objc,obj-c++"
echo " available Python versions: 2.7.3, 2.7.4, 2.7.5"
echo " available clang versions: 3.3, git"
echo " available gcc versions:"
echo " gcc-4.6.2 (4.6.2 release)"
echo " gcc-4.6.3 (4.6.3 release)"
echo " gcc-4.6.4 (4.6.4 release)"
#echo " gcc-4.6.5 (4.6.5 release)"
#echo " gcc-4.6.6 (4.6.6 release)"
echo " gcc-4.7.0 (4.7.0 release)"
echo " gcc-4.7.1 (4.7.1 release)"
echo " gcc-4.7.2 (4.7.2 release)"
echo " gcc-4.7.3 (4.7.3 release)"
#echo " gcc-4.7.4 (4.7.4 release)"
echo " gcc-4.8.0 (4.8.0 release)"
echo " gcc-4.8.1 (4.8.1 release)"
echo " gcc-4.8.2 (4.8.2 release)"
echo " gcc-4_6-branch (currently 4.6.5-prerelease)"
echo " gcc-4_7-branch (currently 4.7.4-prerelease)"
echo " gcc-4_8-branch (currently 4.8.3-prerelease)"
echo " gcc-trunk (currently 4.9.0-snapshot)"
exit 0
}
# **************************************************************************
while [[ $# > 0 ]]; do
case $1 in
--march-x32=*) PROCESSOR_OPTIMIZATION_ARCH_32=${1/--march-x32=/} ;;
--mtume-x32=*) PROCESSOR_OPTIMIZATION_TUNE_32=${1/--mtume-x32=/} ;;
--march-x64=*) PROCESSOR_OPTIMIZATION_ARCH_64=${1/--march-x64=/} ;;
--mtume-x64=*) PROCESSOR_OPTIMIZATION_TUNE_64=${1/--mtume-x64=/} ;;
--cflags=*) BASE_CFLAGS="$BASE_CFLAGS ${1/--cflags=/}" ;;
--cxxflags=*) BASE_CXXFLAGS="$BASE_CXXFLAGS ${1/--cxxflags=/}" ;;
--cppflags=*) BASE_CPPFLAGS="$BASE_CPPFLAGS ${1/--cppflags=/}" ;;
--ldflags=*) BASE_LDFLAGS="$BASE_LDFLAGS ${1/--ldflags=/}" ;;
--buildroot=*)
ROOT_DIR=${1/--buildroot=/}
ROOT_DIR=${ROOT_DIR//:/:\/}
ROOT_DIR=${ROOT_DIR//\/\//\/}
mkdir -p ${ROOT_DIR} || die "incorrect buildroot directory: \"${ROOT_DIR}\". terminate."
pushd ${ROOT_DIR} > /dev/null
ROOT_DIR=$PWD
popd > /dev/null
;;
--bootstrap) BOOTSTRAPING=yes ;;
--fetch-only) FETCH_MODE=yes ;;
--update-sources) UPDATE_SOURCES=yes ;;
--enable-languages=*)
func_check_languages "${1/--enable-languages=/}"
ENABLE_LANGUAGES=${1/--enable-languages=/}
;;
--exceptions=*)
EXCEPTIONS_MODEL=${1/--exceptions=/}
case $EXCEPTIONS_MODEL in
dwarf)
USE_MULTILIB=no
BUILD_ARCHITECTURE=i686
;;
seh)
USE_MULTILIB=no
BUILD_ARCHITECTURE=x86_64
;;
sjlj)
USE_MULTILIB=$USE_MULTILIB
;;
*)
die "\"$EXCEPTIONS_MODEL\" is not valid exception model. available models: dwarf, seh, sjlj. terminate."
;;
esac
;;
--use-lto)
BASE_CFLAGS="$BASE_CFLAGS -flto -fno-use-linker-plugin"
BASE_CXXFLAGS="$BASE_CXXFLAGS -flto -fno-use-linker-plugin"
BASE_LDFLAGS="$BASE_LDFLAGS -flto -fno-use-linker-plugin"
;;
--no-multilib) USE_MULTILIB=no ;;
--no-strip) STRIP_ON_INSTALL=no ;;
--static-gcc)
LINK_TYPE_GCC=$LINK_TYPE_STATIC
GCC_DEPS_LINK_TYPE=$LINK_TYPE_STATIC
BUILD_SHARED_GCC=no
LINK_TYPE_SUFFIX=static
;;
--dyn-deps)
[[ $BUILD_SHARED_GCC == yes ]] && {
GCC_DEPS_LINK_TYPE=$LINK_TYPE_SHARED
LINK_TYPE_SUFFIX=shared
}
;;
--jobs=*)
[[ ${1/--jobs=/} == 0 ]] && {
die "jobs value must be greater then 0. terminate."
}
JOBS=${1/--jobs=/}
;;
--rt-version=*)
RUNTIME_VERSION=${1/--rt-version=/}
case $RUNTIME_VERSION in
v3)
RUNTIME_BRANCH="stable/v3.x"
;;
v4|trunk)
RUNTIME_VERSION=v4
RUNTIME_BRANCH="trunk"
;;
*)
die "Unsupported runtime version $RUNTIME_VERSION."
;;
esac
;;
--threads=*)
THREADS_MODEL=${1/--threads=/}
case $THREADS_MODEL in
win32 | posix)
;;
*)
die "\"$THREADS_MODEL\" is not valid threads model. available models: posix, win32. terminate"
;;
esac
;;
--mode=*)
[[ ! -f $TOP_DIR/scripts/${1/--mode=/}.sh ]] && {
die "bad mode. Script ${1/--mode=/}.sh not found. terminate."
}
readonly BUILD_MODE_VERSION=${1/--mode=/}
readonly BUILD_VERSION=${BUILD_MODE_VERSION#*-}
readonly BUILD_MODE=${BUILD_MODE_VERSION%%-*}
readonly GCC_NAME=$BUILD_MODE_VERSION
[[ $BUILD_MODE != gcc && $BUILD_MODE != clang && $BUILD_MODE != python ]] && {
die "Unsupported mode: \"$BUILD_MODE.\" terminate."
}
;;
--arch=*)
readonly BUILD_ARCHITECTURE=${1/--arch=/}
case $BUILD_ARCHITECTURE in
i686|x86_64)
;;
*) die "Unsupported architecture: \"$BUILD_ARCHITECTURE\". terminate."
;;
esac
;;
--rev=*)
REV_NUM=${1/--rev=/}
MINGW_W64_PKG_STRING="rev$REV_NUM, $MINGW_W64_PKG_STRING"
;;
--with-testsuite)
PKG_RUN_TESTSUITE=yes
;;
--version) echo $MINGW_W64_BUILDS_VERSION; exit 0 ;;
--mingw-compress) COMPRESSING_MINGW=yes ;;
--src-compress) COMPRESSING_SRCS=yes ;;
--mingw-upload) UPLOAD_MINGW=yes ;;
--src-upload) UPLOAD_SOURCES=yes ;;
--sf-user=*) SF_USER=${1/--sf-user=/} ;;
--sf-password=*) SF_PASSWORD=${1/--sf-password=/} ;;
--debug-upload) DEBUG_UPLOAD=yes ;;
*)
die "bad command line: \"$1\". terminate."
;;
esac
shift
done
# **************************************************************************
[[ $UPLOAD_MINGW == yes || $UPLOAD_SOURCES == yes ]] && {
[[ -z $SF_USER ]] && { die "please specify sourceforge user login with '--sf-user=<user>'. terminate."; }
[[ -z $SF_PASSWORD ]] && { die "please specify sourceforge user password with '--sf-password=<password>'. terminate."; }
}
# **************************************************************************
# Create primary directories
# **************************************************************************
[[ ! -d $ROOT_DIR ]] && {
mkdir -p $ROOT_DIR
[[ $? == 0 ]] && {
rm -Rf $ROOT_DIR
} || {
die "bad build root directory. terminate."
}
}
readonly SRCS_DIR=$ROOT_DIR/src
readonly MARKERS_DIR=$SRCS_DIR/MARKERS
mkdir -p \
$SRCS_DIR \
$MARKERS_DIR
# **************************************************************************
# Determine operating system and load appropriate config
# **************************************************************************
source $TOP_DIR/library/os_detect.sh
# **************************************************************************
[[ -z ${BUILD_ARCHITECTURE} ]] && {
die "Build architecture is not specified. terminate."
}
[[ $BUILD_MODE == gcc ]] && {
[[ $IS_64BIT_HOST == no ]] && {
[[ $BUILD_ARCHITECTURE == x86_64 ]] && {
die "you can't build 64-bit toolchain using 32-bit OS. terminate."
}
[[ $USE_MULTILIB == yes ]] && {
die "you can't build multitarget MinGW using 32-bit OS. terminate."
}
}
case $EXCEPTIONS_MODEL in
dwarf)
[[ ${BUILD_ARCHITECTURE} == x86_64 ]] && {
die "DWARF exceptions not allowed on x86_64 architecture. terminate."
}
;;
seh)
[[ ${BUILD_ARCHITECTURE} == i686 ]] && {
die "SEH exceptions not allowed on i686 architecture. terminate."
}
;;
sjlj)
;;
esac
[[ $EXCEPTIONS_MODEL != sjlj && $USE_MULTILIB == yes ]] && {
die "\"$EXCEPTIONS_MODEL\" exceptions not allowed on multilib architecture. terminate."
}
}
[[ $[ $COMPRESSING_MINGW == yes || $COMPRESSING_SRCS == yes ] == 1 ]] && {
func_check_program "7za"
}
[[ $BUILD_MODE != gcc && $COMPRESSING_SRCS == yes ]] && {
die "compressing sources for \"$BUILD_MODE\" mode is currently unimplemented. terminate."
}
# **************************************************************************
# Creating necessary directories
# **************************************************************************
readonly PREREQ_DIR=$ROOT_DIR/prerequisites
readonly RUNTIME_DIR=$ROOT_DIR/runtime
readonly ARCHIVES_DIR=$ROOT_DIR/archives
readonly PREREQ_BUILD_DIR=$ROOT_DIR/prerequisites-build
readonly PREREQ_LOGS_DIR=$ROOT_DIR/prerequisites-logs
[[ -n $REV_NUM ]] && {
readonly REV_STRING="-r$REV_NUM"
} || {
readonly REV_STRING=""
}
[[ $BUILD_MODE == gcc ]] && {
GCC_PART_NAME=${GCC_NAME/gcc-/}
GCC_PART_NAME=${GCC_PART_NAME/-branch/b}
readonly GCC_PART_NAME=${GCC_PART_NAME//./}
BASE_BUILD_DIR=$ROOT_DIR/${BUILD_ARCHITECTURE}-$GCC_PART_NAME-$THREADS_MODEL-$EXCEPTIONS_MODEL-rt_${RUNTIME_VERSION}${REV_STRING}
MINGW_BUILD_NAME=${BUILD_ARCHITECTURE}-${GCC_NAME/gcc-/}
[[ $BUILD_SHARED_GCC == no ]] && {
BASE_BUILD_DIR=$BASE_BUILD_DIR-s
MINGW_BUILD_NAME=$MINGW_BUILD_NAME-static
}
MINGW_BUILD_NAME=$MINGW_BUILD_NAME$([[ $USE_MULTILIB == yes ]] && echo -n -multilib)-$THREADS_MODEL-$EXCEPTIONS_MODEL
readonly MINGW_BUILD_NAME=$MINGW_BUILD_NAME-rt_${RUNTIME_VERSION}$([[ -n $REV_NUM ]] && echo -n -rev$REV_NUM)
readonly MINGWPREFIX=/mingw$(func_get_arch_bit ${BUILD_ARCHITECTURE})
readonly PREFIX=${BASE_BUILD_DIR}${MINGWPREFIX}
readonly LIBS_DIR=$PREFIX/opt
[[ $USE_MULTILIB == yes ]] && {
readonly PROCESSOR_OPTIMIZATION="--with-arch-32=$PROCESSOR_OPTIMIZATION_ARCH_32 --with-arch-64=$PROCESSOR_OPTIMIZATION_ARCH_64"
readonly PROCESSOR_TUNE="--with-tune-32=$PROCESSOR_OPTIMIZATION_TUNE_32 --with-tune-64=$PROCESSOR_OPTIMIZATION_TUNE_64"
} || {
[[ $BUILD_ARCHITECTURE == i686 ]] && {
readonly PROCESSOR_OPTIMIZATION="--with-arch=$PROCESSOR_OPTIMIZATION_ARCH_32"
readonly PROCESSOR_TUNE="--with-tune=$PROCESSOR_OPTIMIZATION_TUNE_32"
} || {
readonly PROCESSOR_OPTIMIZATION="--with-arch=$PROCESSOR_OPTIMIZATION_ARCH_64"
readonly PROCESSOR_TUNE="--with-tune=$PROCESSOR_OPTIMIZATION_TUNE_64"
}
}
} || {
readonly BASE_BUILD_DIR=$ROOT_DIR/$BUILD_MODE-${BUILD_ARCHITECTURE}$REV_STRING
readonly PREFIX=$BASE_BUILD_DIR/${BUILD_MODE_VERSION}-${BUILD_ARCHITECTURE}
readonly LIBS_DIR=$PREFIX
}
readonly BUILDS_DIR=$BASE_BUILD_DIR/build
readonly LOGS_DIR=$BASE_BUILD_DIR/logs
mkdir -p \
$ARCHIVES_DIR \
$BASE_BUILD_DIR \
$PREFIX \
$BUILDS_DIR \
$LIBS_DIR \
$LOGS_DIR
[[ $BUILD_MODE == gcc ]] && {
mkdir -p \
$PREREQ_DIR \
$RUNTIME_DIR \
$PREREQ_BUILD_DIR \
$PREREQ_LOGS_DIR
}
# **************************************************************************
case $BUILD_ARCHITECTURE in
i686)
[[ ! -f $i686_HOST_MINGW_PATH/bin/gcc ]] && {
die "gcc is not exists in the \"$i686_HOST_MINGW_PATH/bin\" directory. terminate."
}
export PATH=$LIBS_DIR/bin:$i686_HOST_MINGW_PATH/bin:$ORIGINAL_PATH
;;
x86_64)
[[ ! -f $x86_64_HOST_MINGW_PATH/bin/gcc ]] && {
die "gcc is not exists in the \"$x86_64_HOST_MINGW_PATH/bin\" directory. terminate."
}
export PATH=$LIBS_DIR/bin:$x86_64_HOST_MINGW_PATH/bin:$ORIGINAL_PATH
;;
esac
[[ $LINK_TYPE_SUFFIX == shared ]] && {
export PATH=$PREREQ_DIR/$HOST-$LINK_TYPE_SUFFIX/bin:$PREREQ_DIR/$BUILD_ARCHITECTURE-libiconv-$LINK_TYPE_SUFFIX/bin:$PREREQ_DIR/$BUILD_ARCHITECTURE-zlib-$LINK_TYPE_SUFFIX/bin:$PATH
}
# **************************************************************************
readonly REVERSE_HOST=$(func_get_reverse_triplet $HOST)
readonly REVERSE_BUILD=$(func_get_reverse_triplet $BUILD)
readonly REVERSE_TARGET=$(func_get_reverse_triplet $TARGET)
readonly REVERSE_ARCHITECTURE=$(func_get_reverse_arch $BUILD_ARCHITECTURE)
[[ $USE_MULTILIB == yes ]] && {
readonly ENABLE_TARGETS=${TARGET},${REVERSE_TARGET}
} || {
readonly ENABLE_TARGETS=$TARGET
}
# **************************************************************************
readonly COMMON_CFLAGS="$BASE_CFLAGS -I$LIBS_DIR/include -I$PREREQ_DIR/${BUILD_ARCHITECTURE}-zlib-$LINK_TYPE_SUFFIX/include -I$PREREQ_DIR/$HOST-$LINK_TYPE_SUFFIX/include"
readonly COMMON_CXXFLAGS="$COMMON_CFLAGS"
readonly COMMON_CPPFLAGS="$BASE_CPPFLAGS"
readonly COMMON_LDFLAGS="$BASE_LDFLAGS -L$LIBS_DIR/lib -L$PREREQ_DIR/${BUILD_ARCHITECTURE}-zlib-$LINK_TYPE_SUFFIX/lib -L$PREREQ_DIR/$HOST-$LINK_TYPE_SUFFIX/lib"
# **************************************************************************
[[ $FETCH_MODE == yes ]] && {
echo -n "-> fetch sources for building ${BUILD_MODE_VERSION}-"
[[ $BUILD_MODE == gcc ]] && {
[[ $USE_MULTILIB == yes && $EXCEPTIONS_MODEL == sjlj ]] && echo -n "multilib-"
echo -n "${BUILD_ARCHITECTURE}-"
echo "$EXCEPTIONS_MODEL"
} || {
echo -n "${BUILD_ARCHITECTURE}"
}
} || {
[[ $BUILD_MODE == gcc ]] && {
echo "-> start building $MINGW_BUILD_NAME"
} || {
echo "-> start building ${BUILD_MODE_VERSION}-${BUILD_ARCHITECTURE}"
}
}
# **************************************************************************
source $TOP_DIR/library/subtargets.sh
readonly SUBTARGETS=( \
$(fun_get_subtargets \
$BUILD_MODE \
$BUILD_VERSION \
) \
)
for rule in ${SUBTARGETS[@]}; do
func_clear_env
rule_arr=( ${rule//|/ } )
sub=${rule_arr[0]}
PKG_ARCHITECTURE=${rule_arr[1]}
[[ -z $PKG_ARCHITECTURE ]] && {
PKG_ARCHITECTURE=$BUILD_ARCHITECTURE
echo -e "-> \E[32;40m$sub\E[37;40m"
} || {
echo -e "-> \E[32;40m$sub-$PKG_ARCHITECTURE\E[37;40m"
}
[[ ! -f $TOP_DIR/scripts/$sub.sh ]] && {
die "script for subtarget \"$sub\" is not exists. terminate."
}
[[ $FETCH_MODE == yes ]] && {
[[ -z $( grep 'PKG_URLS=' $TOP_DIR/scripts/${sub}.sh ) ]] && continue
}
[[ "$PKG_ARCHITECTURE" == "$REVERSE_ARCHITECTURE" ]] && {
switch_to_reverse_arch $PKG_ARCHITECTURE
}
source $TOP_DIR/scripts/$sub.sh
[[ -z $PKG_NAME ]] && continue
case $PKG_PRIORITY in
prereq | runtime)
CURR_LOGS_DIR=$PREREQ_LOGS_DIR
CURR_BUILD_DIR=$PREREQ_BUILD_DIR
;;
main | extra)
CURR_LOGS_DIR=$LOGS_DIR
CURR_BUILD_DIR=$BUILDS_DIR
;;
*)
CURR_LOGS_DIR=$LOGS_DIR
CURR_BUILD_DIR=$BUILDS_DIR
;;
esac
CONFIGURE_LOG=$CURR_LOGS_DIR/$PKG_NAME/configure.log
MAKE_LOG=$CURR_LOGS_DIR/$PKG_NAME/make.log
INSTALL_LOG=$CURR_LOGS_DIR/$PKG_NAME/install.log
TESTSUITE_LOG=$CURR_LOGS_DIR/$PKG_NAME/testsuite.log
mkdir -p $SRCS_DIR/$PKG_DIR_NAME
mkdir -p {$CURR_LOGS_DIR/,$CURR_BUILD_DIR/}$PKG_NAME
[[ -n $PKG_SUBDIR_NAME ]] && { mkdir -p $CURR_BUILD_DIR/$PKG_NAME/$PKG_SUBDIR_NAME; }
#[[ $PKG_NAME != $PKG_DIR_NAME ]] && mkdir -p {$BUILDS_DIR/,$LOGS_DIR/}$PKG_NAME
func_download \
PKG_URLS[@]
func_uncompress \
PKG_URLS[@]
[[ $FETCH_MODE == no ]] && {
[[ ${#PKG_EXECUTE_AFTER_UNCOMPRESS[@]} >0 ]] && {
func_execute \
$SRCS_DIR \
$PKG_DIR_NAME \
"execute commands..." \
"after_unpack" \
$CURR_LOGS_DIR \
PKG_EXECUTE_AFTER_UNCOMPRESS[@]
}
func_apply_patches \
$SRCS_DIR \
$PKG_DIR_NAME \
$CURR_LOGS_DIR \
$PATCHES_DIR \
PKG_PATCHES[@]
[[ ${#PKG_EXECUTE_AFTER_PATCH[@]} >0 ]] && {
func_execute \
$SRCS_DIR \
$PKG_DIR_NAME \
"execute commands..." \
"after_patch" \
$CURR_LOGS_DIR \
PKG_EXECUTE_AFTER_PATCH[@]
}
[[ -z $PKG_LNDIR ]] && { PKG_LNDIR=no; }
[[ -z $PKG_CONFIGURE_SCRIPT ]] && { PKG_CONFIGURE_SCRIPT=configure; }
[[ -z $PKG_MAKE_PROG ]] && { PKG_MAKE_PROG=/bin/make; }
[[ -z $PKG_CONFIGURE_PROG ]] && { PKG_CONFIGURE_PROG=/bin/sh; }
[[ ${#PKG_CONFIGURE_FLAGS[@]} >0 ]] && {
configure_flags="${PKG_CONFIGURE_FLAGS[@]}"
func_configure \
$PKG_NAME \
$PKG_DIR_NAME \
"$configure_flags" \
$CONFIGURE_LOG \
$CURR_BUILD_DIR \
$PKG_LNDIR \
$PKG_SUBDIR_NAME
}
[[ ${#PKG_EXECUTE_AFTER_CONFIGURE[@]} >0 ]] && {
func_execute \
$CURR_BUILD_DIR \
$PKG_NAME \
"execute commands..." \
"after_configure" \
$CURR_LOGS_DIR \
PKG_EXECUTE_AFTER_CONFIGURE[@]
}
[[ ${#PKG_MAKE_FLAGS[@]} >0 ]] && {
make_flags="$PKG_MAKE_PROG ${PKG_MAKE_FLAGS[@]}"
func_make \
$PKG_NAME \
$PKG_DIR_NAME \
"$make_flags" \
$MAKE_LOG \
"building..." \
"built" \
$CURR_BUILD_DIR \
$PKG_SUBDIR_NAME
}
[[ ${#PKG_INSTALL_FLAGS[@]} >0 ]] && {
install_flags="$PKG_MAKE_PROG ${PKG_INSTALL_FLAGS[@]}"
func_make \
$PKG_NAME \
$PKG_DIR_NAME \
"$install_flags" \
$INSTALL_LOG \
"installing..." \
"installed" \
$CURR_BUILD_DIR \
$PKG_SUBDIR_NAME
}
[[ ${#PKG_EXECUTE_AFTER_INSTALL[@]} >0 ]] && {
func_execute \
$CURR_BUILD_DIR \
$PKG_NAME \
"execute commands..." \
"after_install" \
$CURR_LOGS_DIR \
PKG_EXECUTE_AFTER_INSTALL[@]
}
[[ $PKG_RUN_TESTSUITE == yes ]] && {
[[ ${#PKG_TESTSUITE_FLAGS[@]} >0 ]] && {
testsuite_flags="$PKG_MAKE_PROG ${PKG_TESTSUITE_FLAGS[@]}"
func_make \
$PKG_NAME \
$PKG_DIR_NAME \
"$testsuite_flags" \
$TESTSUITE_LOG \
"run testsuite..." \
"tested" \
$CURR_BUILD_DIR \
$PKG_SUBDIR_NAME
}
}
}
[[ "$PKG_ARCHITECTURE" == "$REVERSE_ARCHITECTURE" ]] && {
switch_back_to_arch
}
done
func_clear_env
[[ $FETCH_MODE == yes ]] && {
echo "Sources downloaded successfully."
exit 0
}
# ***************************************************************************
[[ $COMPRESSING_SRCS == yes ]] && {
echo -e "-> \E[32;40mcompress mingw sources\E[37;40m"
source $TOP_DIR/scripts/srcs-compress.sh
}
# ***************************************************************************
[[ $UPLOAD_MINGW == yes ]] && {
mingw_archive_name=$( \
func_create_mingw_archive_name \
$ARCHIVES_DIR \
$SRCS_DIR \
$GCC_NAME \
$BUILD_ARCHITECTURE \
$EXCEPTIONS_MODEL \
$THREADS_MODEL \
$REV_NUM \
)
upload_cmd=$( \
func_create_mingw_upload_cmd \
$ARCHIVES_DIR \
$SF_USER \
$SF_PASSWORD \
$GCC_NAME \
$mingw_archive_name \
$BUILD_ARCHITECTURE \
$THREADS_MODEL \
$EXCEPTIONS_MODEL \
)
mingw_archive_size=$(du -h $mingw_archive_name | cut -f 1)
echo -e -n "-> \E[32;40mupload $(basename $mingw_archive_name) ($mingw_archive_size) ...\E[37;40m"
[[ $DEBUG_UPLOAD == yes ]] && {
echo
echo "bin_cmd:${upload_cmd}"
} || {
eval "${upload_cmd} > $LOGS_DIR/$GCC_NAME/${BUILD_ARCHITECTURE}-mingw-upload.log 2>&1"
func_res=$?
[[ $func_res != 0 ]] && {
echo " error!"
func_show_log $LOGS_DIR/$GCC_NAME/${BUILD_ARCHITECTURE}-mingw-upload.log
die "upload finished with error($func_res). terminate." $func_res
} || {
echo " done"
}
}
[[ $(func_map_gcc_name_to_gcc_type $GCC_NAME) == release ]] && {
echo -e -n "--> \E[32;40mdownload repository file...\E[37;40m"
[[ $DEBUG_UPLOAD == yes ]] && {
func_res=0
} || {
wget $REPOSITORY_FILE -O $TMP/$(basename $REPOSITORY_FILE) > $LOGS_DIR/$GCC_NAME/${BUILD_ARCHITECTURE}-repository-download.log 2>&1
func_res=$?
}
[[ $func_res != 0 ]] && {
func_show_log $LOGS_DIR/$GCC_NAME/${BUILD_ARCHITECTURE}-repository-download.log
die " error($func_res) when downloading repository file. terminate." $func_res
} || {
echo " done"
}
echo -e -n "--> \E[32;40mupdate repository file...\E[37;40m"
[[ $DEBUG_UPLOAD == no ]] && {
func_update_repository_file \
$TMP/$(basename $REPOSITORY_FILE) \
$(func_map_gcc_name_to_gcc_version $GCC_NAME) \
$BUILD_ARCHITECTURE \
$THREADS_MODEL \
$EXCEPTIONS_MODEL \
$REV_NUM \
$(func_create_url_for_archive \
$PROJECT_ROOT_URL \
$GCC_NAME \
$BUILD_ARCHITECTURE \
$THREADS_MODEL \
$EXCEPTIONS_MODEL \
) \
$(basename $mingw_archive_name)
}
echo " done"
upload_cmd=$( \
func_create_repository_file_upload_cmd \
$TMP/$(basename $REPOSITORY_FILE) \
$SF_USER \
$SF_PASSWORD \
)
echo -e -n "--> \E[32;40mupload repository file...\E[37;40m"
[[ $DEBUG_UPLOAD == yes ]] && {
echo "rep_cmd:${upload_cmd}"
} || {
eval "${upload_cmd} > $LOGS_DIR/$GCC_NAME/${BUILD_ARCHITECTURE}-repository-upload.log 2>&1"
func_res=$?
[[ $func_res != 0 ]] && {
func_show_log $LOGS_DIR/$GCC_NAME/${BUILD_ARCHITECTURE}-repository-upload.log
die " error($func_res) when uploading repository file. terminate." $func_res
} || {
echo " done"
}
}
}
}
[[ $UPLOAD_SOURCES == yes ]] && {
sources_archive_name=$( \
func_create_sources_archive_name \
$ARCHIVES_DIR \
$SRCS_DIR \
$GCC_NAME \
$REV_NUM \
)
upload_cmd=$( \
func_create_sources_upload_cmd \
$ARCHIVES_DIR \
$SF_USER \
$SF_PASSWORD \
$GCC_NAME \
$sources_archive_name \
)
sources_archive_size=$(du -h $sources_archive_name | cut -f 1)
echo -e -n "-> \E[32;40mupload $(basename $sources_archive_name) ($sources_archive_size) ...\E[37;40m"
[[ $DEBUG_UPLOAD == yes ]] && {
echo "src_cmd:${upload_cmd}"
} || {
eval "${upload_cmd} > $LOGS_DIR/$GCC_NAME/sources-upload.log 2>&1"
}
func_res=$?
[[ $func_res != 0 ]] && {
func_show_log $LOGS_DIR/$GCC_NAME/sources-upload.log
die " upload finished with error($func_res). terminate." $func_res
} || {
echo " done"
}
}
exit 0
# ***************************************************************************
Jump to Line
Something went wrong with that request. Please try again.