0
0
mirror of https://github.com/termux-pacman/glibc-packages.git synced 2024-11-24 02:26:21 +00:00
glibc-packages/cgct/cbt/PKGBUILD
Ivan Max 418a4faa1a
cgct: updating and adding packages (#294)
- cbt: update to 2.43.1
- cgct-headers: new pkg
2024-10-06 20:51:15 +03:00

85 lines
2.3 KiB
Bash

pkgname=cbt
pkgver=2.43.1
pkgrel=0
pkgdesc='Cross Binutils for Termux (only for Linux)'
arch=(x86_64)
url='https://www.gnu.org/software/binutils/'
license=('GPL3' 'GPL' 'FDL1.3' 'custom:FSFAP')
source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz
config.sub.patch
ldmain.c.patch
ldmain.h.patch)
sha256sums=('13f74202a3c4c51118b797a39ea4200d3f6cfbe224da6d1d95bb938480132dfd'
'8105b0e8bab1759db2aa27a7c21376e2f634d3ecea9e078100dbf8c2543626bd'
'475368e73aeabed942b8b526e74df98d1e499087e736db6a38b401cf272c571e'
'388a25ea90edef3e02e4aa9015cb2846557954ef2e5ae3b34ead06e8bc770753')
optdepends=('glibc-cgct')
groups=('cgct')
prepare() {
for i in *.patch; do
patch -Np1 -i ${srcdir}/$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"
for target in aarch64-linux-gnu arm-linux-gnueabihf x86_64-linux-gnu i686-linux-gnu; do
arch_build=${target/-*}
CGCT_PREFIX="${CGCT_PATH}/${arch_build}"
mkdir binutils-${arch_build}
cd binutils-${arch_build}
local flags_32bit=""
if [ "${arch_build}" = "arm" ] || [ "${arch_build}" = "i686" ]; then
flags_32bit=" -DTARGET_32BIT -Wp,-DTARGET_32BIT"
fi
"$srcdir"/binutils-${pkgver}/configure \
--host=cgct \
--build=${CHOST} \
--target=$target \
--prefix=$CGCT_PREFIX \
--disable-multilib \
--with-gnu-as \
--with-gnu-ld \
--disable-nls \
--enable-ld=default \
--enable-plugins \
--enable-deterministic-archives \
CC=x86_64-linux-gnu-gcc \
CXX=x86_64-linux-gnu-g++ \
CFLAGS="${CFLAGS} ${flags_32bit}" \
CXXFLAGS="${CXXFLAGS} ${flags_32bit}" \
AR=ar \
LD=ld
make
cd ..
done
}
package() {
for target in aarch64-linux-gnu arm-linux-gnueabihf x86_64-linux-gnu i686-linux-gnu; do
arch_build=${target/-*}
CGCT_PREFIX="${CGCT_PATH}/${arch_build}"
cd binutils-${arch_build}
make DESTDIR="$pkgdir" install
mv $pkgdir/${CGCT_PREFIX}/$target/bin/* $pkgdir/${CGCT_PREFIX}/bin
mv $pkgdir/${CGCT_PREFIX}/$target/lib/* $pkgdir/${CGCT_PREFIX}/lib
rm -fr $pkgdir/${CGCT_PREFIX}/$target
rm -fr $pkgdir/${CGCT_PREFIX}/share
rm -fr $pkgdir/${CGCT_PREFIX}/include
rm -fr $pkgdir/${CGCT_PREFIX}/etc
cd ..
done
replace_hard_with_symbolic "$pkgdir"
}