Feat: china mirror and lib32 lib64 switch

This commit is contained in:
zijiren233 2024-01-11 18:10:34 +08:00
parent 1aefb41dad
commit eba4523bd5
3 changed files with 52 additions and 20 deletions

View File

@ -1,6 +1,6 @@
SOURCES = sources SOURCES = sources
CONFIG_SUB_REV = 3d5db9ebe860 CONFIG_SUB_REV = 28ea239c53a2
GCC_VER = 11.4.0 GCC_VER = 11.4.0
MUSL_VER = 1.2.4 MUSL_VER = 1.2.4
BINUTILS_VER = 2.41 BINUTILS_VER = 2.41
@ -11,29 +11,37 @@ ISL_VER =
LINUX_VER = LINUX_VER =
MINGW_VER = v11.0.1 MINGW_VER = v11.0.1
ifeq ($(CHINA),)
GNU_SITE = https://ftp.gnu.org/gnu 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 GCC_SITE = $(GNU_SITE)/gcc
BINUTILS_SITE = $(GNU_SITE)/binutils BINUTILS_SITE = $(GNU_SITE)/binutils
GMP_SITE = $(GNU_SITE)/gmp GMP_SITE = $(GNU_SITE)/gmp
MPC_SITE = $(GNU_SITE)/mpc MPC_SITE = $(GNU_SITE)/mpc
MPFR_SITE = $(GNU_SITE)/mpfr MPFR_SITE = $(GNU_SITE)/mpfr
# SOURCEFORGE_MIRROT = https://downloads.sourceforge.net
SOURCEFORGE_MIRROT = https://jaist.dl.sourceforge.net
ISL_SITE = $(SOURCEFORGE_MIRROT)/project/libisl ISL_SITE = $(SOURCEFORGE_MIRROT)/project/libisl
GCC_SNAP = https://sourceware.org/pub/gcc/snapshots MINGW_SITE = $(SOURCEFORGE_MIRROT)/project/mingw-w64/mingw-w64/mingw-w64-release
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
LINUX_HEADERS_SITE = https://ftp.barfooze.de/pub/sabotage/tarballs LINUX_HEADERS_SITE = https://ftp.barfooze.de/pub/sabotage/tarballs
MINGW_SITE = $(SOURCEFORGE_MIRROT)/project/mingw-w64/mingw-w64/mingw-w64-release # curl --progress-bar -Lo <file> <url>
DL_CMD = curl --progress-bar -Lo
DL_CMD = curl -sLo
SHA1_CMD = sha1sum -c SHA1_CMD = sha1sum -c
COWPATCH = $(CURDIR)/cowpatch.sh COWPATCH = $(CURDIR)/cowpatch.sh
@ -68,6 +76,8 @@ check:
@which bzip2 @which bzip2
@echo "check gcc" @echo "check gcc"
@which gcc @which gcc
@echo "check g++"
@which g++
@echo "check libtool" @echo "check libtool"
@which libtool @which libtool

View File

@ -26,8 +26,6 @@ ifeq ($(CPUS),)
CPUS = $(shell if command -v nproc >/dev/null 2>&1; then nproc; else echo 1; fi) CPUS = $(shell if command -v nproc >/dev/null 2>&1; then nproc; else echo 1; fi)
endif endif
ifneq ($(findstring mingw,$(TARGET)),) ifneq ($(findstring mingw,$(TARGET)),)
MUSL_SRCDIR = MUSL_SRCDIR =
LINUX_SRCDIR = LINUX_SRCDIR =
@ -87,6 +85,23 @@ ifneq ($(filter %hf,$(TARGET)),)
GCC_CONFIG_FOR_TARGET += --with-float=hard GCC_CONFIG_FOR_TARGET += --with-float=hard
endif 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),) ifneq ($(LIBTOOL),)
LIBTOOL_ARG = LIBTOOL=$(LIBTOOL) LIBTOOL_ARG = LIBTOOL=$(LIBTOOL)
endif endif
@ -123,7 +138,6 @@ FULL_GCC_CONFIG = --enable-languages=c,c++,fortran \
--disable-multilib \ --disable-multilib \
--with-dwarf2 \ --with-dwarf2 \
--enable-deterministic-archives \ --enable-deterministic-archives \
--enable-libstdcxx-time \
--enable-libquadmath --enable-libquadmath-support \ --enable-libquadmath --enable-libquadmath-support \
--disable-decimal-float \ --disable-decimal-float \
$(OVERRIDE) $(OVERRIDE)

View File

@ -22,10 +22,11 @@ function Help() {
echo "-h: help" echo "-h: help"
echo "-t: test build only" echo "-t: test build only"
echo "-T: targets file path or targets string" echo "-T: targets file path or targets string"
echo "-C: use china mirror"
} }
function ParseArgs() { function ParseArgs() {
while getopts "htT:" arg; do while getopts "htT:C" arg; do
case $arg in case $arg in
h) h)
Help Help
@ -37,6 +38,9 @@ function ParseArgs() {
T) T)
TARGETS_FILE="$OPTARG" TARGETS_FILE="$OPTARG"
;; ;;
C)
USE_CHINA_MIRROR="1"
;;
?) ?)
echo "unkonw argument" echo "unkonw argument"
exit 1 exit 1
@ -47,7 +51,8 @@ function ParseArgs() {
function Build() { function Build() {
TARGET="$1" TARGET="$1"
make TARGET=${TARGET} \ make TARGET="${TARGET}" \
CONFIG_SUB_REV="28ea239c53a2" \
GCC_VER="11.4.0" \ GCC_VER="11.4.0" \
MUSL_VER="1.2.4" \ MUSL_VER="1.2.4" \
BINUTILS_VER="2.41" \ BINUTILS_VER="2.41" \
@ -57,7 +62,10 @@ function Build() {
ISL_VER="" \ ISL_VER="" \
LINUX_VER="" \ LINUX_VER="" \
MINGW_VER="v11.0.1" \ MINGW_VER="v11.0.1" \
CHINA="${USE_CHINA_MIRROR}" \
'COMMON_CONFIG+=CFLAGS="-g0 -Os" CXXFLAGS="-g0 -Os" LDFLAGS="-s"' \ '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' \ 'BINUTILS_CONFIG+=--enable-compressed-debug-sections=none' \
install install
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then