From eba4523bd54567241fd1f555f3194055aa424d37 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Thu, 11 Jan 2024 18:10:34 +0800 Subject: [PATCH] Feat: china mirror and lib32 lib64 switch --- Makefile | 40 +++++++++++++++++++++++++--------------- litecross/Makefile | 20 +++++++++++++++++--- scripts/build.sh | 12 ++++++++++-- 3 files changed, 52 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 3d6af14..7317ac1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ SOURCES = sources -CONFIG_SUB_REV = 3d5db9ebe860 +CONFIG_SUB_REV = 28ea239c53a2 GCC_VER = 11.4.0 MUSL_VER = 1.2.4 BINUTILS_VER = 2.41 @@ -11,29 +11,37 @@ 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 - -# SOURCEFORGE_MIRROT = https://downloads.sourceforge.net -SOURCEFORGE_MIRROT = https://jaist.dl.sourceforge.net - ISL_SITE = $(SOURCEFORGE_MIRROT)/project/libisl -GCC_SNAP = https://sourceware.org/pub/gcc/snapshots - -MUSL_SITE = https://musl.libc.org/releases -# MUSL_REPO = https://git.musl-libc.org/git/musl -MUSL_REPO = git://git.musl-libc.org/musl - -LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel +MINGW_SITE = $(SOURCEFORGE_MIRROT)/project/mingw-w64/mingw-w64/mingw-w64-release LINUX_HEADERS_SITE = https://ftp.barfooze.de/pub/sabotage/tarballs -MINGW_SITE = $(SOURCEFORGE_MIRROT)/project/mingw-w64/mingw-w64/mingw-w64-release - -DL_CMD = curl -sLo +# curl --progress-bar -Lo +DL_CMD = curl --progress-bar -Lo SHA1_CMD = sha1sum -c COWPATCH = $(CURDIR)/cowpatch.sh @@ -68,6 +76,8 @@ check: @which bzip2 @echo "check gcc" @which gcc + @echo "check g++" + @which g++ @echo "check libtool" @which libtool diff --git a/litecross/Makefile b/litecross/Makefile index df2cf24..913cdfc 100644 --- a/litecross/Makefile +++ b/litecross/Makefile @@ -26,8 +26,6 @@ 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 = @@ -87,6 +85,23 @@ 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 @@ -123,7 +138,6 @@ FULL_GCC_CONFIG = --enable-languages=c,c++,fortran \ --disable-multilib \ --with-dwarf2 \ --enable-deterministic-archives \ - --enable-libstdcxx-time \ --enable-libquadmath --enable-libquadmath-support \ --disable-decimal-float \ $(OVERRIDE) diff --git a/scripts/build.sh b/scripts/build.sh index 9f72903..afa52fd 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -22,10 +22,11 @@ function Help() { echo "-h: help" echo "-t: test build only" echo "-T: targets file path or targets string" + echo "-C: use china mirror" } function ParseArgs() { - while getopts "htT:" arg; do + while getopts "htT:C" arg; do case $arg in h) Help @@ -37,6 +38,9 @@ function ParseArgs() { T) TARGETS_FILE="$OPTARG" ;; + C) + USE_CHINA_MIRROR="1" + ;; ?) echo "unkonw argument" exit 1 @@ -47,7 +51,8 @@ function ParseArgs() { function Build() { TARGET="$1" - make TARGET=${TARGET} \ + make TARGET="${TARGET}" \ + CONFIG_SUB_REV="28ea239c53a2" \ GCC_VER="11.4.0" \ MUSL_VER="1.2.4" \ BINUTILS_VER="2.41" \ @@ -57,7 +62,10 @@ function Build() { ISL_VER="" \ LINUX_VER="" \ MINGW_VER="v11.0.1" \ + 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' \ install if [ $? -ne 0 ]; then