Compare commits

..

No commits in common. "248fe447bdc0611ca55a0379939aaa15ab8d166c" and "8c7e99acd942bcda8563cad4eac03961a322a3da" have entirely different histories.

35 changed files with 662 additions and 1312 deletions

View File

@ -219,7 +219,6 @@ set_alias_make() {
# Build make command
cmd="echo '*** pmbootstrap envkernel.sh active for $PWD! ***';"
cmd="$cmd pmbootstrap -q chroot --user --"
cmd="$cmd CCACHE_DISABLE=1"
cmd="$cmd ARCH=$arch"
if [ "$need_cross_compiler" = 1 ]; then
cmd="$cmd CROSS_COMPILE=$cross_compiler"

View File

@ -16,12 +16,45 @@ def generate(args, pkgname):
"pkgname": pkgname,
"pkgdesc": f"Tools necessary to build programs for {arch} targets",
"arch": pmb.config.arch_native,
"makedepends_build": "",
"makedepends_host": "",
"makedepends": "gettext libtool autoconf automake bison texinfo",
"subpackages": "",
}
below_header = """
CTARGET_ARCH=""" + arch + """
CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
"""
replace_functions = {
"build": """
_target="$(arch_to_hostspec """ + arch + """)"
"$builddir"/configure \\
--build="$CBUILD" \\
--target=$_target \\
--with-lib-path=/usr/lib \\
--prefix=/usr \\
--with-sysroot=/usr/$_target \\
--enable-ld=default \\
--enable-gold=yes \\
--enable-plugins \\
--enable-deterministic-archives \\
--disable-multilib \\
--disable-werror \\
--disable-nls
make
""",
"package": """
make install DESTDIR="$pkgdir"
# remove man, info folders
rm -rf "$pkgdir"/usr/share
# remove files that conflict with non-cross binutils
rm -rf "$pkgdir"/usr/lib/bfd-plugins
""",
"libs": None,
"gold": None,
}
replace_simple = {"\tsubpackages=*": "\tsubpackages=\"\""}
pmb.aportgen.core.rewrite(args, pkgname, "main/binutils", fields,
"binutils", below_header=below_header)
"binutils", replace_functions, replace_simple,
remove_indent=8)

View File

