mirror of
https://github.com/richfelker/musl-cross-make.git
synced 2025-04-18 15:04:59 +02:00
Feat: update build script, china mirror, build config
This commit is contained in:
parent
eba4523bd5
commit
dedd7d04da
76
Makefile
76
Makefile
@ -1,7 +1,7 @@
|
||||
SOURCES = sources
|
||||
|
||||
CONFIG_SUB_REV = 28ea239c53a2
|
||||
GCC_VER = 11.4.0
|
||||
GCC_VER = 13.2.0
|
||||
MUSL_VER = 1.2.4
|
||||
BINUTILS_VER = 2.41
|
||||
GMP_VER = 6.3.0
|
||||
@ -10,35 +10,7 @@ MPFR_VER = 4.2.1
|
||||
ISL_VER =
|
||||
LINUX_VER =
|
||||
MINGW_VER = v11.0.1
|
||||
|
||||
ifeq ($(CHINA),)
|
||||
GNU_SITE = https://ftp.gnu.org/gnu
|
||||
|
||||
SOURCEFORGE_MIRROT = https://downloads.sourceforge.net
|
||||
|
||||
GCC_SNAP = https://sourceware.org/pub/gcc/snapshots
|
||||
|
||||
LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel
|
||||
else
|
||||
GNU_SITE = https://mirrors.ustc.edu.cn/gnu
|
||||
|
||||
SOURCEFORGE_MIRROT = https://jaist.dl.sourceforge.net
|
||||
|
||||
GCC_SNAP = https://mirrors.tuna.tsinghua.edu.cn/sourceware/gcc/snapshots
|
||||
|
||||
LINUX_SITE = https://mirrors.ustc.edu.cn/kernel.org/linux/kernel
|
||||
endif
|
||||
|
||||
MUSL_SITE = https://musl.libc.org/releases
|
||||
MUSL_REPO = https://git.musl-libc.org/git/musl
|
||||
GCC_SITE = $(GNU_SITE)/gcc
|
||||
BINUTILS_SITE = $(GNU_SITE)/binutils
|
||||
GMP_SITE = $(GNU_SITE)/gmp
|
||||
MPC_SITE = $(GNU_SITE)/mpc
|
||||
MPFR_SITE = $(GNU_SITE)/mpfr
|
||||
ISL_SITE = $(SOURCEFORGE_MIRROT)/project/libisl
|
||||
MINGW_SITE = $(SOURCEFORGE_MIRROT)/project/mingw-w64/mingw-w64/mingw-w64-release
|
||||
LINUX_HEADERS_SITE = https://ftp.barfooze.de/pub/sabotage/tarballs
|
||||
CHINA =
|
||||
|
||||
# curl --progress-bar -Lo <file> <url>
|
||||
DL_CMD = curl --progress-bar -Lo
|
||||
@ -54,6 +26,42 @@ REL_TOP = ../../..
|
||||
|
||||
-include config.mak
|
||||
|
||||
ifneq ($(CHINA),)
|
||||
GNU_SITE = https://mirrors.ustc.edu.cn/gnu
|
||||
|
||||
SOURCEFORGE_MIRROT = https://jaist.dl.sourceforge.net
|
||||
|
||||
GCC_SNAP = https://mirrors.tuna.tsinghua.edu.cn/sourceware/gcc/snapshots
|
||||
|
||||
LINUX_SITE = https://mirrors.ustc.edu.cn/kernel.org/linux/kernel
|
||||
else
|
||||
GNU_SITE = https://ftp.gnu.org/gnu
|
||||
|
||||
SOURCEFORGE_MIRROT = https://downloads.sourceforge.net
|
||||
|
||||
GCC_SNAP = https://sourceware.org/pub/gcc/snapshots
|
||||
|
||||
LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel
|
||||
endif
|
||||
|
||||
MUSL_SITE = https://musl.libc.org/releases
|
||||
MUSL_REPO = https://git.musl-libc.org/git/musl
|
||||
GCC_SITE = $(GNU_SITE)/gcc
|
||||
BINUTILS_SITE = $(GNU_SITE)/binutils
|
||||
GMP_SITE = $(GNU_SITE)/gmp
|
||||
MPC_SITE = $(GNU_SITE)/mpc
|
||||
MPFR_SITE = $(GNU_SITE)/mpfr
|
||||
ISL_SITE = $(SOURCEFORGE_MIRROT)/project/libisl
|
||||
MINGW_SITE = $(SOURCEFORGE_MIRROT)/project/mingw-w64/mingw-w64/mingw-w64-release
|
||||
LINUX_HEADERS_SITE = https://ftp.barfooze.de/pub/sabotage/tarballs
|
||||
|
||||
ifneq ($(findstring musl,$(TARGET)),)
|
||||
MINGW_VER =
|
||||
else
|
||||
MUSL_VER =
|
||||
LINUX_VER =
|
||||
endif
|
||||
|
||||
SRC_DIRS = gcc-$(GCC_VER) binutils-$(BINUTILS_VER) \
|
||||
$(if $(MUSL_VER),musl-$(MUSL_VER)) \
|
||||
$(if $(GMP_VER),gmp-$(GMP_VER)) \
|
||||
@ -69,7 +77,7 @@ clean:
|
||||
rm -rf gcc-* binutils-* musl-* gmp-* mpc-* mpfr-* isl-* build build-* linux-* mingw-w64-*
|
||||
|
||||
distclean: clean
|
||||
rm -rf sources
|
||||
rm -rf sources dist
|
||||
|
||||
check:
|
||||
@echo "check bzip2"
|
||||
@ -137,7 +145,7 @@ musl-git-%:
|
||||
case "$@" in */*) exit 1 ;; esac
|
||||
rm -rf $@.tmp
|
||||
mkdir $@.tmp
|
||||
( cd $@.tmp && tar -zxvf - ) < $<
|
||||
( cd $@.tmp && tar -zxvf - > /dev/null ) < $<
|
||||
rm -rf $@
|
||||
touch $@.tmp/$(patsubst %.orig,%,$@)
|
||||
mv $@.tmp/$(patsubst %.orig,%,$@) $@
|
||||
@ -147,7 +155,7 @@ musl-git-%:
|
||||
case "$@" in */*) exit 1 ;; esac
|
||||
rm -rf $@.tmp
|
||||
mkdir $@.tmp
|
||||
( cd $@.tmp && tar -jxvf - ) < $<
|
||||
( cd $@.tmp && tar -jxvf - > /dev/null ) < $<
|
||||
rm -rf $@
|
||||
touch $@.tmp/$(patsubst %.orig,%,$@)
|
||||
mv $@.tmp/$(patsubst %.orig,%,$@) $@
|
||||
@ -157,7 +165,7 @@ musl-git-%:
|
||||
case "$@" in */*) exit 1 ;; esac
|
||||
rm -rf $@.tmp
|
||||
mkdir $@.tmp
|
||||
( cd $@.tmp && tar -Jxvf - ) < $<
|
||||
( cd $@.tmp && tar -Jxvf - > /dev/null ) < $<
|
||||
rm -rf $@
|
||||
touch $@.tmp/$(patsubst %.orig,%,$@)
|
||||
mv $@.tmp/$(patsubst %.orig,%,$@) $@
|
||||
|
1
hashes/gcc-13.2.0.tar.xz.sha1
Normal file
1
hashes/gcc-13.2.0.tar.xz.sha1
Normal file
@ -0,0 +1 @@
|
||||
5f95b6d042fb37d45c6cbebfc91decfbc4fb493c gcc-13.2.0.tar.xz
|
@ -1,4 +1,3 @@
|
||||
|
||||
OUTPUT = $(CURDIR)/output
|
||||
|
||||
BINUTILS_SRCDIR = BINUTILS_SRCDIR_not_set
|
||||
@ -10,6 +9,10 @@ GCC_CONFIG =
|
||||
MINGW_CRT_CONFIG =
|
||||
MINGW_HEADERS_CONFIG =
|
||||
TOOLCHAIN_CONFIG =
|
||||
FULL_CC =
|
||||
FULL_CXX =
|
||||
FULL_FC =
|
||||
STATIC =
|
||||
|
||||
XGCC_DIR = $(CURDIR)/obj_gcc/gcc
|
||||
XGCC = $(XGCC_DIR)/xgcc -B $(XGCC_DIR) -B $(CURDIR)/obj_sysroot/$(TARGET)/lib
|
||||
@ -26,24 +29,49 @@ ifeq ($(CPUS),)
|
||||
CPUS = $(shell if command -v nproc >/dev/null 2>&1; then nproc; else echo 1; fi)
|
||||
endif
|
||||
|
||||
ifneq ($(findstring mingw,$(TARGET)),)
|
||||
MUSL_SRCDIR =
|
||||
LINUX_SRCDIR =
|
||||
ifeq ($(CC_COMPILER),)
|
||||
FULL_CC = gcc
|
||||
else
|
||||
FULL_CC = $(CC_COMPILER)
|
||||
endif
|
||||
|
||||
ifeq ($(CXX_COMPILER),)
|
||||
FULL_CXX = g++
|
||||
else
|
||||
FULL_CXX = $(CXX_COMPILER)
|
||||
endif
|
||||
|
||||
ifeq ($(FC_COMPILER),)
|
||||
FULL_FC = gfortran
|
||||
else
|
||||
FULL_FC = $(FC_COMPILER)
|
||||
endif
|
||||
|
||||
ifeq ($(STATIC),)
|
||||
COMMON_CONFIG += CC="$(FULL_CC)" CXX="$(FULL_CXX)" FC="$(FULL_FC)
|
||||
else
|
||||
COMMON_CONFIG += CC="$(FULL_CC) -static --static" CXX="$(FULL_CXX) -static --static" FC="$(FULL_FC) -static --static"
|
||||
endif
|
||||
|
||||
ifneq ($(findstring musl,$(TARGET)),)
|
||||
MINGW_SRCDIR =
|
||||
# https://wiki.musl-libc.org/getting-started.html#Notes_on_ARM_Float_Mode
|
||||
ifeq ($(findstring armv5,$(TARGET)),armv5)
|
||||
GCC_CONFIG += --with-arch=armv5te --with-fpu=vfp
|
||||
endif
|
||||
# # https://wiki.musl-libc.org/getting-started.html#Notes_on_ARM_Float_Mode
|
||||
# ifeq ($(findstring armv5,$(TARGET)),armv5)
|
||||
# GCC_CONFIG += --with-arch=armv5te --with-fpu=vfp
|
||||
# endif
|
||||
|
||||
ifeq ($(findstring armv6,$(TARGET)),armv6)
|
||||
GCC_CONFIG += --with-arch=armv6 --with-fpu=vfp
|
||||
endif
|
||||
# ifeq ($(findstring armv6,$(TARGET)),armv6)
|
||||
# GCC_CONFIG += --with-arch=armv6 --with-fpu=vfp
|
||||
# endif
|
||||
|
||||
ifeq ($(findstring armv7,$(TARGET)),armv7)
|
||||
GCC_CONFIG += --with-arch=armv7-a --with-fpu=vfpv3
|
||||
# ifeq ($(findstring armv7,$(TARGET)),armv7)
|
||||
# GCC_CONFIG += --with-arch=armv7-a --with-fpu=vfpv3
|
||||
# endif
|
||||
else
|
||||
MUSL_SRCDIR =
|
||||
LINUX_SRCDIR =
|
||||
ifneq ($(findstring x86_64,$(TARGET)),)
|
||||
MINGW_CRT_CONFIG += --disable-lib32 --enable-lib64 --disable-libarm32
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -85,23 +113,6 @@ ifneq ($(filter %hf,$(TARGET)),)
|
||||
GCC_CONFIG_FOR_TARGET += --with-float=hard
|
||||
endif
|
||||
|
||||
ifneq ($(findstring mingw,$(TARGET)),)
|
||||
ifneq ($(findstring x86_64,$(TARGET)),)
|
||||
MINGW_CRT_CONFIG += --disable-lib32 --enable-lib64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(findstring musl,$(TARGET)),)
|
||||
ifneq ($(findstring 64,$(TARGET)),)
|
||||
ifeq ($(findstring 32,$(TARGET)),)
|
||||
MINGW_CRT_CONFIG += --disable-lib32 --enable-lib64
|
||||
endif
|
||||
endif
|
||||
ifneq ($(findstring aarch,$(TARGET)),)
|
||||
MINGW_CRT_CONFIG += --disable-libarm32 --enable-libarm64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(LIBTOOL),)
|
||||
LIBTOOL_ARG = LIBTOOL=$(LIBTOOL)
|
||||
endif
|
||||
@ -111,58 +122,50 @@ MAKE += INFO_DEPS= infodir=
|
||||
MAKE += ac_cv_prog_lex_root=lex.yy
|
||||
MAKE += MAKEINFO=false
|
||||
|
||||
COMMON_CONFIG += --disable-werror \
|
||||
--target=$(TARGET) --prefix= \
|
||||
--libdir=/lib --disable-multilib --disable-multiarch
|
||||
|
||||
GCC_CONFIG += --disable-bootstrap \
|
||||
--disable-assembly \
|
||||
--with-sysroot=$(SYSROOT) \
|
||||
--disable-decimal-float \
|
||||
--enable-libquadmath --enable-libquadmath-support \
|
||||
--enable-deterministic-archives \
|
||||
--enable-default-pie --enable-static-pie --disable-cet
|
||||
|
||||
FULL_BINUTILS_CONFIG = \
|
||||
--disable-separate-code \
|
||||
$(COMMON_CONFIG) $(BINUTILS_CONFIG) $(TOOLCHAIN_CONFIG) \
|
||||
--disable-werror \
|
||||
--target=$(TARGET) --prefix= \
|
||||
--libdir=/lib --disable-multilib \
|
||||
--with-sysroot=$(SYSROOT) \
|
||||
--enable-deterministic-archives
|
||||
--enable-deterministic-archives \
|
||||
--enable-gold=yes
|
||||
|
||||
ifneq ($(findstring mingw,$(TARGET)),)
|
||||
# mingw
|
||||
FULL_GCC_CONFIG = --enable-languages=c,c++,fortran \
|
||||
$(GCC_CONFIG_FOR_TARGET) \
|
||||
$(COMMON_CONFIG) $(GCC_CONFIG) $(TOOLCHAIN_CONFIG) \
|
||||
--disable-bootstrap \
|
||||
--disable-assembly \
|
||||
--disable-werror \
|
||||
--target=$(TARGET) --prefix= \
|
||||
--libdir=/lib --disable-multilib \
|
||||
--with-sysroot=$(SYSROOT) \
|
||||
--enable-fully-dynamic-string \
|
||||
--enable-libstdcxx-time=yes \
|
||||
--enable-libstdcxx-filesystem-ts=yes \
|
||||
--enable-cloog-backend=isl \
|
||||
--disable-sjlj-exceptions \
|
||||
--disable-multilib \
|
||||
--with-dwarf2 \
|
||||
--enable-deterministic-archives \
|
||||
--enable-libquadmath --enable-libquadmath-support \
|
||||
--disable-decimal-float \
|
||||
--enable-threads=win32 \
|
||||
$(OVERRIDE)
|
||||
endif
|
||||
|
||||
ifneq ($(findstring musl,$(TARGET)),)
|
||||
else
|
||||
# musl
|
||||
FULL_GCC_CONFIG = --enable-languages=c,c++,fortran \
|
||||
$(GCC_CONFIG_FOR_TARGET) \
|
||||
$(COMMON_CONFIG) $(GCC_CONFIG) $(TOOLCHAIN_CONFIG) \
|
||||
--disable-bootstrap \
|
||||
--disable-assembly \
|
||||
--disable-werror \
|
||||
--target=$(TARGET) --prefix= \
|
||||
--libdir=/lib --disable-multilib \
|
||||
--with-sysroot=$(SYSROOT) \
|
||||
--enable-tls \
|
||||
--disable-libmudflap --disable-libsanitizer \
|
||||
--disable-gnu-indirect-function \
|
||||
--disable-libmpx \
|
||||
--enable-initfini-array \
|
||||
--enable-libstdcxx-time=rt \
|
||||
--enable-deterministic-archives \
|
||||
--enable-libstdcxx-time \
|
||||
--enable-libquadmath --enable-libquadmath-support \
|
||||
--disable-decimal-float \
|
||||
$(OVERRIDE)
|
||||
endif
|
||||
|
||||
@ -180,7 +183,7 @@ FULL_MINGW_PTHREADS_CONFIG = $(MINGW_CONFIG) \
|
||||
--prefix= --host=$(TARGET) --with-sysroot=$(SYSROOT)
|
||||
|
||||
ifneq ($(NATIVE),)
|
||||
HOST:=$(TARGET)
|
||||
HOST := $(TARGET)
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD),)
|
||||
@ -217,8 +220,7 @@ obj_musl/.lc_built: | obj_gcc/$(TARGET)/libgcc/libgcc.a
|
||||
obj_gcc/gcc/.lc_built: | obj_sysroot/usr obj_sysroot/lib32 obj_sysroot/lib64 obj_sysroot/include
|
||||
ifneq ($(MUSL_SRCDIR),)
|
||||
obj_gcc/.lc_built: | obj_sysroot/.lc_libs obj_sysroot/.lc_headers
|
||||
endif
|
||||
ifneq ($(MINGW_SRCDIR),)
|
||||
else
|
||||
obj_gcc/.lc_built: | obj_sysroot/.lc_libs_crt obj_sysroot/.lc_headers
|
||||
endif
|
||||
obj_gcc/.lc_configured: obj_binutils/.lc_built
|
||||
@ -239,20 +241,12 @@ install: all
|
||||
|
||||
else
|
||||
|
||||
ifneq ($(MUSL_SRCDIR),)
|
||||
all: musl gcc binutils
|
||||
endif
|
||||
|
||||
ifneq ($(MINGW_SRCDIR),)
|
||||
ifeq ($(MUSL_SRCDIR),)
|
||||
all: mingw gcc binutils
|
||||
endif
|
||||
|
||||
ifneq ($(MUSL_SRCDIR),)
|
||||
install: install-musl install-gcc install-binutils
|
||||
endif
|
||||
|
||||
ifneq ($(MINGW_SRCDIR),)
|
||||
install: install-mingw install-gcc install-binutils
|
||||
else
|
||||
all: musl gcc binutils
|
||||
install: install-musl install-gcc install-binutils
|
||||
endif
|
||||
|
||||
musl: obj_musl/.lc_built
|
||||
@ -275,15 +269,11 @@ src_binutils: | $(BINUTILS_SRCDIR)
|
||||
src_gcc_base: | $(GCC_SRCDIR)
|
||||
ln -sf $(GCC_SRCDIR) $@
|
||||
|
||||
ifneq ($(MUSL_SRCDIR),)
|
||||
src_musl: | $(MUSL_SRCDIR)
|
||||
ln -sf $(MUSL_SRCDIR) $@
|
||||
endif
|
||||
|
||||
ifneq ($(MINGW_SRCDIR),)
|
||||
src_mingw: | $(MINGW_SRCDIR)
|
||||
ln -sf $(MINGW_SRCDIR) $@
|
||||
endif
|
||||
|
||||
ifneq ($(GMP_SRCDIR),)
|
||||
src_gcc: src_gmp
|
||||
@ -358,41 +348,33 @@ obj_gcc/.lc_mpc_built: | obj_gcc/.lc_mpfr_built
|
||||
cd obj_gcc && $(MAKE) -j$(CPUS) MAKE="$(MAKE) $(LIBTOOL_STATIC_ARG)" all-mpc
|
||||
touch $@
|
||||
|
||||
ifneq ($(MUSL_SRCDIR),)
|
||||
ifeq ($(MUSL_SRCDIR),)
|
||||
obj_gcc/gcc/.lc_built: | obj_gcc/.lc_mpc_built obj_sysroot/.lc_headers
|
||||
cd obj_gcc && $(MAKE) -j$(CPUS) MAKE="$(MAKE) $(LIBTOOL_ARG)" all-gcc
|
||||
touch $@
|
||||
else
|
||||
obj_gcc/gcc/.lc_built: | obj_gcc/.lc_mpc_built
|
||||
cd obj_gcc && $(MAKE) -j$(CPUS) MAKE="$(MAKE) $(LIBTOOL_ARG)" all-gcc
|
||||
touch $@
|
||||
endif
|
||||
|
||||
ifneq ($(MINGW_SRCDIR),)
|
||||
obj_gcc/gcc/.lc_built: | obj_gcc/.lc_mpc_built obj_sysroot/.lc_headers
|
||||
cd obj_gcc && $(MAKE) -j$(CPUS) MAKE="$(MAKE) $(LIBTOOL_ARG)" all-gcc
|
||||
touch $@
|
||||
endif
|
||||
|
||||
ifneq ($(MUSL_SRCDIR),)
|
||||
obj_musl/.lc_configured: | obj_musl src_musl
|
||||
cd obj_musl && ../src_musl/configure $(FULL_MUSL_CONFIG)
|
||||
touch $@
|
||||
endif
|
||||
|
||||
ifneq ($(MINGW_SRCDIR),)
|
||||
obj_mingw/.lc_configured: | obj_mingw src_mingw obj_mingw_headers/.lc_configured obj_mingw_crt/.lc_configured
|
||||
touch $@
|
||||
endif
|
||||
|
||||
ifneq ($(MUSL_SRCDIR),)
|
||||
obj_sysroot/.lc_headers: | obj_musl/.lc_configured obj_sysroot
|
||||
cd obj_musl && $(MAKE) -j$(CPUS) DESTDIR=$(CURDIR)/obj_sysroot install-headers
|
||||
touch $@
|
||||
endif
|
||||
|
||||
ifneq ($(MINGW_SRCDIR),)
|
||||
ifeq ($(MUSL_SRCDIR),)
|
||||
obj_sysroot/.lc_headers: | obj_mingw_headers/.lc_configured obj_sysroot
|
||||
cd obj_mingw_headers && $(MAKE) -j$(CPUS) DESTDIR=$(CURDIR)/obj_sysroot/$(TARGET) install
|
||||
rm -f $(CURDIR)/obj_sysroot/mingw
|
||||
ln -s $(TARGET) $(CURDIR)/obj_sysroot/mingw
|
||||
touch $@
|
||||
else
|
||||
obj_sysroot/.lc_headers: | obj_musl/.lc_configured obj_sysroot
|
||||
cd obj_musl && $(MAKE) -j$(CPUS) DESTDIR=$(CURDIR)/obj_sysroot install-headers
|
||||
touch $@
|
||||
endif
|
||||
|
||||
obj_gcc/$(TARGET)/libgcc/libgcc.a: | obj_sysroot/.lc_headers
|
||||
@ -402,17 +384,15 @@ obj_musl/.lc_built: | obj_musl/.lc_configured
|
||||
cd obj_musl && $(MAKE) -j$(CPUS) $(MUSL_VARS)
|
||||
touch $@
|
||||
|
||||
ifneq ($(MUSL_SRCDIR),)
|
||||
ifeq ($(MUSL_SRCDIR),)
|
||||
obj_sysroot/.lc_libs: | obj_sysroot/.lc_libs_pthreads obj_sysroot/.lc_libs_crt
|
||||
touch $@
|
||||
else
|
||||
obj_sysroot/.lc_libs: | obj_musl/.lc_built
|
||||
cd obj_musl && $(MAKE) -j$(CPUS) $(MUSL_VARS) DESTDIR=$(CURDIR)/obj_sysroot install
|
||||
touch $@
|
||||
endif
|
||||
|
||||
ifneq ($(MINGW_SRCDIR),)
|
||||
obj_sysroot/.lc_libs: | obj_sysroot/.lc_libs_pthreads obj_sysroot/.lc_libs_crt
|
||||
touch $@
|
||||
endif
|
||||
|
||||
obj_gcc/.lc_built: | obj_gcc/.lc_configured obj_gcc/gcc/.lc_built
|
||||
cd obj_gcc && $(MAKE) -j$(CPUS) MAKE="$(MAKE) $(LIBTOOL_ARG)"
|
||||
touch $@
|
||||
|
@ -20,18 +20,28 @@ function Init() {
|
||||
|
||||
function Help() {
|
||||
echo "-h: help"
|
||||
echo "-a: enable archive"
|
||||
echo "-t: test build only"
|
||||
echo "-T: targets file path or targets string"
|
||||
echo "-C: use china mirror"
|
||||
echo "-c: set CC"
|
||||
echo "-x: set CXX"
|
||||
echo "-f: set FC"
|
||||
echo "-s: static build"
|
||||
echo "-n: native build"
|
||||
echo "-e: skip error (-Wno-error)"
|
||||
}
|
||||
|
||||
function ParseArgs() {
|
||||
while getopts "htT:C" arg; do
|
||||
while getopts "hatT:Cc:x:f:sne" arg; do
|
||||
case $arg in
|
||||
h)
|
||||
Help
|
||||
exit 0
|
||||
;;
|
||||
a)
|
||||
ENABLE_ARCHIVE="1"
|
||||
;;
|
||||
t)
|
||||
TEST_BUILD_ONLY="1"
|
||||
;;
|
||||
@ -41,6 +51,24 @@ function ParseArgs() {
|
||||
C)
|
||||
USE_CHINA_MIRROR="1"
|
||||
;;
|
||||
c)
|
||||
CC="$OPTARG"
|
||||
;;
|
||||
x)
|
||||
CXX="$OPTARG"
|
||||
;;
|
||||
f)
|
||||
FC="$OPTARG"
|
||||
;;
|
||||
s)
|
||||
STATIC_BUILD="1"
|
||||
;;
|
||||
n)
|
||||
NATIVE_BUILD="1"
|
||||
;;
|
||||
e)
|
||||
SKIP_ERROR="1"
|
||||
;;
|
||||
?)
|
||||
echo "unkonw argument"
|
||||
exit 1
|
||||
@ -49,6 +77,12 @@ function ParseArgs() {
|
||||
done
|
||||
}
|
||||
|
||||
function FixArgs() {
|
||||
if [ "$SKIP_ERROR" ]; then
|
||||
FLAG="${FLAG} -Wno-error"
|
||||
fi
|
||||
}
|
||||
|
||||
function Build() {
|
||||
TARGET="$1"
|
||||
make TARGET="${TARGET}" \
|
||||
@ -62,25 +96,40 @@ function Build() {
|
||||
ISL_VER="" \
|
||||
LINUX_VER="" \
|
||||
MINGW_VER="v11.0.1" \
|
||||
CC_COMPILER="${CC}" \
|
||||
CXX_COMPILER="${CXX}" \
|
||||
FC_COMPILER="${FC}" \
|
||||
CHINA="${USE_CHINA_MIRROR}" \
|
||||
'COMMON_CONFIG+=CFLAGS="-g0 -Os" CXXFLAGS="-g0 -Os" LDFLAGS="-s"' \
|
||||
'COMMON_CONFIG+=CC="gcc -static --static" CXX="g++ -static --static"' \
|
||||
'GCC_CONFIG+=--enable-languages=c,c++' \
|
||||
'BINUTILS_CONFIG+=--enable-compressed-debug-sections=none' \
|
||||
STATIC="${STATIC_BUILD}" \
|
||||
NATIVE="${NATIVE_BUILD}" \
|
||||
install
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "build ${TARGET} error"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$NATIVE_BUILD" ]; then
|
||||
DIST_NAME="${DIST}/${TARGET}-native"
|
||||
else
|
||||
DIST_NAME="${DIST}/${TARGET}"
|
||||
fi
|
||||
if [ ! "$TEST_BUILD_ONLY" ]; then
|
||||
tar -zcvf ${DIST}/${TARGET}.tgz output/*
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "package ${TARGET} error"
|
||||
exit 1
|
||||
if [ "$ENABLE_ARCHIVE" ]; then
|
||||
tar -zcvf "${DIST_NAME}.tgz" -C output/ .
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "package ${TARGET} error"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
mv output "${DIST_NAME}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "move ${TARGET} to ${DIST_NAME} error"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
rm -rf output/*
|
||||
rm -rf build/*
|
||||
# rm -rf build/*
|
||||
make clean
|
||||
}
|
||||
|
||||
ALL_TARGETS='aarch64-linux-musl
|
||||
@ -121,7 +170,19 @@ i486-w64-mingw32
|
||||
i686-w64-mingw32
|
||||
x86_64-w64-mingw32'
|
||||
|
||||
FLAG="-g0 -O2 -fno-align-functions -fno-align-jumps -fno-align-loops -fno-align-labels"
|
||||
|
||||
function BuildAll() {
|
||||
cat >config.mak <<EOF
|
||||
COMMON_CONFIG += CFLAGS="${FLAG}" CXXFLAGS="${FLAG}" FFLAGS="${FLAG}" LDFLAGS="-s -static --static"
|
||||
GCC_CONFIG += --enable-languages=c,c++
|
||||
BINUTILS_CONFIG += --enable-compressed-debug-sections=none
|
||||
COMMON_CONFIG += --disable-nls
|
||||
GCC_CONFIG += --disable-libquadmath --disable-decimal-float
|
||||
GCC_CONFIG += --disable-libitm
|
||||
GCC_CONFIG += --disable-fixed-point
|
||||
GCC_CONFIG += --disable-lto
|
||||
EOF
|
||||
if [ "$TARGETS_FILE" ]; then
|
||||
if [ -f "$TARGETS_FILE" ]; then
|
||||
while read line; do
|
||||
@ -151,4 +212,5 @@ function BuildAll() {
|
||||
ChToScriptFileDir
|
||||
Init
|
||||
ParseArgs "$@"
|
||||
FixArgs
|
||||
BuildAll
|
||||
|
Loading…
Reference in New Issue
Block a user