aportgen: remove binutils

Remove the code for generating binutils-aarch64 etc. packages, as these
live upstream in Alpine now. Having the generator scripts for binutils
cross pkgs is therefore not useful anymore and would just bitrot if we
kept it.

Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20231126121617.3855-1-ollieparanoid@postmarketos.org%3E
This commit is contained in:
Oliver Smith 2023-11-26 13:16:12 +01:00
parent 62a05d4fbc
commit d7f9769ee0
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
6 changed files with 9 additions and 190 deletions

View file

@ -216,7 +216,7 @@ $ pmbootstrap pkgrel_bump --auto
Generate cross-compiler aports based on the latest version from Alpine's
aports:
```
$ pmbootstrap aportgen binutils-armhf gcc-armhf
$ pmbootstrap aportgen gcc-armhf
```
Manually rebuild package index:

View file

@ -2,7 +2,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import os
import logging
import pmb.aportgen.binutils
import pmb.aportgen.busybox_static
import pmb.aportgen.device
import pmb.aportgen.gcc

View file

@ -1,33 +0,0 @@
# Copyright 2023 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
import pmb.aportgen.core
import pmb.helpers.git
import pmb.helpers.run
def generate(args, pkgname):
# Copy original aport
arch = pkgname.split("-")[1]
upstream = pmb.aportgen.core.get_upstream_aport(args, "binutils")
pmb.helpers.run.user(args, ["cp", "-r", upstream, args.work + "/aportgen"])
# Rewrite APKBUILD
fields = {
"arch": pmb.config.arch_native,
"makedepends_host": "zlib-dev jansson-dev zstd-dev",
"pkgdesc": f"Tools necessary to build programs for {arch} targets",
"pkgname": pkgname,
}
replace_simple = {
"*--with-bugurl=*": "\t\t--with-bugurl=\"https://postmarketos.org/issues\" \\"
}
below_header = """
CTARGET_ARCH=""" + arch + """
CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
"""
pmb.aportgen.core.rewrite(args, pkgname, "main/binutils", fields,
"binutils", replace_simple=replace_simple,
below_header=below_header)

View file