@ -142,14 +142,7 @@ def generate_deviceinfo_fastboot_content(bootimg=None):
content += f"""\
deviceinfo_header_version="{bootimg["header_version"]}"
"""
if bootimg["header_version"] == "2":
content += f"""\
deviceinfo_append_dtb="false"
deviceinfo_flash_offset_dtb="{bootimg["dtb_offset"]}"
"""
if "base" in bootimg.keys():
else:
content += f"""\
deviceinfo_flash_offset_base="{bootimg["base"]}"
deviceinfo_flash_offset_kernel="{bootimg["kernel_offset"]}"

View File

@ -29,16 +29,16 @@ def generate(args, pkgname):
"pkgname": pkgname,
"pkgdesc": f"Stage2 cross-compiler for {arch}",
"arch": pmb.config.arch_native,
"depends": f"binutils-{arch} mpc1",
"depends": f"isl binutils-{arch} mpc1",
"makedepends_build": "gcc g++ bison flex texinfo gawk zip"
" gmp-dev mpfr-dev mpc1-dev zlib-dev",
"makedepends_host": "linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev"
f" zlib-dev musl-dev-{arch} binutils-{arch}",
"subpackages": "",
"subpackages": f"g++-{arch}:gpp" if prefix == "gcc" else "",
# gcc6: options is already there, so we need to replace it and not only
# set it below the header like done below.
"options": "!strip",
"options": "!strip !tracedeps",
"LIBGOMP": "false",
"LIBGCC": "false",
@ -46,11 +46,6 @@ def generate(args, pkgname):
"LIBITM": "false",
}
# Latest gcc only, not gcc4 and gcc6
if prefix == "gcc":
fields["subpackages"] = f"g++-{arch}:gpp" \
f" libstdc++-dev-{arch}:libcxx_dev"
below_header = "CTARGET_ARCH=" + arch + """
CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})"
LANG_D=false
@ -59,7 +54,7 @@ def generate(args, pkgname):
LANG_GO=false
LANG_FORTRAN=false
LANG_ADA=false
options="!strip"
options="!strip !tracedeps"
# abuild doesn't try to tries to install "build-base-$CTARGET_ARCH"
# when this variable matches "no*"
@ -83,9 +78,6 @@ def generate(args, pkgname):
# use CBUILDROOT as sysroot. In the original APKBUILD this is a local
# variable, but we make it a global one.
'*_cross_configure=*': None,
# Do not build foreign arch libgcc, we use the one from Alpine (#2168)
'_libgcc=true*': '_libgcc=false',
}
pmb.aportgen.core.rewrite(args, pkgname, based_on, fields,

View File

@ -22,12 +22,6 @@ def generate_apkbuild(args, pkgname, deviceinfo, patches):
downstreamkernel_package "$builddir" "$pkgdir" "$_carch\" \\
"$_flavor" "$_outdir\""""
if deviceinfo.get("header_version") == "2":
package += """
make dtbs_install O="$_outdir" ARCH="$_carch" \\
INSTALL_DTBS_PATH="$pkgdir\"/boot/dtbs"""
if deviceinfo["bootimg_qcdt"] == "true":
build += """\n
# Master DTB (deviceinfo_bootimg_qcdt)"""

View File

@ -227,14 +227,6 @@ def init_buildenv(args, apkbuild, arch, strict=False, force=False, cross=None,
pmb.chroot.distccd.start(args, arch)
if cross == "crossdirect":
pmb.chroot.mount_native_into_foreign(args, suffix)
# Workaround: this specific version currently in pmaports.git master
# was built with !tracedeps, so it doesn't pull in the isl dependency
# and we need to install it manually. Doing this is easier than bumping
# the pkgrel and going out of sync with Alpine's gcc package. This
# workaround can be removed once a newer gcc is in Alpine and we
# rebuild our cross gcc based on the new APKBUILD. See pmaports#1732.
if get_gcc_version(args, arch) == "12.2.1_git20220924-r2":
pmb.chroot.apk.install(args, ["isl25"], build=False)
return True

View File

@ -153,12 +153,10 @@ def menuconfig(args, pkgname, use_oldconfig):
pmb.build.checksum.update(args, pkgname)
# Check config
pmb.parse.kconfig.check(args, apkbuild["_flavor"],
force_waydroid_check=False,
pmb.parse.kconfig.check(args, apkbuild["_flavor"], force_anbox_check=False,
force_nftables_check=False,
force_containers_check=False,
force_zram_check=False,
force_netboot_check=False,
force_community_check=False,
force_uefi_check=False,
details=True)

View File

@ -87,110 +87,166 @@ def check_min_version(args, suffix="native"):
pmb.helpers.other.cache["apk_min_version_checked"].append(suffix)
def install_build(args, package, arch):
def install_is_necessary(args, build, arch, package, packages_installed):
"""
Build an outdated package unless pmbootstrap was invoked with
"pmbootstrap install" and the option to build packages during pmb install
is disabled.
This function optionally builds an out of date package, and checks if the
version installed inside a chroot is up to date.
:param build: Set to true to build the package, if the binary packages are
out of date, and it is in the aports folder.
:param packages_installed: Return value from installed().
:returns: True if the package needs to be installed/updated,
False otherwise.
"""
# For packages to be removed we can do the test immediately
if package.startswith("!"):
return package[1:] in packages_installed
:param package: name of the package to build
:param arch: architecture of the package to build
"""
# User may have disabled building packages during "pmbootstrap install"
# User may have disabled buiding packages during "pmbootstrap install"
build_disabled = False
if args.action == "install" and not args.build_pkgs_on_install:
if not pmb.parse.apkindex.package(args, package, arch, False):
build_disabled = True
# Build package
if build and not build_disabled:
pmb.build.package(args, package, arch)
# No further checks when not installed
if package not in packages_installed:
return True
# Make sure that we really have a binary package
data_repo = pmb.parse.apkindex.package(args, package, arch, False)
if not data_repo:
if build_disabled:
raise RuntimeError(f"{package}: no binary package found for"
f" {arch}, and compiling packages during"
" 'pmbootstrap install' has been disabled."
" Consider changing this option in"
" 'pmbootstrap init'.")
# Use the existing binary package
return
logging.warning("WARNING: Internal error in pmbootstrap,"
f" package '{package}' for {arch}"
" has not been built yet, but it should have"
" been. Rebuilding it with force. Please "
" report this, if there is no ticket about this"
" yet!")
pmb.build.package(args, package, arch, True)
return install_is_necessary(args, build, arch, package,
packages_installed)
# Build the package if it's in pmaports and there is no binary package
# with the same pkgver and pkgrel. This check is done in
# pmb.build.is_necessary, which gets called in pmb.build.package.
return pmb.build.package(args, package, arch)
# Compare the installed version vs. the version in the repos
data_installed = packages_installed[package]
compare = pmb.parse.version.compare(data_installed["version"],
data_repo["version"])
# a) Installed newer (should not happen normally)
if compare == 1:
logging.info(f"WARNING: {arch} package '{package}'"
f" installed version {data_installed['version']}"
" is newer, than the version in the repositories:"
f" {data_repo['version']}"
" See also: <https://postmarketos.org/warning-repo>")
return False
# b) Repo newer
elif compare == -1:
return True
# c) Same version, look at last modified
elif compare == 0:
time_installed = float(data_installed["timestamp"])
time_repo = float(data_repo["timestamp"])
return time_repo > time_installed
def packages_split_to_add_del(packages):
def replace_aports_packages_with_path(args, packages, suffix, arch):
"""
Sort packages into "to_add" and "to_del" lists depending on their pkgname
starting with an exclamation mark.
:param packages: list of pkgnames
:returns: (to_add, to_del) - tuple of lists of pkgnames, e.g.
(["hello-world", ...], ["some-conflict-pkg", ...])
apk will only re-install packages with the same pkgname,
pkgver and pkgrel, when you give it the absolute path to the package.
This function replaces all packages that were built locally,
with the absolute path to the package.
"""
to_add = []
to_del = []
for package in packages:
if package.startswith("!"):
to_del.append(package.lstrip("!"))
else:
to_add.append(package)
return (to_add, to_del)
def packages_get_locally_built_apks(args, packages, arch):
"""
Iterate over packages and if existing, get paths to locally built packages.
This is used to force apk to upgrade packages to newer local versions, even
if the pkgver and pkgrel did not change.
:param packages: list of pkgnames
:param arch: architecture that the locally built packages should have
:returns: list of apk file paths that are valid inside the chroots, e.g.
["/mnt/pmbootstrap-packages/x86_64/hello-world-1-r6.apk", ...]
"""
channel = pmb.config.pmaports.read_config(args)["channel"]
ret = []
for package in packages:
data_repo = pmb.parse.apkindex.package(args, package, arch, False)
if not data_repo:
continue
apk_file = f"{package}-{data_repo['version']}.apk"
if not os.path.exists(f"{args.work}/packages/{channel}/{arch}/{apk_file}"):
continue
ret.append(f"/mnt/pmbootstrap-packages/{arch}/{apk_file}")
aport = pmb.helpers.pmaports.find(args, package, False)
if aport:
data_repo = pmb.parse.apkindex.package(args, package, arch, False)
if not data_repo:
raise RuntimeError(f"{package}: could not find binary"
" package, although it should exist for"
" sure at this point in the code."
" Probably an APKBUILD subpackage parsing"
" bug. Related: https://gitlab.com/"
"postmarketOS/build.postmarketos.org/"
"issues/61")
apk_path = (f"/mnt/pmbootstrap-packages/{arch}/"
f"{package}-{data_repo['version']}.apk")
if os.path.exists(f"{args.work}/chroot_{suffix}{apk_path}"):
package = apk_path
ret.append(package)
return ret
def install_run_apk(args, to_add, to_add_local, to_del, suffix):
def install(args, packages, suffix="native", build=True):
"""
Run apk to add packages, and ensure only the desired packages get
explicitly marked as installed.
:param build: automatically build the package, when it does not exist yet
or needs to be updated, and it is inside the pm-aports
folder. Checking this is expensive - if you know that all
packages are provides by upstream repos, set this to False!
"""
# Initialize chroot
check_min_version(args, suffix)
pmb.chroot.init(args, suffix)
# Add depends to packages
arch = pmb.parse.arch.from_chroot_suffix(args, suffix)
packages_with_depends = pmb.parse.depends.recurse(args, packages, suffix)
# Filter outdated packages (build them if required)
packages_installed = installed(args, suffix)
packages_toadd = []
packages_todel = []
for package in packages_with_depends:
if not install_is_necessary(
args, build, arch, package, packages_installed):
continue
if package.startswith("!"):
packages_todel.append(package.lstrip("!"))
else:
packages_toadd.append(package)
if not len(packages_toadd) and not len(packages_todel):
return
:param to_add: list of pkgnames to install, without their dependencies
:param to_add_local: return of packages_get_locally_built_apks()
:param to_del: list of pkgnames to be deleted, this should be set to
conflicting dependencies in any of the packages to be
installed or their dependencies (e.g. ["osk-sdl"])
:param suffix: the chroot suffix, e.g. "native" or "rootfs_qemu-amd64"
"""
# Sanitize packages: don't allow '--allow-untrusted' and other options
# to be passed to apk!
for package in to_add + to_add_local + to_del:
for package in packages_toadd + packages_todel:
if package.startswith("-"):
raise ValueError(f"Invalid package name: {package}")
commands = [["add"] + to_add]
# Readable install message without dependencies
message = f"({suffix}) install"
for pkgname in packages:
if pkgname not in packages_installed:
message += f" {pkgname}"
logging.info(message)
# Local packages: Using the path instead of pkgname makes apk update
# packages of the same version if the build date is different
packages_toadd = replace_aports_packages_with_path(args, packages_toadd,
suffix, arch)
# Split off conflicts
packages_without_conflicts = list(
filter(lambda p: not p.startswith("!"), packages))
# Use a virtual package to mark only the explicitly requested packages as
# explicitly installed, not the ones in to_add_local
if to_add_local:
commands += [["add", "-u", "--virtual", ".pmbootstrap"] + to_add_local,
["del", ".pmbootstrap"]]
if to_del:
commands += [["del"] + to_del]
# explicitly installed, not their dependencies or specific paths (#1212)
commands = [["add"] + packages_without_conflicts]
if len(packages_toadd) and packages_without_conflicts != packages_toadd:
commands = [["add", "-u", "--virtual", ".pmbootstrap"] +
packages_toadd,
["add"] + packages_without_conflicts,
["del", ".pmbootstrap"]]
if len(packages_todel):
commands.append(["del"] + packages_todel)
for (i, command) in enumerate(commands):
if args.offline:
command = ["--no-network"] + command
@ -205,44 +261,6 @@ def install_run_apk(args, to_add, to_add_local, to_del, suffix):
suffix=suffix)
def install(args, packages, suffix="native", build=True):
"""
Install packages from pmbootstrap's local package index or the pmOS/Alpine
binary package mirrors. Iterate over all dependencies recursively, and
build missing packages as necessary.
:param packages: list of pkgnames to be installed
:param suffix: the chroot suffix, e.g. "native" or "rootfs_qemu-amd64"
:param build: automatically build the package, when it does not exist yet
or needs to be updated, and it is inside pmaports. For the
special case that all packages are expected to be in Alpine's
repositories, set this to False for performance optimization.
"""
arch = pmb.parse.arch.from_chroot_suffix(args, suffix)
if not packages:
logging.verbose("pmb.chroot.apk.install called with empty packages list,"
" ignoring")
return
# Initialize chroot
check_min_version(args, suffix)
pmb.chroot.init(args, suffix)
packages_with_depends = pmb.parse.depends.recurse(args, packages, suffix)
to_add, to_del = packages_split_to_add_del(packages_with_depends)
if build:
for package in to_add:
install_build(args, package, arch)
to_add_local = packages_get_locally_built_apks(args, to_add, arch)
to_add_no_deps, _ = packages_split_to_add_del(packages)
logging.info(f"({suffix}) install {' '.join(to_add_no_deps)}")
install_run_apk(args, to_add_no_deps, to_add_local, to_del, suffix)
def installed(args, suffix="native"):
"""
Read the list of installed packages (which has almost the same format, as

View File

@ -55,22 +55,15 @@ def root(args, cmd, suffix="native", working_dir="/", output="log",
# Merge env with defaults into env_all
env_all = {"CHARSET": "UTF-8",
"LANG": "UTF-8",
"HISTFILE": "~/.ash_history",
"HOME": "/root",
"LANG": "UTF-8",
"PATH": pmb.config.chroot_path,
"PYTHONUNBUFFERED": "1",
"SHELL": "/bin/ash",
"TERM": "xterm"}
for key, value in env.items():
env_all[key] = value
# Preserve proxy environment variables
for var in ["FTP_PROXY", "ftp_proxy", "HTTP_PROXY", "http_proxy",
"HTTPS_PROXY", "https_proxy", "HTTP_PROXY_AUTH"]:
if var in os.environ:
env_all[var] = os.environ[var]
# Build the command in steps and run it, e.g.:
# cmd: ["echo", "test"]
# cmd_chroot: ["/sbin/chroot", "/..._native", "/bin/sh", "-c", "echo test"]

View File

@ -17,7 +17,7 @@ from pmb.config.sudo import which_sudo
#
# Exported variables (internal configuration)
#
version = "1.47.1"
version = "1.43.1"
pmb_src = os.path.normpath(os.path.realpath(__file__) + "/../../..")
apk_keys_path = pmb_src + "/pmb/data/keys"
arch_native = pmb.parse.arch.alpine_native()
@ -27,8 +27,7 @@ arch_native = pmb.parse.arch.alpine_native()
# Update this frequently to prevent a MITM attack with an outdated version
# (which may contain a vulnerable apk/openssl, and allows an attacker to
# exploit the system!)
apk_tools_min_version = {"edge": "2.12.9-r7",
"v3.16": "2.12.9-r3",
apk_tools_min_version = {"edge": "2.12.9-r3",
"v3.15": "2.12.7-r3",
"v3.14": "2.12.7-r0",
"v3.13": "2.12.7-r0",
@ -329,8 +328,8 @@ necessary_kconfig_options = {
}
}
# Necessary waydroid kernel config options (android app support)
necessary_kconfig_options_waydroid = {
# Necessary anbox/waydroid kernel config options (android app support)
necessary_kconfig_options_anbox = {
">=0.0.0": { # all versions
"all": { # all arches
"SQUASHFS": True,
@ -339,7 +338,7 @@ necessary_kconfig_options_waydroid = {
"TMPFS_XATTR": True,
"ANDROID_BINDER_IPC": True,
"ANDROID_BINDERFS": False,
"ANDROID_BINDER_DEVICES": ["binder", "hwbinder", "vndbinder"],
"ANDROID_BINDER_DEVICES": ["binder", "hwbinder"],
"NETFILTER_XTABLES": True,
"NETFILTER_XT_MATCH_COMMENT": True,
"IP_NF_MANGLE": True,
@ -354,12 +353,12 @@ necessary_kconfig_options_waydroid = {
},
">=3.5": {
"all": {
"CROSS_MEMORY_ATTACH": True,
"CROSS_MEMORY_ATTACH": True, # required by Waydroid
}
},
">=4.20.0": {
"all": {
"PSI": True, # required by userspace OOM killer
"PSI": True, # required by userspace OOM killer in Waydroid
"PSI_DEFAULT_DISABLED": False,
}
},
@ -370,6 +369,26 @@ necessary_kconfig_options_waydroid = {
}
}
# Necessary apparmor kernel config options (mandatory access control)
# LSM: the value that "config LSM" sets in security/Kconfig, if
# DEFAULT_SECURITY_APPARMOR is set (and other DEFAULT_SECURITY_* are unset).
necessary_kconfig_options_apparmor = {
">=0.0.0": { # all versions
"all": { # all arches
"AUDIT": True,
"DEFAULT_SECURITY_APPARMOR": True,
"LSM": "landlock,lockdown,yama,loadpin,safesetid,integrity,"
"apparmor,selinux,smack,tomoyo,bpf",
"SECURITY_APPARMOR": True,
},
},
"<5.1": {
"all": {
"SECURITY_APPARMOR_BOOTPARAM_VALUE": True,
},
},
}
# Necessary iwd kernel config options (inet wireless daemon)
# Obtained from 'grep ADD_MISSING src/main.c' in iwd.git
necessary_kconfig_options_iwd = {
@ -450,7 +469,7 @@ necessary_kconfig_options_containers = {
"CPUSETS": True,
"KEYS": True,
"VETH": True,
"BRIDGE": True, # (also needed for waydroid)
"BRIDGE": True, # (also needed for anbox)
"BRIDGE_NETFILTER": True,
"IP_NF_FILTER": True,
"IP_NF_TARGET_MASQUERADE": True,
@ -499,7 +518,7 @@ necessary_kconfig_options_containers = {
"DM_THIN_PROVISIONING": True, # Storage Drivers
},
"x86 x86_64": { # only for x86, x86_64 (and sparc64, ia64)
"HUGETLB_PAGE": True,
"CONFIG_HUGETLB_PAGE": True,
"CGROUP_HUGETLB": True, # Optional section
}
},
@ -517,7 +536,7 @@ necessary_kconfig_options_containers = {
},
">=3.9": {
"all": { # all arches
"BRIDGE_VLAN_FILTERING": True, # Network Drivers (also for waydroid)
"BRIDGE_VLAN_FILTERING": True, # Network Drivers (also for anbox)
"MACVLAN": True, # Network Drivers
}
},
@ -593,7 +612,6 @@ apkbuild_package_attributes = {
"provides": {"array": True},
"provider_priority": {"int": True},
"install": {"array": True},
"triggers": {"array": True},
# UI meta-packages can specify apps in "_pmb_recommends" to be explicitly
# installed by default, and not implicitly as dependency of the UI meta-
@ -649,17 +667,13 @@ apkbuild_attributes = {
# git commit
"_commit": {},
"source": {"array": True},
# gcc
"_pkgbase": {},
"_pkgsnap": {}
}
# Reference: https://postmarketos.org/apkbuild-options
apkbuild_custom_valid_options = [
"!pmb:crossdirect",
"!pmb:kconfig-check",
"pmb:kconfigcheck-waydroid",
"pmb:kconfigcheck-anbox",
"pmb:kconfigcheck-containers",
"pmb:kconfigcheck-nftables",
"pmb:cross-native",
@ -706,13 +720,10 @@ deviceinfo_attributes = [
"generate_legacy_uboot_initfs",
"kernel_cmdline",
"generate_bootimg",
"header_version",
"bootimg_qcdt",
"bootimg_mtk_mkimage",
"bootimg_dtb_second",
"bootimg_custom_args",
"flash_offset_base",
"flash_offset_dtb",
"flash_offset_kernel",
"flash_offset_ramdisk",
"flash_offset_second",

View File

@ -64,12 +64,10 @@ def ask_for_work_path(args):
if not exists:
os.makedirs(work, 0o700, True)
# If the version file doesn't exists yet because we either just
# created the work directory or the user has deleted it for
# whatever reason then we need to write initialize it.
work_version_file = f"{work}/version"
if not os.path.isfile(work_version_file):
with open(work_version_file, "w") as handle:
if not os.listdir(work):
# Directory is empty, either because we just created it or
# because user created it before running pmbootstrap init
with open(f"{work}/version", "w") as handle:
handle.write(f"{pmb.config.work_version}\n")
# Create cache_git dir, so it is owned by the host system's user

View File

@ -19,12 +19,6 @@ def odin(args, flavor, folder):
pmb.flasher.init(args)
suffix = "rootfs_" + args.device
# Backwards compatibility with old mkinitfs (pma#660)
suffix_flavor = f"-{flavor}"
pmaports_cfg = pmb.config.pmaports.read_config(args)
if pmaports_cfg.get("supported_mkinitfs_without_flavors", False):
suffix_flavor = ""
# Validate method
method = args.deviceinfo["flash_method"]
if not method.startswith("heimdall-"):
@ -60,16 +54,16 @@ def odin(args, flavor, folder):
if method == "heimdall-isorec":
handle.write(
# Kernel: copy and append md5
f"cp /boot/vmlinuz{suffix_flavor} {odin_kernel_md5}\n"
f"cp /boot/vmlinuz-{flavor} {odin_kernel_md5}\n"
f"md5sum -t {odin_kernel_md5} >> {odin_kernel_md5}\n"
# Initramfs: recompress with lzop, append md5
f"gunzip -c /boot/initramfs{suffix_flavor}"
f"gunzip -c /boot/initramfs-{flavor}"
f" | lzop > {odin_initfs_md5}\n"
f"md5sum -t {odin_initfs_md5} >> {odin_initfs_md5}\n")
elif method == "heimdall-bootimg":
handle.write(
# boot.img: copy and append md5
f"cp /boot/boot.img{suffix_flavor} {odin_kernel_md5}\n"
f"cp /boot/boot.img-{flavor} {odin_kernel_md5}\n"
f"md5sum -t {odin_kernel_md5} >> {odin_kernel_md5}\n")
handle.write(
# Create tar, remove included files and append md5

View File

@ -20,7 +20,7 @@ def kernel(args):
pmb.chroot.initfs.build(args, flavor, "rootfs_" + args.device)
# Check kernel config
pmb.parse.kconfig.check(args, flavor, must_exist=False)
pmb.parse.kconfig.check(args, flavor)
# Generate the paths and run the flasher
if args.action_flasher == "boot":

View File

@ -379,12 +379,11 @@ def kconfig(args):
# Handle passing a file directly
if args.file:
if pmb.parse.kconfig.check_file(args.package,
waydroid=args.waydroid,
anbox=args.anbox,
nftables=args.nftables,
containers=args.containers,
zram=args.zram,
netboot=args.netboot,
community=args.community,
uefi=args.uefi,
details=True):
logging.info("kconfig check succeeded!")
@ -415,13 +414,13 @@ def kconfig(args):
continue
if not pmb.parse.kconfig.check(
args, package,
force_waydroid_check=args.waydroid,
force_anbox_check=args.anbox,
force_apparmor_check=args.apparmor,
force_iwd_check=args.iwd,
force_nftables_check=args.nftables,
force_containers_check=args.containers,
force_zram_check=args.zram,
force_netboot_check=args.netboot,
force_community_check=args.community,
force_uefi_check=args.uefi,
details=True):
error = True

View File

@ -34,7 +34,7 @@ def package(args, pkgname, reason="", dry=False):
pmb.helpers.file.replace(path, old, new)
# Verify
del pmb.helpers.other.cache["apkbuild"][path]
del(pmb.helpers.other.cache["apkbuild"][path])
apkbuild = pmb.parse.apkbuild(path)
if int(apkbuild["pkgrel"]) != pkgrel_new:
raise RuntimeError("Failed to bump pkgrel for package '" + pkgname +

View File

@ -46,7 +46,6 @@ def background(cmd, working_dir=None):
def pipe(cmd, working_dir=None):
""" Run a subprocess in background and redirect its output to a pipe. """
ret = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stdin=subprocess.DEVNULL,
stderr=pmb.helpers.logging.logfd, cwd=working_dir)
logging.verbose(f"New background process: pid={ret.pid}, output=pipe")
return ret
@ -126,7 +125,7 @@ def kill_command(args, pid, sudo):
def foreground_pipe(args, cmd, working_dir=None, output_to_stdout=False,
output_return=False, output_timeout=True,
sudo=False, stdin=None):
sudo=False):
"""
Run a subprocess in foreground with redirected output and optionally kill
it after being silent for too long.
@ -146,8 +145,7 @@ def foreground_pipe(args, cmd, working_dir=None, output_to_stdout=False,
"""
# Start process in background (stdout and stderr combined)
process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, cwd=working_dir,
stdin=stdin)
stderr=subprocess.STDOUT, cwd=working_dir)
# Make process.stdout non-blocking
handle = process.stdout.fileno()
@ -285,14 +283,14 @@ def core(args, log_message, cmd, working_dir=None, output="log",
their properties. "wait" indicates that we wait for the
process to complete.
output value | timeout | out to log | out to stdout | wait | pass stdin
------------------------------------------------------------------------
"log" | x | x | | x |
"stdout" | x | x | x | x | x
"interactive" | | x | x | x | x
"tui" | | | x | x | x
"background" | | x | | |
"pipe" | | | | |
output value | timeout | out to log | out to stdout | wait
-----------------------------------------------------------
"log" | x | x | | x
"stdout" | x | x | x | x
"interactive" | | x | x | x
"tui" | | | x | x
"background" | | x | |
"pipe" | | | |
:param output_return: in addition to writing the program's output to the
destinations above in real time, write to a buffer
@ -338,13 +336,11 @@ def core(args, log_message, cmd, working_dir=None, output="log",
output_timeout = output in ["log", "stdout"] and not disable_timeout
stdin = subprocess.DEVNULL if output == "log" else None
(code, output_after_run) = foreground_pipe(args, cmd, working_dir,
output_to_stdout,
output_return,
output_timeout,
sudo, stdin)
sudo)
# Check the return code
if check is not False:

View File

@ -163,7 +163,7 @@ def partition_cgpt(args, layout, size_boot, size_reserve):
"-t", "kernel",
"-b", cgpt['kpart_start'],
"-s", cgpt['kpart_size'],
"-l", "pmOS_kernel",
"-l", "Kernel",
"-S", "1", # Successful flag
"-T", "5", # Tries flag
"-P", "10", # Priority flag

View File

@ -464,8 +464,10 @@ def arguments_kconfig(subparser):
check.add_argument("--arch", choices=arch_choices, dest="arch")
check.add_argument("--file", action="store_true", help="check a file"
" directly instead of a config in a package")
check.add_argument("--waydroid", action="store_true", help="check"
" options needed for waydroid too")
check.add_argument("--anbox", action="store_true", help="check"
" options needed for anbox too")
check.add_argument("--apparmor", action="store_true", help="check"
" options needed for apparmor too")
check.add_argument("--iwd", action="store_true", help="check"
" options needed for iwd too")
check.add_argument("--nftables", action="store_true", help="check"
@ -476,9 +478,6 @@ def arguments_kconfig(subparser):
" options needed for zram support too")
check.add_argument("--netboot", action="store_true", help="check"
" options needed for netbooting too")
check.add_argument("--community", action="store_true", help="check"
" options needed for various features, required for"
" community/main devices")
check.add_argument("--uefi", action="store_true", help="check"
" options needed for uefi too")
add_kernel_arg(check)

View File

@ -119,15 +119,15 @@ def bootimg(args, path):
working_dir=temp_path)
output = {}
header_version = 0
header_version = None
# Get base, offsets, pagesize, cmdline and qcdt info
# This file does not exist for example for qcdt images
if os.path.isfile(f"{bootimg_path}-header_version"):
with open(f"{bootimg_path}-header_version", 'r') as f:
header_version = int(f.read().replace('\n', ''))
output["header_version"] = str(header_version)
if header_version >= 3:
if header_version is not None and header_version >= 3:
output["header_version"] = str(header_version)
output["pagesize"] = "4096"
else:
with open(f"{bootimg_path}-base", 'r') as f:
@ -147,11 +147,6 @@ def bootimg(args, path):
with open(f"{bootimg_path}-pagesize", 'r') as f:
output["pagesize"] = f.read().replace('\n', '')
if header_version == 2:
with open(f"{bootimg_path}-dtb_offset", 'r') as f:
output["dtb_offset"] = ("0x%08x"
% int(f.read().replace('\n', ''), 16))
output["qcdt"] = ("true" if os.path.isfile(f"{bootimg_path}-dt") and
os.path.getsize(f"{bootimg_path}-dt") > 0 else "false")
output["mtk_mkimage"] = ("true" if check_mtk_bootimg(bootimg_path)

View File

@ -106,7 +106,7 @@ def parse_kernel_suffix(args, info, device, kernel):
# Move ret[key_kernel] to ret[key]
logging.verbose(f"parse_kernel_suffix: {key_kernel} => {key}")
ret[key] = ret[key_kernel]
del ret[key_kernel]
del(ret[key_kernel])
return ret

View File

@ -85,13 +85,13 @@ def check_option(component, details, config, config_path_pretty, option,
def check_config(config_path, config_path_pretty, config_arch, pkgver,
waydroid=False,
anbox=False,
apparmor=False,
iwd=False,
nftables=False,
containers=False,
zram=False,
netboot=False,
community=False,
uefi=False,
details=False):
logging.debug(f"Check kconfig: {config_path}")
@ -99,8 +99,10 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver,
config = handle.read()
components = {"postmarketOS": pmb.config.necessary_kconfig_options}
if waydroid:
components["waydroid"] = pmb.config.necessary_kconfig_options_waydroid
if anbox:
components["anbox"] = pmb.config.necessary_kconfig_options_anbox
if apparmor:
components["apparmor"] = pmb.config.necessary_kconfig_options_apparmor
if iwd:
components["iwd"] = pmb.config.necessary_kconfig_options_iwd
if nftables:
@ -112,14 +114,6 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver,
components["zram"] = pmb.config.necessary_kconfig_options_zram
if netboot:
components["netboot"] = pmb.config.necessary_kconfig_options_netboot
if community:
components["waydroid"] = pmb.config.necessary_kconfig_options_waydroid
components["iwd"] = pmb.config.necessary_kconfig_options_iwd
components["nftables"] = pmb.config.necessary_kconfig_options_nftables
components["containers"] = \
pmb.config.necessary_kconfig_options_containers
components["zram"] = pmb.config.necessary_kconfig_options_zram
components["netboot"] = pmb.config.necessary_kconfig_options_netboot
if uefi:
components["uefi"] = pmb.config.necessary_kconfig_options_uefi
@ -165,21 +159,19 @@ def check_config_options_set(config, config_path_pretty, config_arch, options,
def check(args, pkgname,
force_waydroid_check=False,
force_anbox_check=False,
force_apparmor_check=False,
force_iwd_check=False,
force_nftables_check=False,
force_containers_check=False,
force_zram_check=False,
force_netboot_check=False,
force_community_check=False,
force_uefi_check=False,
details=False,
must_exist=True):
details=False):
"""
Check for necessary kernel config options in a package.
:returns: True when the check was successful, False otherwise
None if the aport cannot be found (only if must_exist=False)
"""
# Pkgname: allow omitting "linux-" prefix
if pkgname.startswith("linux-"):
@ -189,13 +181,13 @@ def check(args, pkgname,
# Read all kernel configs in the aport
ret = True
aport = pmb.helpers.pmaports.find(args, "linux-" + flavor, must_exist=must_exist)
if aport is None:
return None
aport = pmb.helpers.pmaports.find(args, "linux-" + flavor)
apkbuild = pmb.parse.apkbuild(f"{aport}/APKBUILD")
pkgver = apkbuild["pkgver"]
check_waydroid = force_waydroid_check or (
"pmb:kconfigcheck-waydroid" in apkbuild["options"])
check_anbox = force_anbox_check or (
"pmb:kconfigcheck-anbox" in apkbuild["options"])
check_apparmor = force_apparmor_check or (
"pmb:kconfigcheck-apparmor" in apkbuild["options"])
check_iwd = force_iwd_check or (
"pmb:kconfigcheck-iwd" in apkbuild["options"])
check_nftables = force_nftables_check or (
@ -206,8 +198,6 @@ def check(args, pkgname,
"pmb:kconfigcheck-zram" in apkbuild["options"])
check_netboot = force_netboot_check or (
"pmb:kconfigcheck-netboot" in apkbuild["options"])
check_community = force_community_check or (
"pmb:kconfigcheck-community" in apkbuild["options"])
check_uefi = force_uefi_check or (
"pmb:kconfigcheck-uefi" in apkbuild["options"])
for config_path in glob.glob(aport + "/config-*"):
@ -228,13 +218,13 @@ def check(args, pkgname,
config_path_pretty = f"linux-{flavor}/{os.path.basename(config_path)}"
ret &= check_config(config_path, config_path_pretty, config_arch,
pkgver,
waydroid=check_waydroid,
anbox=check_anbox,
apparmor=check_apparmor,
iwd=check_iwd,
nftables=check_nftables,
containers=check_containers,
zram=check_zram,
netboot=check_netboot,
community=check_community,
uefi=check_uefi,
details=details)
return ret
@ -272,9 +262,9 @@ def extract_version(config_file):
return "unknown"
def check_file(config_file, waydroid=False, nftables=False,
containers=False, zram=False, netboot=False,
community=False, uefi=False, details=False):
def check_file(config_file, anbox=False, nftables=False,
containers=False, zram=False, netboot=False, uefi=False,
details=False):
"""
Check for necessary kernel config options in a kconfig file.
@ -285,11 +275,10 @@ def check_file(config_file, waydroid=False, nftables=False,
logging.debug(f"Check kconfig: parsed arch={arch}, version={version} from "
f"file: {config_file}")
return check_config(config_file, config_file, arch, version,
waydroid=waydroid,
anbox=anbox,
nftables=nftables,
containers=containers,
zram=zram,
netboot=netboot,
community=community,
uefi=uefi,
details=details)

View File

@ -177,7 +177,7 @@ def get_token(previous, rest):
value = -1
# Get the next token (for non-leading zeros)
if not len(rest):
if(not len(rest)):
next = "end"
elif next == "invalid" and not invalid_suffix:
(next, rest) = next_token(previous, rest)

View File

@ -277,6 +277,7 @@ def install_depends(args, arch):
Install any necessary qemu dependencies in native chroot
"""
depends = [
"mesa-dri-classic",
"mesa-dri-gallium",
"mesa-egl",
"mesa-gl",

View File

@ -56,7 +56,7 @@ def ssh_install_apks(args, user, host, port, paths):
add_cmd = pmb.helpers.run.flat_cmd(add_cmd)
clean_cmd = pmb.helpers.run.flat_cmd(['rm'] + remote_paths)
command = ['ssh', '-t', '-p', port, f'{user}@{host}',
f'{add_cmd}; rc=$?; {clean_cmd}; exit $rc']
f'{add_cmd}; {clean_cmd}']
pmb.helpers.run.user(args, command, output="tui")

View File

@ -1,11 +1,9 @@
# Copyright 2022 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
import fnmatch
import pytest
import sys
import pmb_test # noqa
import pmb.build
import pmb.chroot.apk
@ -20,135 +18,15 @@ def args(tmpdir, request):
return args
def test_install_build(monkeypatch, args):
func = pmb.chroot.apk.install_build
ret_apkindex_package = None
def test_install_is_necessary(args):
# osk-sdl not installed, nothing to do
ret = pmb.chroot.apk.install_is_necessary(args, False, "aarch64",
"!osk-sdl",
{"unl0kr": {"unl0kr": {}}})
assert not ret
def fake_build_package(args, package, arch):
return "build-pkg"
monkeypatch.setattr(pmb.build, "package", fake_build_package)
def fake_apkindex_package(args, package, arch, must_exist):
return ret_apkindex_package
monkeypatch.setattr(pmb.parse.apkindex, "package", fake_apkindex_package)
package = "hello-world"
arch = "x86_64"
# invoked as pmb install, build_pkgs_on_install disabled
args.action = "install"
args.build_pkgs_on_install = False
with pytest.raises(RuntimeError) as e:
func(args, package, arch)
assert "no binary package found" in str(e.value)
# invoked as pmb install, build_pkgs_on_install disabled, binary exists
args.action = "install"
args.build_pkgs_on_install = False
ret_apkindex_package = {"pkgname": "hello-world"}
assert func(args, package, arch) is None
# invoked as pmb install, build_pkgs_on_install enabled
args.action = "install"
args.build_pkgs_on_install = True
assert func(args, package, arch) == "build-pkg"
# invoked as not pmb install
args.action = "chroot"
args.build_pkgs_on_install = False
assert func(args, package, arch) == "build-pkg"
def test_packages_split_to_add_del():
packages = ["hello", "!test", "hello2", "test2", "!test3"]
to_add, to_del = pmb.chroot.apk.packages_split_to_add_del(packages)
assert to_add == ["hello", "hello2", "test2"]
assert to_del == ["test", "test3"]
def test_packages_get_locally_built_apks(monkeypatch, args):
args.assume_yes = True
arch = pmb.config.arch_native
packages = ["hello-world", # will exist in repo and locally
"postmarketos-base", # will exist in repo only
"package-that-does-not-exist"] # will not exist at all
pmb.chroot.zap(args, pkgs_local=True)
pmb.build.package(args, "hello-world", force=True)
ret = pmb.chroot.apk.packages_get_locally_built_apks(args, packages, arch)
assert len(ret) == 1
assert fnmatch.fnmatch(ret[0], "*/hello-world-*.apk")
def test_install_run_apk(monkeypatch, args):
global cmds_progress
global cmds
func = pmb.chroot.apk.install_run_apk
suffix = "chroot_native"
def fake_chroot_root(args, command, suffix):
global cmds
cmds += [command]
monkeypatch.setattr(pmb.chroot, "root", fake_chroot_root)
def fake_apk_progress(args, command, chroot, suffix):
global cmds_progress
cmds_progress += [command]
monkeypatch.setattr(pmb.helpers.apk, "apk_with_progress", fake_apk_progress)
def reset_cmds():
global cmds_progress, cmds
cmds = []
cmds_progress = []
# Simple add
reset_cmds()
to_add = ["postmarketos-base", "device-ppp"]
to_add_local = []
to_del = []
func(args, to_add, to_add_local, to_del, suffix)
assert cmds_progress == [["apk", "add", "postmarketos-base", "device-ppp"]]
assert cmds == []
# Add and delete
reset_cmds()
to_add = ["postmarketos-base", "device-ppp"]
to_add_local = []
to_del = ["osk-sdl"]
func(args, to_add, to_add_local, to_del, suffix)
assert cmds_progress == [["apk", "add", "postmarketos-base", "device-ppp"]]
assert cmds == [["apk", "--no-progress", "del", "osk-sdl"]]
# Add with local package
reset_cmds()
to_add = ["postmarketos-base", "device-ppp"]
to_add_local = ["/tmp/device-ppp.apk"]
to_del = []
func(args, to_add, to_add_local, to_del, suffix)
assert cmds_progress == [["apk", "add", "postmarketos-base", "device-ppp"]]
assert cmds == [["apk", "--no-progress", "add", "-u", "--virtual",
".pmbootstrap", "/tmp/device-ppp.apk"],
["apk", "--no-progress", "del", ".pmbootstrap"]]
# Add with --no-network
reset_cmds()
args.offline = True
to_add = ["hello-world"]
to_add_local = []
to_del = []
func(args, to_add, to_add_local, to_del, suffix)
assert cmds_progress == [["apk", "--no-network", "add", "hello-world"]]
assert cmds == []
# Package name starting with '-'
reset_cmds()
to_add = ["hello-world", "--allow-untrusted"]
to_add_local = []
to_del = []
with pytest.raises(ValueError) as e:
func(args, to_add, to_add_local, to_del, suffix)
assert "Invalid package name" in str(e.value)
# osk-sdl installed, (un)install necessary
ret = pmb.chroot.apk.install_is_necessary(args, False, "aarch64",
"!osk-sdl",
{"osk-sdl": {"osk-sdl": {}}})
assert ret

View File

@ -43,8 +43,7 @@ def test_bootimg_invalid_file(args):
def test_bootimg_normal(args):
path = pmb_test.const.testdata + "/bootimg/normal-boot.img"
output = {"header_version": "0",
"base": "0x80000000",
output = {"base": "0x80000000",
"kernel_offset": "0x00008000",
"ramdisk_offset": "0x04000000",
"second_offset": "0x00f00000",
@ -74,8 +73,7 @@ def test_bootimg_qcdt(args):
def test_bootimg_mtk_mkimage(args):
path = pmb_test.const.testdata + "/bootimg/mtk_mkimage-boot.img"
output = {"header_version": "0",
"base": "0x10000000",
output = {"base": "0x10000000",
"kernel_offset": "0x00008000",
"ramdisk_offset": "0x01000000",
"second_offset": "0x00f00000",
@ -90,8 +88,7 @@ def test_bootimg_mtk_mkimage(args):
def test_bootimg_mtk_mkimage_recovery(args):
path = pmb_test.const.testdata + "/bootimg/mtk_mkimage-boot-recovery.img"
output = {"header_version": "0",
"base": "0x80000000",
output = {"base": "0x80000000",
"kernel_offset": "0x00008000",
"ramdisk_offset": "0x04000000",
"second_offset": "0x00f00000",
@ -106,8 +103,7 @@ def test_bootimg_mtk_mkimage_recovery(args):
def test_bootimg_dtb_second(args):
path = pmb_test.const.testdata + "/bootimg/dtb-second-boot.img"
output = {"header_version": "0",
"base": "0x00000000",
output = {"base": "0x00000000",
"kernel_offset": "0x00008000",
"ramdisk_offset": "0x02000000",
"second_offset": "0x00f00000",
@ -120,23 +116,6 @@ def test_bootimg_dtb_second(args):
assert pmb.parse.bootimg(args, path) == output
def test_bootimg_v2(args):
path = pmb_test.const.testdata + "/bootimg/boot-header-v2.img"
output = {"header_version": "2",
"base": "0x40078000",
"kernel_offset": "0x00008000",
"ramdisk_offset": "0x07c08000",
"second_offset": "0x00e10000",
"tags_offset": "0x0bc08000",
"pagesize": "2048",
"dtb_offset": "0x0bc08000",
"cmdline": "bootopt=64S3,32N2,64N2 systempart=/dev/mapper/system",
"qcdt": "false",
"mtk_mkimage": "false",
"dtb_second": "false"}
assert pmb.parse.bootimg(args, path) == output
def test_bootimg_v3(args):
path = pmb_test.const.testdata + "/bootimg/boot-header-v3.img"
output = {"header_version": "3",

View File

@ -21,21 +21,17 @@ def args(tmpdir, request):
def test_kconfig_check(args):
# non-existing package
assert pmb.parse.kconfig.check(args, "non-existing-kernel-package",
must_exist=False) is None
# basic checks, from easiers to hard-ish
dir = f"{pmb_test.const.testdata}/kconfig_check/"
assert not pmb.parse.kconfig.check_file(dir +
"bad-missing-required-option")
assert pmb.parse.kconfig.check_file(dir + "good")
assert not pmb.parse.kconfig.check_file(dir + "bad-wrong-option-set")
assert pmb.parse.kconfig.check_file(dir + "good-waydroid",
waydroid=True)
assert pmb.parse.kconfig.check_file(dir + "good-anbox",
anbox=True)
assert not pmb.parse.kconfig.check_file(dir +
"bad-array-missing-some-options",
waydroid=True)
anbox=True)
assert pmb.parse.kconfig.check_file(dir + "good-nftables",
nftables=True)
assert not pmb.parse.kconfig.check_file(dir + "bad-nftables",
@ -56,12 +52,12 @@ def test_kconfig_check(args):
# supports nftables (with pmb:kconfigcheck-nftables)
assert pmb.parse.kconfig.check(args, "nokia-n900")
# supports Waydroid (with pmb:kconfigcheck-waydroid)
# supports Anbox (with pmb:kconfigcheck-anbox)
assert pmb.parse.kconfig.check(args, "postmarketos-allwinner")
# testing the force param: nokia-n900 will never need the uefi options
# testing the force param: nokia-n900 will never have anbox support
assert not pmb.parse.kconfig.check(args, "nokia-n900",
force_uefi_check=True)
force_anbox_check=True)
# supports zram (with pmb:kconfigcheck-zram), nftables
assert pmb.parse.kconfig.check(args, "linux-purism-librem5")

View File

@ -91,8 +91,7 @@ def test_questions_bootimg(args, monkeypatch):
bootimg_path = pmb_test.const.testdata + "/bootimg/normal-boot.img"
fake_answers(monkeypatch, [bootimg_path])
output = {"header_version": "0",
"base": "0x80000000",
output = {"base": "0x80000000",
"kernel_offset": "0x00008000",
"ramdisk_offset": "0x04000000",
"second_offset": "0x00f00000",

View File

@ -1,7 +1,6 @@
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Ariadne Conill <ariadne@dereferenced.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=binutils
pkgver=2.39
pkgver=2.35.2
pkgrel=1
pkgdesc="Tools necessary to build programs"
url="https://www.gnu.org/software/binutils/"
@ -16,7 +15,7 @@ source="https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz
gold-mips.patch
ld-bfd-mips.patch
0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
binutils-mips-disable-assert.patch
CVE-2021-3487.patch
"
builddir="$srcdir/$pkgname-$pkgver"
@ -46,12 +45,10 @@ build() {
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
@ -81,14 +78,12 @@ build() {
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-multilib \
--disable-gprofng \
--enable-ld=default \
$_gold_configure \
--enable-64-bit-bfd \
$_plugin_configure \
--enable-plugins \
--enable-relro \
--enable-deterministic-archives \
--enable-default-execstack=no \
$_cross_configure \
$_arch_configure \
$_hash_style_configure \
@ -111,7 +106,6 @@ package() {
# 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
}
@ -133,11 +127,9 @@ gold() {
mv "$pkgdir"/usr/$CTARGET/bin/ld.gold "$subpkgdir"/usr/$CTARGET/bin/ld.gold
}
sha512sums="
68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.tar.xz
sha512sums="9974ede5978d32e0d68fef23da48fa00bd06b0bff7ec45b00ca075c126d6bbe0cf2defc03ecc3f17bc6cc85b64271a13009c4049d7ba17de26e84e3a6e2c0348 binutils-2.35.2.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
"
642c617db6c6e491f78f053d60f3aa369bad7bf8c1bc7ce267de6cf8fddf6c0d4cf63ce8c8f6e2f225dedbce7cb930d8e87e168fd8f72ca0837c77266ee2b5f8 0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
b08384ed124a74ad3a424db370c107230f09a54378502ca4385deb738f7cf799857f2af0db52709c7eeab8fa6c0a3d972f891396cce1e2834a21f67682fc4355 CVE-2021-3487.patch"

View File

@ -1,10 +1,6 @@
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Ariadne Conill <ariadne@dereferenced.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gcc
_pkgbase=12.2.1 # must match gcc/BASE-VER
_pkgsnap=20220924
pkgver=${_pkgbase}_git${_pkgsnap}
pkgver=8.2.0
[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
@ -12,35 +8,33 @@ pkgver=${_pkgbase}_git${_pkgsnap}
pkgname="$pkgname$_target"
pkgrel=1
pkgdesc="The GNU Compiler Collection"
url="https://gcc.gnu.org"
url="http://gcc.gnu.org"
arch="all"
license="GPL-2.0-or-later LGPL-2.1-or-later"
license="GPL LGPL"
_gccrel=$pkgver-r$pkgrel
depends="binutils$_target"
makedepends_build="gcc$_cross g++$_cross bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev"
makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev !gettext-dev libucontext-dev"
depends="binutils$_target isl"
makedepends_build="gcc$_cross g++$_cross paxmark bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev"
makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev !gettext-dev"
subpackages=" "
[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-doc$_target"
replaces="libstdc++ binutils"
: "${LANG_CXX:=true}"
: "${LANG_D:=true}"
: "${LANG_OBJC:=true}"
: "${LANG_GO:=true}"
: "${LANG_FORTRAN:=true}"
: "${LANG_ADA:=true}"
: "${LANG_JIT:=true}"
: ${LANG_CXX:=true}
: ${LANG_OBJC:=true}
: ${LANG_GO:=true}
: ${LANG_FORTRAN:=true}
: ${LANG_ADA:=true}
_libgomp=true
_libgcc=true
_libatomic=true
_libitm=true
LIBGOMP=true
LIBGCC=true
LIBATOMIC=true
LIBITM=true
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
LANG_CXX=false
LANG_ADA=false
_libgcc=false
LIBGCC=false
_builddir="$srcdir/build-cross-pass2"
else
_builddir="$srcdir/build-cross-final"
@ -48,11 +42,9 @@ if [ "$CHOST" != "$CTARGET" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
_libgomp=false
_libatomic=false
_libitm=false
LIBGOMP=false
LIBATOMIC=false
LIBITM=false
# reset target flags (should be set in crosscreate abuild)
# fixup flags. seems gcc treats CPPFLAGS as global without
@ -86,8 +78,6 @@ elif [ "$CBUILD" != "$CHOST" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
_builddir="$srcdir/build-cross-native"
@ -96,63 +86,37 @@ else
_builddir="$srcdir/build"
fi
case "$CARCH" in
# GDC hasn't been ported to PowerPC
# See libphobos/configure.tgt in GCC sources for supported targets
# riscv fails with: error: static assert "unimplemented"
ppc64le|riscv64) LANG_D=false ;;
# GDC does currently not work on 32-bit musl architectures.
# This is a known upstream issue.
# See: https://github.com/dlang/druntime/pull/3383
armhf|armv7|x86) LANG_D=false ;;
esac
# Go needs {set,make,swap}context, unimplemented in musl
[ "$CTARGET_LIBC" = musl ] && LANG_GO=false
# libitm has TEXTRELs in ARM build, so disable for now
case "$CTARGET_ARCH" in
arm*) _libitm=false ;;
mips*) _libitm=false ;;
riscv64) _libitm=false ;;
esac
# Internal libffi fails to build on MIPS at the moment, need to
# investigate further. We disable LANG_GO on mips64 as it requires
# the internal libffi.
case "$CTARGET_ARCH" in
mips*) LANG_GO=false ;;
arm*) LIBITM=false ;;
mips*) LIBITM=false ;;
esac
# Fortran uses libquadmath if toolchain has __float128
# currently on x86, x86_64 and ia64
_libquadmath=$LANG_FORTRAN
LIBQUADMATH=$LANG_FORTRAN
case "$CTARGET_ARCH" in
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
*) _libquadmath=false ;;
x86 | x86_64) LIBQUADMATH=$LANG_FORTRAN ;;
*) LIBQUADMATH=false ;;
esac
# libatomic is a dependency for openvswitch
$_libatomic && subpackages="$subpackages libatomic::$CTARGET_ARCH"
$_libgcc && subpackages="$subpackages libgcc::$CTARGET_ARCH"
$_libquadmath && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
if $_libgomp; then
$LIBATOMIC && subpackages="$subpackages libatomic::$CTARGET_ARCH"
$LIBGCC && subpackages="$subpackages libgcc::$CTARGET_ARCH"
$LIBQUADMATH && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
if $LIBGOMP; then
depends="$depends libgomp=$_gccrel"
subpackages="$subpackages libgomp::$CTARGET_ARCH"
fi
case "$CARCH" in
riscv64)
LANG_ADA=false;;
esac
_languages=c
if $LANG_CXX; then
subpackages="$subpackages libstdc++:libcxx:$CTARGET_ARCH libstdc++-dev$_target:libcxx_dev g++$_target:gpp"
subpackages="$subpackages libstdc++:libcxx:$CTARGET_ARCH g++$_target:gpp"
_languages="$_languages,c++"
fi
if $LANG_D; then
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
_languages="$_languages,d"
makedepends_build="$makedepends_build libucontext-dev gcc-gdc-bootstrap"
fi
if $LANG_OBJC; then
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
_languages="$_languages,objc"
@ -166,83 +130,56 @@ if $LANG_FORTRAN; then
_languages="$_languages,fortran"
fi
if $LANG_ADA; then
subpackages="$subpackages gcc-gnat$_target:gnat"
subpackages="$subpackages libgnat::$CTARGET_ARCH gcc-gnat$_target:gnat"
_languages="$_languages,ada"
if [ "$CBUILD" = "$CTARGET" ]; then
makedepends_build="$makedepends_build gcc-gnat-bootstrap"
subpackages="$subpackages libgnat-static:libgnatstatic:$CTARGET_ARCH libgnat::$CTARGET_ARCH"
else
subpackages="$subpackages libgnat::$CTARGET_ARCH"
makedepends_build="$makedepends_build gcc-gnat gcc-gnat$_cross"
fi
fi
if $LANG_JIT; then
subpackages="$subpackages libgccjit:jit libgccjit-dev:jitdev"
makedepends_build="$makedepends_build gcc-gnat gcc-gnat$_cross"
fi
makedepends="$makedepends_build $makedepends_host"
# when using upstream releases, use this URI template
# https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz
#
# right now, we are using a git snapshot. snapshots are taken from gcc.gnu.org/pub/gcc/snapshots.
# However, since they are periodically deleted from the GCC mirrors the utilized snapshots are
# mirrored on dev.alpinelinux.org. Please ensure that the snapshot Git commit (as stated in the
# README) matches the base commit on the version-specific branch in the Git repository below.
#
# PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches,
# so that they can be properly tracked and easily rebased if needed.
source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-${_pkgsnap}/gcc-${_pkgbase%%.*}-${_pkgsnap}.tar.xz
0001-posix_memalign.patch
0002-gcc-poison-system-directories.patch
0003-specs-turn-on-Wl-z-now-by-default.patch
0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
0006-Enable-Wformat-and-Wformat-security-by-default.patch
0007-Enable-Wtrampolines-by-default.patch
0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
0011-libiberty-copy-PIC-objects-during-build-process.patch
0012-libitm-disable-FORTIFY.patch
0013-libgcc_s.patch
0014-nopie.patch
0015-dlang-use-libucontext-on-mips64.patch
0016-ada-fix-shared-linking.patch
0017-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
0018-add-fortify-headers-paths.patch
0019-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
0020-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
0021-mips64-disable-multilib-support.patch
0022-aarch64-disable-multilib-support.patch
0023-s390x-disable-multilib-support.patch
0024-ppc64-le-disable-multilib-support.patch
0025-x86_64-disable-multilib-support.patch
0026-riscv-disable-multilib-support.patch
0027-always-build-libgcc_eh.a.patch
0028-ada-libgnarl-compatibility-for-musl.patch
0029-ada-musl-support-fixes.patch
0033-gcc-go-link-to-libucontext.patch
0034-Use-generic-errstr.go-implementation-on-musl.patch
0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
0036-configure-fix-detection-of-atomic-builtins-in-libato.patch
0037-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch
0039-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
0041-go-gospec-forcibly-disable-fsplit-stack-support.patch
0042-gcc-go-fix-build-error-with-SYS_SECCOMP.patch
0043-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
0044-gdc-unconditionally-link-libgphobos-against-libucont.patch
0045-druntime-link-against-libucontext-on-all-platforms.patch
0049-libgo-adjust-name-of-union-in-sigevent-struct.patch
0050-libphobos-don-t-define-__mode_t-twice-on-musl-target.patch
0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
0052-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
0053-libgo-make-match.sh-POSIX-shell-compatible.patch
source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz
002_all_default-relro.patch
003_all_default-fortify-source.patch
005_all_default-as-needed.patch
gcc-as-needed-gold.patch
gcc-as-needed-push-pop.patch
011_all_default-warn-format-security.patch
012_all_default-warn-trampolines.patch
013_all_default-ssp-fix.patch
020_all_msgfmt-libstdc++-link.patch
050_all_libiberty-asprintf.patch
051_all_libiberty-pic.patch
053_all_libitm-no-fortify-source.patch
090_all_pr55930-dependency-tracking.patch
0003-gcc-poison-system-directories.patch
203-libgcc_s.patch
205-nopie.patch
0002-posix_memalign.patch
0008-s390x-muslldso.patch
0010-ldbl128-config.patch
0012-static-pie.patch
libgcc-always-build-gcceh.a.patch
gcc-4.9-musl-fortify.patch
gcc-6.1-musl-libssp.patch
gcc-pure64.patch
fix-cxxflags-passing.patch
ada-shared.patch
ada-musl.patch
libgnarl-musl.patch
320-libffi-gnulinux.patch
gcc-pure64-mips.patch
"
# gcc-4.8-build-args.patch
# we build out-of-tree
_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-${_pkgsnap}
_gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
_gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}"
_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver}
_gcclibdir=/usr/lib/gcc/${CTARGET}/$pkgver
_gcclibexec=/usr/libexec/gcc/${CTARGET}/$pkgver
prepare() {
cd "$_gccdir"
@ -265,7 +202,7 @@ prepare() {
return 1
fi
echo ${_pkgbase:-$pkgver} > gcc/BASE-VER
echo ${pkgver} > gcc/BASE-VER
}
build() {
@ -274,7 +211,6 @@ build() {
local _cross_configure=
local _bootstrap_configure=
local _symvers=
local _jit_configure=
cd "$_gccdir"
@ -292,7 +228,6 @@ build() {
i486-*-*-*) _arch_configure="--with-arch=i486 --with-tune=generic --enable-cld";;
i586-*-*-*) _arch_configure="--with-arch=i586 --with-tune=generic --enable-cld";;
s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";;
riscv64-*-*-*) _arch_configure="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic";;
esac
case "$CTARGET_ARCH" in
@ -319,10 +254,10 @@ build() {
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
esac
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
$LIBGOMP || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
$LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
@ -336,112 +271,78 @@ build() {
echo " libc_configure=$_libc_configure"
echo " cross_configure=$_cross_configure"
echo " bootstrap_configure=$_bootstrap_configure"
echo " hash_style_configure=$_hash_style_configure"
echo " hash_style_configure=$_hash_style_configure"
echo ""
export CFLAGS="$CFLAGS -O2"
export CXXFLAGS="$CXXFLAGS -O2"
export CPPFLAGS="$CPPFLAGS -O2"
local version="Alpine $pkgver-r$pkgrel"
local gccconfiguration="
--prefix=/usr
--mandir=/usr/share/man
--infodir=/usr/share/info
--build=${CBUILD}
--host=${CHOST}
--target=${CTARGET}
--enable-checking=release
--disable-fixed-point
--disable-libstdcxx-pch
--disable-multilib
--disable-nls
--disable-werror
$_symvers
--enable-__cxa_atexit
--enable-default-pie
--enable-default-ssp
--enable-cloog-backend
--enable-languages=$_languages
$_arch_configure
$_libc_configure
$_cross_configure
$_bootstrap_configure
--with-bugurl=https://gitlab.alpinelinux.org/alpine/aports/-/issues
--with-system-zlib
$_hash_style_configure
"
mkdir -p "$_builddir"
cd "$_builddir"
"$_gccdir"/configure $gccconfiguration \
--with-pkgversion="$version"
msg "building gcc"
"$_gccdir"/configure --prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--build=${CBUILD} \
--host=${CHOST} \
--target=${CTARGET} \
--with-pkgversion="Alpine ${pkgver}" \
--enable-checking=release \
--disable-fixed-point \
--disable-libstdcxx-pch \
--disable-multilib \
--disable-nls \
--disable-werror \
$_symvers \
--enable-__cxa_atexit \
--enable-default-pie \
--enable-default-ssp \
--enable-cloog-backend \
--enable-languages=$_languages \
$_arch_configure \
$_libc_configure \
$_cross_configure \
$_bootstrap_configure \
--with-system-zlib \
$_hash_style_configure
make
# we build gccjit separate to not build all of gcc with --enable-host-shared
# as doing so slows it down a few %, so for some quick if's here we gain
# free performance
if $LANG_JIT; then
mkdir -p "$_builddir"/libgccjit-build
cd "$_builddir"/libgccjit-build
"$_gccdir"/configure $gccconfiguration \
--disable-bootstrap \
--enable-host-shared \
--enable-languages=jit \
--with-pkgversion="$version"
msg "building libgccjit"
make all-gcc
fi
}
package() {
cd "$_builddir"
make DESTDIR="$pkgdir" install
make -j1 DESTDIR="${pkgdir}" install
ln -s gcc "$pkgdir"/usr/bin/cc
if $LANG_JIT; then
make -C "$_builddir"/libgccjit-build/gcc DESTDIR="$pkgdir" jit.install-common
fi
# we dont support gcj -static
# we don't support gcj -static
# and saving 35MB is not bad.
find "$pkgdir" \( -name libgtkpeer.a \
-o -name libgjsmalsa.a \
-o -name libgij.a \) \
-delete
find "$pkgdir" -name libgtkpeer.a \
-o -name libgjsmalsa.a -o \
-o -name libgij.a -o \
| xargs rm -f
# strip debug info from some static libs
find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
-o -name libgphobos.a -o -name libgdruntime.a \
${STRIP_FOR_TARGET} -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
-o -name libmudflap.a -o -name libmudflapth.a \
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
-o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \
-a -type f \
-exec ${STRIP_FOR_TARGET} -g {} +
-a -type f`
if $_libgomp; then
if $LIBGOMP; then
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
fi
if $_libitm; then
if $LIBITM; then
mv "$pkgdir"/usr/lib/libitm.spec "$pkgdir"/$_gcclibdir
fi
# remove ffi
rm -f "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi*
find "$pkgdir" -name 'ffi*.h' -delete
find "$pkgdir" -name 'ffi*.h' | xargs rm -f
local gdblib=${_target:+$CTARGET/}lib
if [ -d "$pkgdir"/usr/$gdblib/ ]; then
for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py"); do
mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
done
fi
for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py" ); do
mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
done
paxmark -pmrs "$pkgdir"/$_gcclibexec/cc1
# move ada runtime libs
if $LANG_ADA; then
@ -449,26 +350,20 @@ package() {
mv "$i" "$pkgdir"/usr/lib/
ln -s ../../../../${i##*/} $i
done
if [ "$CHOST" = "$CTARGET" ]; then
for i in $(find "$pkgdir"/$_gcclibdir/adalib/ -type f -maxdepth 1 -name "libgna*.a"); do
mv "$i" "$pkgdir"/usr/lib/
ln -s ../../../../${i##*/} $i
done
fi
fi
if [ "$CHOST" != "$CTARGET" ]; then
# cross-gcc: remove any files that would conflict with the
# native gcc package
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "${pkgdir:?}"/usr/share
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "$pkgdir"/usr/share
# libcc1 does not depend on target, don't ship it
rm -rf "$pkgdir"/usr/lib/libcc1.so*
# fixup gcc library symlinks to be linker scripts so
# linker finds the libs from relocated sysroot
for so in "$pkgdir"/usr/"$CTARGET"/lib/*.so; do
for so in "$pkgdir"/usr/$CTARGET/lib/*.so; do
if [ -h "$so" ]; then
local _real=$(basename "$(readlink "$so")")
local _real=$(basename $(readlink "$so"))
rm -f "$so"
echo "GROUP ($_real)" > "$so"
fi
@ -477,33 +372,29 @@ package() {
# add c89/c99 wrapper scripts
cat >"$pkgdir"/usr/bin/c89 <<'EOF'
#!/bin/sh
_flavor="-std=c89"
fl="-std=c89"
for opt; do
case "$opt" in
-ansi|-std=c89|-std=iso9899:1990) _flavor="";;
-ansi|-std=c89|-std=iso9899:1990) fl="";;
-std=*) echo "$(basename $0) called with non ANSI/ISO C option $opt" >&2
exit 1;;
esac
done
exec gcc $_flavor ${1+"$@"}
exec gcc $fl ${1+"$@"}
EOF
cat >"$pkgdir"/usr/bin/c99 <<'EOF'
#!/bin/sh
_flavor="-std=c99"
fl="-std=c99"
for opt; do
case "$opt" in
-std=c99|-std=iso9899:1999) _flavor="";;
-std=c99|-std=iso9899:1999) fl="";;
-std=*) echo "$(basename $0) called with non ISO C99 option $opt" >&2
exit 1;;
esac
done
exec gcc $_flavor ${1+"$@"}
exec gcc $fl ${1+"$@"}
EOF
chmod 755 "$pkgdir"/usr/bin/c?9
# install lto plugin so regular binutils may use it
mkdir -p "$pkgdir"/usr/lib/bfd-plugins
ln -s /$_gcclibexec/liblto_plugin.so "$pkgdir/usr/lib/bfd-plugins/"
fi
}
@ -520,53 +411,26 @@ libcxx() {
pkgdesc="GNU C++ standard runtime library"
depends=
if [ "$CHOST" = "$CTARGET" ]; then
# verify that we are using clock_gettime rather than doing direct syscalls
# so we dont break 32 bit arches due to time64.
nm -D "$pkgdir"/usr/lib/libstdc++.so.* | grep clock_gettime
fi
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libstdc++.so.* "$subpkgdir"/usr/lib/
}
libcxx_dev() {
pkgdesc="GNU C++ standard runtime library (development files)"
depends=
replaces="g++"
amove usr/${_target:+$CTARGET/}lib/libstdc++.a \
usr/${_target:+$CTARGET/}lib/libstdc++.so \
usr/${_target:+$CTARGET/}lib/libstdc++fs.a \
usr/${_target:+$CTARGET/}lib/libsupc++.a \
usr/${_target:+$CTARGET/}include/c++
}
gpp() {
pkgdesc="GNU C++ standard library and compiler"
depends="libstdc++=$_gccrel libstdc++-dev$_target=$_gccrel gcc$_target=$_gccrel libc-dev"
depends="libstdc++=$_gccrel gcc=$_gccrel libc-dev"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/usr/bin \
"$subpkgdir"/usr/${_target:+$CTARGET/}include \
"$subpkgdir"/usr/${_target:+$CTARGET/}lib \
mv "$pkgdir/$_gcclibexec/cc1plus" "$subpkgdir/$_gcclibexec/"
paxmark -pmrs "$subpkgdir/$_gcclibexec/cc1plus"
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/*++* "$subpkgdir"/usr/${_target:+$CTARGET/}lib/
mv "$pkgdir"/usr/${_target:+$CTARGET/}include/c++ "$subpkgdir"/usr/${_target:+$CTARGET/}include/
mv "$pkgdir"/usr/bin/*++ "$subpkgdir"/usr/bin/
}
jit() {
pkgdesc="GCC JIT Library"
depends=
amove usr/lib/libgccjit.so*
}
jitdev() {
pkgdesc="GCC JIT Library (development files)"
depends="libgccjit"
amove usr/include/libgccjit*.h
}
libobjc() {
pkgdesc="GNU Objective-C runtime"
replaces="objc"
@ -580,10 +444,8 @@ objc() {
replaces="gcc"
depends="libc-dev gcc=$_gccrel libobjc=$_gccrel"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include \
mkdir -p "$subpkgdir"/$_gcclibdir/include \
"$subpkgdir"/usr/lib
mv "$pkgdir/$_gcclibexec/cc1obj" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/objc "$subpkgdir"/$_gcclibdir/include/
mv "$pkgdir"/usr/lib/libobjc.so "$pkgdir"/usr/lib/libobjc.a \
"$subpkgdir"/usr/lib/
@ -606,40 +468,6 @@ libgomp() {
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libgomp.so.* "$subpkgdir"/usr/lib/
}
libgphobos() {
pkgdesc="D programming language standard library for GCC"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgdruntime.so.* "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so.* "$subpkgdir"/usr/lib/
}
gdc() {
pkgdesc="GCC-based D language compiler"
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
depends="$depends libucontext-dev"
provides="gcc-gdc-bootstrap=$_gccrel"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include/d/ \
"$subpkgdir"/usr/lib \
"$subpkgdir"/usr/bin
# Copy: The installed '.d' files, the static lib, the binary itself
# The shared libs are part of 'libgphobos' so one can run program
# without installing the compiler
mv "$pkgdir/$_gcclibexec/d21" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/$CTARGET-gdc "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
}
libgo() {
pkgdesc="Go runtime library for GCC"
depends=
@ -650,24 +478,17 @@ libgo() {
go() {
pkgdesc="Go support for GCC"
depends="gcc=$_gccrel libgo=$_gccrel !go"
depends="gcc=$_gccrel libgo=$_gccrel"
mkdir -p "$subpkgdir"/$_gcclibexec \
"$subpkgdir"/usr/lib \
"$subpkgdir"/usr/bin
mv "$pkgdir"/usr/lib/go "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/*gccgo "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/*go "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/*gofmt "$subpkgdir"/usr/bin
mv "$pkgdir"/$_gcclibexec/go1 "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/cgo "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/buildid "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/test2json "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/vet "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/usr/lib/libgo.a \
"$pkgdir"/usr/lib/libgo.so \
"$pkgdir"/usr/lib/libgobegin.a \
"$pkgdir"/usr/lib/libgolibbegin.a \
"$subpkgdir"/usr/lib/
}
@ -691,7 +512,7 @@ libquadmath() {
gfortran() {
pkgdesc="GNU Fortran Compiler"
depends="gcc=$_gccrel libgfortran=$_gccrel"
$_libquadmath && depends="$depends libquadmath=$_gccrel"
$LIBQUADMATH && depends="$depends libquadmath=$_gccrel"
replaces="gcc"
mkdir -p "$subpkgdir"/$_gcclibexec \
@ -702,12 +523,11 @@ gfortran() {
mv "$pkgdir"/usr/lib/libgfortran.a \
"$pkgdir"/usr/lib/libgfortran.so \
"$subpkgdir"/usr/lib/
if $_libquadmath; then
if $LIBQUADMATH; then
mv "$pkgdir"/usr/lib/libquadmath.a \
"$pkgdir"/usr/lib/libquadmath.so \
"$subpkgdir"/usr/lib/
fi
mv "$pkgdir"/$_gcclibdir/finclude "$subpkgdir"/$_gcclibdir/
mv "$pkgdir"/$_gcclibexec/f951 "$subpkgdir"/$_gcclibexec
mv "$pkgdir"/usr/lib/libgfortran.spec "$subpkgdir"/$_gcclibdir
}
@ -720,18 +540,9 @@ libgnat() {
mv "$pkgdir"/usr/lib/libgna*.so "$subpkgdir"/usr/lib/
}
libgnatstatic() {
pkgdesc="GNU Ada static libraries"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgna*.a "$subpkgdir"/usr/lib/
}
gnat() {
pkgdesc="Ada support for GCC"
depends="gcc=$_gccrel"
provides="$pkgname-gnat-bootstrap=$_gccrel"
[ "$CHOST" = "$CTARGET" ] && depends="$depends libgnat=$_gccrel"
mkdir -p "$subpkgdir"/$_gcclibexec \
@ -742,51 +553,34 @@ gnat() {
mv "$pkgdir"/usr/bin/*gnat* "$subpkgdir"/usr/bin/
}
sha512sums="
ba4d9e73d108088da26fbefe18d9b245b76771ffe752c2b4b31bdf38a2d0b638fbc115c377526c27311d4d7ffd4e0d236a5af5016bd364ccaa11a4989d1401e8 gcc-12-20220924.tar.xz
41cbb4d69218006cf9e0cdb6c86212ef451f8decd52a50a7dbb4d34726009da7a4e0261c852b46cb584db253a4bae2f31dc485c506cb545e64a7d26e0ba6c2b6 0001-posix_memalign.patch
531155055cda7f119bcac6479bcae73af9201cd596af9cf1616850bbcf4393b91c5de9f2fbbc1cde6e158fb4df7237b033146f662dff5fa0ea12151cc514adb8 0002-gcc-poison-system-directories.patch
c1275d77b5269386a2ec683933570810f5a2ba1208c161ed887797eb9aee3cb82ef08a8964635902614e6a6e83f3065ba0801c9355d85dd8d60cb1fa20bdf687 0003-specs-turn-on-Wl-z-now-by-default.patch
a54e45bff4484a35d3826435a414d909281453f5605f4081cf3be1f15336cceed93a1d8a54e92e2fa97188623e3030ca1323d7749141e228a7db73795230d86a 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
ad132ddbd0c33a3983e3de4f74d8fdb8cb1ddf53ef54de0a5c12efb49e42014ed117165d43f396bcf3455ecfe2c8620e0326e73b4160a370a4cc92d213329c34 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
0b9ce0f130a7b797770f3d58a5200575f20e5663c86c0c5710718b7bffd3416cc2f05861613d9c258428e9541c6e0b9837d01f0c99d383e2c3de0503a988e861 0006-Enable-Wformat-and-Wformat-security-by-default.patch
e7813acc7ead61373c212cefbe53eb020b4c5bd8f0f35ee972e0524060713f911624f5a1a871feada642e1f3f5e48c8508125ca2da09de351d544bedf1d44ada 0007-Enable-Wtrampolines-by-default.patch
d0d0566a11e4828bdd6f53346a9a6b9841f3066d3f4a05ee2b6fe97aeb4552654170e7662318ea18fc777c3e75c88a067097478fc4e880a3f9c134b8a3af2277 0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
f75e63d9d933874f18fb7f55b135c60dfa0377abafa8e0edb91b85d5f00f4f072d0a338ba5d9baec18494211dbbda8068782830dbafbb37068936f76aede270f 0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
afa4daba222a19569588736a8276dc7c12223a7c222f3dd3795dc3f1cd90f40b90518971ae27b358020354f89562c9680ec8b8e24e85e6d4f8e54e79d185359b 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
79dac82249fb573ec477e1451a33883302eb63a5110853faed117f5021221f2153e2ec845dd5a0043b1bf9f0e5736ef0c89743ff2d771774a281c8b24542803a 0011-libiberty-copy-PIC-objects-during-build-process.patch
b035f85c1703b45d15c1d1ffe7d23400e01625e5d403504911cc92f740b02586447de2a9d66a9f80f12b9c227bc193e2a43942c8af2bdb42cdeff8272bbe6068 0012-libitm-disable-FORTIFY.patch
9fb4d396a9493d2d68fe829ce075ba4c5df148b1d6aaab315a6f8ccbdd70d0e052a5dc50369adc2dab005b4a3becd1504b182faed6e82c86accb95f5bc2b9f50 0013-libgcc_s.patch
f82ac22961d842c9f8e731a601bb255918cc160969888363ad2d83e2ccf08b19114a200d46bcf99d097bf530f470c2b1e71e46828bc1b9fff5469ff945f541d8 0014-nopie.patch
6527dc9d250db48d56cf01e9299461bf22a838ffda96c40d448e18f457b206cec2322275d2d5abbbaf3c6573c5e7eba12724c9691b601f118ff7520e19726373 0015-dlang-use-libucontext-on-mips64.patch
6c3ce0ccd68b19e2c76172d8f24b0747ee0af2b8de7af692f2f699848267d7fc42fec8e5c303102fe05be7e934b56f21eea17ce47c8aca20570590830d88e9b0 0016-ada-fix-shared-linking.patch
7089a96aaec8e0b222cb3fa7301d71bb2e328a24dec33e15ea9e3e7695bcae919308249b9a3be5ea2f3b1f069f9fd1739066f31d12317fcdab0596dba9ca54a4 0017-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
b7ebdeee0b143052fdd6e3efa070ea8621d4fb729312cbc787d618e666b593990a20cd9044a786265970d8e09ec13da03b797009543d0b657b0fe924f2dcaa68 0018-add-fortify-headers-paths.patch
8e682893d6367732ab8c490b915112a68d98855deec3bd8db91dc0d9bf486b8c044b13ee2b95c4806da7ac17c41034e081b7a66861018274cb33fdb2fd6df04a 0019-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
a14c5f98ade5af8cd6e3a0244752674d9c4f6dadb4260f98f1949bff51ac1211a3f8319e0f933f776e98998d2c7221004f92413f97ccc2e966f8462ed6d33597 0020-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
28c1d477da79aa212ac79e4b02cf865d8b9c31cec6c42f41b4268e3f3c49bf67fb51e54180abe543a54e550788bb472bfcf1b4bc38d072a792d7403dbbee178a 0021-mips64-disable-multilib-support.patch
0920e31c46bf937b47a0602766f042d45adb71abf332ee84399c665c12298ef115cff945fe26d646b0276bfdfdd04913970e6f1f8784a11c26e15111c854643d 0022-aarch64-disable-multilib-support.patch
e4c6bf7ec40f2798c8e5b40a543aecffd5591a2805546b3b97aaa4fbe4df6ce4330a60973a9ddfbca9890590606d5204e7f653ab2b6e4b2c13feeb595b68e63a 0023-s390x-disable-multilib-support.patch
0e956d793c94283ce5af7fe84bfcbb655585a9573608e9bf497fa7b726e12daa391e44977d0a8c97fb460aba89b1773b91e036b0ee1ef4d6263a3943cb63d9cd 0024-ppc64-le-disable-multilib-support.patch
95917fcb60dbc0a8134db9beb583f3c9ea61128499c214f594c434ec8246641ec41e245ce2d1d9b85ffd40ea0e5764f7a33c5522b2547145814245ac0fa25025 0025-x86_64-disable-multilib-support.patch
b40d7e4712c035674c993bbb55475290ec14523b3f0fd05493514bac4e9adaa6641faf815fc40ffc00119d9fd64be28218ee874c289ec7430eeef05ab2fcae5e 0026-riscv-disable-multilib-support.patch
674360ce2ee9f704d0632cc98756f9fe8dd8ca30064fb9d3423b437f7e679c1c51e765b15e535dcb278cd2769583690acb3395b91e4fd5f6f4e3b97879fcc313 0027-always-build-libgcc_eh.a.patch
f060687adcd5297124e4000f1ba1e3fd5d7d124da04d948cbd0d4a6c69a90a2b29a4a0dbbe13a83ab6950724f434de012b681bdbcdf53c0100b40fe3d00f2f2f 0028-ada-libgnarl-compatibility-for-musl.patch
5160bae68e20a1966c1f6d655ee98af759e9b9ee842718ae6007d467b418e1cf3b307528a0841477b5259671ce868521b06c0f2e947b7b8f3a398c53dd978252 0029-ada-musl-support-fixes.patch
3c04b26554a78096296ca9542c77a91219bd26044dd2cb2006db4c1944889a97c215900b3828ba7e8c675162406db543605a815bdfbd915bf810663b1b253bdd 0033-gcc-go-link-to-libucontext.patch
699dc3641099da6136dd3689f06c6553c03b3a85acf83a3fce1beb5425065b3e378535ca9e9100a120fdbafc34871d61c063fd5328a49cd87a15a989ed51706d 0034-Use-generic-errstr.go-implementation-on-musl.patch
d9ba710f770e053c8f212e821817c188091a829658050b9ab5906388553ec60fec37943ea43c270e92a9014902949f3c98fc4639032d92b8145b375bb29e193e 0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
ab90d8fdd977d6cd3da096a1c76d77be3e89a020b2127247771711a32eb608cceed21834ef488ab4b69bb0f408b098fdfb61630819e3d1a1e57d5af67800ee74 0036-configure-fix-detection-of-atomic-builtins-in-libato.patch
8bc6823f0b3c66f7b73d7ddb64ffa6930463285c2e9a14a2bc1882bcc4271144eaa1107d713294699caf9481648163cbf43921a2b8e4ac0d55c78a804bae8a3d 0037-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch
e9699f4721778869eb3a8fef2c679208ef5b98584892f30b0e1cb5dc1669f8158198d7792659b1b56c381baf62247d21990dcced9178547affd5d6bfb2d12548 0039-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
d6dc1bfb881a313d167aaa5658790b0f55eea4336c408cfc6613dd5783440dafd0d37c43031a5f3e69be40f632e38371cd4fb6e5f0494ac4ea4d7d5025d2ae02 0041-go-gospec-forcibly-disable-fsplit-stack-support.patch
684c6a6d52512b973429b6e709966439ac1e174f9e79a33d4a638b452245b457b34752b4b4034ba983f6a712f86522e7adf715bab00a6603f64a12139c5b1e39 0042-gcc-go-fix-build-error-with-SYS_SECCOMP.patch
25014dfa99d96ee70ce0ad22e9f7974f0a51cc50b3b9c2db49df50774c8cd29e497ceed120486bee50be83bfb07f2009ed310eb9b0543f2795bd7359b87eadd2 0043-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
75fd83ac05ab0a08d5f48547b08810f9934209bc78b5db59d65f33887b382af7ec24d8a29d40f86325c05af40c1ae1ec6466c839f646af90afc895a13073d07b 0044-gdc-unconditionally-link-libgphobos-against-libucont.patch
13e047153076d6e1fc40c9f5b6bfe5699c0e5460248f3d2b35ae36677cb960525af7b0b025997e5000a8492cec5e77a86828d66b4058c0d7f89fde0ab3890142 0045-druntime-link-against-libucontext-on-all-platforms.patch
c33ca2553642c2dbd1c65cd97046548f08775785a3db06d761e3bbe61398c37bc382fe132c0c3fa2101dfd4eea2a6d48bf4fae899a0ddb811c81abd7be35c122 0049-libgo-adjust-name-of-union-in-sigevent-struct.patch
179cd15d629884a66e954fd76066675efa594686b970facbb12ad50769e5d70b5530d7f61e77120e26d1c3dfc701cfc5295f341f635db998df73c41bc8e62172 0050-libphobos-don-t-define-__mode_t-twice-on-musl-target.patch
c82d7c8d340a76df3d796565a79b0ccc04ddffef39927620e1f3719bf2dc1db101ba13aef24b46c5bc95b7bf1e31c8bda4ab0936ba4c9c5e5047ba08826c982c 0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
eb403d8ea665fd5dc2c11faf43b055e6a3bf480a397ceee3e0ca1e38ec7d2392315f2694ed9a34ffbc99e464f2873fbbf91be8646ea4dea5d3636e3ea22fefa0 0052-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
22fb6edf1ed0387e2b93839ffe6e82a7fee420950af90e91199c3488d966702fdeb1a3396d22be0c73a4051525da9349c93d070a0d83b724c83f2b268da6483f 0053-libgo-make-match.sh-POSIX-shell-compatible.patch
"
sha512sums="64898a165f67e136d802a92e7633bf1b06c85266027e52127ea025bf5fc2291b5e858288aac0bdba246e6cdf7c6ec88bc8e0e7f3f6f1985f4297710cafde56ed gcc-8.2.0.tar.xz
e36e95b81489163abd6fe9d58f7867bdca43e61143afacbfb17f4698c0b16ec5fd0061d8fab7b2ae615540bebd721c2e2227f80401b4e7fc253da9da62e6b513 002_all_default-relro.patch
f86466c62b8291fac46f9c250c7ad8fa5ab7b1cce2504442fd07ddc4543665b317ae28951f244e39aba29aeaf3fff252ec4f6a147aa16adb2b7aed747dd89188 003_all_default-fortify-source.patch
02b725b220e540077efef741e9d457f9e004fe53ae642a138e214875d076a60f7c2f27de0ed9a4225db2030fc9c3d2c5b0414c895b9eec0f5f48fad70e2fb029 005_all_default-as-needed.patch
6c9a5068f6eea8a85d297a3555b1d2333ffd4b9ddbfb7560a3e643f8577603871ca123373ef7f96e894225291d88f7bf575c7f8386bcfdd1dabcd7ba12598b65 gcc-as-needed-gold.patch
ab0df1862f1b645634e79b8101326ce53215eba39861a455cd145b81b5267a6a61bc6e76b32d53887a0a48873f7efc23e2c52cc04400c6afd89822f245cdbc77 gcc-as-needed-push-pop.patch
e026bf9f73ee254528423c6cabdfd7794960c567161581b7d4b7c61c45027e12a6efef79662d4288b9cbaecb4798f01af6a5b4a13b766c2d501444ac1846fd43 011_all_default-warn-format-security.patch
37de4cc9061bfe1963e6e6570e1a6bbfd58204bf90e0eef819882599a9a80ea28f3eb815c20c1f173dc25d4bd9971b7c7f7f9512d6f8f91f04de1e1175114d4d 012_all_default-warn-trampolines.patch
38a0fedeac3eebe4a6a957792ba520225cf42663c96a171cd168fdb6c91ffa9a56b80351f8238c5d03b78d3ae2a6539a54481fe4848b4a395e2c87f2ff7adc08 013_all_default-ssp-fix.patch
d35a3ac7e13a4446921a90e1ff3eec1079840c845f9d523c868e24ae21f94cf69ba041de5341ebef96432a6f57598e223381d4286e8fb8baaa25906707f29fbd 020_all_msgfmt-libstdc++-link.patch
840070a3c423e6206aaa6e63e1d9a0fcd6efd53626cd1240a193f0b60aa5d84216acc4a2a4fa8bce74549b07e6a316b01d638f20cea13dc62473491a302fb3d6 050_all_libiberty-asprintf.patch
0a0bc72b9366158f5d23fff1928e756fdd212433bac6ab1f00d632f241382820db8db5d475ddf11ea020eaf7e2e71b12fb9b1c3c870cf84adf6c2b16f15aabca 051_all_libiberty-pic.patch
e7a2eb1b1870e199d6fd753d065781575656fa12baa264f96c5d179689d88c31b8a3f92a5dae96088c05e96aa2bda138364ad7dbcc79e1819a102f192cbb7bab 053_all_libitm-no-fortify-source.patch
4a328d1e1a56c20166307edcfa322068915784d9c08025b7f81cf69714da48fc266b6d34f77b9135c2f10da830d9df408276a1b78d1fd218637c2823506593c2 090_all_pr55930-dependency-tracking.patch
3842bd2be3e53db34e59bfb2bd438b244fc3712055058b9e232e33345f0fab216256b79e364fbac335972dc599a1d74393704f0cd595f3f076dcc10883c85b28 0003-gcc-poison-system-directories.patch
d1c2d7ff7f673375dc7cd84ae9d8515853b5af6390c70bb763412c012101344e4ee1ce155151ce3fb6ba2b80af7ed42d697dbe1bf6fd6e7b2b9087a378c47c37 203-libgcc_s.patch
98473bcaa77903a223ca9b0d2087c0921b287a2816d308cc32c8fe009e6cbf5dd1ae7fba27794ab8d9c09e117fe534413d91a464d1218474fc123ce0adfdc2c1 205-nopie.patch
6d84354e6df96d5ea244eb3bb5f044781796b88040b11c78fb6ee509e5aac19d46e0e92ca836e98e6495d9751f52439833b748efc419e4f5d5301fb549c4dcc9 0002-posix_memalign.patch
7f434a7350c9b06d0ae7cc18a569d813238483afa34b0801d112844a0dfe6164ae36b0416955fd4da7a8caa54672247f319a8ec7ce4b6a97a5f4e17ec083112a 0008-s390x-muslldso.patch
66085c5555e6b91b6874d1782d5a1dc0ab1792889f9400f48cde9483f82b51b9e3a5de1efbba21a19fc5e664334f2188d0c2bc988d42335efa26118b3c85cc7f 0010-ldbl128-config.patch
45d5bc11a89e5af77503ca06eec52d6d84e6fea0be021aaee1bcc39f8dd3c7b4baa4200cfa2b0688faa0f207d005db89c029eff32f362207aa3d2365b2f2363e 0012-static-pie.patch
d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch
600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch
dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-6.1-musl-libssp.patch
fa62556719449caec6b2b434355bfbcaa5ae55ffe017b3e1f827f66a2aae21b79c571ee7a4ce723ea69169bc3a6447e73650991a200cc372adf2f102677518d7 gcc-pure64.patch
35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch
3f5bc334d9f73d06f5f7c876738d02356acdd08958bea0e4d2095ebf15c2c2ec4e411abdae0297505ae9a1699ca01b17338e853184e84663203b192b0d35fc19 ada-shared.patch
50537add461714f44dc6a778e0c6d0e15d6a782591c8aff38d1fb559191ddac2b5ee14a43a3005b389fdf98d2e7468ff4e64c88ba024cf94f9fe0d9854b9e9c8 ada-musl.patch
a1f7750bc7b8b7d916a5dee34fcc736bd4fb249c96538b547d495794e6cfd49356aa3974506a15074b4cb58edd5d7e2868607c902dd003e8c464d5066fd4a575 libgnarl-musl.patch
f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45b58ba8764ab1eb575d4eb6d6dfc550a87a183f8b94e76181 320-libffi-gnulinux.patch
86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3 gcc-pure64-mips.patch"

View File

@ -2,32 +2,25 @@
# Generator: pmbootstrap aportgen binutils-armhf
# Based on: main/binutils
CTARGET_ARCH=armhf
CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
pkgname=binutils-armhf
pkgver=2.39
pkgver=2.35.2
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"
makedepends="$makedepends_build $makedepends_host"
makedepends="gettext libtool autoconf automake bison texinfo"
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
CVE-2021-3487.patch
"
builddir="$srcdir/binutils-$pkgver"
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
subpackages="$subpackages binutils-gold"
subpackages=""
fi
if [ "$CHOST" != "$CTARGET" ]; then
@ -48,102 +41,38 @@ fi
# - 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 \
_target="$(arch_to_hostspec armhf)"
"$builddir"/configure \
--build="$CBUILD" \
--target=$_target \
--with-lib-path=/usr/lib \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-multilib \
--disable-gprofng \
--with-sysroot=/usr/$_target \
--enable-ld=default \
$_gold_configure \
--enable-64-bit-bfd \
$_plugin_configure \
--enable-relro \
--enable-gold=yes \
--enable-plugins \
--enable-deterministic-archives \
--enable-default-execstack=no \
$_cross_configure \
$_arch_configure \
$_hash_style_configure \
--with-pic \
--disable-multilib \
--disable-werror \
--disable-nls \
--with-mmap \
--with-system-zlib
--disable-nls
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
# remove man, info folders
rm -rf "$pkgdir"/usr/share
# remove files that conflict with non-cross binutils
rm -rf "$pkgdir"/usr/lib/bfd-plugins
}
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
sha512sums="9974ede5978d32e0d68fef23da48fa00bd06b0bff7ec45b00ca075c126d6bbe0cf2defc03ecc3f17bc6cc85b64271a13009c4049d7ba17de26e84e3a6e2c0348 binutils-2.35.2.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
"
642c617db6c6e491f78f053d60f3aa369bad7bf8c1bc7ce267de6cf8fddf6c0d4cf63ce8c8f6e2f225dedbce7cb930d8e87e168fd8f72ca0837c77266ee2b5f8 0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
b08384ed124a74ad3a424db370c107230f09a54378502ca4385deb738f7cf799857f2af0db52709c7eeab8fa6c0a3d972f891396cce1e2834a21f67682fc4355 CVE-2021-3487.patch"

View File

@ -10,7 +10,7 @@ LANG_JAVA=false
LANG_GO=false
LANG_FORTRAN=false
LANG_ADA=false
options="!strip"
options="!strip !tracedeps"
# abuild doesn't try to tries to install "build-base-$CTARGET_ARCH"
# when this variable matches "no*"
@ -24,9 +24,7 @@ CBUILDROOT="/"
_cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
pkgname=gcc-armhf
_pkgbase=12.2.1 # must match gcc/BASE-VER
_pkgsnap=20220924
pkgver=${_pkgbase}_git${_pkgsnap}
pkgver=8.2.0
[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
@ -34,35 +32,33 @@ pkgver=${_pkgbase}_git${_pkgsnap}
pkgname=gcc-armhf
pkgrel=1
pkgdesc="Stage2 cross-compiler for armhf"
url="https://gcc.gnu.org"
url="http://gcc.gnu.org"
arch="x86_64"
license="GPL-2.0-or-later LGPL-2.1-or-later"
license="GPL LGPL"
_gccrel=$pkgver-r$pkgrel
depends="binutils-armhf mpc1"
depends="isl binutils-armhf mpc1"
makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev"
makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-armhf binutils-armhf"
subpackages="g++-armhf:gpp libstdc++-dev-armhf:libcxx_dev"
subpackages="g++-armhf:gpp"
[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-doc$_target"
replaces="libstdc++ binutils"
: "${LANG_CXX:=true}"
: "${LANG_D:=true}"
: "${LANG_OBJC:=true}"
: "${LANG_GO:=true}"
: "${LANG_FORTRAN:=true}"
: "${LANG_ADA:=true}"
: "${LANG_JIT:=true}"
: ${LANG_CXX:=true}
: ${LANG_OBJC:=true}
: ${LANG_GO:=true}
: ${LANG_FORTRAN:=true}
: ${LANG_ADA:=true}
_libgomp=true
_libgcc=false
_libatomic=true
_libitm=true
LIBGOMP="false"
LIBGCC="false"
LIBATOMIC="false"
LIBITM="false"
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
LANG_CXX=false
LANG_ADA=false
_libgcc=false
LIBGCC=false
_builddir="$srcdir/build-cross-pass2"
else
_builddir="$srcdir/build-cross-final"
@ -70,11 +66,9 @@ if [ "$CHOST" != "$CTARGET" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
_libgomp=false
_libatomic=false
_libitm=false
LIBGOMP=false
LIBATOMIC=false
LIBITM=false
# reset target flags (should be set in crosscreate abuild)
# fixup flags. seems gcc treats CPPFLAGS as global without
@ -108,8 +102,6 @@ elif [ "$CBUILD" != "$CHOST" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
_builddir="$srcdir/build-cross-native"
@ -118,62 +110,36 @@ else
_builddir="$srcdir/build"
fi
case "$CARCH" in
# GDC hasn't been ported to PowerPC
# See libphobos/configure.tgt in GCC sources for supported targets
# riscv fails with: error: static assert "unimplemented"
ppc64le|riscv64) LANG_D=false ;;
# GDC does currently not work on 32-bit musl architectures.
# This is a known upstream issue.
# See: https://github.com/dlang/druntime/pull/3383
armhf|armv7|x86) LANG_D=false ;;
esac
# Go needs {set,make,swap}context, unimplemented in musl
[ "$CTARGET_LIBC" = musl ] && LANG_GO=false
# libitm has TEXTRELs in ARM build, so disable for now
case "$CTARGET_ARCH" in
arm*) _libitm=false ;;
mips*) _libitm=false ;;
riscv64) _libitm=false ;;
esac
# Internal libffi fails to build on MIPS at the moment, need to
# investigate further. We disable LANG_GO on mips64 as it requires
# the internal libffi.
case "$CTARGET_ARCH" in
mips*) LANG_GO=false ;;
arm*) LIBITM=false ;;
mips*) LIBITM=false ;;
esac
# Fortran uses libquadmath if toolchain has __float128
# currently on x86, x86_64 and ia64
_libquadmath=$LANG_FORTRAN
LIBQUADMATH=$LANG_FORTRAN
case "$CTARGET_ARCH" in
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
*) _libquadmath=false ;;
x86 | x86_64) LIBQUADMATH=$LANG_FORTRAN ;;
*) LIBQUADMATH=false ;;
esac
# libatomic is a dependency for openvswitch
$_libatomic && subpackages="$subpackages libatomic::$CTARGET_ARCH"
$_libgcc && subpackages="$subpackages libgcc::$CTARGET_ARCH"
$_libquadmath && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
if $_libgomp; then
$LIBATOMIC && subpackages="$subpackages libatomic::$CTARGET_ARCH"
$LIBGCC && subpackages="$subpackages libgcc::$CTARGET_ARCH"
$LIBQUADMATH && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
if $LIBGOMP; then
depends="$depends libgomp=$_gccrel"
subpackages="$subpackages libgomp::$CTARGET_ARCH"
fi
case "$CARCH" in
riscv64)
LANG_ADA=false;;
esac
_languages=c
if $LANG_CXX; then
_languages="$_languages,c++"
fi
if $LANG_D; then
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
_languages="$_languages,d"
makedepends_build="$makedepends_build libucontext-dev gcc-gdc-bootstrap"
fi
if $LANG_OBJC; then
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
_languages="$_languages,objc"
@ -187,83 +153,56 @@ if $LANG_FORTRAN; then
_languages="$_languages,fortran"
fi
if $LANG_ADA; then
subpackages="$subpackages gcc-gnat$_target:gnat"
subpackages="$subpackages libgnat::$CTARGET_ARCH gcc-gnat$_target:gnat"
_languages="$_languages,ada"
if [ "$CBUILD" = "$CTARGET" ]; then
makedepends_build="$makedepends_build gcc-gnat-bootstrap"
subpackages="$subpackages libgnat-static:libgnatstatic:$CTARGET_ARCH libgnat::$CTARGET_ARCH"
else
subpackages="$subpackages libgnat::$CTARGET_ARCH"
makedepends_build="$makedepends_build gcc-gnat gcc-gnat$_cross"
fi
fi
if $LANG_JIT; then
subpackages="$subpackages libgccjit:jit libgccjit-dev:jitdev"
makedepends_build="$makedepends_build gcc-gnat gcc-gnat$_cross"
fi
makedepends="$makedepends_build $makedepends_host"
# when using upstream releases, use this URI template
# https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz
#
# right now, we are using a git snapshot. snapshots are taken from gcc.gnu.org/pub/gcc/snapshots.
# However, since they are periodically deleted from the GCC mirrors the utilized snapshots are
# mirrored on dev.alpinelinux.org. Please ensure that the snapshot Git commit (as stated in the
# README) matches the base commit on the version-specific branch in the Git repository below.
#
# PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches,
# so that they can be properly tracked and easily rebased if needed.
source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-${_pkgsnap}/gcc-${_pkgbase%%.*}-${_pkgsnap}.tar.xz
0001-posix_memalign.patch
0002-gcc-poison-system-directories.patch
0003-specs-turn-on-Wl-z-now-by-default.patch
0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
0006-Enable-Wformat-and-Wformat-security-by-default.patch
0007-Enable-Wtrampolines-by-default.patch
0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
0011-libiberty-copy-PIC-objects-during-build-process.patch
0012-libitm-disable-FORTIFY.patch
0013-libgcc_s.patch
0014-nopie.patch
0015-dlang-use-libucontext-on-mips64.patch
0016-ada-fix-shared-linking.patch
0017-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
0018-add-fortify-headers-paths.patch
0019-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
0020-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
0021-mips64-disable-multilib-support.patch
0022-aarch64-disable-multilib-support.patch
0023-s390x-disable-multilib-support.patch
0024-ppc64-le-disable-multilib-support.patch
0025-x86_64-disable-multilib-support.patch
0026-riscv-disable-multilib-support.patch
0027-always-build-libgcc_eh.a.patch
0028-ada-libgnarl-compatibility-for-musl.patch
0029-ada-musl-support-fixes.patch
0033-gcc-go-link-to-libucontext.patch
0034-Use-generic-errstr.go-implementation-on-musl.patch
0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
0036-configure-fix-detection-of-atomic-builtins-in-libato.patch
0037-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch
0039-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
0041-go-gospec-forcibly-disable-fsplit-stack-support.patch
0042-gcc-go-fix-build-error-with-SYS_SECCOMP.patch
0043-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
0044-gdc-unconditionally-link-libgphobos-against-libucont.patch
0045-druntime-link-against-libucontext-on-all-platforms.patch
0049-libgo-adjust-name-of-union-in-sigevent-struct.patch
0050-libphobos-don-t-define-__mode_t-twice-on-musl-target.patch
0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
0052-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
0053-libgo-make-match.sh-POSIX-shell-compatible.patch
source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz
002_all_default-relro.patch
003_all_default-fortify-source.patch
005_all_default-as-needed.patch
gcc-as-needed-gold.patch
gcc-as-needed-push-pop.patch
011_all_default-warn-format-security.patch
012_all_default-warn-trampolines.patch
013_all_default-ssp-fix.patch
020_all_msgfmt-libstdc++-link.patch
050_all_libiberty-asprintf.patch
051_all_libiberty-pic.patch
053_all_libitm-no-fortify-source.patch
090_all_pr55930-dependency-tracking.patch
0003-gcc-poison-system-directories.patch
203-libgcc_s.patch
205-nopie.patch
0002-posix_memalign.patch
0008-s390x-muslldso.patch
0010-ldbl128-config.patch
0012-static-pie.patch
libgcc-always-build-gcceh.a.patch
gcc-4.9-musl-fortify.patch
gcc-6.1-musl-libssp.patch
gcc-pure64.patch
fix-cxxflags-passing.patch
ada-shared.patch
ada-musl.patch
libgnarl-musl.patch
320-libffi-gnulinux.patch
gcc-pure64-mips.patch
"
# gcc-4.8-build-args.patch
# we build out-of-tree
_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-${_pkgsnap}
_gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
_gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}"
_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver}
_gcclibdir=/usr/lib/gcc/${CTARGET}/$pkgver
_gcclibexec=/usr/libexec/gcc/${CTARGET}/$pkgver
prepare() {
cd "$_gccdir"
@ -286,7 +225,7 @@ prepare() {
return 1
fi
echo ${_pkgbase:-$pkgver} > gcc/BASE-VER
echo ${pkgver} > gcc/BASE-VER
}
build() {
@ -294,7 +233,6 @@ build() {
local _libc_configure=
local _bootstrap_configure=
local _symvers=
local _jit_configure=
cd "$_gccdir"
@ -312,7 +250,6 @@ build() {
i486-*-*-*) _arch_configure="--with-arch=i486 --with-tune=generic --enable-cld";;
i586-*-*-*) _arch_configure="--with-arch=i586 --with-tune=generic --enable-cld";;
s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";;
riscv64-*-*-*) _arch_configure="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic";;
esac
case "$CTARGET_ARCH" in
@ -337,10 +274,10 @@ build() {
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
esac
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
$LIBGOMP || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
$LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
@ -354,112 +291,78 @@ build() {
echo " libc_configure=$_libc_configure"
echo " cross_configure=$_cross_configure"
echo " bootstrap_configure=$_bootstrap_configure"
echo " hash_style_configure=$_hash_style_configure"
echo " hash_style_configure=$_hash_style_configure"
echo ""
export CFLAGS="$CFLAGS -O2"
export CXXFLAGS="$CXXFLAGS -O2"
export CPPFLAGS="$CPPFLAGS -O2"
local version="Alpine $pkgver-r$pkgrel"
local gccconfiguration="
--prefix=/usr
--mandir=/usr/share/man
--infodir=/usr/share/info
--build=${CBUILD}
--host=${CHOST}
--target=${CTARGET}
--enable-checking=release
--disable-fixed-point
--disable-libstdcxx-pch
--disable-multilib
--disable-nls
--disable-werror
$_symvers
--enable-__cxa_atexit
--enable-default-pie
--enable-default-ssp
--enable-cloog-backend
--enable-languages=$_languages
$_arch_configure
$_libc_configure
$_cross_configure
$_bootstrap_configure
--with-bugurl=https://gitlab.alpinelinux.org/alpine/aports/-/issues
--with-system-zlib
$_hash_style_configure
"
mkdir -p "$_builddir"
cd "$_builddir"
"$_gccdir"/configure $gccconfiguration \
--with-pkgversion="$version"
msg "building gcc"
"$_gccdir"/configure --prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--build=${CBUILD} \
--host=${CHOST} \
--target=${CTARGET} \
--with-pkgversion="Alpine ${pkgver}" \
--enable-checking=release \
--disable-fixed-point \
--disable-libstdcxx-pch \
--disable-multilib \
--disable-nls \
--disable-werror \
$_symvers \
--enable-__cxa_atexit \
--enable-default-pie \
--enable-default-ssp \
--enable-cloog-backend \
--enable-languages=$_languages \
$_arch_configure \
$_libc_configure \
$_cross_configure \
$_bootstrap_configure \
--with-system-zlib \
$_hash_style_configure
make
# we build gccjit separate to not build all of gcc with --enable-host-shared
# as doing so slows it down a few %, so for some quick if's here we gain
# free performance
if $LANG_JIT; then
mkdir -p "$_builddir"/libgccjit-build
cd "$_builddir"/libgccjit-build
"$_gccdir"/configure $gccconfiguration \
--disable-bootstrap \
--enable-host-shared \
--enable-languages=jit \
--with-pkgversion="$version"
msg "building libgccjit"
make all-gcc
fi
}
package() {
cd "$_builddir"
make DESTDIR="$pkgdir" install
make -j1 DESTDIR="${pkgdir}" install
ln -s gcc "$pkgdir"/usr/bin/cc
if $LANG_JIT; then
make -C "$_builddir"/libgccjit-build/gcc DESTDIR="$pkgdir" jit.install-common
fi
# we dont support gcj -static
# we don't support gcj -static
# and saving 35MB is not bad.
find "$pkgdir" \( -name libgtkpeer.a \
-o -name libgjsmalsa.a \
-o -name libgij.a \) \
-delete
find "$pkgdir" -name libgtkpeer.a \
-o -name libgjsmalsa.a -o \
-o -name libgij.a -o \
| xargs rm -f
# strip debug info from some static libs
find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
-o -name libgphobos.a -o -name libgdruntime.a \
${STRIP_FOR_TARGET} -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
-o -name libmudflap.a -o -name libmudflapth.a \
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
-o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \
-a -type f \
-exec ${STRIP_FOR_TARGET} -g {} +
-a -type f`
if $_libgomp; then
if $LIBGOMP; then
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
fi
if $_libitm; then
if $LIBITM; then
mv "$pkgdir"/usr/lib/libitm.spec "$pkgdir"/$_gcclibdir
fi
# remove ffi
rm -f "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi*
find "$pkgdir" -name 'ffi*.h' -delete
find "$pkgdir" -name 'ffi*.h' | xargs rm -f
local gdblib=${_target:+$CTARGET/}lib
if [ -d "$pkgdir"/usr/$gdblib/ ]; then
for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py"); do
mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
done
fi
for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py" ); do
mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
done
paxmark -pmrs "$pkgdir"/$_gcclibexec/cc1
# move ada runtime libs
if $LANG_ADA; then
@ -467,26 +370,20 @@ package() {
mv "$i" "$pkgdir"/usr/lib/
ln -s ../../../../${i##*/} $i
done
if [ "$CHOST" = "$CTARGET" ]; then
for i in $(find "$pkgdir"/$_gcclibdir/adalib/ -type f -maxdepth 1 -name "libgna*.a"); do
mv "$i" "$pkgdir"/usr/lib/
ln -s ../../../../${i##*/} $i
done
fi
fi
if [ "$CHOST" != "$CTARGET" ]; then
# cross-gcc: remove any files that would conflict with the
# native gcc package
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "${pkgdir:?}"/usr/share
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "$pkgdir"/usr/share
# libcc1 does not depend on target, don't ship it
rm -rf "$pkgdir"/usr/lib/libcc1.so*
# fixup gcc library symlinks to be linker scripts so
# linker finds the libs from relocated sysroot
for so in "$pkgdir"/usr/"$CTARGET"/lib/*.so; do
for so in "$pkgdir"/usr/$CTARGET/lib/*.so; do
if [ -h "$so" ]; then
local _real=$(basename "$(readlink "$so")")
local _real=$(basename $(readlink "$so"))
rm -f "$so"
echo "GROUP ($_real)" > "$so"
fi
@ -495,33 +392,29 @@ package() {
# add c89/c99 wrapper scripts
cat >"$pkgdir"/usr/bin/c89 <<'EOF'
#!/bin/sh
_flavor="-std=c89"
fl="-std=c89"
for opt; do
case "$opt" in
-ansi|-std=c89|-std=iso9899:1990) _flavor="";;
-ansi|-std=c89|-std=iso9899:1990) fl="";;
-std=*) echo "$(basename $0) called with non ANSI/ISO C option $opt" >&2
exit 1;;
esac
done
exec gcc $_flavor ${1+"$@"}
exec gcc $fl ${1+"$@"}
EOF
cat >"$pkgdir"/usr/bin/c99 <<'EOF'
#!/bin/sh
_flavor="-std=c99"
fl="-std=c99"
for opt; do
case "$opt" in
-std=c99|-std=iso9899:1999) _flavor="";;
-std=c99|-std=iso9899:1999) fl="";;
-std=*) echo "$(basename $0) called with non ISO C99 option $opt" >&2
exit 1;;
esac
done
exec gcc $_flavor ${1+"$@"}
exec gcc $fl ${1+"$@"}
EOF
chmod 755 "$pkgdir"/usr/bin/c?9
# install lto plugin so regular binutils may use it
mkdir -p "$pkgdir"/usr/lib/bfd-plugins
ln -s /$_gcclibexec/liblto_plugin.so "$pkgdir/usr/lib/bfd-plugins/"
fi
}
@ -538,53 +431,26 @@ libcxx() {
pkgdesc="GNU C++ standard runtime library"
depends=
if [ "$CHOST" = "$CTARGET" ]; then
# verify that we are using clock_gettime rather than doing direct syscalls
# so we dont break 32 bit arches due to time64.
nm -D "$pkgdir"/usr/lib/libstdc++.so.* | grep clock_gettime
fi
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libstdc++.so.* "$subpkgdir"/usr/lib/
}
libcxx_dev() {
pkgdesc="GNU C++ standard runtime library (development files)"
depends=
replaces="g++"
amove usr/${_target:+$CTARGET/}lib/libstdc++.a \
usr/${_target:+$CTARGET/}lib/libstdc++.so \
usr/${_target:+$CTARGET/}lib/libstdc++fs.a \
usr/${_target:+$CTARGET/}lib/libsupc++.a \
usr/${_target:+$CTARGET/}include/c++
}
gpp() {
pkgdesc="GNU C++ standard library and compiler"
depends="libstdc++=$_gccrel libstdc++-dev$_target=$_gccrel gcc$_target=$_gccrel libc-dev"
depends="libstdc++=$_gccrel gcc=$_gccrel libc-dev"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/usr/bin \
"$subpkgdir"/usr/${_target:+$CTARGET/}include \
"$subpkgdir"/usr/${_target:+$CTARGET/}lib \
mv "$pkgdir/$_gcclibexec/cc1plus" "$subpkgdir/$_gcclibexec/"
paxmark -pmrs "$subpkgdir/$_gcclibexec/cc1plus"
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/*++* "$subpkgdir"/usr/${_target:+$CTARGET/}lib/
mv "$pkgdir"/usr/${_target:+$CTARGET/}include/c++ "$subpkgdir"/usr/${_target:+$CTARGET/}include/
mv "$pkgdir"/usr/bin/*++ "$subpkgdir"/usr/bin/
}
jit() {
pkgdesc="GCC JIT Library"
depends=
amove usr/lib/libgccjit.so*
}
jitdev() {
pkgdesc="GCC JIT Library (development files)"
depends="libgccjit"
amove usr/include/libgccjit*.h
}
libobjc() {
pkgdesc="GNU Objective-C runtime"
replaces="objc"
@ -598,10 +464,8 @@ objc() {
replaces="gcc"
depends="libc-dev gcc=$_gccrel libobjc=$_gccrel"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include \
mkdir -p "$subpkgdir"/$_gcclibdir/include \
"$subpkgdir"/usr/lib
mv "$pkgdir/$_gcclibexec/cc1obj" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/objc "$subpkgdir"/$_gcclibdir/include/
mv "$pkgdir"/usr/lib/libobjc.so "$pkgdir"/usr/lib/libobjc.a \
"$subpkgdir"/usr/lib/
@ -624,40 +488,6 @@ libgomp() {
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libgomp.so.* "$subpkgdir"/usr/lib/
}
libgphobos() {
pkgdesc="D programming language standard library for GCC"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgdruntime.so.* "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so.* "$subpkgdir"/usr/lib/
}
gdc() {
pkgdesc="GCC-based D language compiler"
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
depends="$depends libucontext-dev"
provides="gcc-gdc-bootstrap=$_gccrel"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include/d/ \
"$subpkgdir"/usr/lib \
"$subpkgdir"/usr/bin
# Copy: The installed '.d' files, the static lib, the binary itself
# The shared libs are part of 'libgphobos' so one can run program
# without installing the compiler
mv "$pkgdir/$_gcclibexec/d21" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/$CTARGET-gdc "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
}
libgo() {
pkgdesc="Go runtime library for GCC"
depends=
@ -668,24 +498,17 @@ libgo() {
go() {
pkgdesc="Go support for GCC"
depends="gcc=$_gccrel libgo=$_gccrel !go"
depends="gcc=$_gccrel libgo=$_gccrel"
mkdir -p "$subpkgdir"/$_gcclibexec \
"$subpkgdir"/usr/lib \
"$subpkgdir"/usr/bin
mv "$pkgdir"/usr/lib/go "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/*gccgo "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/*go "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/*gofmt "$subpkgdir"/usr/bin
mv "$pkgdir"/$_gcclibexec/go1 "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/cgo "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/buildid "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/test2json "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/vet "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/usr/lib/libgo.a \
"$pkgdir"/usr/lib/libgo.so \
"$pkgdir"/usr/lib/libgobegin.a \
"$pkgdir"/usr/lib/libgolibbegin.a \
"$subpkgdir"/usr/lib/
}
@ -709,7 +532,7 @@ libquadmath() {
gfortran() {
pkgdesc="GNU Fortran Compiler"
depends="gcc=$_gccrel libgfortran=$_gccrel"
$_libquadmath && depends="$depends libquadmath=$_gccrel"
$LIBQUADMATH && depends="$depends libquadmath=$_gccrel"
replaces="gcc"
mkdir -p "$subpkgdir"/$_gcclibexec \
@ -720,12 +543,11 @@ gfortran() {
mv "$pkgdir"/usr/lib/libgfortran.a \
"$pkgdir"/usr/lib/libgfortran.so \
"$subpkgdir"/usr/lib/
if $_libquadmath; then
if $LIBQUADMATH; then
mv "$pkgdir"/usr/lib/libquadmath.a \
"$pkgdir"/usr/lib/libquadmath.so \
"$subpkgdir"/usr/lib/
fi
mv "$pkgdir"/$_gcclibdir/finclude "$subpkgdir"/$_gcclibdir/
mv "$pkgdir"/$_gcclibexec/f951 "$subpkgdir"/$_gcclibexec
mv "$pkgdir"/usr/lib/libgfortran.spec "$subpkgdir"/$_gcclibdir
}
@ -738,18 +560,9 @@ libgnat() {
mv "$pkgdir"/usr/lib/libgna*.so "$subpkgdir"/usr/lib/
}
libgnatstatic() {
pkgdesc="GNU Ada static libraries"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgna*.a "$subpkgdir"/usr/lib/
}
gnat() {
pkgdesc="Ada support for GCC"
depends="gcc=$_gccrel"
provides="$pkgname-gnat-bootstrap=$_gccrel"
[ "$CHOST" = "$CTARGET" ] && depends="$depends libgnat=$_gccrel"
mkdir -p "$subpkgdir"/$_gcclibexec \
@ -760,51 +573,34 @@ gnat() {
mv "$pkgdir"/usr/bin/*gnat* "$subpkgdir"/usr/bin/
}
sha512sums="
ba4d9e73d108088da26fbefe18d9b245b76771ffe752c2b4b31bdf38a2d0b638fbc115c377526c27311d4d7ffd4e0d236a5af5016bd364ccaa11a4989d1401e8 gcc-12-20220924.tar.xz
41cbb4d69218006cf9e0cdb6c86212ef451f8decd52a50a7dbb4d34726009da7a4e0261c852b46cb584db253a4bae2f31dc485c506cb545e64a7d26e0ba6c2b6 0001-posix_memalign.patch
531155055cda7f119bcac6479bcae73af9201cd596af9cf1616850bbcf4393b91c5de9f2fbbc1cde6e158fb4df7237b033146f662dff5fa0ea12151cc514adb8 0002-gcc-poison-system-directories.patch
c1275d77b5269386a2ec683933570810f5a2ba1208c161ed887797eb9aee3cb82ef08a8964635902614e6a6e83f3065ba0801c9355d85dd8d60cb1fa20bdf687 0003-specs-turn-on-Wl-z-now-by-default.patch
a54e45bff4484a35d3826435a414d909281453f5605f4081cf3be1f15336cceed93a1d8a54e92e2fa97188623e3030ca1323d7749141e228a7db73795230d86a 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
ad132ddbd0c33a3983e3de4f74d8fdb8cb1ddf53ef54de0a5c12efb49e42014ed117165d43f396bcf3455ecfe2c8620e0326e73b4160a370a4cc92d213329c34 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
0b9ce0f130a7b797770f3d58a5200575f20e5663c86c0c5710718b7bffd3416cc2f05861613d9c258428e9541c6e0b9837d01f0c99d383e2c3de0503a988e861 0006-Enable-Wformat-and-Wformat-security-by-default.patch
e7813acc7ead61373c212cefbe53eb020b4c5bd8f0f35ee972e0524060713f911624f5a1a871feada642e1f3f5e48c8508125ca2da09de351d544bedf1d44ada 0007-Enable-Wtrampolines-by-default.patch
d0d0566a11e4828bdd6f53346a9a6b9841f3066d3f4a05ee2b6fe97aeb4552654170e7662318ea18fc777c3e75c88a067097478fc4e880a3f9c134b8a3af2277 0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
f75e63d9d933874f18fb7f55b135c60dfa0377abafa8e0edb91b85d5f00f4f072d0a338ba5d9baec18494211dbbda8068782830dbafbb37068936f76aede270f 0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
afa4daba222a19569588736a8276dc7c12223a7c222f3dd3795dc3f1cd90f40b90518971ae27b358020354f89562c9680ec8b8e24e85e6d4f8e54e79d185359b 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
79dac82249fb573ec477e1451a33883302eb63a5110853faed117f5021221f2153e2ec845dd5a0043b1bf9f0e5736ef0c89743ff2d771774a281c8b24542803a 0011-libiberty-copy-PIC-objects-during-build-process.patch
b035f85c1703b45d15c1d1ffe7d23400e01625e5d403504911cc92f740b02586447de2a9d66a9f80f12b9c227bc193e2a43942c8af2bdb42cdeff8272bbe6068 0012-libitm-disable-FORTIFY.patch
9fb4d396a9493d2d68fe829ce075ba4c5df148b1d6aaab315a6f8ccbdd70d0e052a5dc50369adc2dab005b4a3becd1504b182faed6e82c86accb95f5bc2b9f50 0013-libgcc_s.patch
f82ac22961d842c9f8e731a601bb255918cc160969888363ad2d83e2ccf08b19114a200d46bcf99d097bf530f470c2b1e71e46828bc1b9fff5469ff945f541d8 0014-nopie.patch
6527dc9d250db48d56cf01e9299461bf22a838ffda96c40d448e18f457b206cec2322275d2d5abbbaf3c6573c5e7eba12724c9691b601f118ff7520e19726373 0015-dlang-use-libucontext-on-mips64.patch
6c3ce0ccd68b19e2c76172d8f24b0747ee0af2b8de7af692f2f699848267d7fc42fec8e5c303102fe05be7e934b56f21eea17ce47c8aca20570590830d88e9b0 0016-ada-fix-shared-linking.patch
7089a96aaec8e0b222cb3fa7301d71bb2e328a24dec33e15ea9e3e7695bcae919308249b9a3be5ea2f3b1f069f9fd1739066f31d12317fcdab0596dba9ca54a4 0017-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
b7ebdeee0b143052fdd6e3efa070ea8621d4fb729312cbc787d618e666b593990a20cd9044a786265970d8e09ec13da03b797009543d0b657b0fe924f2dcaa68 0018-add-fortify-headers-paths.patch
8e682893d6367732ab8c490b915112a68d98855deec3bd8db91dc0d9bf486b8c044b13ee2b95c4806da7ac17c41034e081b7a66861018274cb33fdb2fd6df04a 0019-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
a14c5f98ade5af8cd6e3a0244752674d9c4f6dadb4260f98f1949bff51ac1211a3f8319e0f933f776e98998d2c7221004f92413f97ccc2e966f8462ed6d33597 0020-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
28c1d477da79aa212ac79e4b02cf865d8b9c31cec6c42f41b4268e3f3c49bf67fb51e54180abe543a54e550788bb472bfcf1b4bc38d072a792d7403dbbee178a 0021-mips64-disable-multilib-support.patch
0920e31c46bf937b47a0602766f042d45adb71abf332ee84399c665c12298ef115cff945fe26d646b0276bfdfdd04913970e6f1f8784a11c26e15111c854643d 0022-aarch64-disable-multilib-support.patch
e4c6bf7ec40f2798c8e5b40a543aecffd5591a2805546b3b97aaa4fbe4df6ce4330a60973a9ddfbca9890590606d5204e7f653ab2b6e4b2c13feeb595b68e63a 0023-s390x-disable-multilib-support.patch
0e956d793c94283ce5af7fe84bfcbb655585a9573608e9bf497fa7b726e12daa391e44977d0a8c97fb460aba89b1773b91e036b0ee1ef4d6263a3943cb63d9cd 0024-ppc64-le-disable-multilib-support.patch
95917fcb60dbc0a8134db9beb583f3c9ea61128499c214f594c434ec8246641ec41e245ce2d1d9b85ffd40ea0e5764f7a33c5522b2547145814245ac0fa25025 0025-x86_64-disable-multilib-support.patch
b40d7e4712c035674c993bbb55475290ec14523b3f0fd05493514bac4e9adaa6641faf815fc40ffc00119d9fd64be28218ee874c289ec7430eeef05ab2fcae5e 0026-riscv-disable-multilib-support.patch
674360ce2ee9f704d0632cc98756f9fe8dd8ca30064fb9d3423b437f7e679c1c51e765b15e535dcb278cd2769583690acb3395b91e4fd5f6f4e3b97879fcc313 0027-always-build-libgcc_eh.a.patch
f060687adcd5297124e4000f1ba1e3fd5d7d124da04d948cbd0d4a6c69a90a2b29a4a0dbbe13a83ab6950724f434de012b681bdbcdf53c0100b40fe3d00f2f2f 0028-ada-libgnarl-compatibility-for-musl.patch
5160bae68e20a1966c1f6d655ee98af759e9b9ee842718ae6007d467b418e1cf3b307528a0841477b5259671ce868521b06c0f2e947b7b8f3a398c53dd978252 0029-ada-musl-support-fixes.patch
3c04b26554a78096296ca9542c77a91219bd26044dd2cb2006db4c1944889a97c215900b3828ba7e8c675162406db543605a815bdfbd915bf810663b1b253bdd 0033-gcc-go-link-to-libucontext.patch
699dc3641099da6136dd3689f06c6553c03b3a85acf83a3fce1beb5425065b3e378535ca9e9100a120fdbafc34871d61c063fd5328a49cd87a15a989ed51706d 0034-Use-generic-errstr.go-implementation-on-musl.patch
d9ba710f770e053c8f212e821817c188091a829658050b9ab5906388553ec60fec37943ea43c270e92a9014902949f3c98fc4639032d92b8145b375bb29e193e 0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
ab90d8fdd977d6cd3da096a1c76d77be3e89a020b2127247771711a32eb608cceed21834ef488ab4b69bb0f408b098fdfb61630819e3d1a1e57d5af67800ee74 0036-configure-fix-detection-of-atomic-builtins-in-libato.patch
8bc6823f0b3c66f7b73d7ddb64ffa6930463285c2e9a14a2bc1882bcc4271144eaa1107d713294699caf9481648163cbf43921a2b8e4ac0d55c78a804bae8a3d 0037-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch
e9699f4721778869eb3a8fef2c679208ef5b98584892f30b0e1cb5dc1669f8158198d7792659b1b56c381baf62247d21990dcced9178547affd5d6bfb2d12548 0039-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
d6dc1bfb881a313d167aaa5658790b0f55eea4336c408cfc6613dd5783440dafd0d37c43031a5f3e69be40f632e38371cd4fb6e5f0494ac4ea4d7d5025d2ae02 0041-go-gospec-forcibly-disable-fsplit-stack-support.patch
684c6a6d52512b973429b6e709966439ac1e174f9e79a33d4a638b452245b457b34752b4b4034ba983f6a712f86522e7adf715bab00a6603f64a12139c5b1e39 0042-gcc-go-fix-build-error-with-SYS_SECCOMP.patch
25014dfa99d96ee70ce0ad22e9f7974f0a51cc50b3b9c2db49df50774c8cd29e497ceed120486bee50be83bfb07f2009ed310eb9b0543f2795bd7359b87eadd2 0043-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
75fd83ac05ab0a08d5f48547b08810f9934209bc78b5db59d65f33887b382af7ec24d8a29d40f86325c05af40c1ae1ec6466c839f646af90afc895a13073d07b 0044-gdc-unconditionally-link-libgphobos-against-libucont.patch
13e047153076d6e1fc40c9f5b6bfe5699c0e5460248f3d2b35ae36677cb960525af7b0b025997e5000a8492cec5e77a86828d66b4058c0d7f89fde0ab3890142 0045-druntime-link-against-libucontext-on-all-platforms.patch
c33ca2553642c2dbd1c65cd97046548f08775785a3db06d761e3bbe61398c37bc382fe132c0c3fa2101dfd4eea2a6d48bf4fae899a0ddb811c81abd7be35c122 0049-libgo-adjust-name-of-union-in-sigevent-struct.patch
179cd15d629884a66e954fd76066675efa594686b970facbb12ad50769e5d70b5530d7f61e77120e26d1c3dfc701cfc5295f341f635db998df73c41bc8e62172 0050-libphobos-don-t-define-__mode_t-twice-on-musl-target.patch
c82d7c8d340a76df3d796565a79b0ccc04ddffef39927620e1f3719bf2dc1db101ba13aef24b46c5bc95b7bf1e31c8bda4ab0936ba4c9c5e5047ba08826c982c 0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
eb403d8ea665fd5dc2c11faf43b055e6a3bf480a397ceee3e0ca1e38ec7d2392315f2694ed9a34ffbc99e464f2873fbbf91be8646ea4dea5d3636e3ea22fefa0 0052-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
22fb6edf1ed0387e2b93839ffe6e82a7fee420950af90e91199c3488d966702fdeb1a3396d22be0c73a4051525da9349c93d070a0d83b724c83f2b268da6483f 0053-libgo-make-match.sh-POSIX-shell-compatible.patch
"
sha512sums="64898a165f67e136d802a92e7633bf1b06c85266027e52127ea025bf5fc2291b5e858288aac0bdba246e6cdf7c6ec88bc8e0e7f3f6f1985f4297710cafde56ed gcc-8.2.0.tar.xz
e36e95b81489163abd6fe9d58f7867bdca43e61143afacbfb17f4698c0b16ec5fd0061d8fab7b2ae615540bebd721c2e2227f80401b4e7fc253da9da62e6b513 002_all_default-relro.patch
f86466c62b8291fac46f9c250c7ad8fa5ab7b1cce2504442fd07ddc4543665b317ae28951f244e39aba29aeaf3fff252ec4f6a147aa16adb2b7aed747dd89188 003_all_default-fortify-source.patch
02b725b220e540077efef741e9d457f9e004fe53ae642a138e214875d076a60f7c2f27de0ed9a4225db2030fc9c3d2c5b0414c895b9eec0f5f48fad70e2fb029 005_all_default-as-needed.patch
6c9a5068f6eea8a85d297a3555b1d2333ffd4b9ddbfb7560a3e643f8577603871ca123373ef7f96e894225291d88f7bf575c7f8386bcfdd1dabcd7ba12598b65 gcc-as-needed-gold.patch
ab0df1862f1b645634e79b8101326ce53215eba39861a455cd145b81b5267a6a61bc6e76b32d53887a0a48873f7efc23e2c52cc04400c6afd89822f245cdbc77 gcc-as-needed-push-pop.patch
e026bf9f73ee254528423c6cabdfd7794960c567161581b7d4b7c61c45027e12a6efef79662d4288b9cbaecb4798f01af6a5b4a13b766c2d501444ac1846fd43 011_all_default-warn-format-security.patch
37de4cc9061bfe1963e6e6570e1a6bbfd58204bf90e0eef819882599a9a80ea28f3eb815c20c1f173dc25d4bd9971b7c7f7f9512d6f8f91f04de1e1175114d4d 012_all_default-warn-trampolines.patch
38a0fedeac3eebe4a6a957792ba520225cf42663c96a171cd168fdb6c91ffa9a56b80351f8238c5d03b78d3ae2a6539a54481fe4848b4a395e2c87f2ff7adc08 013_all_default-ssp-fix.patch
d35a3ac7e13a4446921a90e1ff3eec1079840c845f9d523c868e24ae21f94cf69ba041de5341ebef96432a6f57598e223381d4286e8fb8baaa25906707f29fbd 020_all_msgfmt-libstdc++-link.patch
840070a3c423e6206aaa6e63e1d9a0fcd6efd53626cd1240a193f0b60aa5d84216acc4a2a4fa8bce74549b07e6a316b01d638f20cea13dc62473491a302fb3d6 050_all_libiberty-asprintf.patch
0a0bc72b9366158f5d23fff1928e756fdd212433bac6ab1f00d632f241382820db8db5d475ddf11ea020eaf7e2e71b12fb9b1c3c870cf84adf6c2b16f15aabca 051_all_libiberty-pic.patch
e7a2eb1b1870e199d6fd753d065781575656fa12baa264f96c5d179689d88c31b8a3f92a5dae96088c05e96aa2bda138364ad7dbcc79e1819a102f192cbb7bab 053_all_libitm-no-fortify-source.patch
4a328d1e1a56c20166307edcfa322068915784d9c08025b7f81cf69714da48fc266b6d34f77b9135c2f10da830d9df408276a1b78d1fd218637c2823506593c2 090_all_pr55930-dependency-tracking.patch
3842bd2be3e53db34e59bfb2bd438b244fc3712055058b9e232e33345f0fab216256b79e364fbac335972dc599a1d74393704f0cd595f3f076dcc10883c85b28 0003-gcc-poison-system-directories.patch
d1c2d7ff7f673375dc7cd84ae9d8515853b5af6390c70bb763412c012101344e4ee1ce155151ce3fb6ba2b80af7ed42d697dbe1bf6fd6e7b2b9087a378c47c37 203-libgcc_s.patch
98473bcaa77903a223ca9b0d2087c0921b287a2816d308cc32c8fe009e6cbf5dd1ae7fba27794ab8d9c09e117fe534413d91a464d1218474fc123ce0adfdc2c1 205-nopie.patch
6d84354e6df96d5ea244eb3bb5f044781796b88040b11c78fb6ee509e5aac19d46e0e92ca836e98e6495d9751f52439833b748efc419e4f5d5301fb549c4dcc9 0002-posix_memalign.patch
7f434a7350c9b06d0ae7cc18a569d813238483afa34b0801d112844a0dfe6164ae36b0416955fd4da7a8caa54672247f319a8ec7ce4b6a97a5f4e17ec083112a 0008-s390x-muslldso.patch
66085c5555e6b91b6874d1782d5a1dc0ab1792889f9400f48cde9483f82b51b9e3a5de1efbba21a19fc5e664334f2188d0c2bc988d42335efa26118b3c85cc7f 0010-ldbl128-config.patch
45d5bc11a89e5af77503ca06eec52d6d84e6fea0be021aaee1bcc39f8dd3c7b4baa4200cfa2b0688faa0f207d005db89c029eff32f362207aa3d2365b2f2363e 0012-static-pie.patch
d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch
600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch
dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-6.1-musl-libssp.patch
fa62556719449caec6b2b434355bfbcaa5ae55ffe017b3e1f827f66a2aae21b79c571ee7a4ce723ea69169bc3a6447e73650991a200cc372adf2f102677518d7 gcc-pure64.patch
35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch
3f5bc334d9f73d06f5f7c876738d02356acdd08958bea0e4d2095ebf15c2c2ec4e411abdae0297505ae9a1699ca01b17338e853184e84663203b192b0d35fc19 ada-shared.patch
50537add461714f44dc6a778e0c6d0e15d6a782591c8aff38d1fb559191ddac2b5ee14a43a3005b389fdf98d2e7468ff4e64c88ba024cf94f9fe0d9854b9e9c8 ada-musl.patch
a1f7750bc7b8b7d916a5dee34fcc736bd4fb249c96538b547d495794e6cfd49356aa3974506a15074b4cb58edd5d7e2868607c902dd003e8c464d5066fd4a575 libgnarl-musl.patch
f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45b58ba8764ab1eb575d4eb6d6dfc550a87a183f8b94e76181 320-libffi-gnulinux.patch
86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3 gcc-pure64-mips.patch"

View File

@ -1,7 +1,7 @@
# Forked from Alpine INSERT-REASON-HERE (CHANGEME!)
pkgname=binutils
pkgver=2.39
pkgver=2.35.2
pkgrel=1
pkgdesc="Tools necessary to build programs"
url="https://www.gnu.org/software/binutils/"
@ -16,7 +16,7 @@ source="https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz
gold-mips.patch
ld-bfd-mips.patch
0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
binutils-mips-disable-assert.patch
CVE-2021-3487.patch
"
builddir="$srcdir/$pkgname-$pkgver"
@ -46,12 +46,10 @@ build() {
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
@ -81,14 +79,12 @@ build() {
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-multilib \
--disable-gprofng \
--enable-ld=default \
$_gold_configure \
--enable-64-bit-bfd \
$_plugin_configure \
--enable-plugins \
--enable-relro \
--enable-deterministic-archives \
--enable-default-execstack=no \
$_cross_configure \
$_arch_configure \
$_hash_style_configure \
@ -111,7 +107,6 @@ package() {
# 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
}
@ -133,11 +128,9 @@ gold() {
mv "$pkgdir"/usr/$CTARGET/bin/ld.gold "$subpkgdir"/usr/$CTARGET/bin/ld.gold
}
sha512sums="
68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.tar.xz
sha512sums="9974ede5978d32e0d68fef23da48fa00bd06b0bff7ec45b00ca075c126d6bbe0cf2defc03ecc3f17bc6cc85b64271a13009c4049d7ba17de26e84e3a6e2c0348 binutils-2.35.2.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
"
642c617db6c6e491f78f053d60f3aa369bad7bf8c1bc7ce267de6cf8fddf6c0d4cf63ce8c8f6e2f225dedbce7cb930d8e87e168fd8f72ca0837c77266ee2b5f8 0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
b08384ed124a74ad3a424db370c107230f09a54378502ca4385deb738f7cf799857f2af0db52709c7eeab8fa6c0a3d972f891396cce1e2834a21f67682fc4355 CVE-2021-3487.patch"

Binary file not shown.