push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,99 @@
{
stdenv,
lib,
fetchFromGitHub,
gnat,
which,
xmlada, # for src
}:
let
version = "25.0.0";
gprConfigKbSrc = fetchFromGitHub {
name = "gprconfig-kb-${version}-src";
owner = "AdaCore";
repo = "gprconfig_kb";
rev = "v${version}";
sha256 = "09x1njq0i0z7fbwg0mg39r5ghy7369avbqvdycfj67lpmw17gb1r";
};
in
stdenv.mkDerivation {
pname = "gprbuild-boot";
inherit version;
src = fetchFromGitHub {
name = "gprbuild-${version}";
owner = "AdaCore";
repo = "gprbuild";
rev = "v${version}";
sha256 = "1mqsmc0q5bzg8223ls18kbvaz6mhzjz7ik8d3sqhhn24c0j6wjaw";
};
nativeBuildInputs = [
gnat
which
];
postPatch = ''
# The Makefile uses gprbuild to build gprbuild which
# we can't do at this point, delete it to prevent the
# default phases from failing.
rm Makefile
# make sure bootstrap script runs
patchShebangs --build bootstrap.sh
'';
# This setupHook populates GPR_PROJECT_PATH which is used by
# gprbuild to find dependencies. It works quite similar to
# the pkg-config setupHook in the sense that it also splits
# dependencies into GPR_PROJECT_PATH and GPR_PROJECT_PATH_FOR_BUILD,
# but gprbuild itself doesn't support this, so we'll need to
# introducing a wrapper for it in the future remains TODO.
# For the moment this doesn't matter since we have no situation
# were gprbuild is used to build something used at build time.
setupHooks = [
./gpr-project-path-hook.sh
]
++ lib.optionals stdenv.targetPlatform.isDarwin [
# This setupHook replaces the paths of shared libraries starting
# with @rpath with the absolute paths on Darwin, so that the
# binaries can be run without additional setup.
./gpr-project-darwin-rpath-hook.sh
];
installPhase = ''
runHook preInstall
./bootstrap.sh \
--with-xmlada=${xmlada.src} \
--with-kb=${gprConfigKbSrc} \
--prefix=$out
# Install custom compiler description which can detect nixpkgs'
# GNAT wrapper as a proper Ada compiler. The default compiler
# description expects the runtime library to be installed in
# the same prefix which isn't the case for nixpkgs. As a
# result, it would detect the unwrapped GNAT as a proper
# compiler which is unable to produce working binaries.
#
# Our compiler description is very similar to the upstream
# GNAT description except that we use a symlink in $out/nix-support
# created by the cc-wrapper to find the associated runtime
# libraries and use gnatmake instead of gnatls to find GNAT's
# bin directory.
install -m644 ${./nixpkgs-gnat.xml} $out/share/gprconfig/nixpkgs-gnat.xml
runHook postInstall
'';
meta = with lib; {
description = "Multi-language extensible build tool";
homepage = "https://github.com/AdaCore/gprbuild";
license = licenses.gpl3Plus;
maintainers = [ maintainers.sternenseemann ];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,79 @@
{
lib,
stdenv,
gprbuild-boot,
which,
gnat,
xmlada,
}:
stdenv.mkDerivation {
pname = "gprbuild";
# See ./boot.nix for an explanation of the gprbuild setupHook,
# our custom knowledge base entry and the situation wrt a
# (future) gprbuild wrapper.
inherit (gprbuild-boot)
version
src
setupHooks
meta
;
nativeBuildInputs = [
gnat
gprbuild-boot
which
];
propagatedBuildInputs = [
xmlada
];
makeFlags = [
"ENABLE_SHARED=${if stdenv.hostPlatform.isStatic then "no" else "yes"}"
"PROCESSORS=$(NIX_BUILD_CORES)"
# confusingly, for gprbuild --target is autoconf --host
"TARGET=${stdenv.hostPlatform.config}"
"prefix=${placeholder "out"}"
]
++ lib.optionals (!stdenv.hostPlatform.isStatic) [
"LIBRARY_TYPE=relocatable"
];
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
# Ensure that there is enough space for the `fixDarwinDylibNames` hook to
# update the install names of the output dylibs.
NIX_LDFLAGS = "-headerpad_max_install_names";
};
# Fixes gprbuild being linked statically always. Based on the AUR's patch:
# https://aur.archlinux.org/cgit/aur.git/plain/0001-Makefile-build-relocatable-instead-of-static-binary.patch?h=gprbuild&id=bac524c76cd59c68fb91ef4dfcbe427357b9f850
patches = lib.optionals (!stdenv.hostPlatform.isStatic) [
./gprbuild-relocatable-build.patch
];
buildFlags = [
"all"
"libgpr.build"
];
installFlags = [
"all"
"libgpr.install"
];
# link gprconfig_kb db from gprbuild-boot into build dir,
# the install process copies its contents to $out
preInstall = ''
# Use PATH to discover spliced gprbuild-boot from buildPackages,
# since path interpolation would give us gprbuild-boot from pkgsHostTarget
gprbuild_boot="$(dirname "$(type -p gprbuild)")/.."
ln -sf "$gprbuild_boot/share/gprconfig" share/gprconfig
'';
# no need for the install script
postInstall = ''
rm $out/doinstall
'';
}

View File

@@ -0,0 +1,10 @@
fixGprProjectDarwinRpath() {
for f in $(find $out -type f -executable); do
install_name_tool -id $f $f || true
for rpath in $(otool -L $f | grep @rpath | awk '{print $1}'); do
install_name_tool -change $rpath ${!outputLib}/lib/$(basename $rpath) $f || true
done
done
}
appendToVar preFixupPhases fixGprProjectDarwinRpath

View File

@@ -0,0 +1,8 @@
addAdaObjectsPath() {
local role_post
getHostRoleEnvHook
addToSearchPath "GPR_PROJECT_PATH${role_post}" "$1/share/gpr"
}
addEnvHooks "$targetOffset" addAdaObjectsPath

View File

@@ -0,0 +1,13 @@
diff --git a/Makefile b/Makefile
index 8c542078..e91cef5e 100644
--- a/Makefile
+++ b/Makefile
@@ -82,7 +82,7 @@ LIB_INSTALLER=gprinstall -p -f --target=$(TARGET) $(RBD) "--prefix=${prefix}"
CLEANER=gprclean -q $(RBD)
GPRBUILD_BUILDER=$(BUILDER) $(GPRBUILD_GPR) \
- -XLIBRARY_TYPE=static -XXMLADA_BUILD=static
+ -XLIBRARY_TYPE=relocatable -XXMLADA_BUILD=relocatable
LIBGPR_BUILDER=$(BUILDER) $(GPR_GPR) $(LIBGPR_OS)
LIBGPR_INSTALLER=$(LIB_INSTALLER) $(GPR_GPR) $(LIBGPR_OS) -XBUILD=${BUILD} \
--install-name=gpr \

View File

@@ -0,0 +1,89 @@
<?xml version="1.0" ?>
<gprconfig>
<!-- This differs from the default GNAT compiler description
in the following ways:
* gnatmake is used over gnatls to detect the GNAT version
since the latter is not part of the wrapper.
* to find the runtime libraries, we rely on the symlink
../nix-support/gprconfig-gnat-unwrapped which is a
gprconfig-specific addition to the cc-wrapper we employ
for Ada compilers (which is only GNAT at the moment).
For documentation on this file format and its use refer to
https://docs.adacore.com/gprbuild-docs/html/gprbuild_ug/companion_tools.html#the-gprconfig-knowledge-base
-->
<compiler_description>
<!-- We would like to name this something different, so users
of gprconfig know this is something custom, nixpkgs-related,
but unfortunately the knowledge base depends on the name of
the compiler for e. g. linker settings.
-->
<name>GNAT</name>
<executable prefix="1">(.*-.*-.*)?gnatmake</executable>
<version>
<external>${PREFIX}gnatmake -v</external>
<grep regexp="^GNATMAKE.+?(\d+(\.\d+)?)" group="1"></grep>
</version>
<languages>Ada</languages>
<variable name="gcc_version">
<external>${PREFIX}gcc -v</external>
<grep regexp="^[-\w]*gcc \S+ (\S+)" group="1"></grep>
</variable>
<!-- The ada runtime libraries and objects are only part of the unwrapped
GNAT derivation. We can't symlink them into the wrapper derivation
(at least not the canonical location) since that screws with linking
against libraries distributed with gcc.
As a workaround, we create a symlink to the unwrapped GNAT's "out"
output in the cc-wrapper which we can read into a variable here and
use to find GNAT's Ada runtime.
-->
<variable name="gnat_unwrapped">
<external>readlink -n ${PATH}/../nix-support/gprconfig-gnat-unwrapped</external>
</variable>
<runtimes default="default,kernel,native">
<directory group="default" >$gnat_unwrapped/lib/gcc(-lib)?/$TARGET/$gcc_version/adalib/</directory>
<directory group="default" contents="^rts-">$gnat_unwrapped/lib/gcc(-lib)?/$TARGET/$gcc_version/ada_object_path</directory>
<directory group="2" >$gnat_unwrapped/lib/gcc(-lib)?/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
<directory group="1" >$gnat_unwrapped/$TARGET/lib/gnat/(.*)/adalib/</directory>
</runtimes>
<target>
<external>${PREFIX}gcc -dumpmachine</external>
<grep regexp="[^\r\n]+"></grep>
</target>
</compiler_description>
<configuration>
<!-- aarch64-linux - native compiler. -->
<targets>
<target name="^aarch64-unknown-linux-gnu$" />
</targets>
<hosts>
<host name="^aarch64-unknown-linux-gnu$" />
</hosts>
<config>
for Archive_Builder use ("ar", "cr");
for Archive_Builder_Append_Option use ("q");
for Archive_Indexer use ("ranlib");
for Archive_Suffix use ".a";
</config>
</configuration>
<configuration>
<!-- aarch64-linux - native compiler. -->
<targets>
<target name="^aarch64-unknown-linux-gnu$" />
</targets>
<hosts>
<host name="^aarch64-unknown-linux-gnu$" />
</hosts>
<config>
for Object_Lister use ("nm", "-g");
for Object_Lister_Matcher use " [TDRBSG] (.*)";
package Linker is
for Export_File_Format use "GNU";
for Export_File_Switch use "-Wl,--version-script=";
end Linker;
</config>
</configuration>
</gprconfig>