mirror of
https://github.com/termux-pacman/glibc-packages.git
synced 2024-11-21 20:46:38 +00:00
159 lines
4.7 KiB
Bash
159 lines
4.7 KiB
Bash
pkgname=cgt
|
|
pkgver=14.2.0
|
|
pkgrel=0
|
|
pkgdesc='Cross GCCs for Termux (only for Linux)'
|
|
arch=(x86_64)
|
|
url='https://gcc.gnu.org/'
|
|
license=(GPL LGPL FDL)
|
|
source=(https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz
|
|
gcc-configure.patch
|
|
config.sub.patch
|
|
configure.patch
|
|
set_dynamic_path.patch
|
|
cgct-app-prefix.cc
|
|
cgct-app-prefix.h)
|
|
sha256sums=('a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9'
|
|
'f4962b9ab48271994fefbd7c654fd2d60356a39abecc3510cfe45d1be7f50483'
|
|
'805fa7799fe23f2e4b1d5f9d10fadf46a45f446c6462f32f3b7633b8941003f3'
|
|
'ba65de3512c3d02030c5e3bcd70b69a7922eec6bdc24763bf4a6045447dc1d84'
|
|
'e402f2bc3288158e8edbef27b511015d87f37ba70ddbd84c2b925fe075822f95'
|
|
'732e15a76056348911f60825c377c0378f6dad57b29eb86fcc7447cf8172f171'
|
|
'9fb91df134d096bf493844812617b5aed9ce5d6ccd564f8a3a11c8d9812be744')
|
|
depends=('cbt')
|
|
optdepends=('glibc-cgct')
|
|
groups=('cgct')
|
|
targets=(aarch64-linux-gnu arm-linux-gnueabihf x86_64-linux-gnu i686-linux-gnu)
|
|
options=(libtool staticlibs !emptydirs)
|
|
|
|
prepare() {
|
|
for i in *.patch; do
|
|
patch -Np1 -i ${srcdir}/$i
|
|
done
|
|
|
|
cp ./cgct-app-prefix.{cc,h} ./gcc-${pkgver}/gcc/
|
|
|
|
cd gcc-${pkgver}
|
|
sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
|
|
sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
|
|
sed -i '/lp64=/s/lib64/lib/' gcc/config/aarch64/t-aarch64-linux
|
|
for i in "'\${exec_prefix}'/\${target_noncanonical}" \
|
|
'${exec_prefix}/'{'${host_alias}','${target_noncanonical}'} \
|
|
'$(exec_prefix)/'{'$(host_noncanonical)','$(target_noncanonical)','$(target_alias)'} \
|
|
'${prefix}/${target_alias}'; do
|
|
sed -i "s|${i}|${i%%/*}|" $(grep -s -r -l "${i}")
|
|
done
|
|
}
|
|
|
|
build() {
|
|
unset CFLAGS CXXFLAGS AR LD CC CXX
|
|
CFLAGS="-O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -fstack-clash-protection"
|
|
CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS"
|
|
|
|
clean_prefix || true
|
|
|
|
for target in ${targets[@]}; do
|
|
arch_build=${target/-*}
|
|
CGCT_PREFIX=${CGCT_PATH}/${arch_build}
|
|
mkdir gcc-${arch_build} || true
|
|
cd gcc-${arch_build}
|
|
|
|
for pkg in glibc linux-api-headers-glibc libxcrypt-glibc; do
|
|
install_gpkg ${arch_build} ${pkg}
|
|
done
|
|
|
|
FLAGS_FOR_TARGET="-I$GLIBC_PREFIX/include -L$GLIBC_PREFIX/lib -Wl,-rpath=$GLIBC_PREFIX/lib"
|
|
CONFIGFLAG=""
|
|
case "$arch_build" in
|
|
"aarch64") CONFIGFLAG="--with-arch=armv8-a --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419";;
|
|
"arm") CONFIGFLAG="--with-arch=armv7-a --with-float=hard --with-fpu=neon";;
|
|
"x86_64") CONFIGFLAG="--with-arch=x86-64";;
|
|
"i686") CONFIGFLAG="--with-arch=i686";;
|
|
esac
|
|
|
|
"$srcdir"/gcc-${pkgver}/configure \
|
|
--host=cgct \
|
|
--build=${CHOST} \
|
|
--target=${target} \
|
|
--prefix=${CGCT_PREFIX} \
|
|
--with-local-prefix=${CGCT_PREFIX} \
|
|
--libdir=${CGCT_PREFIX}/lib \
|
|
--libexecdir=${CGCT_PREFIX}/lib \
|
|
--includedir=${GLIBC_PREFIX}/include \
|
|
--with-bugurl=https://github.com/termux-pacman/glibc-packages/issues \
|
|
$CONFIGFLAG \
|
|
--enable-languages=c,c++ \
|
|
--enable-checking=release \
|
|
--enable-threads=posix \
|
|
--enable-lto \
|
|
--disable-multilib \
|
|
--disable-bootstrap \
|
|
--disable-nls \
|
|
--enable-clocale=gnu \
|
|
--enable-default-pie \
|
|
--enable-default-ssp \
|
|
--with-system-zlib \
|
|
--enable-__cxa_atexit \
|
|
--enable-linker-build-id \
|
|
--enable-plugin \
|
|
--with-linker-hash-style=gnu \
|
|
--enable-gnu-indirect-function \
|
|
--enable-gnu-unique-object \
|
|
--enable-libstdcxx-backtrace \
|
|
--enable-shared \
|
|
--disable-werror \
|
|
--disable-libssp \
|
|
--disable-libstdcxx-pch \
|
|
--disable-libunwind-exceptions \
|
|
CFLAGS_FOR_TARGET="$FLAGS_FOR_TARGET $CFLAGS" \
|
|
CXXFLAGS_FOR_TARGET="$FLAGS_FOR_TARGET $CXXFLAGS" \
|
|
LD_FOR_TARGET=${CGCT_PREFIX}/bin/ld \
|
|
AS_FOR_TARGET=${CGCT_PREFIX}/bin/as \
|
|
AR_FOR_TARGET=${CGCT_PREFIX}/bin/ar \
|
|
RANLIB_FOR_TARGET=${CGCT_PREFIX}/bin/ranlib \
|
|
NM_FOR_TARGET=${CGCT_PREFIX}/bin/nm \
|
|
OBJCOPY_FOR_TARGET=${CGCT_PREFIX}/bin/objcopy \
|
|
OBJDUMP_FOR_TARGET=${CGCT_PREFIX}/bin/objdump \
|
|
CC=x86_64-linux-gnu-gcc \
|
|
CXX=x86_64-linux-gnu-g++ \
|
|
AR=ar \
|
|
LD=ld \
|
|
OBJCOPY=objcopy \
|
|
OBJDUMP=objdump
|
|
make
|
|
|
|
clean_prefix
|
|
|
|
cd ..
|
|
done
|
|
}
|
|
|
|
package() {
|
|
clean_prefix || true
|
|
|
|
for target in ${targets[@]}; do
|
|
arch_build=${target/-*}
|
|
CGCT_PREFIX=${CGCT_PATH}/${arch_build}
|
|
cd gcc-${arch_build}
|
|
|
|
for pkg in glibc linux-api-headers-glibc libxcrypt-glibc; do
|
|
install_gpkg ${arch_build} ${pkg}
|
|
done
|
|
|
|
make DESTDIR="$pkgdir" install-gcc \
|
|
install-target-{libgcc,libstdc++-v3,libgomp,libquadmath,libatomic,libitm,libsanitizer,libvtv}
|
|
|
|
for i in gcc g++; do
|
|
ln -s ${target}-${i} $pkgdir/${CGCT_PREFIX}/bin/${i}
|
|
done
|
|
ln -s gcc $pkgdir/${CGCT_PREFIX}/bin/cc
|
|
ln -s g++ $pkgdir/${CGCT_PREFIX}/bin/cpp
|
|
rm -fr $pkgdir/${CGCT_PREFIX}/share
|
|
|
|
clean_prefix
|
|
|
|
cd ..
|
|
done
|
|
|
|
replace_hard_with_symbolic "$pkgdir"
|
|
}
|