@ -271,8 +271,8 @@ chroot_outdated = 3600 * 24 * 2
#
# Officially supported host/target architectures for postmarketOS. Only
# specify architectures supported by Alpine here. For cross-compiling,
# we need to generate the "musl-$ARCH", "binutils-$ARCH" and "gcc-$ARCH"
# packages (use "pmbootstrap aportgen musl-armhf" etc.).
# we need to generate the "musl-$ARCH" and "gcc-$ARCH" packages (use
# "pmbootstrap aportgen musl-armhf" etc.).
build_device_architectures = ["armhf", "armv7", "aarch64", "x86_64", "x86", "riscv64"]
# Packages that will be installed in a chroot before it builds packages
@ -1090,7 +1090,7 @@ git_repo_outdated = 3600 * 24 * 2
#
aportgen = {
"cross": {
"prefixes": ["binutils", "busybox-static", "gcc", "musl", "grub-efi"],
"prefixes": ["busybox-static", "gcc", "musl", "grub-efi"],
"confirm_overwrite": False,
},
"device/testing": {

View file

@ -42,7 +42,7 @@ def test_aportgen_compare_output(args, tmpdir, monkeypatch):
monkeypatch.setattr(pmb.aportgen.core, "get_upstream_aport", func)
# Run aportgen and compare output
pkgnames = ["binutils-armhf", "gcc-armhf"]
pkgnames = ["gcc-armhf"]
for pkgname in pkgnames:
pmb.aportgen.generate(args, pkgname)
path_new = args.aports + "/cross/" + pkgname + "/APKBUILD"
@ -87,8 +87,10 @@ def test_aportgen(args, tmpdir):
pmb.helpers.run.user(args, ["mkdir", "-p", args.work + "/aportgen"])
# Generate all valid packages (gcc twice -> different code path)
pkgnames = ["binutils-armv7", "musl-armv7", "busybox-static-armv7",
"gcc-armv7", "gcc-armv7"]
pkgnames = ["musl-armv7",
"busybox-static-armv7",
"gcc-armv7",
"gcc-armv7"]
for pkgname in pkgnames:
pmb.aportgen.generate(args, pkgname)

View file

@ -1,149 +0,0 @@
# Automatically generated aport, do not edit!
# Generator: pmbootstrap aportgen binutils-armhf
# Based on: main/binutils
CTARGET_ARCH=armhf
CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
pkgname=binutils-armhf
pkgver=2.39
pkgrel=1
pkgdesc="Tools necessary to build programs for armhf targets"
url="https://www.gnu.org/software/binutils/"
makedepends_build="bison flex texinfo"
makedepends_host="zlib-dev jansson-dev zstd-dev"
makedepends="$makedepends_build $makedepends_host"
arch="x86_64"
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
subpackages="binutils-dev binutils-doc"
source="https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz
binutils-ld-fix-static-linking.patch
gold-mips.patch
ld-bfd-mips.patch
0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
binutils-mips-disable-assert.patch
"
builddir="$srcdir/binutils-$pkgver"
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
subpackages="$subpackages binutils-gold"
fi
if [ "$CHOST" != "$CTARGET" ]; then
pkgname="binutils-$CTARGET_ARCH"
subpackages=""
sonameprefix="binutils:"
fi
# secfixes:
# 2.35.2-r1:
# - CVE-2021-3487
# 2.32-r0:
# - CVE-2018-19931
# - CVE-2018-19932
# - CVE-2018-20002
# - CVE-2018-20712
# 2.28-r1:
# - CVE-2017-7614
build() {
local _sysroot=/
local _cross_configure="--enable-install-libiberty --enable-shared"
local _arch_configure=""
local _gold_configure="--disable-gold"
local _plugin_configure="--enable-plugins"
if [ "$CHOST" != "$CTARGET" ]; then
_sysroot="$CBUILDROOT"
_cross_configure="--disable-install-libiberty"
_plugin_configure="--disable-plugins"
fi
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
_gold_configure="--enable-gold"
fi
if [ "$CTARGET_ARCH" = "x86_64" ]; then
_arch_configure="--enable-targets=x86_64-pep"
fi
if [ "$CTARGET_ARCH" = "riscv64" ]; then
_gold_configure="--disable-gold"
fi
case "$CTARGET_ARCH" in
mips*) _hash_style_configure="--enable-default-hash-style=sysv" ;;
*) _hash_style_configure="--enable-default-hash-style=gnu" ;;
esac
./configure \
--build=$CBUILD \
--host=$CHOST \
--target=$CTARGET \
--with-build-sysroot="$CBUILDROOT" \
--with-sysroot=$_sysroot \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-multilib \
--disable-gprofng \
--enable-ld=default \
$_gold_configure \
--enable-64-bit-bfd \
$_plugin_configure \
--enable-relro \
--enable-deterministic-archives \
--enable-default-execstack=no \
$_cross_configure \
$_arch_configure \
$_hash_style_configure \
--with-pic \
--disable-werror \
--disable-nls \
--with-mmap \
--with-system-zlib
make
}
package() {
make install DESTDIR="$pkgdir"
if [ -d "$pkgdir"/usr/lib64 ]; then
mv "$pkgdir"/usr/lib64/* "$pkgdir"/usr/lib/
rmdir "$pkgdir"/usr/lib64
fi
if [ "$CHOST" != "$CTARGET" ]; then
# creating cross tools: remove any files that would conflict
# with the native tools, or other cross tools
rm -r "${pkgdir:?}"/usr/share
rm -f "$pkgdir"/usr/lib/libiberty.a
rm -r "${pkgdir:?}"/usr/lib/bfd-plugins
fi
}
libs() {
pkgdesc="Runtime libraries from binutils - libbfd and libopcodes"
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/lib*.so "$subpkgdir"/usr/lib/
}
gold() {
pkgdesc="GNU binutils - gold linker"
if [ -e "$pkgdir"/usr/bin/ld.gold ]; then
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/ld.gold "$subpkgdir"/usr/bin
fi
mkdir -p "$subpkgdir"/usr/$CTARGET/bin
mv "$pkgdir"/usr/$CTARGET/bin/ld.gold "$subpkgdir"/usr/$CTARGET/bin/ld.gold
}
sha512sums="
68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.tar.xz
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49 binutils-ld-fix-static-linking.patch
f55cf2e0bf82f97583a1abe10710e4013ecf7d64f1da2ef8659a44a06d0dd8beaf58dab98a183488ea137f03e32d62efc878d95f018f836f8cec870bc448556f gold-mips.patch
314d2ef9071c89940aa6c8118e8a1e2f191a5d0a4bf596da1ad9cc84f884d8bc7dea8bd7b9fc3f8f1bddd3fd41c6eb017e1e804044b3bf084df1ed9e6e095e2d ld-bfd-mips.patch
70ec22bd72ef6dddecfd970613387dd4a8cdc8730dd3cbf03d5a0c3a7c4d839383167bb06dad21bf7c235329fd44b5dc4aefe762f68544f17155cf002bf1be4a 0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
609cd90d8b334eb309f586b17b9d335a08d3dbb6def7c3eb5c010028fcb681674031e5b9d853aa7a39a50304356a86afc184b85562b3f228f8197f4d29395c8f binutils-mips-disable-assert.patch
"