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,62 @@
{
lib,
stdenv,
fetchurl,
m4,
perl,
}:
stdenv.mkDerivation rec {
pname = "autoconf";
version = "2.69";
src = fetchurl {
url = "mirror://gnu/autoconf/autoconf-${version}.tar.xz";
sha256 = "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4";
};
nativeBuildInputs = [
m4
perl
];
buildInputs = [ m4 ];
# Work around a known issue in Cygwin. See
# http://thread.gmane.org/gmane.comp.sysutils.autoconf.bugs/6822 for
# details.
# There are many test failures on `i386-pc-solaris2.11'.
#doCheck = ((!stdenv.hostPlatform.isCygwin) && (!stdenv.hostPlatform.isSunOS));
doCheck = false;
# Don't fixup "#! /bin/sh" in Autoconf, otherwise it will use the
# "fixed" path in generated files!
dontPatchShebangs = true;
enableParallelBuilding = true;
# Make the Autotest test suite run in parallel.
preCheck = ''
export TESTSUITEFLAGS="-j$NIX_BUILD_CORES"
'';
doInstallCheck = false; # fails
meta = {
homepage = "https://www.gnu.org/software/autoconf/";
description = "Part of the GNU Build System";
longDescription = ''
GNU Autoconf is an extensible package of M4 macros that produce
shell scripts to automatically configure software source code
packages. These scripts can adapt the packages to many kinds of
UNIX-like systems without manual user intervention. Autoconf
creates a configuration script for a package from a template
file that lists the operating system features that the package
can use, in the form of M4 macro calls.
'';
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.all;
};
}

View File

@@ -0,0 +1,36 @@
https://savannah.gnu.org/support/index.php?110521
https://git.savannah.gnu.org/cgit/autoconf.git/patch/?id=3a9802d60156809c139e9b4620bf04917e143ee2
--- a/lib/Autom4te/FileUtils.pm
+++ b/lib/Autom4te/FileUtils.pm
@@ -34,12 +34,12 @@ This perl module provides various general purpose file handling functions.
=cut
-use 5.006;
+use 5.008;
use strict;
use warnings FATAL => 'all';
use Exporter;
-use File::stat;
+use Time::HiRes qw(stat);
use IO::File;
use Autom4te::Channels;
@@ -115,10 +115,11 @@ sub mtime ($)
return 0
if $file eq '-' || ! -f $file;
- my $stat = stat ($file)
+ my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+ $atime,$mtime,$ctime,$blksize,$blocks) = stat ($file)
or fatal "cannot stat $file: $!";
- return $stat->mtime;
+ return $mtime;
}
--
cgit v1.2.1

View File

@@ -0,0 +1,83 @@
{
lib,
stdenv,
fetchurl,
m4,
perl,
texinfo,
}:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
stdenv.mkDerivation rec {
pname = "autoconf";
version = "2.71";
outputs = [
"out"
"doc"
];
src = fetchurl {
url = "mirror://gnu/autoconf/autoconf-${version}.tar.xz";
sha256 = "197sl23irn6s9pd54rxj5vcp5y8dv65jb9yfqgr2g56cxg7q6k7i";
};
patches = [
# fix stale autom4te cache race condition:
# https://savannah.gnu.org/support/index.php?110521
./2.71-fix-race.patch
];
strictDeps = true;
nativeBuildInputs = [
m4
perl
texinfo
];
buildInputs = [ m4 ];
postBuild = "
make html
";
postInstall = "
make install-html
";
# Work around a known issue in Cygwin. See
# http://thread.gmane.org/gmane.comp.sysutils.autoconf.bugs/6822 for
# details.
# There are many test failures on `i386-pc-solaris2.11'.
doCheck = ((!stdenv.hostPlatform.isCygwin) && (!stdenv.hostPlatform.isSunOS));
# Don't fixup "#! /bin/sh" in Autoconf, otherwise it will use the
# "fixed" path in generated files!
dontPatchShebangs = true;
enableParallelBuilding = true;
# Make the Autotest test suite run in parallel.
preCheck = ''
export TESTSUITEFLAGS="-j$NIX_BUILD_CORES"
'';
meta = {
homepage = "https://www.gnu.org/software/autoconf/";
description = "Part of the GNU Build System";
longDescription = ''
GNU Autoconf is an extensible package of M4 macros that produce
shell scripts to automatically configure software source code
packages. These scripts can adapt the packages to many kinds of
UNIX-like systems without manual user intervention. Autoconf
creates a configuration script for a package from a template
file that lists the operating system features that the package
can use, in the form of M4 macro calls.
'';
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.all;
};
}

View File

@@ -0,0 +1,78 @@
{
lib,
stdenv,
fetchurl,
m4,
perl,
texinfo,
}:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
stdenv.mkDerivation rec {
pname = "autoconf";
version = "2.72";
outputs = [
"out"
"doc"
];
src = fetchurl {
url = "mirror://gnu/autoconf/autoconf-${version}.tar.xz";
hash = "sha256-uohcExlXjWyU1G6bDc60AUyq/iSQ5Deg28o/JwoiP1o=";
};
strictDeps = true;
nativeBuildInputs = [
m4
perl
texinfo
];
buildInputs = [ m4 ];
postBuild = "
make html
";
postInstall = "
make install-html
";
# Work around a known issue in Cygwin. See
# http://thread.gmane.org/gmane.comp.sysutils.autoconf.bugs/6822 for
# details.
# There are many test failures on `i386-pc-solaris2.11'.
doCheck = ((!stdenv.hostPlatform.isCygwin) && (!stdenv.hostPlatform.isSunOS));
# Don't fixup "#! /bin/sh" in Autoconf, otherwise it will use the
# "fixed" path in generated files!
dontPatchShebangs = true;
enableParallelBuilding = true;
# Make the Autotest test suite run in parallel.
preCheck = ''
export TESTSUITEFLAGS="-j$NIX_BUILD_CORES"
'';
meta = {
homepage = "https://www.gnu.org/software/autoconf/";
description = "Part of the GNU Build System";
longDescription = ''
GNU Autoconf is an extensible package of M4 macros that produce
shell scripts to automatically configure software source code
packages. These scripts can adapt the packages to many kinds of
UNIX-like systems without manual user intervention. Autoconf
creates a configuration script for a package from a template
file that lists the operating system features that the package
can use, in the form of M4 macro calls.
'';
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.all;
};
}

View File

@@ -0,0 +1,51 @@
{
lib,
stdenv,
fetchurl,
perl,
autoconf,
updateAutotoolsGnuConfigScriptsHook,
}:
stdenv.mkDerivation rec {
pname = "automake";
version = "1.16.5";
src = fetchurl {
url = "mirror://gnu/automake/automake-${version}.tar.xz";
sha256 = "0sdl32qxdy7m06iggmkkvf7j520rmmgbsjzbm7fgnxwxdp6mh7gh";
};
strictDeps = true;
nativeBuildInputs = [
updateAutotoolsGnuConfigScriptsHook
autoconf
perl
];
buildInputs = [ autoconf ];
setupHook = ./setup-hook.sh;
doCheck = false; # takes _a lot_ of time, fails 3 out of 2698 tests, all seem to be related to paths
doInstallCheck = false; # runs the same thing, fails the same tests
# The test suite can run in parallel.
enableParallelBuilding = true;
# Don't fixup "#! /bin/sh" in Libtool, otherwise it will use the
# "fixed" path in generated files!
dontPatchShebangs = true;
meta = with lib; {
branch = "1.16";
homepage = "https://www.gnu.org/software/automake/";
description = "GNU standard-compliant makefile generator";
license = licenses.gpl2Plus;
longDescription = ''
GNU Automake is a tool for automatically generating
`Makefile.in' files compliant with the GNU Coding
Standards. Automake requires the use of Autoconf.
'';
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,51 @@
{
lib,
stdenv,
fetchurl,
perl,
autoconf,
updateAutotoolsGnuConfigScriptsHook,
}:
stdenv.mkDerivation rec {
pname = "automake";
version = "1.18.1";
src = fetchurl {
url = "mirror://gnu/automake/automake-${version}.tar.xz";
hash = "sha256-FoqjYyeDUbia9WaERI9SWlvOUHnQtoQr2RD90/FkaIc=";
};
strictDeps = true;
nativeBuildInputs = [
updateAutotoolsGnuConfigScriptsHook
autoconf
perl
];
buildInputs = [ autoconf ];
setupHook = ./setup-hook.sh;
doCheck = false; # takes _a lot_ of time, fails 3 out of 2698 tests, all seem to be related to paths
doInstallCheck = false; # runs the same thing, fails the same tests
# The test suite can run in parallel.
enableParallelBuilding = true;
# Don't fixup "#! /bin/sh" in Libtool, otherwise it will use the
# "fixed" path in generated files!
dontPatchShebangs = true;
meta = with lib; {
branch = "1.18";
homepage = "https://www.gnu.org/software/automake/";
description = "GNU standard-compliant makefile generator";
license = licenses.gpl2Plus;
longDescription = ''
GNU Automake is a tool for automatically generating
`Makefile.in' files compliant with the GNU Coding
Standards. Automake requires the use of Autoconf.
'';
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,5 @@
addAclocals () {
addToSearchPathWithCustomDelimiter : ACLOCAL_PATH $1/share/aclocal
}
addEnvHooks "$hostOffset" addAclocals

View File

@@ -0,0 +1,137 @@
From beca4a2c25ee86e4020f8b8bddc4d8e0ed3430b3 Mon Sep 17 00:00:00 2001
From: Andrew Childs <andrew.childs@bibo.com.ph>
Date: Tue, 22 Feb 2022 11:28:04 +0900
Subject: [PATCH] Revert "libtool.m4: fix nm BSD flag detection"
This reverts commit bef9ef8ca0f941d743c77cc55b5fe7985990b2a7.
---
ChangeLog | 9 ------
libtool.m4 | 88 ++++++++++++++++++++++++++----------------------------
2 files changed, 43 insertions(+), 54 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 18e8b6835da..c12f07403c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -375,15 +375,6 @@
* src-release.sh (GDB_SUPPPORT_DIRS): Add libbacktrace.
-2021-09-27 Nick Alcock <nick.alcock@oracle.com>
-
- PR libctf/27967
- * libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
- NM, if there is one. Run nm on itself, not on /dev/null, to avoid
- errors from nms that refuse to work on non-regular files. Remove
- other workarounds for this problem. Strip out blank lines from the
- nm output.
-
2021-09-27 Nick Alcock <nick.alcock@oracle.com>
PR libctf/27967
diff --git a/libtool.m4 b/libtool.m4
index a216bb14e99..7a711249304 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -3200,55 +3200,53 @@ _LT_DECL([], [file_magic_cmd], [1],
# LT_PATH_NM
# ----------
-# find the pathname to a BSD- or MS-compatible name lister, and any flags
-# needed to make it compatible
+# find the pathname to a BSD- or MS-compatible name lister
AC_DEFUN([LT_PATH_NM],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
[if test -n "$NM"; then
- # Let the user override the nm to test.
- lt_nm_to_check="$NM"
- else
- lt_nm_to_check="${ac_tool_prefix}nm"
- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
- lt_nm_to_check="$lt_nm_to_check nm"
- fi
- fi
- for lt_tmp_nm in $lt_nm_to_check; do
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
- IFS="$lt_save_ifs"
- test -z "$ac_dir" && ac_dir=.
- case "$lt_tmp_nm" in
- */*|*\\*) tmp_nm="$lt_tmp_nm";;
- *) tmp_nm="$ac_dir/$lt_tmp_nm";;
- esac
- if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
- # Check to see if the nm accepts a BSD-compat flag.
- # Adding the `sed 1q' prevents false positives on HP-UX, which says:
- # nm: unknown option "B" ignored
- case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
- *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
- break
- ;;
- *)
- case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
- *$tmp_nm*)
- lt_cv_path_NM="$tmp_nm -p"
- break
- ;;
- *)
- lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
- continue # so that we can try to find one that supports BSD flags
- ;;
- esac
- ;;
- esac
- fi
- done
- IFS="$lt_save_ifs"
- done
- : ${lt_cv_path_NM=no}])
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi])
if test "$lt_cv_path_NM" != "no"; then
NM="$lt_cv_path_NM"
else
--
2.34.1

View File

@@ -0,0 +1,42 @@
This reverts upstream commit caf606c90d55305967b9253447dda93d2f1835ab
until https://sourceware.org/PR29547 is fixed.
--- a/libtool.m4
+++ b/libtool.m4
@@ -3214,31 +3214,25 @@ AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
lt_nm_to_check="$lt_nm_to_check nm"
fi
fi
- for lt_tmp_nm in "$lt_nm_to_check"; do
+ for lt_tmp_nm in $lt_nm_to_check; do
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
- # Strip out any user-provided options from the nm to test twice,
- # the first time to test to see if nm (rather than its options) has
- # an explicit path, the second time to yield a file which can be
- # nm'ed itself.
- tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
- case "$tmp_nm_path" in
+ case "$lt_tmp_nm" in
*/*|*\\*) tmp_nm="$lt_tmp_nm";;
*) tmp_nm="$ac_dir/$lt_tmp_nm";;
esac
- tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
- if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
- case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+ case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
*$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
break
;;
*)
- case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+ case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
*$tmp_nm*)
lt_cv_path_NM="$tmp_nm -p"
break

View File

@@ -0,0 +1,24 @@
From 368f26bfece3899a8c992cfec66427266918ab80 Mon Sep 17 00:00:00 2001
From: Randy Eckenrode <randy@largeandhighquality.com>
Date: Thu, 4 Jul 2024 12:20:34 -0400
Subject: [PATCH] libtool.m4: update macos version detection block
---
libtool.m4 | 1 +
1 file changed, 1 insertion(+)
diff --git a/libtool.m4 b/libtool.m4
index e36fdd3c0e2..dd4725f8cd1 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1011,6 +1011,7 @@ _LT_EOF
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
;;
*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}dynamic_lookup'
;;
esac
;;
--
2.45.1

View File

@@ -0,0 +1,137 @@
From beca4a2c25ee86e4020f8b8bddc4d8e0ed3430b3 Mon Sep 17 00:00:00 2001
From: Andrew Childs <andrew.childs@bibo.com.ph>
Date: Tue, 22 Feb 2022 11:28:04 +0900
Subject: [PATCH] Revert "libtool.m4: fix nm BSD flag detection"
This reverts commit bef9ef8ca0f941d743c77cc55b5fe7985990b2a7.
---
ChangeLog | 9 ------
libtool.m4 | 88 ++++++++++++++++++++++++++----------------------------
2 files changed, 43 insertions(+), 54 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 18e8b6835da..c12f07403c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -375,15 +375,6 @@
* src-release.sh (GDB_SUPPPORT_DIRS): Add libbacktrace.
-2021-09-27 Nick Alcock <nick.alcock@oracle.com>
-
- PR libctf/27967
- * libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
- NM, if there is one. Run nm on itself, not on /dev/null, to avoid
- errors from nms that refuse to work on non-regular files. Remove
- other workarounds for this problem. Strip out blank lines from the
- nm output.
-
2021-09-27 Nick Alcock <nick.alcock@oracle.com>
PR libctf/27967
diff --git a/libtool.m4 b/libtool.m4
index a216bb14e99..7a711249304 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -3200,55 +3200,53 @@ _LT_DECL([], [file_magic_cmd], [1],
# LT_PATH_NM
# ----------
-# find the pathname to a BSD- or MS-compatible name lister, and any flags
-# needed to make it compatible
+# find the pathname to a BSD- or MS-compatible name lister
AC_DEFUN([LT_PATH_NM],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
[if test -n "$NM"; then
- # Let the user override the nm to test.
- lt_nm_to_check="$NM"
- else
- lt_nm_to_check="${ac_tool_prefix}nm"
- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
- lt_nm_to_check="$lt_nm_to_check nm"
- fi
- fi
- for lt_tmp_nm in $lt_nm_to_check; do
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
- IFS="$lt_save_ifs"
- test -z "$ac_dir" && ac_dir=.
- case "$lt_tmp_nm" in
- */*|*\\*) tmp_nm="$lt_tmp_nm";;
- *) tmp_nm="$ac_dir/$lt_tmp_nm";;
- esac
- if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
- # Check to see if the nm accepts a BSD-compat flag.
- # Adding the `sed 1q' prevents false positives on HP-UX, which says:
- # nm: unknown option "B" ignored
- case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
- *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
- break
- ;;
- *)
- case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
- *$tmp_nm*)
- lt_cv_path_NM="$tmp_nm -p"
- break
- ;;
- *)
- lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
- continue # so that we can try to find one that supports BSD flags
- ;;
- esac
- ;;
- esac
- fi
- done
- IFS="$lt_save_ifs"
- done
- : ${lt_cv_path_NM=no}])
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi])
if test "$lt_cv_path_NM" != "no"; then
NM="$lt_cv_path_NM"
else
--
2.34.1

View File

@@ -0,0 +1,47 @@
From 33a8dc728eb5da3e1d3439c96810d1f6b2660b89 Mon Sep 17 00:00:00 2001
From: Andrew Childs <andrew.childs@bibo.com.ph>
Date: Tue, 22 Feb 2022 12:24:46 +0900
Subject: [PATCH] libtool.m4: update macos version detection block
Includes upstream change
9e8c882517082fe5755f2524d23efb02f1522490
---
libtool.m4 | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/libtool.m4 b/libtool.m4
index 7a711249304..f452efb4300 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -996,20 +996,15 @@ _LT_EOF
])
case $host_os in
rhapsody* | darwin1.[[012]])
- _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
darwin1.*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- darwin*) # darwin 5.x on
- # if running on 10.5 or later, the deployment target defaults
- # to the OS version, if on x86, and 10.4, the deployment
- # target defaults to 10.4. Don't you love it?
- case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
- 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- 10.[[012]][[,.]]*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- 10.*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+ darwin*)
+ case $MACOSX_DEPLOYMENT_TARGET,$host in
+ 10.[[012]],*|,*powerpc*-darwin[[5-8]]*)
+ _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+ *)
+ _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
esac
;;
esac
--
2.34.1

View File

@@ -0,0 +1,14 @@
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index b6940d376d..0feb1adfd0 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -125,6 +125,9 @@ if test "x$NATIVE" = "xyes" ; then
USE_LIBPATH=yes
fi
+# TODO: why is this needed?
+USE_LIBPATH=yes
+
# Set the library search path, for libraries named by -lfoo.
# If LIB_PATH is defined (e.g., by Makefile) and non-empty, it is used.
# Otherwise, the default is set here.

View File

@@ -0,0 +1,155 @@
diff --git a/bfd/configure.ac b/bfd/configure.ac
index fec067b2135..377e1f5443f 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -292,30 +292,16 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
LT_LIB_M
-# When building a shared libbfd, link against the pic version of libiberty
-# so that apps that use libbfd won't need libiberty just to satisfy any
-# libbfd references.
-# We can't do that if a pic libiberty is unavailable since including non-pic
-# code would insert text relocations into libbfd.
SHARED_LIBADD=
-SHARED_LDFLAGS=
+SHARED_LDFLAGS=-liberty
if test "$enable_shared" = "yes"; then
-changequote(,)dnl
- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
-changequote([,])dnl
- if test -n "$x"; then
- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
- fi
-fi
-
SHARED_LIBADD="$SHARED_LIBADD $LIBINTL"
-if test "$enable_shared" = "yes"; then
case "${host}" in
# More hacks to build DLLs on Windows.
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
- SHARED_LIBADD="-L`pwd`/../libiberty -liberty $SHARED_LIBADD -lcygwin -lkernel32"
+ SHARED_LIBADD="-liberty $SHARED_LIBADD -lcygwin -lkernel32"
;;
esac
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index 0e04b4c05c4..848a02662e7 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -51,7 +51,7 @@ libopcodes_la_LDFLAGS += -rpath $(rpath_bfdlibdir)
endif
# This is where bfd.h lives.
-BFD_H = ../bfd/bfd.h
+BFD_H = $(BFDDIR)/bfd.h
BUILD_LIBS = @BUILD_LIBS@
BUILD_LIB_DEPS = @BUILD_LIB_DEPS@
@@ -303,7 +303,7 @@ OFILES = @BFD_MACHINES@
# development.sh is used to determine -Werror default.
CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
-AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
+AM_CPPFLAGS = -I. -I$(srcdir) -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
disassemble.lo: disassemble.c
if am__fastdepCC
@@ -327,9 +327,18 @@ libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c
-libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@
+libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@ libtool-soversion
libopcodes_la_LIBADD = $(OFILES) @SHARED_LIBADD@
-libopcodes_la_LDFLAGS += -release `cat ../bfd/libtool-soversion` @SHARED_LDFLAGS@
+libopcodes_la_LDFLAGS += -release `cat libtool-soversion` @SHARED_LDFLAGS@
# Allow dependency tracking to work on all the source files.
EXTRA_libopcodes_la_SOURCES = $(LIBOPCODES_CFILES)
+libtool-soversion:
+ @echo "creating $@"
+ bfd_soversion="$(VERSION)" ;\
+ . $(BFDDIR)/development.sh ;\
+ if test "$$development" = true ; then \
+ bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
+ fi ;\
+ echo "$${bfd_soversion}" > $@
+
# libtool will build .libs/libopcodes.a. We create libopcodes.a in
# the build directory so that we don't have to convert all the
# programs that use libopcodes.a simultaneously. This is a hack which
diff --git a/opcodes/configure.ac b/opcodes/configure.ac
index e564f067334..5da62a3d58b 100644
--- a/opcodes/configure.ac
+++ b/opcodes/configure.ac
@@ -98,6 +98,8 @@ BFD_64_BIT
AC_SUBST(HDEFINES)
AC_PROG_INSTALL
+GCC_HEADER_STDINT(bfd_stdint.h)
+
AC_CHECK_DECLS([basename, stpcpy])
# Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do
@@ -148,44 +150,21 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
LT_LIB_M
-#Libs for generator progs
-if test "x$cross_compiling" = "xno"; then
- BUILD_LIBS=../libiberty/libiberty.a
- BUILD_LIB_DEPS=$BUILD_LIBS
-else
- # if cross-compiling, assume that the system provides -liberty
- # and that the version is compatible with new headers.
- BUILD_LIBS=-liberty
- BUILD_LIB_DEPS=
-fi
-BUILD_LIBS="$BUILD_LIBS $LIBINTL"
-BUILD_LIB_DEPS="$BUILD_LIB_DEPS $LIBINTL_DEP"
+BUILD_LIBS="-liberty $LIBINTL"
+BUILD_LIB_DEPS="$LIBINTL_DEP"
AC_SUBST(BUILD_LIBS)
AC_SUBST(BUILD_LIB_DEPS)
# Horrible hacks to build DLLs on Windows and a shared library elsewhere.
SHARED_LDFLAGS=
-SHARED_LIBADD=
+SHARED_LIBADD=-liberty
SHARED_DEPENDENCIES=
-if test "$enable_shared" = "yes"; then
-# When building a shared libopcodes, link against the pic version of libiberty
-# so that apps that use libopcodes won't need libiberty just to satisfy any
-# libopcodes references.
-# We can't do that if a pic libiberty is unavailable since including non-pic
-# code would insert text relocations into libopcodes.
# Note that linking against libbfd as we do here, which is itself linked
# against libiberty, may not satisfy all the libopcodes libiberty references
# since libbfd may not pull in the entirety of libiberty.
# Also, jam libintl into the right place in all of this: after libiberty,
# which uses it, but before -lcygwin, which it uses.
-changequote(,)dnl
- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
-changequote([,])dnl
- if test -n "$x"; then
- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
- fi
-fi
SHARED_LIBADD="$SHARED_LIBADD $LIBINTL"
@@ -193,11 +172,10 @@ if test "$enable_shared" = "yes"; then
case "${host}" in
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
- SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty $SHARED_LIBADD"
+ SHARED_LIBADD="-lbfd -liberty $SHARED_LIBADD"
;;
*)
- SHARED_LIBADD="../bfd/libbfd.la ${SHARED_LIBADD}"
- SHARED_DEPENDENCIES="../bfd/libbfd.la"
+ SHARED_LIBADD="-lbfd ${SHARED_LIBADD}"
;;
esac

View File

@@ -0,0 +1,277 @@
{
stdenv,
autoreconfHook,
autoconf269,
automake,
libtool,
bison,
buildPackages,
fetchFromGitHub,
fetchurl,
flex,
gettext,
lib,
noSysDirs,
perl,
substitute,
texinfo,
zlib,
enableGold ? stdenv.targetPlatform.isElf,
enableShared ? !stdenv.hostPlatform.isStatic,
# WARN: Enabling all targets increases output size to a multiple.
withAllTargets ? false,
}:
# WARN: configure silently disables ld.gold if it's unsupported, so we need to
# make sure that intent matches result ourselves.
assert enableGold -> stdenv.targetPlatform.isElf;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
version = "2.38";
srcs = {
normal = fetchurl {
url = "mirror://gnu/binutils/binutils-${version}.tar.bz2";
sha256 = "sha256-Bw7HHPB3pqWOC5WfBaCaNQFTeMLYpR6Q866r/jBZDvg=";
};
vc4-none = fetchFromGitHub {
owner = "itszor";
repo = "binutils-vc4";
rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36";
sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63";
};
};
#INFO: The targetPrefix prepended to binary names to allow multiple binuntils
# on the PATH to both be usable.
targetPrefix = lib.optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
in
stdenv.mkDerivation {
pname = targetPrefix + "binutils";
inherit version;
# HACK: Ensure that we preserve source from bootstrap binutils to not rebuild LLVM
src =
stdenv.__bootPackages.binutils-unwrapped_2_38.src or srcs.${targetPlatform.system} or srcs.normal;
# WARN: this package is used for bootstrapping fetchurl, and thus cannot use
# fetchpatch! All mutable patches (generated by GitHub or cgit) that are
# needed here should be included directly in Nixpkgs as files.
patches = [
# Make binutils output deterministic by default.
./deterministic.patch
# Breaks nm BSD flag detection
./0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch
# Required for newer macos versions
./0001-libtool.m4-update-macos-version-detection-block.patch
# For some reason bfd ld doesn't search DT_RPATH when cross-compiling. It's
# not clear why this behavior was decided upon but it has the unfortunate
# consequence that the linker will fail to find transitive dependencies of
# shared objects when cross-compiling. Consequently, we are forced to
# override this behavior, forcing ld to search DT_RPATH even when
# cross-compiling.
./always-search-rpath.patch
# Fixed in 2.39
# https://sourceware.org/bugzilla/show_bug.cgi?id=28885
# https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=99852365513266afdd793289813e8e565186c9e6
# https://github.com/NixOS/nixpkgs/issues/170946
./deterministic-temp-prefixes.patch
]
++ lib.optional targetPlatform.isiOS ./support-ios.patch
++ lib.optional stdenv.targetPlatform.isWindows ./windres-locate-gcc.patch
++
lib.optional stdenv.targetPlatform.isMips64n64
# this patch is from debian:
# https://sources.debian.org/data/main/b/binutils/2.38-3/debian/patches/mips64-default-n64.diff
(
if stdenv.targetPlatform.isMusl then
substitute {
src = ./mips64-default-n64.patch;
substitutions = [
"--replace"
"gnuabi64"
"muslabi64"
];
}
else
./mips64-default-n64.patch
)
# On PowerPC, when generating assembly code, GCC generates a `.machine`
# custom instruction which instructs the assembler to generate code for this
# machine. However, some GCC versions generate the wrong one, or make it
# too strict, which leads to some confusing "unrecognized opcode: wrtee"
# or "unrecognized opcode: eieio" errors.
#
# To remove when binutils 2.39 is released.
#
# Upstream commit:
# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=cebc89b9328eab994f6b0314c263f94e7949a553
++ lib.optional stdenv.targetPlatform.isPower ./ppc-make-machine-less-strict.patch;
outputs = [
"out"
"info"
"man"
];
strictDeps = true;
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [
bison
perl
texinfo
]
++ lib.optionals targetPlatform.isiOS [ autoreconfHook ]
++ lib.optionals buildPlatform.isDarwin [
autoconf269
automake
gettext
libtool
]
++ lib.optionals targetPlatform.isVc4 [ flex ];
buildInputs = [
zlib
gettext
];
inherit noSysDirs;
preConfigure =
(lib.optionalString buildPlatform.isDarwin ''
for i in */configure.ac; do
pushd "$(dirname "$i")"
echo "Running autoreconf in $PWD"
# autoreconf doesn't work, don't know why
# autoreconf ''${autoreconfFlags:---install --force --verbose}
autoconf
popd
done
'')
+ ''
# Clear the default library search path.
if test "$noSysDirs" = "1"; then
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
fi
# Use symlinks instead of hard links to save space ("strip" in the
# fixup phase strips each hard link separately).
for i in binutils/Makefile.in gas/Makefile.in ld/Makefile.in gold/Makefile.in; do
sed -i "$i" -e 's|ln |ln -s |'
done
'';
# As binutils takes part in the stdenv building, we don't want references
# to the bootstrap-tools libgcc (as uses to happen on arm/mips)
env.NIX_CFLAGS_COMPILE =
if hostPlatform.isDarwin then
"-Wno-string-plus-int -Wno-deprecated-declarations"
else
"-static-libgcc";
hardeningDisable = [
"format"
"pie"
];
configurePlatforms = [
"build"
"host"
"target"
];
configureFlags = [
"--enable-64-bit-bfd"
"--with-system-zlib"
"--enable-deterministic-archives"
"--disable-werror"
"--enable-fix-loongson2f-nop"
# Turn on --enable-new-dtags by default to make the linker set
# RUNPATH instead of RPATH on binaries. This is important because
# RUNPATH can be overridden using LD_LIBRARY_PATH at runtime.
"--enable-new-dtags"
# force target prefix. Some versions of binutils will make it empty if
# `--host` and `--target` are too close, even if Nixpkgs thinks the
# platforms are different (e.g. because not all the info makes the
# `config`). Other versions of binutils will always prefix if `--target` is
# passed, even if `--host` and `--target` are the same. The easiest thing
# for us to do is not leave it to chance, and force the program prefix to be
# what we want it to be.
"--program-prefix=${targetPrefix}"
]
++ lib.optionals withAllTargets [ "--enable-targets=all" ]
++ lib.optionals enableGold [
"--enable-gold"
"--enable-plugins"
]
++ (
if enableShared then
[
"--enable-shared"
"--disable-static"
]
else
[
"--disable-shared"
"--enable-static"
]
);
# Fails
doCheck = false;
# Remove on next bump. It's a vestige of past conditional. Stays here to avoid
# mass rebuild.
postFixup = "";
# Break dependency on pkgsBuildBuild.gcc when building a cross-binutils
stripDebugList =
if stdenv.hostPlatform != stdenv.targetPlatform then
"bin lib ${stdenv.hostPlatform.config}"
else
null;
# INFO: Otherwise it fails with:
# `./sanity.sh: line 36: $out/bin/size: not found`
doInstallCheck = (buildPlatform == hostPlatform) && (hostPlatform == targetPlatform);
enableParallelBuilding = true;
passthru = {
inherit targetPrefix;
hasGold = enableGold;
isGNU = true;
};
meta = with lib; {
description = "Tools for manipulating binaries (linker, assembler, etc.)";
longDescription = ''
The GNU Binutils are a collection of binary tools. The main
ones are `ld' (the GNU linker) and `as' (the GNU assembler).
They also include the BFD (Binary File Descriptor) library,
`gprof', `nm', `strip', etc.
'';
homepage = "https://www.gnu.org/software/binutils/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [
ericson2314
lovesegfault
];
platforms = platforms.unix;
# INFO: Give binutils a lower priority than gcc-wrapper to prevent a
# collision due to the ld/as wrappers/symlinks in the latter.
priority = 10;
};
}

View File

@@ -0,0 +1,36 @@
From 99852365513266afdd793289813e8e565186c9e6 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 23 Mar 2022 11:39:49 +0000
Subject: [PATCH] dlltool: Use the output name as basis for deterministic temp
prefixes
PR 28885
* dlltool.c (main): use imp_name rather than dll_name when
generating a temporary file name.
---
binutils/ChangeLog | 9 +++++++++
binutils/dlltool.c | 7 ++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index d95bf3f5470..89871510b45 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -3992,10 +3992,11 @@ main (int ac, char **av)
if (tmp_prefix == NULL)
{
/* If possible use a deterministic prefix. */
- if (dll_name)
+ if (imp_name || delayimp_name)
{
- tmp_prefix = xmalloc (strlen (dll_name) + 2);
- sprintf (tmp_prefix, "%s_", dll_name);
+ const char *input = imp_name ? imp_name : delayimp_name;
+ tmp_prefix = xmalloc (strlen (input) + 2);
+ sprintf (tmp_prefix, "%s_", input);
for (i = 0; tmp_prefix[i]; i++)
if (!ISALNUM (tmp_prefix[i]))
tmp_prefix[i] = '_';
--
2.31.1

View File

@@ -0,0 +1,12 @@
diff -ur orig/binutils-2.23.1/ld/ldlang.c binutils-2.23.1/ld/ldlang.c
--- orig/ld/ldlang.c
+++ new/ld/ldlang.c
@@ -3095,6 +3095,8 @@
ldfile_output_machine))
einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
+ link_info.output_bfd->flags |= BFD_DETERMINISTIC_OUTPUT;
+
link_info.hash = bfd_link_hash_table_create (link_info.output_bfd);
if (link_info.hash == NULL)
einfo (_("%P%F: can not create hash table: %E\n"));

View File

@@ -0,0 +1,82 @@
{
lib,
stdenv,
fetchpatch,
gnu-config,
autoreconfHook,
bison,
binutils-unwrapped_2_38,
libiberty,
libintl,
zlib,
}:
stdenv.mkDerivation {
pname = "libbfd";
inherit (binutils-unwrapped_2_38) version src;
outputs = [
"out"
"dev"
];
patches = binutils-unwrapped_2_38.patches ++ [
./build-components-separately.patch
(fetchpatch {
url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch";
sha256 = "0pzb3i74d1r7lhjan376h59a7kirw15j7swwm8pz3zy9lkdqkj6q";
})
];
# We just want to build libbfd
postPatch = ''
cd bfd
'';
postAutoreconf = ''
echo "Updating config.guess and config.sub from ${gnu-config}"
cp -f ${gnu-config}/config.{guess,sub} ../
'';
# We update these ourselves
dontUpdateAutotoolsGnuConfigScripts = true;
strictDeps = true;
nativeBuildInputs = [
autoreconfHook
bison
];
buildInputs = [
libiberty
zlib
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ libintl ];
configurePlatforms = [
"build"
"host"
];
configureFlags = [
"--enable-targets=all"
"--enable-64-bit-bfd"
"--enable-install-libbfd"
"--with-system-zlib"
]
++ lib.optional (!stdenv.hostPlatform.isStatic) "--enable-shared";
enableParallelBuilding = true;
meta = with lib; {
description = "Library for manipulating containers of machine code";
longDescription = ''
BFD is a library which provides a single interface to read and write
object files, executables, archive files, and core files in any format.
It is associated with GNU Binutils, and elsewhere often distributed with
it.
'';
homepage = "https://www.gnu.org/software/binutils/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ ericson2314 ];
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,60 @@
{
lib,
stdenv,
buildPackages,
autoreconfHook,
bison,
binutils-unwrapped_2_38,
libiberty,
libbfd_2_38,
}:
stdenv.mkDerivation {
pname = "libopcodes";
inherit (binutils-unwrapped_2_38) version src;
outputs = [
"out"
"dev"
];
patches = binutils-unwrapped_2_38.patches ++ [
./build-components-separately.patch
];
# We just want to build libopcodes
postPatch = ''
cd opcodes
find . ../include/opcode -type f -exec sed {} -i -e 's/"bfd.h"/<bfd.h>/' \;
'';
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [
autoreconfHook
bison
];
buildInputs = [ libiberty ];
# dis-asm.h includes bfd.h
propagatedBuildInputs = [ libbfd_2_38 ];
configurePlatforms = [
"build"
"host"
];
configureFlags = [
"--enable-targets=all"
"--enable-64-bit-bfd"
"--enable-install-libbfd"
"--enable-shared"
];
enableParallelBuilding = true;
meta = with lib; {
description = "Library from binutils for manipulating machine code";
homepage = "https://www.gnu.org/software/binutils/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ ericson2314 ];
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,82 @@
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -927,11 +927,21 @@ case "${targ}" in
targ_defvec=mips_elf32_be_vec
targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
;;
- mips64*el-*-linux*)
+ mips*64*el-*-linux*-gnuabi64)
+ targ_defvec=mips_elf64_trad_le_vec
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec"
+ want64=true
+ ;;
+ mips*64*-*-linux*-gnuabi64)
+ targ_defvec=mips_elf64_trad_be_vec
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec"
+ want64=true
+ ;;
+ mips*64*el-*-linux*)
targ_defvec=mips_elf32_ntrad_le_vec
targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec"
;;
- mips64*-*-linux*)
+ mips*64*-*-linux*)
targ_defvec=mips_elf32_ntrad_be_vec
targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
;;
--- a/binutils/testsuite/binutils-all/mips/mips-note-2-n32.d
+++ b/binutils/testsuite/binutils-all/mips/mips-note-2-n32.d
@@ -1,4 +1,5 @@
#PROG: objcopy
+#as: -n32
#readelf: --notes --wide
#objcopy: --merge-notes
#name: MIPS merge notes section (n32)
--- a/gas/configure
+++ b/gas/configure
@@ -12167,6 +12167,9 @@ _ACEOF
esac
# Decide which ABI to target by default.
case ${target} in
+ mips*64*-linux-gnuabi64)
+ mips_default_abi=N64_ABI
+ ;;
mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
| mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
mips_default_abi=N32_ABI
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -384,6 +384,9 @@ changequote([,])dnl
esac
# Decide which ABI to target by default.
case ${target} in
+ mips*64*-linux-gnuabi64)
+ mips_default_abi=N64_ABI
+ ;;
mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
| mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
mips_default_abi=N32_ABI
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -543,11 +543,19 @@ mips*-*-vxworks*) targ_emul=elf32ebmipvx
;;
mips*-*-windiss) targ_emul=elf32mipswindiss
;;
-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
+mips*64*el-*-linux-gnuabi64) targ_emul=elf64ltsmip
+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
+mips*64*el-*-linux-*) targ_emul=elf32ltsmipn32
targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
targ_extra_libpath=$targ_extra_emuls
;;
-mips64*-*-linux-*) targ_emul=elf32btsmipn32
+mips*64*-*-linux-gnuabi64) targ_emul=elf64btsmip
+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
+mips*64*-*-linux-*) targ_emul=elf32btsmipn32
targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
targ_extra_libpath=$targ_extra_emuls
;;

View File

@@ -0,0 +1,51 @@
From cebc89b9328eab994f6b0314c263f94e7949a553 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Mon, 21 Feb 2022 10:58:57 +1030
Subject: [PATCH] binutils 2.38 vs. ppc32 linux kernel
Commit b25f942e18d6 made .machine more strict. Weaken it again.
* config/tc-ppc.c (ppc_machine): Treat an early .machine specially,
keeping sticky options to work around gcc bugs.
---
gas/config/tc-ppc.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 054f9c72161..89bc7d3f9b9 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -5965,7 +5965,30 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED)
options do not count as a new machine, instead they add
to currently selected opcodes. */
ppc_cpu_t machine_sticky = 0;
- new_cpu = ppc_parse_cpu (ppc_cpu, &machine_sticky, cpu_string);
+ /* Unfortunately, some versions of gcc emit a .machine
+ directive very near the start of the compiler's assembly
+ output file. This is bad because it overrides user -Wa
+ cpu selection. Worse, there are versions of gcc that
+ emit the *wrong* cpu, not even respecting the -mcpu given
+ to gcc. See gcc pr101393. And to compound the problem,
+ as of 20220222 gcc doesn't pass the correct cpu option to
+ gas on the command line. See gcc pr59828. Hack around
+ this by keeping sticky options for an early .machine. */
+ asection *sec;
+ for (sec = stdoutput->sections; sec != NULL; sec = sec->next)
+ {
+ segment_info_type *info = seg_info (sec);
+ /* Are the frags for this section perturbed from their
+ initial state? Even .align will count here. */
+ if (info != NULL
+ && (info->frchainP->frch_root != info->frchainP->frch_last
+ || info->frchainP->frch_root->fr_type != rs_fill
+ || info->frchainP->frch_root->fr_fix != 0))
+ break;
+ }
+ new_cpu = ppc_parse_cpu (ppc_cpu,
+ sec == NULL ? &sticky : &machine_sticky,
+ cpu_string);
if (new_cpu != 0)
ppc_cpu = new_cpu;
else
--
2.31.1

View File

@@ -0,0 +1,168 @@
diff --git a/bfd/config.bfd b/bfd/config.bfd
index f04a993f06..1e24a9d030 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -238,7 +238,7 @@ case "${targ}" in
# START OF targmatch.h
#ifdef BFD64
- aarch64-*-darwin*)
+ aarch64-*-darwin* | aarch64-*-ios*)
targ_defvec=aarch64_mach_o_vec
targ_selvecs="arm_mach_o_vec mach_o_le_vec mach_o_be_vec mach_o_fat_vec"
targ_archs="$targ_archs bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
@@ -358,7 +358,7 @@ case "${targ}" in
targ_selvecs=arc_elf32_be_vec
;;
- arm-*-darwin*)
+ arm-*-darwin* | arm-*-ios*)
targ_defvec=arm_mach_o_vec
targ_selvecs="mach_o_le_vec mach_o_be_vec mach_o_fat_vec"
targ_archs="$targ_archs bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
@@ -678,7 +678,7 @@ case "${targ}" in
i[3-7]86-*-aix*)
targ_defvec=i386_coff_vec
;;
- i[3-7]86-*-darwin* | i[3-7]86-*-macos10* | i[3-7]86-*-rhapsody*)
+ i[3-7]86-*-darwin* | i[3-7]86-*-ios* | i[3-7]86-*-macos10* | i[3-7]86-*-rhapsody*)
targ_defvec=i386_mach_o_vec
targ_selvecs="mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
targ64_selvecs=x86_64_mach_o_vec
@@ -762,7 +762,7 @@ case "${targ}" in
targ_defvec=x86_64_elf64_cloudabi_vec
want64=true
;;
- x86_64-*-darwin*)
+ x86_64-*-darwin* | x86_64-*-ios*)
targ_defvec=x86_64_mach_o_vec
targ_selvecs="i386_mach_o_vec mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
targ_archs="$targ_archs bfd_powerpc_arch bfd_rs6000_arch"
@@ -1402,7 +1402,7 @@ case "${targ}" in
targ_selvecs="powerpc_elf32_le_vec powerpc_boot_vec"
targ64_selvecs="powerpc_elf64_vec powerpc_elf64_le_vec"
;;
- powerpc-*-darwin* | powerpc-*-macos10* | powerpc-*-rhapsody*)
+ powerpc-*-darwin* | powerpc-*-ios* | powerpc-*-macos10* | powerpc-*-rhapsody*)
targ_defvec=mach_o_be_vec
targ_selvecs="mach_o_be_vec mach_o_le_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
targ_archs="$targ_archs bfd_i386_arch"
diff --git a/configure.ac b/configure.ac
index aae94501e4..2cceb4dad4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -510,7 +510,7 @@ if test x$enable_libgomp = x ; then
;;
*-*-solaris2* | *-*-hpux11*)
;;
- *-*-darwin* | *-*-aix*)
+ *-*-darwin* | *-*-ios* | *-*-aix*)
;;
nvptx*-*-*)
;;
@@ -700,13 +700,13 @@ esac
# Disable libffi for some systems.
case "${target}" in
- powerpc-*-darwin*)
+ powerpc-*-darwin* | powerpc-*-ios*)
;;
- i[[3456789]]86-*-darwin*)
+ i[[3456789]]86-*-darwin* | i[[3456789]]86-*-ios*)
;;
- x86_64-*-darwin[[912]]*)
+ x86_64-*-darwin[[912]]* | x86_64-*-ios[[912]]*)
;;
- *-*-darwin*)
+ *-*-darwin* | *-*-ios*)
noconfigdirs="$noconfigdirs target-libffi"
;;
*-*-netware*)
@@ -788,7 +788,7 @@ esac
# Disable the go frontend on systems where it is known to not work. Please keep
# this in sync with contrib/config-list.mk.
case "${target}" in
-*-*-darwin* | *-*-cygwin* | *-*-mingw*)
+*-*-darwin* | *-*-ios* | *-*-cygwin* | *-*-mingw*)
unsupported_languages="$unsupported_languages go"
;;
esac
@@ -797,7 +797,7 @@ esac
# For testing, you can easily override this with --enable-libgo.
if test x$enable_libgo = x; then
case "${target}" in
- *-*-darwin*)
+ *-*-darwin* | *-*-ios*)
# PR 46986
noconfigdirs="$noconfigdirs target-libgo"
;;
@@ -916,27 +916,27 @@ esac
case "${target}" in
*-*-chorusos)
;;
- aarch64-*-darwin*)
+ aarch64-*-darwin* | aarch64-*-ios*)
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
- arm-*-darwin*)
+ arm-*-darwin* | arm-*-ios*)
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
- powerpc-*-darwin*)
+ powerpc-*-darwin* | powerpc-*-ios*)
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
- i[[3456789]]86-*-darwin*)
+ i[[3456789]]86-*-darwin* | i[[3456789]]86-*-ios*)
noconfigdirs="$noconfigdirs ld gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
- x86_64-*-darwin[[912]]*)
+ x86_64-*-darwin[[912]]* | x86_64-*-ios[[912]]*)
noconfigdirs="$noconfigdirs ld gas gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
- *-*-darwin*)
+ *-*-darwin* | *-*-ios*)
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
@@ -1226,7 +1226,7 @@ case "${host}" in
hppa*-*)
host_makefile_frag="config/mh-pa"
;;
- *-*-darwin*)
+ *-*-darwin* | *-*-ios*)
host_makefile_frag="config/mh-darwin"
;;
powerpc-*-aix*)
@@ -1697,7 +1697,7 @@ ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
build_lto_plugin=yes
],[if test x"$default_enable_lto" = x"yes" ; then
case $target in
- *-apple-darwin[[912]]* | *-cygwin* | *-mingw* | *djgpp*) ;;
+ *-apple-darwin[[912]]* | *-apple-ios[[912]]* | *-cygwin* | *-mingw* | *djgpp*) ;;
# On other non-ELF platforms, LTO has yet to be validated.
*) enable_lto=no ;;
esac
@@ -1708,7 +1708,7 @@ ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
# warn during gcc/ subconfigure; unless you're bootstrapping with
# -flto it won't be needed until after installation anyway.
case $target in
- *-cygwin* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
+ *-cygwin* | *-mingw* | *-apple-darwin* | *-apple-ios* | *djgpp*) ;;
*) if test x"$enable_lto" = x"yes"; then
AC_MSG_ERROR([LTO support is not enabled for this target.])
fi
@@ -2590,7 +2590,7 @@ rm -f conftest*
# Decide which environment variable is used to find dynamic libraries.
case "${host}" in
*-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
- *-*-darwin*) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
+ *-*-darwin* | *-*-ios* ) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
*-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
*) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
esac

View File

@@ -0,0 +1,19 @@
diff --git a/binutils/resrc.c b/binutils/resrc.c
index a875c3a4..0411d047 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -521,7 +521,13 @@ read_rc_file (const char *filename, const char *preprocessor,
cpp_pipe = 0;
- if (dash)
+ /* Nixpkgs specific : look first at the prefixed path
+ ( there should be no gcc in the binutils folder ) */
+ if (slash && dash) {
+ cpp_pipe = look_for_default(cmd, slash + 1, dash - slash, preprocargs, filename);
+ }
+
+ if (dash && ! cpp_pipe)
{
/* First, try looking for a prefixed gcc in the windres
directory, with the same prefix as windres */

View File

@@ -0,0 +1,14 @@
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index b6940d376d..0feb1adfd0 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -125,6 +125,9 @@ if test "x$NATIVE" = "xyes" ; then
USE_LIBPATH=yes
fi
+# TODO: why is this needed?
+USE_LIBPATH=yes
+
# Set the library search path, for libraries named by -lfoo.
# If LIB_PATH is defined (e.g., by Makefile) and non-empty, it is used.
# Otherwise, the default is set here.

View File

@@ -0,0 +1,435 @@
diff --git a/binutils/size.c b/binutils/size.c
index 3697087714..f99d45a6bf 100644
--- a/binutils/size.c
+++ b/binutils/size.c
@@ -51,7 +51,8 @@ enum output_format
{
FORMAT_BERKLEY,
FORMAT_SYSV,
- FORMAT_GNU
+ FORMAT_GNU,
+ FORMAT_AVR
};
static enum output_format selected_output_format =
#if BSD_DEFAULT
@@ -74,6 +75,246 @@ static bfd_size_type total_textsize;
/* Program exit status. */
static int return_code = 0;
+
+/* AVR Size specific stuff */
+
+#define AVR64 64UL
+#define AVR128 128UL
+#define AVR256 256UL
+#define AVR512 512UL
+#define AVR1K 1024UL
+#define AVR2K 2048UL
+#define AVR4K 4096UL
+#define AVR8K 8192UL
+#define AVR16K 16384UL
+#define AVR20K 20480UL
+#define AVR24K 24576UL
+#define AVR32K 32768UL
+#define AVR36K 36864UL
+#define AVR40K 40960UL
+#define AVR64K 65536UL
+#define AVR68K 69632UL
+#define AVR128K 131072UL
+#define AVR136K 139264UL
+#define AVR200K 204800UL
+#define AVR256K 262144UL
+#define AVR264K 270336UL
+
+typedef struct
+{
+ char *name;
+ long flash;
+ long ram;
+ long eeprom;
+} avr_device_t;
+
+avr_device_t avr[] =
+{
+ {"atxmega256a3", AVR264K, AVR16K, AVR4K},
+ {"atxmega256a3b", AVR264K, AVR16K, AVR4K},
+ {"atxmega256d3", AVR264K, AVR16K, AVR4K},
+
+ {"atmega2560", AVR256K, AVR8K, AVR4K},
+ {"atmega2561", AVR256K, AVR8K, AVR4K},
+
+ {"atxmega192a3", AVR200K, AVR16K, AVR2K},
+ {"atxmega192d3", AVR200K, AVR16K, AVR2K},
+
+ {"atxmega128a1", AVR136K, AVR8K, AVR2K},
+ {"atxmega128a1u", AVR136K, AVR8K, AVR2K},
+ {"atxmega128a3", AVR136K, AVR8K, AVR2K},
+ {"atxmega128d3", AVR136K, AVR8K, AVR2K},
+
+ {"at43usb320", AVR128K, 608UL, 0UL},
+ {"at90can128", AVR128K, AVR4K, AVR4K},
+ {"at90usb1286", AVR128K, AVR8K, AVR4K},
+ {"at90usb1287", AVR128K, AVR8K, AVR4K},
+ {"atmega128", AVR128K, AVR4K, AVR4K},
+ {"atmega1280", AVR128K, AVR8K, AVR4K},
+ {"atmega1281", AVR128K, AVR8K, AVR4K},
+ {"atmega1284p", AVR128K, AVR16K, AVR4K},
+ {"atmega128rfa1", AVR128K, AVR16K, AVR4K},
+ {"atmega103", AVR128K, 4000UL, AVR4K},
+
+ {"atxmega64a1", AVR68K, AVR4K, AVR2K},
+ {"atxmega64a1u", AVR68K, AVR4K, AVR2K},
+ {"atxmega64a3", AVR68K, AVR4K, AVR2K},
+ {"atxmega64d3", AVR68K, AVR4K, AVR2K},
+
+ {"at90can64", AVR64K, AVR4K, AVR2K},
+ {"at90scr100", AVR64K, AVR4K, AVR2K},
+ {"at90usb646", AVR64K, AVR4K, AVR2K},
+ {"at90usb647", AVR64K, AVR4K, AVR2K},
+ {"atmega64", AVR64K, AVR4K, AVR2K},
+ {"atmega640", AVR64K, AVR8K, AVR4K},
+ {"atmega644", AVR64K, AVR4K, AVR2K},
+ {"atmega644a", AVR64K, AVR4K, AVR2K},
+ {"atmega644p", AVR64K, AVR4K, AVR2K},
+ {"atmega644pa", AVR64K, AVR4K, AVR2K},
+ {"atmega645", AVR64K, AVR4K, AVR2K},
+ {"atmega645a", AVR64K, AVR4K, AVR2K},
+ {"atmega645p", AVR64K, AVR4K, AVR2K},
+ {"atmega6450", AVR64K, AVR4K, AVR2K},
+ {"atmega6450a", AVR64K, AVR4K, AVR2K},
+ {"atmega6450p", AVR64K, AVR4K, AVR2K},
+ {"atmega649", AVR64K, AVR4K, AVR2K},
+ {"atmega649a", AVR64K, AVR4K, AVR2K},
+ {"atmega649p", AVR64K, AVR4K, AVR2K},
+ {"atmega6490", AVR64K, AVR4K, AVR2K},
+ {"atmega6490a", AVR64K, AVR4K, AVR2K},
+ {"atmega6490p", AVR64K, AVR4K, AVR2K},
+ {"atmega64c1", AVR64K, AVR4K, AVR2K},
+ {"atmega64hve", AVR64K, AVR4K, AVR1K},
+ {"atmega64m1", AVR64K, AVR4K, AVR2K},
+ {"m3000", AVR64K, AVR4K, 0UL},
+
+ {"atmega406", AVR40K, AVR2K, AVR512},
+
+ {"atxmega32a4", AVR36K, AVR4K, AVR1K},
+ {"atxmega32d4", AVR36K, AVR4K, AVR1K},
+
+ {"at90can32", AVR32K, AVR2K, AVR1K},
+ {"at94k", AVR32K, AVR4K, 0UL},
+ {"atmega32", AVR32K, AVR2K, AVR1K},
+ {"atmega323", AVR32K, AVR2K, AVR1K},
+ {"atmega324a", AVR32K, AVR2K, AVR1K},
+ {"atmega324p", AVR32K, AVR2K, AVR1K},
+ {"atmega324pa", AVR32K, AVR2K, AVR1K},
+ {"atmega325", AVR32K, AVR2K, AVR1K},
+ {"atmega325a", AVR32K, AVR2K, AVR1K},
+ {"atmega325p", AVR32K, AVR2K, AVR1K},
+ {"atmega3250", AVR32K, AVR2K, AVR1K},
+ {"atmega3250a", AVR32K, AVR2K, AVR1K},
+ {"atmega3250p", AVR32K, AVR2K, AVR1K},
+ {"atmega328", AVR32K, AVR2K, AVR1K},
+ {"atmega328p", AVR32K, AVR2K, AVR1K},
+ {"atmega329", AVR32K, AVR2K, AVR1K},
+ {"atmega329a", AVR32K, AVR2K, AVR1K},
+ {"atmega329p", AVR32K, AVR2K, AVR1K},
+ {"atmega329pa", AVR32K, AVR2K, AVR1K},
+ {"atmega3290", AVR32K, AVR2K, AVR1K},
+ {"atmega3290a", AVR32K, AVR2K, AVR1K},
+ {"atmega3290p", AVR32K, AVR2K, AVR1K},
+ {"atmega32hvb", AVR32K, AVR2K, AVR1K},
+ {"atmega32c1", AVR32K, AVR2K, AVR1K},
+ {"atmega32hvb", AVR32K, AVR2K, AVR1K},
+ {"atmega32m1", AVR32K, AVR2K, AVR1K},
+ {"atmega32u2", AVR32K, AVR1K, AVR1K},
+ {"atmega32u4", AVR32K, 2560UL, AVR1K},
+ {"atmega32u6", AVR32K, 2560UL, AVR1K},
+
+ {"at43usb355", AVR24K, 1120UL, 0UL},
+
+ {"atxmega16a4", AVR20K, AVR2K, AVR1K},
+ {"atxmega16d4", AVR20K, AVR2K, AVR1K},
+
+ {"at76c711", AVR16K, AVR2K, 0UL},
+ {"at90pwm216", AVR16K, AVR1K, AVR512},
+ {"at90pwm316", AVR16K, AVR1K, AVR512},
+ {"at90usb162", AVR16K, AVR512, AVR512},
+ {"atmega16", AVR16K, AVR1K, AVR512},
+ {"atmega16a", AVR16K, AVR1K, AVR512},
+ {"atmega161", AVR16K, AVR1K, AVR512},
+ {"atmega162", AVR16K, AVR1K, AVR512},
+ {"atmega163", AVR16K, AVR1K, AVR512},
+ {"atmega164", AVR16K, AVR1K, AVR512},
+ {"atmega164a", AVR16K, AVR1K, AVR512},
+ {"atmega164p", AVR16K, AVR1K, AVR512},
+ {"atmega165a", AVR16K, AVR1K, AVR512},
+ {"atmega165", AVR16K, AVR1K, AVR512},
+ {"atmega165p", AVR16K, AVR1K, AVR512},
+ {"atmega168", AVR16K, AVR1K, AVR512},
+ {"atmega168a", AVR16K, AVR1K, AVR512},
+ {"atmega168p", AVR16K, AVR1K, AVR512},
+ {"atmega169", AVR16K, AVR1K, AVR512},
+ {"atmega169a", AVR16K, AVR1K, AVR512},
+ {"atmega169p", AVR16K, AVR1K, AVR512},
+ {"atmega169pa", AVR16K, AVR1K, AVR512},
+ {"atmega16hva", AVR16K, 768UL, AVR256},
+ {"atmega16hva2", AVR16K, AVR1K, AVR256},
+ {"atmega16hvb", AVR16K, AVR1K, AVR512},
+ {"atmega16m1", AVR16K, AVR1K, AVR512},
+ {"atmega16u2", AVR16K, AVR512, AVR512},
+ {"atmega16u4", AVR16K, 1280UL, AVR512},
+ {"attiny167", AVR16K, AVR512, AVR512},
+
+ {"at90c8534", AVR8K, 352UL, AVR512},
+ {"at90pwm1", AVR8K, AVR512, AVR512},
+ {"at90pwm2", AVR8K, AVR512, AVR512},
+ {"at90pwm2b", AVR8K, AVR512, AVR512},
+ {"at90pwm3", AVR8K, AVR512, AVR512},
+ {"at90pwm3b", AVR8K, AVR512, AVR512},
+ {"at90pwm81", AVR8K, AVR256, AVR512},
+ {"at90s8515", AVR8K, AVR512, AVR512},
+ {"at90s8535", AVR8K, AVR512, AVR512},
+ {"at90usb82", AVR8K, AVR512, AVR512},
+ {"ata6289", AVR8K, AVR512, 320UL},
+ {"atmega8", AVR8K, AVR1K, AVR512},
+ {"atmega8515", AVR8K, AVR512, AVR512},
+ {"atmega8535", AVR8K, AVR512, AVR512},
+ {"atmega88", AVR8K, AVR1K, AVR512},
+ {"atmega88a", AVR8K, AVR1K, AVR512},
+ {"atmega88p", AVR8K, AVR1K, AVR512},
+ {"atmega88pa", AVR8K, AVR1K, AVR512},
+ {"atmega8hva", AVR8K, 768UL, AVR256},
+ {"atmega8u2", AVR8K, AVR512, AVR512},
+ {"attiny84", AVR8K, AVR512, AVR512},
+ {"attiny84a", AVR8K, AVR512, AVR512},
+ {"attiny85", AVR8K, AVR512, AVR512},
+ {"attiny861", AVR8K, AVR512, AVR512},
+ {"attiny861a", AVR8K, AVR512, AVR512},
+ {"attiny87", AVR8K, AVR512, AVR512},
+ {"attiny88", AVR8K, AVR512, AVR64},
+
+ {"at90s4414", AVR4K, 352UL, AVR256},
+ {"at90s4433", AVR4K, AVR128, AVR256},
+ {"at90s4434", AVR4K, 352UL, AVR256},
+ {"atmega48", AVR4K, AVR512, AVR256},
+ {"atmega48a", AVR4K, AVR512, AVR256},
+ {"atmega48p", AVR4K, AVR512, AVR256},
+ {"attiny4313", AVR4K, AVR256, AVR256},
+ {"attiny43u", AVR4K, AVR256, AVR64},
+ {"attiny44", AVR4K, AVR256, AVR256},
+ {"attiny44a", AVR4K, AVR256, AVR256},
+ {"attiny45", AVR4K, AVR256, AVR256},
+ {"attiny461", AVR4K, AVR256, AVR256},
+ {"attiny461a", AVR4K, AVR256, AVR256},
+ {"attiny48", AVR4K, AVR256, AVR64},
+
+ {"at86rf401", AVR2K, 224UL, AVR128},
+ {"at90s2313", AVR2K, AVR128, AVR128},
+ {"at90s2323", AVR2K, AVR128, AVR128},
+ {"at90s2333", AVR2K, 224UL, AVR128},
+ {"at90s2343", AVR2K, AVR128, AVR128},
+ {"attiny20", AVR2K, AVR128, 0UL},
+ {"attiny22", AVR2K, 224UL, AVR128},
+ {"attiny2313", AVR2K, AVR128, AVR128},
+ {"attiny2313a", AVR2K, AVR128, AVR128},
+ {"attiny24", AVR2K, AVR128, AVR128},
+ {"attiny24a", AVR2K, AVR128, AVR128},
+ {"attiny25", AVR2K, AVR128, AVR128},
+ {"attiny26", AVR2K, AVR128, AVR128},
+ {"attiny261", AVR2K, AVR128, AVR128},
+ {"attiny261a", AVR2K, AVR128, AVR128},
+ {"attiny28", AVR2K, 0UL, 0UL},
+ {"attiny40", AVR2K, AVR256, 0UL},
+
+ {"at90s1200", AVR1K, 0UL, AVR64},
+ {"attiny9", AVR1K, 32UL, 0UL},
+ {"attiny10", AVR1K, 32UL, 0UL},
+ {"attiny11", AVR1K, 0UL, AVR64},
+ {"attiny12", AVR1K, 0UL, AVR64},
+ {"attiny13", AVR1K, AVR64, AVR64},
+ {"attiny13a", AVR1K, AVR64, AVR64},
+ {"attiny15", AVR1K, 0UL, AVR64},
+
+ {"attiny4", AVR512, 32UL, 0UL},
+ {"attiny5", AVR512, 32UL, 0UL},
+};
+
+static char *avrmcu = NULL;
+
+
static char *target = NULL;
/* Forward declarations. */
@@ -89,7 +330,8 @@ usage (FILE *stream, int status)
fprintf (stream, _(" Displays the sizes of sections inside binary files\n"));
fprintf (stream, _(" If no input file(s) are specified, a.out is assumed\n"));
fprintf (stream, _(" The options are:\n\
- -A|-B|-G --format={sysv|berkeley|gnu} Select output style (default is %s)\n\
+ -A|-B|-G|-C --format={sysv|berkeley|gnu|avr} Select output style (default is %s)\n\
+ --mcu=<avrmcu> MCU name for AVR format only\n\
-o|-d|-x --radix={8|10|16} Display numbers in octal, decimal or hex\n\
-t --totals Display the total sizes (Berkeley only)\n\
--common Display total size for *COM* syms\n\
@@ -113,6 +355,7 @@ usage (FILE *stream, int status)
#define OPTION_FORMAT (200)
#define OPTION_RADIX (OPTION_FORMAT + 1)
#define OPTION_TARGET (OPTION_RADIX + 1)
+#define OPTION_MCU (OPTION_TARGET + 1)
static struct option long_options[] =
{
@@ -120,6 +363,7 @@ static struct option long_options[] =
{"format", required_argument, 0, OPTION_FORMAT},
{"radix", required_argument, 0, OPTION_RADIX},
{"target", required_argument, 0, OPTION_TARGET},
+ {"mcu", required_argument, 0, 203},
{"totals", no_argument, &show_totals, 1},
{"version", no_argument, &show_version, 1},
{"help", no_argument, &show_help, 1},
@@ -153,7 +397,7 @@ main (int argc, char **argv)
fatal (_("fatal error: libbfd ABI mismatch"));
set_default_bfd_target ();
- while ((c = getopt_long (argc, argv, "ABGHhVvdfotx", long_options,
+ while ((c = getopt_long (argc, argv, "ABCGHhVvdfotx", long_options,
(int *) 0)) != EOF)
switch (c)
{
@@ -172,12 +416,20 @@ main (int argc, char **argv)
case 'g':
selected_output_format = FORMAT_GNU;
break;
+ case 'A':
+ case 'a':
+ selected_output_format = FORMAT_AVR;
+ break;
default:
non_fatal (_("invalid argument to --format: %s"), optarg);
usage (stderr, 1);
}
break;
+ case OPTION_MCU:
+ avrmcu = optarg;
+ break;
+
case OPTION_TARGET:
target = optarg;
break;
@@ -214,6 +466,9 @@ main (int argc, char **argv)
case 'G':
selected_output_format = FORMAT_GNU;
break;
+ case 'C':
+ selected_output_format = FORMAT_AVR;
+ break;
case 'v':
case 'V':
show_version = 1;
@@ -656,6 +911,98 @@ print_sysv_format (bfd *file)
printf ("\n\n");
}
+static avr_device_t *
+avr_find_device (void)
+{
+ unsigned int i;
+ if (avrmcu != NULL)
+ {
+ for (i = 0; i < sizeof(avr) / sizeof(avr[0]); i++)
+ {
+ if (strcmp(avr[i].name, avrmcu) == 0)
+ {
+ /* Match found */
+ return (&avr[i]);
+ }
+ }
+ }
+ return (NULL);
+}
+
+static void
+print_avr_format (bfd *file)
+{
+ char *avr_name = "Unknown";
+ int flashmax = 0;
+ int rammax = 0;
+ int eeprommax = 0;
+ asection *section;
+ bfd_size_type my_datasize = 0;
+ bfd_size_type my_textsize = 0;
+ bfd_size_type my_bsssize = 0;
+ bfd_size_type bootloadersize = 0;
+ bfd_size_type noinitsize = 0;
+ bfd_size_type eepromsize = 0;
+
+ avr_device_t *avrdevice = avr_find_device();
+ if (avrdevice != NULL)
+ {
+ avr_name = avrdevice->name;
+ flashmax = avrdevice->flash;
+ rammax = avrdevice->ram;
+ eeprommax = avrdevice->eeprom;
+ }
+
+ if ((section = bfd_get_section_by_name (file, ".data")) != NULL)
+ my_datasize = bfd_section_size (section);
+ if ((section = bfd_get_section_by_name (file, ".text")) != NULL)
+ my_textsize = bfd_section_size (section);
+ if ((section = bfd_get_section_by_name (file, ".bss")) != NULL)
+ my_bsssize = bfd_section_size (section);
+ if ((section = bfd_get_section_by_name (file, ".bootloader")) != NULL)
+ bootloadersize = bfd_section_size (section);
+ if ((section = bfd_get_section_by_name (file, ".noinit")) != NULL)
+ noinitsize = bfd_section_size (section);
+ if ((section = bfd_get_section_by_name (file, ".eeprom")) != NULL)
+ eepromsize = bfd_section_size (section);
+
+ bfd_size_type text = my_textsize + my_datasize + bootloadersize;
+ bfd_size_type data = my_datasize + my_bsssize + noinitsize;
+ bfd_size_type eeprom = eepromsize;
+
+ printf ("AVR Memory Usage\n"
+ "----------------\n"
+ "Device: %s\n\n", avr_name);
+
+ /* Text size */
+ printf ("Program:%8ld bytes", text);
+ if (flashmax > 0)
+ {
+ printf (" (%2.1f%% Full)", ((float)text / flashmax) * 100);
+ }
+ printf ("\n(.text + .data + .bootloader)\n\n");
+
+ /* Data size */
+ printf ("Data: %8ld bytes", data);
+ if (rammax > 0)
+ {
+ printf (" (%2.1f%% Full)", ((float)data / rammax) * 100);
+ }
+ printf ("\n(.data + .bss + .noinit)\n\n");
+
+ /* EEPROM size */
+ if (eeprom > 0)
+ {
+ printf ("EEPROM: %8ld bytes", eeprom);
+ if (eeprommax > 0)
+ {
+ printf (" (%2.1f%% Full)", ((float)eeprom / eeprommax) * 100);
+ }
+ printf ("\n(.eeprom)\n\n");
+ }
+}
+
+
static void
print_sizes (bfd *file)
{
@@ -663,6 +1010,8 @@ print_sizes (bfd *file)
calculate_common_size (file);
if (selected_output_format == FORMAT_SYSV)
print_sysv_format (file);
+ else if (selected_output_format == FORMAT_AVR)
+ print_avr_format (file);
else
print_berkeley_or_gnu_format (file);
}

View File

@@ -0,0 +1,376 @@
let
withGold = platform: platform.isElf && !platform.isRiscV && !platform.isLoongArch64;
in
{
stdenv,
autoconf269,
automake,
libtool,
bison,
buildPackages,
fetchurl,
gettext,
lib,
noSysDirs,
perl,
runCommand,
zlib,
enableGold ? withGold stdenv.targetPlatform,
enableGoldDefault ? false,
enableShared ? !stdenv.hostPlatform.isStatic,
# WARN: Enabling all targets increases output size to a multiple.
withAllTargets ? false,
}:
# WARN: configure silently disables ld.gold if it's unsupported, so we need to
# make sure that intent matches result ourselves.
assert enableGold -> withGold stdenv.targetPlatform;
assert enableGoldDefault -> enableGold;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
version = "2.44";
#INFO: The targetPrefix prepended to binary names to allow multiple binuntils
# on the PATH to both be usable.
targetPrefix = lib.optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
# gas is disabled for some targets via noconfigdirs in configure.
targetHasGas = !stdenv.targetPlatform.isDarwin;
# gas isn't multi-target, even with --enable-targets=all, so we do
# separate builds of just gas for each target.
#
# There's no way to do this exhaustively, so feel free to add
# additional targets here as required.
allGasTargets =
allGasTargets'
++ lib.optional (
targetHasGas && !lib.elem targetPlatform.config allGasTargets'
) targetPlatform.config;
allGasTargets' = [
"aarch64-unknown-linux-gnu"
"alpha-unknown-linux-gnu"
"arm-unknown-linux-gnu"
"avr-unknown-linux-gnu"
"cris-unknown-linux-gnu"
"hppa-unknown-linux-gnu"
"i686-unknown-linux-gnu"
"ia64-unknown-linux-gnu"
"m68k-unknown-linux-gnu"
"mips-unknown-linux-gnu"
"mips64-unknown-linux-gnu"
"msp430-unknown-linux-gnu"
"powerpc-unknown-linux-gnu"
"powerpc64-unknown-linux-gnu"
"s390-unknown-linux-gnu"
"sparc-unknown-linux-gnu"
"vax-unknown-linux-gnu"
"x86_64-unknown-linux-gnu"
"xscale-unknown-linux-gnu"
];
in
stdenv.mkDerivation (finalAttrs: {
pname = targetPrefix + "binutils";
inherit version;
src = fetchurl {
url = "mirror://gnu/binutils/binutils-with-gold-${version}.tar.bz2";
hash = "sha256-NHM+pJXMDlDnDbTliQ3sKKxB8OFMShZeac8n+5moxMg=";
};
# WARN: this package is used for bootstrapping fetchurl, and thus cannot use
# fetchpatch! All mutable patches (generated by GitHub or cgit) that are
# needed here should be included directly in Nixpkgs as files.
patches = [
# Make binutils output deterministic by default.
./deterministic.patch
# Breaks nm BSD flag detection, heeds an upstream fix:
# https://sourceware.org/PR29547
./0001-Revert-libtool.m4-fix-the-NM-nm-over-here-B-option-w.patch
./0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch
# For some reason bfd ld doesn't search DT_RPATH when cross-compiling. It's
# not clear why this behavior was decided upon but it has the unfortunate
# consequence that the linker will fail to find transitive dependencies of
# shared objects when cross-compiling. Consequently, we are forced to
# override this behavior, forcing ld to search DT_RPATH even when
# cross-compiling.
./always-search-rpath.patch
# Avoid `lib -> out -> lib` reference. Normally `bfd-plugins` does
# not need to know binutils' BINDIR at all. It's an absolute path
# where libraries are stored.
./plugins-no-BINDIR.patch
# ld64 needs `-undefined dynamic_lookup` to link `libctf-nobfd.dylib`, but the Darwin
# version detection in `libtool.m4` fails to detect the Darwin version correctly.
./0001-libtool.m4-update-macos-version-detection-block.patch
# Adds AVR-specific options to "size" for compatibility with Atmel's downstream distribution
# Patch from arch-community
# https://github.com/archlinux/svntogit-community/blob/c8d53dd1734df7ab15931f7fad0c9acb8386904c/trunk/avr-size.patch
./avr-size.patch
./windres-locate-gcc.patch
];
outputs = [
"out"
"info"
"man"
"dev"
]
# Ideally we would like to always install 'lib' into a separate
# target. Unfortunately cross-compiled binutils installs libraries
# across both `$lib/lib/` and `$out/$target/lib` with a reference
# from $out to $lib. Probably a binutils bug: all libraries should go
# to $lib as binutils does not build target libraries. Let's make our
# life slightly simpler by installing everything into $out for
# cross-binutils.
++ lib.optionals (targetPlatform == hostPlatform) [ "lib" ];
strictDeps = true;
depsBuildBuild = [ buildPackages.stdenv.cc ];
# texinfo was removed here in https://github.com/NixOS/nixpkgs/pull/210132
# to reduce rebuilds during stdenv bootstrap. Please don't add it back without
# checking the impact there first.
nativeBuildInputs = [
bison
perl
]
++ lib.optionals buildPlatform.isDarwin [
autoconf269
automake
gettext
libtool
];
buildInputs = [
zlib
gettext
];
inherit noSysDirs;
preConfigure =
(lib.optionalString buildPlatform.isDarwin ''
for i in */configure.ac; do
pushd "$(dirname "$i")"
echo "Running autoreconf in $PWD"
# autoreconf doesn't work, don't know why
# autoreconf ''${autoreconfFlags:---install --force --verbose}
autoconf
popd
done
'')
+ ''
# Clear the default library search path.
if test "$noSysDirs" = "1"; then
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
fi
# Use symlinks instead of hard links to save space ("strip" in the
# fixup phase strips each hard link separately).
for i in binutils/Makefile.in gas/Makefile.in ld/Makefile.in gold/Makefile.in; do
sed -i "$i" -e 's|ln |ln -s |'
done
configureScript="$PWD/configure"
mkdir $NIX_BUILD_TOP/build
cd $NIX_BUILD_TOP/build
'';
# As binutils takes part in the stdenv building, we don't want references
# to the bootstrap-tools libgcc (as uses to happen on arm/mips)
#
# for FreeBSD it's more complicated. With -static-libgcc, configure
# thinks that limits.h does not exist and the build fails for not finding
# LONG_MIN. The configure test itself succeeds but the compiler issues a
# warning about -static-libgcc being unused.
env.NIX_CFLAGS_COMPILE =
if (hostPlatform.isDarwin || hostPlatform.isFreeBSD) then
"-Wno-string-plus-int -Wno-deprecated-declarations"
else
"-static-libgcc";
hardeningDisable = [
"format"
"pie"
];
configurePlatforms = [
"build"
"host"
"target"
];
configureFlags = [
"--enable-64-bit-bfd"
"--with-system-zlib"
"--enable-deterministic-archives"
"--disable-werror"
"--enable-fix-loongson2f-nop"
# Turn on --enable-new-dtags by default to make the linker set
# RUNPATH instead of RPATH on binaries. This is important because
# RUNPATH can be overridden using LD_LIBRARY_PATH at runtime.
"--enable-new-dtags"
# force target prefix. Some versions of binutils will make it empty if
# `--host` and `--target` are too close, even if Nixpkgs thinks the
# platforms are different (e.g. because not all the info makes the
# `config`). Other versions of binutils will always prefix if `--target` is
# passed, even if `--host` and `--target` are the same. The easiest thing
# for us to do is not leave it to chance, and force the program prefix to be
# what we want it to be.
"--program-prefix=${targetPrefix}"
# Unconditionally disable:
# - musl target needs porting: https://sourceware.org/PR29477
"--disable-gprofng"
# By default binutils searches $libdir for libraries. This brings in
# libbfd and libopcodes into a default visibility. Drop default lib
# path to force users to declare their use of these libraries.
"--with-lib-path=:"
]
++ lib.optionals withAllTargets [
"--enable-targets=all"
# gas will be built separately for each target.
"--disable-gas"
]
++ lib.optionals enableGold [
"--enable-gold${lib.optionalString enableGoldDefault "=default"}"
"--enable-plugins"
]
++ (
if enableShared then
[
"--enable-shared"
"--disable-static"
]
else
[
"--disable-shared"
"--enable-static"
]
)
++ (lib.optionals (stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17")
[
# lld17+ passes `--no-undefined-version` by default and makes this a hard
# error; libctf.ver version script references symbols that aren't present.
#
# This is fixed upstream and can be removed with the future release of 2.43.
# For now we allow this with `--undefined-version`:
"LDFLAGS=-Wl,--undefined-version"
]
);
postConfigure = lib.optionalString withAllTargets ''
for target in ${lib.escapeShellArgs allGasTargets}; do
mkdir "$NIX_BUILD_TOP/build-$target"
env -C "$NIX_BUILD_TOP/build-$target" \
"$configureScript" $configureFlags "''${configureFlagsArray[@]}" \
--enable-gas --program-prefix "$target-" --target "$target"
done
'';
makeFlags = [
# As we regenerated configure build system tries hard to use
# texinfo to regenerate manuals. Let's avoid the dependency
# on texinfo in bootstrap path and keep manuals unmodified.
"MAKEINFO=true"
];
postBuild = lib.optionalString withAllTargets ''
for target in ${lib.escapeShellArgs allGasTargets}; do
make -C "$NIX_BUILD_TOP/build-$target" -j"$NIX_BUILD_CORES" \
$makeFlags "''${makeFlagsArray[@]}" $buildFlags "''${buildFlagsArray[@]}" \
TARGET-gas=as-new all-gas
done
'';
# Fails
doCheck = false;
# Break dependency on pkgsBuildBuild.gcc when building a cross-binutils
stripDebugList =
if stdenv.hostPlatform != stdenv.targetPlatform then
"bin lib ${stdenv.hostPlatform.config}"
else
null;
# INFO: Otherwise it fails with:
# `./sanity.sh: line 36: $out/bin/size: not found`
doInstallCheck = (buildPlatform == hostPlatform) && (hostPlatform == targetPlatform);
enableParallelBuilding = true;
# For the same reason we don't split "lib" output we undo the $target/
# prefix for installed headers and libraries we link:
# $out/$host/$target/lib/* to $out/lib/
# $out/$host/$target/include/* to $dev/include/*
# TODO(trofi): fix installation paths upstream so we could remove this
# code and have "lib" output unconditionally.
postInstall =
lib.optionalString (hostPlatform.config != targetPlatform.config) ''
ln -s $out/${hostPlatform.config}/${targetPlatform.config}/lib/* $out/lib/
ln -s $out/${hostPlatform.config}/${targetPlatform.config}/include/* $dev/include/
''
+ lib.optionalString withAllTargets ''
for target in ${lib.escapeShellArgs allGasTargets}; do
make -C "$NIX_BUILD_TOP/build-$target/gas" -j"$NIX_BUILD_CORES" \
$makeFlags "''${makeFlagsArray[@]}" $installFlags "''${installFlagsArray[@]}" \
install-exec-bindir
done
''
+ lib.optionalString (withAllTargets && targetHasGas) ''
ln -s $out/bin/${stdenv.targetPlatform.config}-as $out/bin/as
'';
passthru = {
inherit targetPrefix;
hasGold = enableGold;
isGNU = true;
# The plugin API is not a function of any targets. Expose it separately,
# currently only used by LLVM for enabling BFD to do LTO with LLVM bitcode.
# (Tar will exit with an error if there are no matches).
plugin-api-header = runCommand "libbfd-plugin-api-header" { } ''
mkdir -p $out
tar --directory=$out \
--extract \
--file=${finalAttrs.src} \
--strip-components=1 \
--wildcards '*'/include/plugin-api.h
'';
};
meta = with lib; {
description = "Tools for manipulating binaries (linker, assembler, etc.)";
longDescription = ''
The GNU Binutils are a collection of binary tools. The main
ones are `ld' (the GNU linker) and `as' (the GNU assembler).
They also include the BFD (Binary File Descriptor) library,
`gprof', `nm', `strip', etc.
'';
homepage = "https://www.gnu.org/software/binutils/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [
ericson2314
lovesegfault
];
platforms = platforms.unix;
# INFO: Give binutils a lower priority than gcc-wrapper to prevent a
# collision due to the ld/as wrappers/symlinks in the latter.
priority = 10;
};
})

View File

@@ -0,0 +1,12 @@
diff -ur orig/binutils-2.23.1/ld/ldlang.c binutils-2.23.1/ld/ldlang.c
--- orig/ld/ldlang.c
+++ new/ld/ldlang.c
@@ -3095,6 +3095,8 @@
ldfile_output_machine))
einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
+ link_info.output_bfd->flags |= BFD_DETERMINISTIC_OUTPUT;
+
link_info.hash = bfd_link_hash_table_create (link_info.output_bfd);
if (link_info.hash == NULL)
einfo (_("%P%F: can not create hash table: %E\n"));

View File

@@ -0,0 +1,36 @@
{
lib,
stdenv,
binutils-unwrapped-all-targets,
}:
stdenv.mkDerivation {
pname = "libbfd";
inherit (binutils-unwrapped-all-targets) version;
dontUnpack = true;
dontBuild = true;
dontInstall = true;
propagatedBuildInputs = [
binutils-unwrapped-all-targets.dev
binutils-unwrapped-all-targets.lib
];
passthru = {
inherit (binutils-unwrapped-all-targets) src dev plugin-api-header;
};
meta = with lib; {
description = "Library for manipulating containers of machine code";
longDescription = ''
BFD is a library which provides a single interface to read and write
object files, executables, archive files, and core files in any format.
It is associated with GNU Binutils, and elsewhere often distributed with
it.
'';
homepage = "https://www.gnu.org/software/binutils/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ ericson2314 ];
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,30 @@
{
lib,
stdenv,
binutils-unwrapped-all-targets,
}:
stdenv.mkDerivation {
pname = "libopcodes";
inherit (binutils-unwrapped-all-targets) version;
dontUnpack = true;
dontBuild = true;
dontInstall = true;
propagatedBuildInputs = [
binutils-unwrapped-all-targets.dev
binutils-unwrapped-all-targets.lib
];
passthru = {
inherit (binutils-unwrapped-all-targets) dev;
};
meta = with lib; {
description = "Library from binutils for manipulating machine code";
homepage = "https://www.gnu.org/software/binutils/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ ericson2314 ];
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,25 @@
Avoid `lib -> out -> lib` reference. Normally `bfd-plugins` does not
need to know binutils' BINDIR at all. It's an absolute path where
libraries are stored.
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -493,7 +493,7 @@ build_plugin_list (bfd *abfd)
when configuring binutils using --libdir. Search in the proper
path first, then the old one for backwards compatibility. */
static const char *path[]
- = { LIBDIR "/bfd-plugins", BINDIR "/../lib/bfd-plugins" };
+ = { LIBDIR "/bfd-plugins", };
struct stat last_st;
unsigned int i;
@@ -508,9 +508,7 @@ build_plugin_list (bfd *abfd)
last_st.st_ino = 0;
for (i = 0; i < sizeof (path) / sizeof (path[0]); i++)
{
- char *plugin_dir = make_relative_prefix (plugin_program_name,
- BINDIR,
- path[i]);
+ char *plugin_dir = xstrdup (path[i]);
if (plugin_dir)
{
struct stat st;

View File

@@ -0,0 +1,19 @@
diff --git a/binutils/resrc.c b/binutils/resrc.c
index a875c3a4..0411d047 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -521,7 +521,13 @@ read_rc_file (const char *filename, const char *preprocessor,
cpp_pipe = 0;
- if (dash)
+ /* Nixpkgs specific : look first at the prefixed path
+ ( there should be no gcc in the binutils folder ) */
+ if (slash && dash) {
+ cpp_pipe = look_for_default(cmd, slash + 1, dash - slash, preprocargs, filename);
+ }
+
+ if (dash && ! cpp_pipe)
{
/* First, try looking for a prefixed gcc in the windres
directory, with the same prefix as windres */

View File

@@ -0,0 +1,50 @@
{
stdenv,
lib,
fetchFromGitHub,
runCommand,
rubies ? null,
}:
let
rubiesEnv = runCommand "chruby-env" { preferLocalBuild = true; } ''
mkdir $out
${lib.concatStrings (lib.mapAttrsToList (name: path: "ln -s ${path} $out/${name}\n") rubies)}
'';
in
stdenv.mkDerivation rec {
pname = "chruby";
version = "0.3.9";
src = fetchFromGitHub {
owner = "postmodern";
repo = "chruby";
rev = "v${version}";
sha256 = "1894g6fymr8kra9vwhbmnrcr58l022mcd7g9ans4zd3izla2j3gx";
};
patches = lib.optionalString (rubies != null) [
./env.patch
];
postPatch = lib.optionalString (rubies != null) ''
substituteInPlace share/chruby/chruby.sh --replace "@rubiesEnv@" ${rubiesEnv}
'';
installPhase = ''
mkdir $out
cp -r bin $out
cp -r share $out
'';
meta = with lib; {
description = "Changes the current Ruby";
homepage = "https://github.com/postmodern/chruby";
license = licenses.mit;
maintainers = [ ];
mainProgram = "chruby-exec";
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,12 @@
diff --git a/share/chruby/chruby.sh b/share/chruby/chruby.sh
--- a/share/chruby/chruby.sh
+++ b/share/chruby/chruby.sh
@@ -1,7 +1,7 @@
CHRUBY_VERSION="0.3.8"
RUBIES=()
-for dir in "$PREFIX/opt/rubies" "$HOME/.rubies"; do
+for dir in @rubiesEnv@; do
[[ -d "$dir" && -n "$(ls -A "$dir")" ]] && RUBIES+=("$dir"/*)
done
unset dir

View File

@@ -0,0 +1,64 @@
{
stdenv,
lib,
fetchFromGitHub,
ocamlPackages,
pkg-config,
autoreconfHook,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "coccinelle";
version = "1.3.0";
src = fetchFromGitHub {
repo = "coccinelle";
rev = finalAttrs.version;
owner = "coccinelle";
hash = "sha256-be95cuFP6bAdpCT0Z9zBAx9cc3gYuuXAmHYaI/bmyTE=";
};
nativeBuildInputs = with ocamlPackages; [
autoreconfHook
pkg-config
ocaml
findlib
menhir
];
buildInputs = with ocamlPackages; [
ocaml_pcre
parmap
pyml
stdcompat
];
strictDeps = true;
postPatch = ''
# Ensure dependencies from Nixpkgs are picked up.
rm -rf bundles/
'';
meta = {
description = "Program to apply semantic patches to C code";
longDescription = ''
Coccinelle is a program matching and transformation engine which
provides the language SmPL (Semantic Patch Language) for
specifying desired matches and transformations in C code.
Coccinelle was initially targeted towards performing collateral
evolutions in Linux. Such evolutions comprise the changes that
are needed in client code in response to evolutions in library
APIs, and may include modifications such as renaming a function,
adding a function argument whose value is somehow
context-dependent, and reorganizing a data structure. Beyond
collateral evolutions, Coccinelle is successfully used (by us
and others) for finding and fixing bugs in systems code.
'';
homepage = "https://coccinelle.gitlabpages.inria.fr/website/";
license = lib.licenses.gpl2Only;
platforms = lib.platforms.unix;
maintainers = [ lib.maintainers.thoughtpolice ];
};
})

View File

@@ -0,0 +1,106 @@
{
stdenv,
lib,
callPackage,
}:
let
common =
arch:
callPackage (
{
bison,
callPackage,
curl,
fetchgit,
flex,
getopt,
git,
gnat14,
gcc14,
lib,
perl,
stdenvNoCC,
zlib,
withAda ? true,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "coreboot-toolchain-${arch}";
version = "25.03";
src = fetchgit {
url = "https://review.coreboot.org/coreboot";
rev = finalAttrs.version;
hash = "sha256-zyfBQKVton+2vjYd6fqrUqkHY9bci411pujRGabvTjQ=";
fetchSubmodules = false;
leaveDotGit = true;
postFetch = ''
PATH=${lib.makeBinPath [ getopt ]}:$PATH ${stdenv.shell} $out/util/crossgcc/buildgcc -W > $out/.crossgcc_version
rm -rf $out/.git
'';
allowedRequisites = [ ];
};
nativeBuildInputs = [
bison
curl
git
perl
];
buildInputs = [
flex
zlib
(if withAda then gnat14 else gcc14)
];
enableParallelBuilding = true;
dontConfigure = true;
dontInstall = true;
postPatch = ''
patchShebangs util/crossgcc/buildgcc
mkdir -p util/crossgcc/tarballs
${lib.concatMapStringsSep "\n" (file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}") (
callPackage ./stable.nix { }
)}
patchShebangs util/genbuild_h/genbuild_h.sh
'';
buildPhase = ''
export CROSSGCC_VERSION=$(cat .crossgcc_version)
make crossgcc-${arch} CPUS=$NIX_BUILD_CORES DEST=$out
'';
meta = with lib; {
homepage = "https://www.coreboot.org";
description = "Coreboot toolchain for ${arch} targets";
license = with licenses; [
bsd2
bsd3
gpl2
lgpl2Plus
gpl3Plus
];
maintainers = with maintainers; [
felixsinger
jmbaur
];
platforms = platforms.linux;
};
})
);
in
lib.listToAttrs (
map (arch: lib.nameValuePair arch (common arch { })) [
"i386"
"x64"
"arm"
"aarch64"
"riscv"
"ppc64"
]
)

View File

@@ -0,0 +1,52 @@
{ fetchurl }:
[
{
name = "gmp-6.3.0.tar.xz";
archive = fetchurl {
sha256 = "1648ad1mr7c1r8lkkqshrv1jfjgfdb30plsadxhni7mq041bihm3";
url = "mirror://gnu/gmp/gmp-6.3.0.tar.xz";
};
}
{
name = "mpfr-4.2.1.tar.xz";
archive = fetchurl {
sha256 = "1cnb3y7y351qg6r7ynwsgaykm7l2a8zg2nlljs4rf9k778shfy17";
url = "mirror://gnu/mpfr/mpfr-4.2.1.tar.xz";
};
}
{
name = "mpc-1.3.1.tar.gz";
archive = fetchurl {
sha256 = "1f2rqz0hdrrhx4y1i5f8pv6yv08a876k1dqcm9s2p26gyn928r5b";
url = "mirror://gnu/mpc/mpc-1.3.1.tar.gz";
};
}
{
name = "gcc-14.2.0.tar.xz";
archive = fetchurl {
sha256 = "1j9wdznsp772q15w1kl5ip0gf0bh8wkanq2sdj12b7mzkk39pcx7";
url = "mirror://gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz";
};
}
{
name = "binutils-2.43.1.tar.xz";
archive = fetchurl {
sha256 = "1z9d2f0894xvjlfnvni4wbxnqgqd42j9x8wpnwc13if4lc145xqk";
url = "mirror://gnu/binutils/binutils-2.43.1.tar.xz";
};
}
{
name = "acpica-unix-20241212.tar.gz";
archive = fetchurl {
sha256 = "0q8rqc9nxvyg4310rc93az04j01p91q7ipzvhl2722rrxv7q7jlx";
url = "https://github.com/acpica/acpica/releases/download/R2024_12_12/acpica-unix-20241212.tar.gz";
};
}
{
name = "nasm-2.16.03.tar.bz2";
archive = fetchurl {
sha256 = "0mwynbnn7c4ay4rpcsyp99j49sa6j3p8gk5pigwssqfdkcaxxwxy";
url = "https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/nasm-2.16.03.tar.bz2";
};
}
]

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash -p nix cacert git getopt
# shellcheck shell=bash
if [ ! -d .git ]; then
echo "This script needs to be run from the root directory of nixpkgs. Exiting."
exit 1
fi
pkg_dir="$(dirname "$0")"
src="$(nix-build . --no-out-link -A coreboot-toolchain.i386.src)"
urls=$("${src}/util/crossgcc/buildgcc" -u)
tmp=$(mktemp)
echo '{ fetchurl }: [' >"$tmp"
for url in $urls; do
name="$(basename "$url")"
hash="$(nix-prefetch-url "$url")"
cat <<EOF >>"$tmp"
{
name = "$name";
archive = fetchurl {
sha256 = "$hash";
url = "$url";
};
}
EOF
done
echo ']' >>"$tmp"
sed -i -e 's/https\:\/\/ftpmirror\.gnu\.org/mirror\:\/\/gnu/g' "$tmp"
mv "$tmp" "${pkg_dir}/sources.nix"

View File

@@ -0,0 +1,78 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
makeWrapper,
llvm,
libclang,
flex,
zlib,
perlPackages,
util-linux,
}:
stdenv.mkDerivation {
pname = "creduce";
version = "2.10.0-unstable-2024-06-01";
src = fetchFromGitHub {
owner = "csmith-project";
repo = "creduce";
rev = "31e855e290970cba0286e5032971509c0e7c0a80";
hash = "sha256-RbxFqZegsCxnUaIIA5OfTzx1wflCPeF+enQt90VwMgA=";
};
postPatch =
# On Linux, c-reduce's preferred way to reason about
# the cpu architecture/topology is to use 'lscpu',
# so let's make sure it knows where to find it:
lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace creduce/creduce_utils.pm --replace \
lscpu ${util-linux}/bin/lscpu
'';
nativeBuildInputs = [
cmake
makeWrapper
llvm.dev
];
buildInputs = [
# Ensure stdenv's CC is on PATH before clang-unwrapped
stdenv.cc
# Actual deps:
llvm
libclang
flex
zlib
]
++ (with perlPackages; [
perl
ExporterLite
FileWhich
GetoptTabular
RegexpCommon
TermReadKey
]);
postInstall = ''
wrapProgram $out/bin/creduce --prefix PERL5LIB : "$PERL5LIB"
'';
meta = with lib; {
description = "C program reducer";
mainProgram = "creduce";
homepage = "https://embed.cs.utah.edu/creduce";
# Officially, the license is: https://github.com/csmith-project/creduce/blob/master/COPYING
license = licenses.ncsa;
longDescription = ''
C-Reduce is a tool that takes a large C or C++ program that has a
property of interest (such as triggering a compiler bug) and
automatically produces a much smaller C/C++ program that has the same
property. It is intended for use by people who discover and report
bugs in compilers and other tools that process C/C++ code.
'';
maintainers = [ ];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,49 @@
{
lib,
stdenv,
fetchsvn,
autoreconfHook,
}:
stdenv.mkDerivation rec {
pname = "ctags";
version = "816";
src = fetchsvn {
url = "https://svn.code.sf.net/p/ctags/code/trunk";
rev = version;
sha256 = "0jmbkrmscbl64j71qffcc39x005jrmphx8kirs1g2ws44wil39hf";
};
nativeBuildInputs = [ autoreconfHook ];
# don't use $T(E)MP which is set to the build directory
configureFlags = [ "--enable-tmpdir=/tmp" ];
patches = [
# Library defines an `__unused__` which is a reserved name, and may
# conflict with the standard library definition. One such conflict is with
# macOS headers.
./unused-collision.patch
];
meta = with lib; {
description = "Tool for fast source code browsing (exuberant ctags)";
mainProgram = "ctags";
longDescription = ''
Ctags generates an index (or tag) file of language objects found
in source files that allows these items to be quickly and easily
located by a text editor or other utility. A tag signifies a
language object for which an index entry is available (or,
alternatively, the index entry created for that object). Many
programming languages are supported.
'';
homepage = "https://ctags.sourceforge.net/";
license = licenses.gpl2Plus;
platforms = platforms.unix;
# So that Exuberant ctags is preferred over emacs's ctags
priority = 1;
};
}

View File

@@ -0,0 +1,246 @@
--- a/c.c (revision 816)
+++ b/c.c (working copy)
@@ -619,7 +619,7 @@
return name;
}
-static void __unused__ pt (tokenInfo *const token)
+static void UNUSED pt (tokenInfo *const token)
{
if (isType (token, TOKEN_NAME))
printf ("type: %-12s: %-13s line: %lu\n",
@@ -634,7 +634,7 @@
tokenString (token->type), token->lineNumber);
}
-static void __unused__ ps (statementInfo *const st)
+static void UNUSED ps (statementInfo *const st)
{
unsigned int i;
printf ("scope: %s decl: %s gotName: %s gotParenName: %s\n",
--- a/eiffel.c (revision 816)
+++ b/eiffel.c (working copy)
@@ -807,7 +807,7 @@
static boolean parseType (tokenInfo *const token);
-static void parseGeneric (tokenInfo *const token, boolean declaration __unused__)
+static void parseGeneric (tokenInfo *const token, boolean declaration UNUSED)
{
unsigned int depth = 0;
#ifdef TYPE_REFERENCE_TOOL
--- a/general.h (revision 816)
+++ b/general.h (working copy)
@@ -57,10 +57,10 @@
* to prevent warnings about unused variables.
*/
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !defined (__GNUG__)
-# define __unused__ __attribute__((unused))
+# define UNUSED __attribute__((unused))
# define __printf__(s,f) __attribute__((format (printf, s, f)))
#else
-# define __unused__
+# define UNUSED
# define __printf__(s,f)
#endif
--- a/lregex.c (revision 816)
+++ b/lregex.c (working copy)
@@ -538,11 +538,11 @@
#endif /* HAVE_REGEX */
extern void addTagRegex (
- const langType language __unused__,
- const char* const regex __unused__,
- const char* const name __unused__,
- const char* const kinds __unused__,
- const char* const flags __unused__)
+ const langType language UNUSED,
+ const char* const regex UNUSED,
+ const char* const name UNUSED,
+ const char* const kinds UNUSED,
+ const char* const flags UNUSED)
{
#ifdef HAVE_REGEX
Assert (regex != NULL);
@@ -564,10 +564,10 @@
}
extern void addCallbackRegex (
- const langType language __unused__,
- const char* const regex __unused__,
- const char* const flags __unused__,
- const regexCallback callback __unused__)
+ const langType language UNUSED,
+ const char* const regex UNUSED,
+ const char* const flags UNUSED,
+ const regexCallback callback UNUSED)
{
#ifdef HAVE_REGEX
Assert (regex != NULL);
@@ -581,7 +581,7 @@
}
extern void addLanguageRegex (
- const langType language __unused__, const char* const regex __unused__)
+ const langType language UNUSED, const char* const regex UNUSED)
{
#ifdef HAVE_REGEX
if (! regexBroken)
@@ -602,7 +602,7 @@
*/
extern boolean processRegexOption (const char *const option,
- const char *const parameter __unused__)
+ const char *const parameter UNUSED)
{
boolean handled = FALSE;
const char* const dash = strchr (option, '-');
@@ -624,7 +624,7 @@
return handled;
}
-extern void disableRegexKinds (const langType language __unused__)
+extern void disableRegexKinds (const langType language UNUSED)
{
#ifdef HAVE_REGEX
if (language <= SetUpper && Sets [language].count > 0)
@@ -639,8 +639,8 @@
}
extern boolean enableRegexKind (
- const langType language __unused__,
- const int kind __unused__, const boolean mode __unused__)
+ const langType language UNUSED,
+ const int kind UNUSED, const boolean mode UNUSED)
{
boolean result = FALSE;
#ifdef HAVE_REGEX
@@ -660,7 +660,7 @@
return result;
}
-extern void printRegexKinds (const langType language __unused__, boolean indent __unused__)
+extern void printRegexKinds (const langType language UNUSED, boolean indent UNUSED)
{
#ifdef HAVE_REGEX
if (language <= SetUpper && Sets [language].count > 0)
--- a/lua.c (revision 816)
+++ b/lua.c (working copy)
@@ -37,7 +37,7 @@
*/
/* for debugging purposes */
-static void __unused__ print_string (char *p, char *q)
+static void UNUSED print_string (char *p, char *q)
{
for ( ; p != q; p++)
fprintf (errout, "%c", *p);
--- a/main.c (revision 816)
+++ b/main.c (working copy)
@@ -522,7 +522,7 @@
* Start up code
*/
-extern int main (int __unused__ argc, char **argv)
+extern int main (int UNUSED argc, char **argv)
{
cookedArgs *args;
#ifdef VMS
--- a/options.c (revision 816)
+++ b/options.c (working copy)
@@ -730,7 +730,7 @@
}
static void processExcludeOption (
- const char *const option __unused__, const char *const parameter)
+ const char *const option UNUSED, const char *const parameter)
{
const char *const fileName = parameter + 1;
if (parameter [0] == '\0')
@@ -867,7 +867,7 @@
}
static void processFilterTerminatorOption (
- const char *const option __unused__, const char *const parameter)
+ const char *const option UNUSED, const char *const parameter)
{
freeString (&Option.filterTerminator);
Option.filterTerminator = stringCopy (parameter);
@@ -930,8 +930,8 @@
}
static void processHelpOption (
- const char *const option __unused__,
- const char *const parameter __unused__)
+ const char *const option UNUSED,
+ const char *const parameter UNUSED)
{
printProgramIdentification ();
putchar ('\n');
@@ -1139,8 +1139,8 @@
}
static void processLicenseOption (
- const char *const option __unused__,
- const char *const parameter __unused__)
+ const char *const option UNUSED,
+ const char *const parameter UNUSED)
{
printProgramIdentification ();
puts ("");
@@ -1166,8 +1166,8 @@
}
static void processListMapsOption (
- const char *const __unused__ option,
- const char *const __unused__ parameter)
+ const char *const UNUSED option,
+ const char *const UNUSED parameter)
{
if (parameter [0] == '\0' || strcasecmp (parameter, "all") == 0)
printLanguageMaps (LANG_AUTO);
@@ -1183,8 +1183,8 @@
}
static void processListLanguagesOption (
- const char *const option __unused__,
- const char *const parameter __unused__)
+ const char *const option UNUSED,
+ const char *const parameter UNUSED)
{
printLanguageList ();
exit (0);
@@ -1358,8 +1358,8 @@
}
static void processVersionOption (
- const char *const option __unused__,
- const char *const parameter __unused__)
+ const char *const option UNUSED,
+ const char *const parameter UNUSED)
{
printProgramIdentification ();
exit (0);
--- a/parse.c (revision 816)
+++ b/parse.c (working copy)
@@ -376,7 +376,7 @@
*/
extern void processLanguageDefineOption (
- const char *const option, const char *const parameter __unused__)
+ const char *const option, const char *const parameter UNUSED)
{
#ifdef HAVE_REGEX
if (parameter [0] == '\0')
--- a/routines.c (revision 816)
+++ b/routines.c (working copy)
@@ -526,7 +526,7 @@
#if ! defined (HAVE_STAT_ST_INO)
-static void canonicalizePath (char *const path __unused__)
+static void canonicalizePath (char *const path UNUSED)
{
#if defined (MSDOS_STYLE_PATH)
char *p;

View File

@@ -0,0 +1,90 @@
{
lib,
ctags,
writeTextFile,
runtimeShell,
ctagsWrapped,
name ? "${ctags.name}-wrapped",
args ? lib.concatLists [
ctagsWrapped.defaultArgs
ctagsWrapped.phpLang
ctagsWrapped.jsLang
ctagsWrapped.nixLang
ctagsWrapped.asLang
ctagsWrapped.rubyLang
],
}:
# Define a ctags wrapper derivation adding support for some not-that-common languages customization.
# Override this to provide different args.
writeTextFile {
inherit name;
executable = true;
destination = "/bin/${name}";
text = ''
#!${runtimeShell}
exec ${ctags}/bin/ctags ${lib.concatStringsSep " " (map lib.escapeShellArg args)} "$@"
'';
derivationArgs = {
# Inherit the metadata from the parent `ctags` derivation.
inherit (ctags) meta;
passthru = {
# `ctagsWrapped` exists for backwards compatibility; ctagsWrapped used to be an attrset and
# now is a derivation, so keep supporting the use of `ctagsWrapped.ctagsWrapped`.
inherit ctagsWrapped;
### language arguments
# don't scan version control directories
defaultArgs = [
"--exclude=.svn"
"--exclude=.hg"
"--exclude=.git"
"--exclude=_darcs"
"--sort=yes"
];
# actionscript
asLang = [
"--langdef=ActionScript"
"--langmap=ActionScript:.as"
"--regex-ActionScript=/function[ \\t]+([A-Za-z0-9_]+)[ \\t]*\\(/\\1/f,function,functions/"
"--regex-ActionScript=/function[ \\t]+(set|get)[ \\t]+([A-Za-z0-9_]+)[ \\t]*\\(/\\2/p,property,properties/"
"--regex-ActionScript=/interface[ \\t]+[a-z0-9_.]*([A-Z][A-Za-z0-9_]+)/\\1/i,interface,interfaces/"
"--regex-ActionScript=/package[ \\t]+([^ \\t]*)/\\1/p/"
"--regex-ActionScript=/class[ \\t]+[a-z0-9_.]*([A-Z][A-Za-z0-9_]+)/\\1/c,class,classes/"
];
# PHP
phpLang = [
"--langmap=PHP:.php"
"--regex-PHP=/abstract class ([^ ]*)/\\1/c/"
"--regex-PHP=/interface ([^ ]*)/\\1/i/"
"--regex-PHP=/function[ \\t]+([^ (]*)/\\1/f/"
];
# Javascript: also find unnamed functions and functions being passed within a dict.
# the dict properties is used to implement duck typing in frameworks
# var foo = function () { ... }
# {
# a : function () {}
# only recognize names up 100 characters. Else you'll be in trouble scanning compressed .js files.
jsLang = [ "--regex-JavaScript=/([^ \\t]{1,100})[ \\t]*:[ \\t]*function[ \\t]*\\(/\\1/f/" ];
# find foo in "foo =", don't think we can do a lot better
nixLang = [
"--langdef=NIX"
"--langmap=NIX:.nix"
"--regex-NIX=/([^ \\t*]*)[ \\t]*=/\\1/f/"
];
rubyLang = [
"--langmap=RUBY:.rb"
"--regex-RUBY=/class ([^ ]*)/\\1/c/"
"--regex-RUBY=/^[ ]*module[ ]*([^ ]*)/\\1/m/"
];
};
};
}

View File

@@ -0,0 +1,88 @@
{
lib,
buildPythonApplication,
fetchFromGitHub,
clang-tools,
cmake,
colordiff,
flex,
libclang,
llvm,
unifdef,
chardet,
pebble,
psutil,
pytestCheckHook,
}:
buildPythonApplication rec {
pname = "cvise";
version = "2.12.0";
format = "other";
src = fetchFromGitHub {
owner = "marxin";
repo = "cvise";
tag = "v${version}";
hash = "sha256-UaWOHjgTiSVvpKKw6VFAeRAYkYp4y0Dnamzr7yhH0vQ=";
};
patches = [
# Refer to unifdef by absolute path.
./unifdef.patch
];
postPatch = ''
# Avoid blanket -Werror to evade build failures on less
# tested compilers.
substituteInPlace CMakeLists.txt \
--replace-fail " -Werror " " "
substituteInPlace cvise/utils/testing.py \
--replace-fail "'colordiff --version'" "'${colordiff}/bin/colordiff --version'" \
--replace-fail "'colordiff'" "'${colordiff}/bin/colordiff'"
'';
nativeBuildInputs = [
cmake
flex
llvm.dev
];
buildInputs = [
libclang
llvm
llvm.dev
unifdef
];
propagatedBuildInputs = [
chardet
pebble
psutil
];
nativeCheckInputs = [
pytestCheckHook
unifdef
];
cmakeFlags = [
# By default `cvise` looks it up in `llvm` bin directory. But
# `nixpkgs` moves it into a separate derivation.
"-DCLANG_FORMAT_PATH=${clang-tools}/bin/clang-format"
];
disabledTests = [
# Needs gcc, fails when run noninteractively (without tty).
"test_simple_reduction"
];
meta = with lib; {
homepage = "https://github.com/marxin/cvise";
description = "Super-parallel Python port of C-Reduce";
license = licenses.ncsa;
maintainers = with maintainers; [ orivej ];
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,8 @@
--- a/cvise.py
+++ b/cvise.py
@@ -93,4 +93,5 @@ def find_external_programs():
# Special case for clang-format
programs['clang-format'] = '@CLANG_FORMAT_PATH@'
+ programs['unifdef'] = '@UNIFDEF@'
return programs

View File

@@ -0,0 +1,110 @@
{
lib,
stdenv,
fetchFromGitHub,
popt,
avahi,
pkg-config,
python3,
gtk3,
runCommand,
gcc,
autoconf,
automake,
which,
procps,
libiberty_static,
runtimeShell,
sysconfDir ? "", # set this parameter to override the default value $out/etc
static ? false,
}:
let
pname = "distcc";
version = "2021-03-11";
distcc = stdenv.mkDerivation {
inherit pname version;
src = fetchFromGitHub {
owner = "distcc";
repo = "distcc";
rev = "de21b1a43737fbcf47967a706dab4c60521dbbb1";
sha256 = "0zjba1090awxkmgifr9jnjkxf41zhzc4f6mrnbayn3v6s77ca9x4";
};
nativeBuildInputs = [
pkg-config
autoconf
automake
which
(python3.withPackages (p: [ p.setuptools ]))
];
buildInputs = [
popt
avahi
gtk3
procps
libiberty_static
];
preConfigure = ''
export CPATH=$(ls -d ${gcc.cc}/lib/gcc/*/${gcc.cc.version}/plugin/include)
configureFlagsArray=( CFLAGS="-O2 -fno-strict-aliasing"
CXXFLAGS="-O2 -fno-strict-aliasing"
--mandir=$out/share/man
${lib.optionalString (sysconfDir != "") "--sysconfdir=${sysconfDir}"}
${lib.optionalString static "LDFLAGS=-static"}
${lib.withFeature (static == true || popt == null) "included-popt"}
${lib.withFeature (avahi != null) "avahi"}
${lib.withFeature (gtk3 != null) "gtk"}
--without-gnome
--enable-rfc2553
--disable-Werror # a must on gcc 4.6
)
installFlags="sysconfdir=$out/etc";
./autogen.sh
'';
# The test suite fails because it uses hard-coded paths, i.e. /usr/bin/gcc.
doCheck = false;
passthru = {
# A derivation that provides gcc and g++ commands, but that
# will end up calling distcc for the given cacheDir
#
# extraConfig is meant to be sh lines exporting environment
# variables like DISTCC_HOSTS, DISTCC_DIR, ...
links =
extraConfig:
(runCommand "distcc-links" { passthru.gcc = gcc.cc; } ''
mkdir -p $out/bin
if [ -x "${gcc.cc}/bin/gcc" ]; then
cat > $out/bin/gcc << EOF
#!${runtimeShell}
${extraConfig}
exec ${distcc}/bin/distcc gcc "\$@"
EOF
chmod +x $out/bin/gcc
fi
if [ -x "${gcc.cc}/bin/g++" ]; then
cat > $out/bin/g++ << EOF
#!${runtimeShell}
${extraConfig}
exec ${distcc}/bin/distcc g++ "\$@"
EOF
chmod +x $out/bin/g++
fi
'');
};
meta = {
description = "Fast, free distributed C/C++ compiler";
homepage = "http://distcc.org";
license = lib.licenses.gpl2Only;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ anderspapitto ];
};
};
in
distcc

View File

@@ -0,0 +1,50 @@
{
lib,
stdenv,
gccRaw,
binutils,
}:
stdenv.mkDerivation {
name = "distcc-masq-${gccRaw.name}";
dontUnpack = true;
installPhase = ''
mkdir -p $out/bin
bin=${gccRaw}/bin
shopt -s nullglob
if [ -f $bin/gcc ]; then
ln -s $bin/gcc $out/bin
else
for a in $bin/*-gcc; do
ln -s $bin/*-gcc $out/bin/gcc
ln -s $bin/*-gcc $out/bin/cc
done
fi
if [ -f $bin/g++ ]; then
ln -s $bin/g++ $out/bin
else
for a in $bin/*-g++; do
ln -sf $bin/*-g++ $out/bin/g++
ln -sf $bin/*-g++ $out/bin/c++
done
fi
bbin=${binutils}/bin
if [ -f $bbin/as ]; then
ln -s $bbin/as $out/bin
else
for a in $bbin/*-as; do
ln -sf $bbin/*-as $out/bin/as
done
fi
'';
meta = {
platforms = lib.platforms.linux;
};
}

View File

@@ -0,0 +1,77 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
boost,
capstone_4,
double-conversion,
graphviz,
qtxmlpatterns,
qttools,
qtbase,
wrapQtAppsHook,
testers,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "edb";
version = "1.5.0";
src = fetchFromGitHub {
owner = "eteran";
repo = "edb-debugger";
tag = finalAttrs.version;
fetchSubmodules = true;
hash = "sha256-ALhA/odVwUQHKuOZ1W/i/6L7da/yitdpBsx2kz2ySQE=";
};
nativeBuildInputs = [
cmake
pkg-config
wrapQtAppsHook
qttools
];
buildInputs = [
qtbase
boost.dev
capstone_4
double-conversion
graphviz
qtxmlpatterns
];
cmakeFlags = [
(lib.cmakeFeature "DEFAULT_PLUGIN_DIR" "${placeholder "out"}/lib/edb")
];
postPatch = ''
# The build script checks for the presence of .git to determine whether
# submodules were fetched and will throw an error if it's not there.
# Avoid using leaveDotGit in the fetchFromGitHub options as it is non-deterministic.
mkdir -p src/qhexview/.git lib/gdtoa-desktop/.git
'';
passthru = {
tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
command = "env QT_QPA_PLATFORM=minimal ${lib.getExe finalAttrs.finalPackage} --version";
};
updateScript = nix-update-script { };
};
meta = {
description = "Cross platform AArch32/x86/x86-64 debugger";
mainProgram = "edb";
homepage = "https://github.com/eteran/edb-debugger";
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [
lihop
maxxk
];
platforms = [ "x86_64-linux" ];
};
})

View File

@@ -0,0 +1,11 @@
--- a/configure 2017-06-05 00:51:26.000000000 +0900
+++ b/configure 2018-03-06 23:12:58.000000000 +0900
@@ -3644,7 +3644,7 @@
noconfigdirs="$noconfigdirs ld gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
- x86_64-*-darwin[912]*)
+ x86_64-*-darwin*)
noconfigdirs="$noconfigdirs ld gas gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;

View File

@@ -0,0 +1,17 @@
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -708,8 +708,12 @@ captured_main_1 (struct captured_main_args *context)
if (gdb_sysroot.empty ())
gdb_sysroot = TARGET_SYSROOT_PREFIX;
- debug_file_directory
- = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE);
+ const char * nix_debug = getenv ("NIX_DEBUG_INFO_DIRS");
+ if (nix_debug != NULL)
+ debug_file_directory = nix_debug;
+ else
+ debug_file_directory
+ = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE);
gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
GDB_DATADIR_RELOCATABLE);

View File

@@ -0,0 +1,223 @@
{
lib,
stdenv,
targetPackages,
# Build time
fetchurl,
pkg-config,
perl,
texinfo,
setupDebugInfoDirs,
buildPackages,
# Run time
ncurses,
readline,
gmp,
mpfr,
expat,
libipt,
zlib,
zstd,
xz,
dejagnu,
sourceHighlight,
libiconv,
pythonSupport ? stdenv.hostPlatform == stdenv.buildPlatform && !stdenv.hostPlatform.isCygwin,
python3 ? null,
enableDebuginfod ? lib.meta.availableOn stdenv.hostPlatform elfutils,
elfutils,
guile ? null,
hostCpuOnly ? false,
enableSim ? false,
safePaths ? [
# $debugdir:$datadir/auto-load are whitelisted by default by GDB
"$debugdir"
"$datadir/auto-load"
# targetPackages so we get the right libc when cross-compiling and using buildPackages.gdb
(lib.getLib targetPackages.stdenv.cc.cc)
],
writeScript,
}:
let
basename = "gdb";
targetPrefix = lib.optionalString (
stdenv.targetPlatform != stdenv.hostPlatform
) "${stdenv.targetPlatform.config}-";
in
assert pythonSupport -> python3 != null;
stdenv.mkDerivation rec {
pname = targetPrefix + basename + lib.optionalString hostCpuOnly "-host-cpu-only";
version = "16.3";
src = fetchurl {
url = "mirror://gnu/gdb/${basename}-${version}.tar.xz";
hash = "sha256-vPzQlVKKmHkXrPn/8/FnIYFpSSbMGNYJyZ0AQsACJMU=";
};
postPatch =
lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace gdb/darwin-nat.c \
--replace '#include "bfd/mach-o.h"' '#include "mach-o.h"'
''
+ lib.optionalString stdenv.hostPlatform.isMusl ''
substituteInPlace sim/erc32/erc32.c --replace sys/fcntl.h fcntl.h
substituteInPlace sim/erc32/interf.c --replace sys/fcntl.h fcntl.h
substituteInPlace sim/erc32/sis.c --replace sys/fcntl.h fcntl.h
substituteInPlace sim/ppc/emul_unix.c --replace sys/termios.h termios.h
'';
patches = [
./debug-info-from-env.patch
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
./darwin-target-match.patch
];
nativeBuildInputs = [
pkg-config
texinfo
perl
setupDebugInfoDirs
];
buildInputs = [
ncurses
readline
gmp
mpfr
expat
libipt
zlib
zstd
xz
guile
sourceHighlight
]
++ lib.optional pythonSupport python3
++ lib.optional doCheck dejagnu
++ lib.optional enableDebuginfod (elfutils.override { enableDebuginfod = true; })
++ lib.optional stdenv.hostPlatform.isDarwin libiconv;
propagatedNativeBuildInputs = [ setupDebugInfoDirs ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
enableParallelBuilding = true;
# darwin build fails with format hardening since v7.12
hardeningDisable = lib.optionals stdenv.hostPlatform.isDarwin [ "format" ];
env.NIX_CFLAGS_COMPILE = "-Wno-format-nonliteral";
# Workaround for Apple Silicon, configurePlatforms must be disabled
configurePlatforms =
lib.optionals (!(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64))
[
"build"
"host"
"target"
];
preConfigure = ''
# remove precompiled docs, required for man gdbinit to mention /etc/gdb/gdbinit
rm gdb/doc/*.info*
rm gdb/doc/*.5
rm gdb/doc/*.1
# fix doc build https://sourceware.org/bugzilla/show_bug.cgi?id=27808
rm gdb/doc/GDBvn.texi
# GDB have to be built out of tree.
mkdir _build
cd _build
'';
configureScript = "../configure";
configureFlags = [
# Set the program prefix to the current targetPrefix.
# This ensures that the prefix always conforms to
# nixpkgs' expectations instead of relying on the build
# system which only receives `config` which is merely a
# subset of the platform description.
"--program-prefix=${targetPrefix}"
"--disable-werror"
]
++ lib.optional (!hostCpuOnly) "--enable-targets=all"
++ [
"--enable-64-bit-bfd"
"--disable-install-libbfd"
"--disable-shared"
"--enable-static"
"--with-system-zlib"
"--with-system-readline"
"--with-system-gdbinit=/etc/gdb/gdbinit"
"--with-system-gdbinit-dir=/etc/gdb/gdbinit.d"
"--with-gmp=${gmp.dev}"
"--with-mpfr=${mpfr.dev}"
"--with-expat"
"--with-libexpat-prefix=${expat.dev}"
"--with-auto-load-safe-path=${builtins.concatStringsSep ":" safePaths}"
]
++ lib.optional (!pythonSupport) "--without-python"
++ lib.optional stdenv.hostPlatform.isMusl "--disable-nls"
++ lib.optional stdenv.hostPlatform.isStatic "--disable-inprocess-agent"
++ lib.optional enableDebuginfod "--with-debuginfod=yes"
++ lib.optional (!enableSim) "--disable-sim"
# Workaround for Apple Silicon, "--target" must be "faked", see eg: https://github.com/Homebrew/homebrew-core/pull/209753
++ lib.optional (
stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64
) "--target=x86_64-apple-darwin";
postInstall = ''
# Remove Info files already provided by Binutils and other packages.
rm -v $out/share/info/bfd.info
'';
# TODO: Investigate & fix the test failures.
doCheck = false;
passthru = {
updateScript = writeScript "update-gdb" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl pcre common-updater-scripts
set -eu -o pipefail
# Expect the text in format of '<h3>GDB version 12.1</h3>'
new_version="$(curl -s https://www.sourceware.org/gdb/ |
pcregrep -o1 '<h3>GDB version ([0-9.]+)</h3>')"
update-source-version ${pname} "$new_version"
'';
};
meta = {
mainProgram = "gdb";
description = "GNU Project debugger";
longDescription = ''
GDB, the GNU Project debugger, allows you to see what is going
on `inside' another program while it executes -- or what another
program was doing at the moment it crashed.
'';
homepage = "https://www.gnu.org/software/gdb/";
license = lib.licenses.gpl3Plus;
platforms = with lib.platforms; linux ++ cygwin ++ freebsd ++ darwin;
maintainers = with lib.maintainers; [
pierron
globin
lsix
];
};
}

View File

@@ -0,0 +1,58 @@
{
lib,
buildPythonApplication,
fetchPypi,
gdb,
eventlet,
flask-compress,
flask-socketio,
pygdbmi,
pygments,
}:
buildPythonApplication rec {
pname = "gdbgui";
version = "0.15.3.0";
format = "setuptools";
buildInputs = [ gdb ];
propagatedBuildInputs = [
eventlet
flask-compress
flask-socketio
pygdbmi
pygments
];
src = fetchPypi {
inherit pname version;
hash = "sha256-/HyFE0JnoN03CDyCQCo/Y9RyH4YOMoeB7khReIb8t7Y=";
};
postPatch = ''
echo ${version} > gdbgui/VERSION.txt
# relax version requirements
sed -i 's/==.*$//' requirements.txt
'';
postInstall = ''
wrapProgram $out/bin/gdbgui \
--prefix PATH : ${lib.makeBinPath [ gdb ]}
'';
# tests do not work without stdout/stdin
doCheck = false;
meta = with lib; {
description = "Browser-based frontend for GDB";
mainProgram = "gdbgui";
homepage = "https://www.gdbgui.com/";
license = licenses.gpl3;
platforms = platforms.unix;
maintainers = with maintainers; [
yrashk
dump_stack
];
};
}

View File

@@ -0,0 +1,59 @@
{
mkDerivation,
lib,
fetchFromGitHub,
makeWrapper,
python3,
qtbase,
qmake,
qtserialport,
ctags,
gdb,
}:
mkDerivation rec {
pname = "gede";
version = "2.22.1";
src = fetchFromGitHub {
owner = "jhn98032";
repo = "gede";
tag = "v${version}";
hash = "sha256-6YSrqLDuV4G/uvtYy4vzbwqrMFftMvZdp3kr3R436rs=";
};
nativeBuildInputs = [
ctags
makeWrapper
python3
qmake
qtserialport
];
strictDeps = true;
dontUseQmakeConfigure = true;
dontBuild = true;
installPhase = ''
python build.py install --verbose --prefix="$out"
wrapProgram $out/bin/gede \
--prefix QT_PLUGIN_PATH : ${qtbase}/${qtbase.qtPluginPrefix} \
--prefix PATH : ${
lib.makeBinPath [
ctags
gdb
]
}
'';
meta = with lib; {
description = "Graphical frontend (GUI) to GDB";
mainProgram = "gede";
homepage = "http://gede.dexar.se";
license = licenses.bsd2;
platforms = platforms.linux;
maintainers = with maintainers; [ juliendehos ];
};
}

View File

@@ -0,0 +1,46 @@
{
lib,
stdenv,
fetchurl,
m4,
perl,
}:
stdenv.mkDerivation rec {
pname = "libtool";
version = "1.5.26";
src = fetchurl {
url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
sha256 = "029ggq5kri1gjn6nfqmgw4w920gyfzscjjxbsxxidal5zqsawd8w";
};
nativeBuildInputs = [ m4 ];
buildInputs = [ perl ];
# Don't fixup "#! /bin/sh" in Libtool, otherwise it will use the
# "fixed" path in generated files!
dontPatchShebangs = true;
dontFixLibtool = true;
meta = {
description = "Generic library support script";
longDescription = ''
GNU libtool is a generic library support script. Libtool hides
the complexity of using shared libraries behind a consistent,
portable interface.
To use libtool, add the new generic library building commands to
your Makefile, Makefile.in, or Makefile.am. See the
documentation for details.
'';
homepage = "https://www.gnu.org/software/libtool/";
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.unix;
mainProgram = "libtool";
};
}

View File

@@ -0,0 +1,88 @@
{
lib,
stdenv,
fetchurl,
m4,
runtimeShell,
updateAutotoolsGnuConfigScriptsHook,
file,
}:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
stdenv.mkDerivation rec {
pname = "libtool";
version = "2.5.4";
src = fetchurl {
url = "mirror://gnu/libtool/${pname}-${version}.tar.gz";
sha256 = "sha256-2o67LOTc9GuQCY2vliz/po9LT2LqYPeY0O8Skp7eat8=";
};
outputs = [
"out"
"lib"
];
# FILECMD was added in libtool 2.4.7; previous versions hardwired `/usr/bin/file`
# https://lists.gnu.org/archive/html/autotools-announce/2022-03/msg00000.html
FILECMD = "${file}/bin/file";
postPatch =
# libtool commit da2e352735722917bf0786284411262195a6a3f6 changed
# the shebang from `/bin/sh` (which is a special sandbox exception)
# to `/usr/bin/env sh`, meaning that we now need to patch shebangs
# in libtoolize.in:
''
substituteInPlace libtoolize.in --replace '#! /usr/bin/env sh' '#!${runtimeShell}'
# avoid help2man run after 'libtoolize.in' update
touch doc/libtoolize.1
'';
strictDeps = true;
# As libtool is an early bootstrap dependency try hard not to
# add autoconf and automake or help2man dependencies here. That way we can
# avoid pulling in perl and get away with just an `m4` depend.
nativeBuildInputs = [
updateAutotoolsGnuConfigScriptsHook
m4
file
];
propagatedBuildInputs = [
m4
file
];
# Don't fixup "#! /bin/sh" in Libtool, otherwise it will use the
# "fixed" path in generated files!
dontPatchShebangs = true;
dontFixLibtool = true;
# XXX: The GNU ld wrapper does all sorts of nasty things wrt. RPATH, which
# leads to the failure of a number of tests.
doCheck = false;
doInstallCheck = false;
enableParallelBuilding = true;
meta = with lib; {
description = "GNU Libtool, a generic library support script";
longDescription = ''
GNU libtool is a generic library support script. Libtool hides
the complexity of using shared libraries behind a consistent,
portable interface.
To use libtool, add the new generic library building commands to
your Makefile, Makefile.in, or Makefile.am. See the
documentation for details.
'';
homepage = "https://www.gnu.org/software/libtool/";
license = licenses.gpl2Plus;
maintainers = [ ];
platforms = platforms.unix;
mainProgram = "libtool";
};
}

View File

@@ -0,0 +1,53 @@
diff --git a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/osversion.go b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/osversion.go
index d72a7856d..b186d3aff 100644
--- a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/osversion.go
+++ b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/osversion.go
@@ -9,6 +9,7 @@ import "C"
import (
"errors"
"fmt"
+ "os/exec"
"strconv"
"strings"
"sync"
@@ -48,6 +49,40 @@ func fetchMajorMinorVersion() (float64, error) {
if err != nil {
return 0, err
}
+
+ // For backward compatibility reasons, if code compiled against an SDK
+ // earlier than macOS 11 is run on macOS 11 or later, and then tries to read
+ // value of kern.osproductversion, the OS will return the value "10.16"
+ // instead of the real OS version string. By contrast, the command `sw_vers
+ // -productVersion` will return the real OS version string unless the
+ // environment variable SYSTEM_VERSION_COMPAT is set to 1 or 2, in which
+ // case it will respectively return "10.16" and "15.7" (the latter is for
+ // some iOS compatibility reason).
+ //
+ // The only (currently) sure way to get the real OS version string
+ // regardless of SYSTEM_VERSION_COMPAT or the SDK compiled against is
+ // apparently to parse
+ // /System/Library/CoreServices/.SystemVersionPlatform.plist if it exists,
+ // and /System/Library/CoreServices/SystemVersion.plist otherwise. Doing
+ // so, however, requires parsing XML plist files.
+ //
+ // Given what this library does, it doesn't seem likely that there would be
+ // a good reason to run its code with SYSTEM_VERSION_COMPAT set, so using
+ // `sw_vers` should be adequate until a proper parsing of plist files is
+ // added.
+ //
+ // See https://github.com/ziglang/zig/issues/7569,
+ // https://github.com/ziglang/zig/pull/7714 and
+ // https://eclecticlight.co/2020/08/13/macos-version-numbering-isnt-so-simple/
+ // for more information.
+ if osver == "10.16" {
+ out, err := exec.Command("sw_vers", "-productVersion").Output()
+ if err != nil {
+ return 0, err
+ }
+ osver = strings.TrimRight(string(out), "\r\n")
+ }
+
prefix := "v"
majorMinor := strings.TrimPrefix(semver.MajorMinor(prefix+osver), prefix)
version, err := strconv.ParseFloat(majorMinor, 64)

View File

@@ -0,0 +1,69 @@
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
git,
sigtool,
testers,
linuxkit,
}:
buildGoModule rec {
pname = "linuxkit";
version = "1.8.2";
src = fetchFromGitHub {
owner = "linuxkit";
repo = "linuxkit";
rev = "v${version}";
sha256 = "sha256-0W3YWj6amNI6jr10FfLAqF1kEUwx4BU5+gjkg4iqX1Q=";
};
vendorHash = null;
modRoot = "./src/cmd/linuxkit";
patches = [
./darwin-os-version.patch
./support-apple-11-sdk.patch
];
# - On macOS, an executable must be signed with the right entitlement(s) to be
# able to use the Virtualization framework at runtime.
# - sigtool is allows us to validly sign such executables with a dummy
# authority.
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ sigtool ];
ldflags = [
"-s"
"-w"
"-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=${version}"
];
nativeCheckInputs = [ git ];
# - Because this package definition doesn't build using the source's Makefile,
# we must manually call the sign target.
# - The binary stripping that nixpkgs does by default in the
# fixup phase removes such signing and entitlements, so we have to sign
# after stripping.
# - Finally, at the start of the fixup phase, the working directory is
# $sourceRoot/src/cmd/linuxkit, so it's simpler to use the sign target from
# the Makefile in that directory rather than $sourceRoot/Makefile.
postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
make sign LOCAL_TARGET=$out/bin/linuxkit
'';
passthru.tests.version = testers.testVersion {
package = linuxkit;
command = "linuxkit version";
};
meta = with lib; {
description = "Toolkit for building secure, portable and lean operating systems for containers";
mainProgram = "linuxkit";
license = licenses.asl20;
homepage = "https://github.com/linuxkit/linuxkit";
maintainers = with maintainers; [ nicknovitski ];
};
}

View File

@@ -0,0 +1,811 @@
diff --git a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_12.m b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_12.m
index 567172ba2..e2c1ac047 100644
--- a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_12.m
+++ b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_12.m
@@ -8,6 +8,7 @@
bool vmCanStop(void *machine, void *queue)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
__block BOOL result;
dispatch_sync((dispatch_queue_t)queue, ^{
@@ -15,12 +16,13 @@ bool vmCanStop(void *machine, void *queue)
});
return (bool)result;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
void stopWithCompletionHandler(void *machine, void *queue, void *completionHandler)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
vm_completion_handler_t handler = makeVMCompletionHandler(completionHandler);
dispatch_sync((dispatch_queue_t)queue, ^{
@@ -29,7 +31,7 @@ void stopWithCompletionHandler(void *machine, void *queue, void *completionHandl
Block_release(handler);
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -38,10 +40,11 @@ void stopWithCompletionHandler(void *machine, void *queue, void *completionHandl
*/
void *newVZGenericPlatformConfiguration()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZGenericPlatformConfiguration alloc] init];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -51,11 +54,12 @@ void *newVZGenericPlatformConfiguration()
*/
void setDirectorySharingDevicesVZVirtualMachineConfiguration(void *config, void *directorySharingDevices)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZVirtualMachineConfiguration *)config setDirectorySharingDevices:[(NSMutableArray *)directorySharingDevices copy]];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -66,11 +70,12 @@ void setDirectorySharingDevicesVZVirtualMachineConfiguration(void *config, void
*/
void setPlatformVZVirtualMachineConfiguration(void *config, void *platform)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZVirtualMachineConfiguration *)config setPlatform:(VZPlatformConfiguration *)platform];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -80,11 +85,12 @@ void setPlatformVZVirtualMachineConfiguration(void *config, void *platform)
*/
void setGraphicsDevicesVZVirtualMachineConfiguration(void *config, void *graphicsDevices)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZVirtualMachineConfiguration *)config setGraphicsDevices:[(NSMutableArray *)graphicsDevices copy]];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -94,11 +100,12 @@ void setGraphicsDevicesVZVirtualMachineConfiguration(void *config, void *graphic
*/
void setPointingDevicesVZVirtualMachineConfiguration(void *config, void *pointingDevices)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZVirtualMachineConfiguration *)config setPointingDevices:[(NSMutableArray *)pointingDevices copy]];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -108,11 +115,12 @@ void setPointingDevicesVZVirtualMachineConfiguration(void *config, void *pointin
*/
void setKeyboardsVZVirtualMachineConfiguration(void *config, void *keyboards)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZVirtualMachineConfiguration *)config setKeyboards:[(NSMutableArray *)keyboards copy]];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -122,11 +130,12 @@ void setKeyboardsVZVirtualMachineConfiguration(void *config, void *keyboards)
*/
void setAudioDevicesVZVirtualMachineConfiguration(void *config, void *audioDevices)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZVirtualMachineConfiguration *)config setAudioDevices:[(NSMutableArray *)audioDevices copy]];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -136,10 +145,11 @@ void setAudioDevicesVZVirtualMachineConfiguration(void *config, void *audioDevic
*/
void *newVZVirtioSoundDeviceConfiguration()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZVirtioSoundDeviceConfiguration alloc] init];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -148,11 +158,12 @@ void *newVZVirtioSoundDeviceConfiguration()
*/
void setStreamsVZVirtioSoundDeviceConfiguration(void *audioDeviceConfiguration, void *streams)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZVirtioSoundDeviceConfiguration *)audioDeviceConfiguration setStreams:[(NSMutableArray *)streams copy]];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -162,10 +173,11 @@ void setStreamsVZVirtioSoundDeviceConfiguration(void *audioDeviceConfiguration,
*/
void *newVZVirtioSoundDeviceInputStreamConfiguration()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZVirtioSoundDeviceInputStreamConfiguration alloc] init];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -174,12 +186,13 @@ void *newVZVirtioSoundDeviceInputStreamConfiguration()
*/
void *newVZVirtioSoundDeviceHostInputStreamConfiguration()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZVirtioSoundDeviceInputStreamConfiguration *inputStream = (VZVirtioSoundDeviceInputStreamConfiguration *)newVZVirtioSoundDeviceInputStreamConfiguration();
[inputStream setSource:[[VZHostAudioInputStreamSource alloc] init]];
return inputStream;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -189,10 +202,11 @@ void *newVZVirtioSoundDeviceHostInputStreamConfiguration()
*/
void *newVZVirtioSoundDeviceOutputStreamConfiguration()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZVirtioSoundDeviceOutputStreamConfiguration alloc] init];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -201,12 +215,13 @@ void *newVZVirtioSoundDeviceOutputStreamConfiguration()
*/
void *newVZVirtioSoundDeviceHostOutputStreamConfiguration()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZVirtioSoundDeviceOutputStreamConfiguration *outputStream = (VZVirtioSoundDeviceOutputStreamConfiguration *)newVZVirtioSoundDeviceOutputStreamConfiguration();
[outputStream setSink:[[VZHostAudioOutputStreamSink alloc] init]];
return outputStream;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -220,12 +235,13 @@ void *newVZVirtioSoundDeviceHostOutputStreamConfiguration()
*/
void *newVZSharedDirectory(const char *dirPath, bool readOnly)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
NSString *dirPathNSString = [NSString stringWithUTF8String:dirPath];
NSURL *dirURL = [NSURL fileURLWithPath:dirPathNSString];
return [[VZSharedDirectory alloc] initWithURL:dirURL readOnly:(BOOL)readOnly];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -237,10 +253,11 @@ void *newVZSharedDirectory(const char *dirPath, bool readOnly)
*/
void *newVZSingleDirectoryShare(void *sharedDirectory)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZSingleDirectoryShare alloc] initWithDirectory:(VZSharedDirectory *)sharedDirectory];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -252,10 +269,11 @@ void *newVZSingleDirectoryShare(void *sharedDirectory)
*/
void *newVZMultipleDirectoryShare(void *sharedDirectories)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZMultipleDirectoryShare alloc] initWithDirectories:(NSDictionary<NSString *, VZSharedDirectory *> *)sharedDirectories];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -267,6 +285,7 @@ void *newVZMultipleDirectoryShare(void *sharedDirectories)
*/
void *newVZVirtioFileSystemDeviceConfiguration(const char *tag, void **error)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
NSString *tagNSString = [NSString stringWithUTF8String:tag];
BOOL valid = [VZVirtioFileSystemDeviceConfiguration validateTag:tagNSString error:(NSError *_Nullable *_Nullable)error];
@@ -275,7 +294,7 @@ void *newVZVirtioFileSystemDeviceConfiguration(const char *tag, void **error)
}
return [[VZVirtioFileSystemDeviceConfiguration alloc] initWithTag:tagNSString];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -284,11 +303,12 @@ void *newVZVirtioFileSystemDeviceConfiguration(const char *tag, void **error)
*/
void setVZVirtioFileSystemDeviceConfigurationShare(void *config, void *share)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZVirtioFileSystemDeviceConfiguration *)config setShare:(VZDirectoryShare *)share];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -298,10 +318,11 @@ void setVZVirtioFileSystemDeviceConfigurationShare(void *config, void *share)
*/
void *newVZUSBScreenCoordinatePointingDeviceConfiguration()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZUSBScreenCoordinatePointingDeviceConfiguration alloc] init];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -311,10 +332,11 @@ void *newVZUSBScreenCoordinatePointingDeviceConfiguration()
*/
void *newVZUSBKeyboardConfiguration()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZUSBKeyboardConfiguration alloc] init];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -328,6 +350,7 @@ void sharedApplication()
void startVirtualMachineWindow(void *machine, double width, double height)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
@autoreleasepool {
AppDelegate *appDelegate = [[[AppDelegate alloc]
@@ -340,5 +363,6 @@ void startVirtualMachineWindow(void *machine, double width, double height)
return;
}
}
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
diff --git a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_12_arm64.m b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_12_arm64.m
index 4fbaf6cb7..452adb747 100644
--- a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_12_arm64.m
+++ b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_12_arm64.m
@@ -30,6 +30,7 @@
*/
void *newVZMacAuxiliaryStorageWithCreating(const char *storagePath, void *hardwareModel, void **error)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
NSString *storagePathNSString = [NSString stringWithUTF8String:storagePath];
NSURL *storageURL = [NSURL fileURLWithPath:storagePathNSString];
@@ -38,7 +39,7 @@ void *newVZMacAuxiliaryStorageWithCreating(const char *storagePath, void *hardwa
options:VZMacAuxiliaryStorageInitializationOptionAllowOverwrite
error:(NSError *_Nullable *_Nullable)error];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -49,6 +50,7 @@ void *newVZMacAuxiliaryStorageWithCreating(const char *storagePath, void *hardwa
*/
void *newVZMacAuxiliaryStorage(const char *storagePath)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
NSString *storagePathNSString = [NSString stringWithUTF8String:storagePath];
NSURL *storageURL = [NSURL fileURLWithPath:storagePathNSString];
@@ -56,7 +58,7 @@ void *newVZMacAuxiliaryStorage(const char *storagePath)
// https://developer.apple.com/documentation/virtualization/vzmacauxiliarystorage?language=objc
return [[VZMacAuxiliaryStorage alloc] initWithContentsOfURL:storageURL];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -80,10 +82,11 @@ void *newVZMacAuxiliaryStorage(const char *storagePath)
*/
void *newVZMacPlatformConfiguration()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZMacPlatformConfiguration alloc] init];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -92,17 +95,19 @@ void *newVZMacPlatformConfiguration()
*/
void setHardwareModelVZMacPlatformConfiguration(void *config, void *hardwareModel)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZMacPlatformConfiguration *)config setHardwareModel:(VZMacHardwareModel *)hardwareModel];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
// Store the hardware model to disk so that we can retrieve them for subsequent boots.
void storeHardwareModelDataVZMacPlatformConfiguration(void *config, const char *filePath)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacPlatformConfiguration *macPlatformConfiguration = (VZMacPlatformConfiguration *)config;
NSString *filePathNSString = [NSString stringWithUTF8String:filePath];
@@ -110,7 +115,7 @@ void storeHardwareModelDataVZMacPlatformConfiguration(void *config, const char *
[macPlatformConfiguration.hardwareModel.dataRepresentation writeToURL:fileURL atomically:YES];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -121,17 +126,19 @@ void storeHardwareModelDataVZMacPlatformConfiguration(void *config, const char *
*/
void setMachineIdentifierVZMacPlatformConfiguration(void *config, void *machineIdentifier)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZMacPlatformConfiguration *)config setMachineIdentifier:(VZMacMachineIdentifier *)machineIdentifier];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
// Store the machine identifier to disk so that we can retrieve them for subsequent boots.
void storeMachineIdentifierDataVZMacPlatformConfiguration(void *config, const char *filePath)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacPlatformConfiguration *macPlatformConfiguration = (VZMacPlatformConfiguration *)config;
NSString *filePathNSString = [NSString stringWithUTF8String:filePath];
@@ -139,7 +146,7 @@ void storeMachineIdentifierDataVZMacPlatformConfiguration(void *config, const ch
[macPlatformConfiguration.machineIdentifier.dataRepresentation writeToURL:fileURL atomically:YES];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -151,11 +158,12 @@ void storeMachineIdentifierDataVZMacPlatformConfiguration(void *config, const ch
*/
void setAuxiliaryStorageVZMacPlatformConfiguration(void *config, void *auxiliaryStorage)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZMacPlatformConfiguration *)config setAuxiliaryStorage:(VZMacAuxiliaryStorage *)auxiliaryStorage];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -169,10 +177,11 @@ void setAuxiliaryStorageVZMacPlatformConfiguration(void *config, void *auxiliary
*/
void *newVZMacOSBootLoader()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZMacOSBootLoader alloc] init];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -182,10 +191,11 @@ void *newVZMacOSBootLoader()
*/
void *newVZMacGraphicsDeviceConfiguration()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZMacGraphicsDeviceConfiguration alloc] init];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -194,11 +204,12 @@ void *newVZMacGraphicsDeviceConfiguration()
*/
void setDisplaysVZMacGraphicsDeviceConfiguration(void *graphicsConfiguration, void *displays)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZMacGraphicsDeviceConfiguration *)graphicsConfiguration setDisplays:[(NSMutableArray *)displays copy]];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -210,13 +221,14 @@ void setDisplaysVZMacGraphicsDeviceConfiguration(void *graphicsConfiguration, vo
*/
void *newVZMacGraphicsDisplayConfiguration(NSInteger widthInPixels, NSInteger heightInPixels, NSInteger pixelsPerInch)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZMacGraphicsDisplayConfiguration alloc]
initWithWidthInPixels:widthInPixels
heightInPixels:heightInPixels
pixelsPerInch:pixelsPerInch];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -226,6 +238,7 @@ void *newVZMacGraphicsDisplayConfiguration(NSInteger widthInPixels, NSInteger he
*/
void *newVZMacHardwareModelWithPath(const char *hardwareModelPath)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacHardwareModel *hardwareModel;
NSString *hardwareModelPathNSString = [NSString stringWithUTF8String:hardwareModelPath];
@@ -236,12 +249,13 @@ void *newVZMacHardwareModelWithPath(const char *hardwareModelPath)
}
return hardwareModel;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
void *newVZMacHardwareModelWithBytes(void *hardwareModelBytes, int len)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacHardwareModel *hardwareModel;
@autoreleasepool {
@@ -250,7 +264,7 @@ void *newVZMacHardwareModelWithBytes(void *hardwareModelBytes, int len)
}
return hardwareModel;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -259,10 +273,11 @@ void *newVZMacHardwareModelWithBytes(void *hardwareModelBytes, int len)
*/
void *newVZMacMachineIdentifier()
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[VZMacMachineIdentifier alloc] init];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -274,6 +289,7 @@ void *newVZMacMachineIdentifier()
*/
void *newVZMacMachineIdentifierWithPath(const char *machineIdentifierPath)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacMachineIdentifier *machineIdentifier;
NSString *machineIdentifierPathNSString = [NSString stringWithUTF8String:machineIdentifierPath];
@@ -284,12 +300,13 @@ void *newVZMacMachineIdentifierWithPath(const char *machineIdentifierPath)
}
return machineIdentifier;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
void *newVZMacMachineIdentifierWithBytes(void *machineIdentifierBytes, int len)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacMachineIdentifier *machineIdentifier;
@autoreleasepool {
@@ -298,12 +315,13 @@ void *newVZMacMachineIdentifierWithBytes(void *machineIdentifierBytes, int len)
}
return machineIdentifier;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
nbyteslice getVZMacMachineIdentifierDataRepresentation(void *machineIdentifierPtr)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacMachineIdentifier *machineIdentifier = (VZMacMachineIdentifier *)machineIdentifierPtr;
NSData *data = [machineIdentifier dataRepresentation];
@@ -313,12 +331,13 @@ nbyteslice getVZMacMachineIdentifierDataRepresentation(void *machineIdentifierPt
};
return ret;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
VZMacOSRestoreImageStruct convertVZMacOSRestoreImage2Struct(void *restoreImagePtr)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacOSRestoreImage *restoreImage = (VZMacOSRestoreImage *)restoreImagePtr;
VZMacOSRestoreImageStruct ret;
@@ -329,12 +348,13 @@ VZMacOSRestoreImageStruct convertVZMacOSRestoreImage2Struct(void *restoreImagePt
ret.mostFeaturefulSupportedConfiguration = (void *)CFBridgingRetain([restoreImage mostFeaturefulSupportedConfiguration]);
return ret;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
void fetchLatestSupportedMacOSRestoreImageWithCompletionHandler(void *cgoHandler)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[VZMacOSRestoreImage fetchLatestSupportedWithCompletionHandler:^(VZMacOSRestoreImage *restoreImage, NSError *error) {
VZMacOSRestoreImageStruct restoreImageStruct = convertVZMacOSRestoreImage2Struct(restoreImage);
@@ -342,12 +362,13 @@ void fetchLatestSupportedMacOSRestoreImageWithCompletionHandler(void *cgoHandler
}];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
void loadMacOSRestoreImageFile(const char *ipswPath, void *cgoHandler)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
NSString *ipswPathNSString = [NSString stringWithUTF8String:ipswPath];
NSURL *ipswURL = [NSURL fileURLWithPath:ipswPathNSString];
@@ -358,12 +379,13 @@ void loadMacOSRestoreImageFile(const char *ipswPath, void *cgoHandler)
}];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
VZMacOSConfigurationRequirementsStruct convertVZMacOSConfigurationRequirements2Struct(void *requirementsPtr)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacOSConfigurationRequirements *requirements = (VZMacOSConfigurationRequirements *)requirementsPtr;
VZMacOSConfigurationRequirementsStruct ret;
@@ -373,12 +395,13 @@ VZMacOSConfigurationRequirementsStruct convertVZMacOSConfigurationRequirements2S
ret.hardwareModel = (void *)CFBridgingRetain([requirements hardwareModel]);
return ret;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
VZMacHardwareModelStruct convertVZMacHardwareModel2Struct(void *hardwareModelPtr)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacHardwareModel *hardwareModel = (VZMacHardwareModel *)hardwareModelPtr;
VZMacHardwareModelStruct ret;
@@ -391,7 +414,7 @@ VZMacHardwareModelStruct convertVZMacHardwareModel2Struct(void *hardwareModelPtr
ret.dataRepresentation = retByteSlice;
return ret;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -405,6 +428,7 @@ VZMacHardwareModelStruct convertVZMacHardwareModel2Struct(void *hardwareModelPtr
*/
void *newVZMacOSInstaller(void *virtualMachine, void *vmQueue, const char *restoreImageFilePath)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
__block VZMacOSInstaller *ret;
NSString *restoreImageFilePathNSString = [NSString stringWithUTF8String:restoreImageFilePath];
@@ -414,7 +438,7 @@ void *newVZMacOSInstaller(void *virtualMachine, void *vmQueue, const char *resto
});
return ret;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -425,6 +449,7 @@ void *newProgressObserverVZMacOSInstaller()
void installByVZMacOSInstaller(void *installerPtr, void *vmQueue, void *progressObserverPtr, void *completionHandler, void *fractionCompletedHandler)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacOSInstaller *installer = (VZMacOSInstaller *)installerPtr;
dispatch_sync((dispatch_queue_t)vmQueue, ^{
@@ -439,12 +464,13 @@ void installByVZMacOSInstaller(void *installerPtr, void *vmQueue, void *progress
});
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
void cancelInstallVZMacOSInstaller(void *installerPtr)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
VZMacOSInstaller *installer = (VZMacOSInstaller *)installerPtr;
if (installer.progress.cancellable) {
@@ -452,7 +478,7 @@ void cancelInstallVZMacOSInstaller(void *installerPtr)
}
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
diff --git a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_debug.m b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_debug.m
index 67fe356ae..af81a46b0 100644
--- a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_debug.m
+++ b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_debug.m
@@ -12,10 +12,11 @@
*/
void *newVZGDBDebugStubConfiguration(uint32_t port)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
return [[_VZGDBDebugStubConfiguration alloc] initWithPort:(NSInteger)port];
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
@@ -24,10 +25,11 @@ void *newVZGDBDebugStubConfiguration(uint32_t port)
*/
void setDebugStubVZVirtualMachineConfiguration(void *config, void *debugStub)
{
+#ifdef INCLUDE_TARGET_OSX_12
if (@available(macOS 12, *)) {
[(VZVirtualMachineConfiguration *)config _setDebugStub:(_VZDebugStubConfiguration *)debugStub];
return;
}
-
+#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
\ No newline at end of file
diff --git a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_helper.h b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_helper.h
index 995b40882..9da0700b9 100644
--- a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_helper.h
+++ b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_helper.h
@@ -18,6 +18,13 @@ NSDictionary *dumpProcessinfo();
__builtin_unreachable(); \
} while (0)
+// for macOS 12 API
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
+#define INCLUDE_TARGET_OSX_12 1
+#else
+#pragma message("macOS 12 API has been disabled")
+#endif
+
// for macOS 12.3 API
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120300
#define INCLUDE_TARGET_OSX_12_3 1
diff --git a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_view.h b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_view.h
index ab00b9225..15d306f66 100644
--- a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_view.h
+++ b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_view.h
@@ -23,9 +23,11 @@
- (instancetype)init;
@end
+#ifdef INCLUDE_TARGET_OSX_12
API_AVAILABLE(macos(12.0))
@interface AppDelegate : NSObject <NSApplicationDelegate, NSWindowDelegate, VZVirtualMachineDelegate>
- (instancetype)initWithVirtualMachine:(VZVirtualMachine *)virtualMachine
windowWidth:(CGFloat)windowWidth
windowHeight:(CGFloat)windowHeight;
-@end
\ No newline at end of file
+@end
+#endif
\ No newline at end of file
diff --git a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_view.m b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_view.m
index 9031c44f1..33b20d91b 100644
--- a/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_view.m
+++ b/src/cmd/linuxkit/vendor/github.com/Code-Hex/vz/v3/virtualization_view.m
@@ -165,6 +165,7 @@
@end
+#ifdef INCLUDE_TARGET_OSX_12
@implementation AppDelegate {
VZVirtualMachine *_virtualMachine;
VZVirtualMachineView *_virtualMachineView;
@@ -372,3 +373,4 @@
[aboutPanel makeKeyAndOrderFront:nil];
}
@end
+#endif

View File

@@ -0,0 +1,24 @@
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
index 535bd69..b017161 100644
--- a/src/luarocks/core/cfg.lua
+++ b/src/luarocks/core/cfg.lua
@@ -436,7 +436,7 @@ local function make_defaults(lua_version, target_cpu, platforms, home)
defaults.external_lib_extension = "dylib"
defaults.arch = "macosx-"..target_cpu
defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load"
- local version = util.popen_read("sw_vers -productVersion")
+ local version = os.getenv("MACOSX_DEPLOYMENT_TARGET") or "@darwinMinVersion@"
if not (version:match("^%d+%.%d+%.%d+$") or version:match("^%d+%.%d+$")) then
version = "10.3"
end
@@ -448,8 +448,8 @@ local function make_defaults(lua_version, target_cpu, platforms, home)
else
defaults.gcc_rpath = false
end
- defaults.variables.CC = "env MACOSX_DEPLOYMENT_TARGET="..tostring(version).." gcc"
- defaults.variables.LD = "env MACOSX_DEPLOYMENT_TARGET="..tostring(version).." gcc"
+ defaults.variables.CC = "env MACOSX_DEPLOYMENT_TARGET="..tostring(version).." clang"
+ defaults.variables.LD = "env MACOSX_DEPLOYMENT_TARGET="..tostring(version).." clang"
defaults.web_browser = "open"
end

View File

@@ -0,0 +1,145 @@
/*
This is a minimal/manual luarocks derivation used by `buildLuarocksPackage` to install lua packages.
As a nix user, you should use the generated lua.pkgs.luarocks that contains a luarocks manifest
which makes it recognizable to luarocks.
Generating the manifest for luarocks_bootstrap seemed too hackish, which is why we end up
with two "luarocks" derivations.
*/
{
lib,
stdenv,
fetchFromGitHub,
curl,
makeWrapper,
which,
unzip,
lua,
versionCheckHook,
# for 'luarocks pack'
zip,
nix-update-script,
# some packages need to be compiled with cmake
cmake,
installShellFiles,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "luarocks_bootstrap";
version = "3.12.2";
src = fetchFromGitHub {
owner = "luarocks";
repo = "luarocks";
tag = "v${finalAttrs.version}";
hash = "sha256-hQysstYGUcZnnEXL+9ECS0sBViYggeDIMgo6LpUexBA=";
};
patches = [
./darwin-3.7.0.patch
];
postPatch = lib.optionalString stdenv.targetPlatform.isDarwin ''
substituteInPlace src/luarocks/core/cfg.lua --subst-var-by 'darwinMinVersion' '${stdenv.targetPlatform.darwinMinVersion}'
'';
# Manually written ./configure does not support --build= or --host=:
# Error: Unknown flag: --build=x86_64-unknown-linux-gnu
configurePlatforms = [ ];
preConfigure = ''
lua -e "" || {
luajit -e "" && {
export LUA_SUFFIX=jit
appendToVar configureFlags "--lua-suffix=$LUA_SUFFIX"
}
}
lua_inc="$(echo "${lua}/include"/*/)"
if test -n "$lua_inc"; then
appendToVar configureFlags "--with-lua-include=$lua_inc"
fi
'';
nativeBuildInputs = [
makeWrapper
installShellFiles
lua
unzip
versionCheckHook
];
buildInputs = [
curl
which
];
postInstall = ''
sed -e "1s@.*@#! ${lua}/bin/lua$LUA_SUFFIX@" -i "$out"/bin/*
substituteInPlace $out/etc/luarocks/* \
--replace-quiet '${lua.luaOnBuild}' '${lua}'
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd luarocks \
--bash <($out/bin/luarocks completion bash) \
--fish <($out/bin/luarocks completion fish) \
--zsh <($out/bin/luarocks completion zsh)
installShellCompletion --cmd luarocks-admin \
--bash <($out/bin/luarocks-admin completion bash) \
--fish <($out/bin/luarocks-admin completion fish) \
--zsh <($out/bin/luarocks-admin completion zsh)
''
+ ''
for i in "$out"/bin/*; do
test -L "$i" || {
wrapProgram "$i" \
--suffix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?.lua" \
--suffix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?/init.lua" \
--suffix LUA_CPATH ";" "$(echo "$out"/lib/lua/*/)?.so" \
--suffix LUA_CPATH ";" "$(echo "$out"/share/lua/*/)?/init.lua" \
--suffix PATH : ${lib.makeBinPath finalAttrs.propagatedNativeBuildInputs}
}
done
'';
propagatedNativeBuildInputs = [
zip
unzip
cmake
];
doInstallCheck = true;
versionCheckProgram = "${placeholder "out"}/bin/luarocks";
versionCheckProgramArg = "--version";
# unpack hook for src.rock and rockspec files
setupHook = ./setup-hook.sh;
# cmake is just to compile packages with "cmake" buildType, not luarocks itself
dontUseCmakeConfigure = true;
shellHook = ''
export PATH="src/bin:''${PATH:-}"
export LUA_PATH="src/?.lua;''${LUA_PATH:-}"
'';
disallowedReferences = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
lua.luaOnBuild
];
passthru = {
updateScript = nix-update-script { };
};
meta = with lib; {
description = "Package manager for Lua";
license = licenses.mit;
maintainers = with maintainers; [
raskin
teto
];
mainProgram = "luarocks";
platforms = platforms.linux ++ platforms.darwin;
downloadPage = "http://luarocks.org/releases/";
};
})

View File

@@ -0,0 +1,46 @@
{
luarocks_bootstrap,
fetchFromGitHub,
unstableGitUpdater,
nurl,
file,
}:
luarocks_bootstrap.overrideAttrs (old: {
pname = "luarocks-nix";
version = "0-unstable-2024-05-31";
src = fetchFromGitHub {
owner = "nix-community";
repo = "luarocks-nix";
rev = "9d0440da358eac11afdbef392e2cf3272a8c7101";
hash = "sha256-9SC+YQ06u35LN3mPohG7Lz0eLXPsMGKG3mhS+0zSO7Y=";
};
propagatedNativeBuildInputs = old.propagatedNativeBuildInputs ++ [
file
nurl
];
patches = [ ];
doInstallCheck = false;
passthru = {
updateScript = unstableGitUpdater {
# tags incompletely inherited from regular luarocks
hardcodeZeroVersion = true;
};
};
# old.meta // { /* ... */ } doesn't update meta.position, which breaks the updateScript
meta = {
inherit (old.meta)
description
license
maintainers
platforms
;
mainProgram = "luarocks";
};
})

View File

@@ -0,0 +1,16 @@
unpackCmdHooks+=(_trySourceRock)
unpackCmdHooks+=(_tryRockSpec)
_tryRockSpec() {
if ! [[ "$curSrc" =~ \.rockspec$ ]]; then return 1; fi
}
_trySourceRock() {
if ! [[ "$curSrc" =~ \.src.rock$ ]]; then return 1; fi
# luarocks expects a clean <name>.rock.spec name to be the package name
# so we have to strip the hash
renamed="$(stripHash $curSrc)"
cp "$curSrc" "$renamed"
luarocks unpack --force "$renamed"
}

View File

@@ -0,0 +1,27 @@
{
lib,
pythonPackages,
fetchFromGitHub,
}:
pythonPackages.buildPythonApplication rec {
pname = "nixbang";
version = "0.1.2";
format = "setuptools";
namePrefix = "";
src = fetchFromGitHub {
owner = "madjar";
repo = "nixbang";
rev = version;
sha256 = "1kzk53ry60i814wa6n9y2ni0bcxhbi9p8gdv10b974gf23mhi8vc";
};
meta = {
homepage = "https://github.com/madjar/nixbang";
description = "Special shebang to run scripts in a nix-shell";
mainProgram = "nixbang";
maintainers = [ lib.maintainers.madjar ];
platforms = lib.platforms.all;
};
}

View File

@@ -0,0 +1,38 @@
{
lib,
stdenv,
fetchurl,
}:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
stdenv.mkDerivation rec {
pname = "patchelf";
version = "0.15.2";
src = fetchurl {
url = "https://github.com/NixOS/${pname}/releases/download/${version}/${pname}-${version}.tar.bz2";
sha256 = "sha256-F3RfVkFZyOIo/EEtplogSLhGxLa0Igt3y/IkFuAvLXw=";
};
strictDeps = true;
setupHook = [ ./setup-hook.sh ];
enableParallelBuilding = true;
# fails 8 out of 24 tests, problems when loading libc.so.6
doCheck = stdenv.name == "stdenv-linux";
meta = with lib; {
homepage = "https://github.com/NixOS/patchelf";
license = licenses.gpl3Plus;
description = "Small utility to modify the dynamic linker and RPATH of ELF executables";
mainProgram = "patchelf";
maintainers = [ ];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,20 @@
# This setup hook calls patchelf to automatically remove unneeded
# directories from the RPATH of every library or executable in every
# output.
fixupOutputHooks+=('if [ -z "${dontPatchELF-}" ]; then patchELF "$prefix"; fi')
patchELF() {
local dir="$1"
[ -e "$dir" ] || return 0
echo "shrinking RPATHs of ELF executables and libraries in $dir"
local i
while IFS= read -r -d $'\0' i; do
if [[ "$i" =~ .build-id ]]; then continue; fi
if ! isELF "$i"; then continue; fi
echo "shrinking $i"
patchelf --shrink-rpath "$i" || true
done < <(find "$dir" -type f -print0)
}

View File

@@ -0,0 +1,47 @@
{
lib,
stdenv,
autoreconfHook,
fetchFromGitHub,
unstableGitUpdater,
}:
stdenv.mkDerivation {
pname = "patchelf";
version = "0.18.0-unstable-2025-08-13";
src = fetchFromGitHub {
owner = "NixOS";
repo = "patchelf";
rev = "b49de1b3384e7928bf0df9a889fe5a4e7b3fbddf";
sha256 = "sha256-0AGK+ZPZDc7zTVAmG6jAAynQhh4nP8skVwOEV5hZKh0=";
};
# Drop test that fails on musl (?)
postPatch = lib.optionalString stdenv.hostPlatform.isMusl ''
substituteInPlace tests/Makefile.am \
--replace "set-rpath-library.sh" ""
'';
setupHook = [ ./setup-hook.sh ];
nativeBuildInputs = [ autoreconfHook ];
buildInputs = [ ];
doCheck = !stdenv.hostPlatform.isDarwin;
passthru = {
updateScript = unstableGitUpdater {
url = "https://github.com/NixOS/patchelf.git";
};
};
meta = with lib; {
homepage = "https://github.com/NixOS/patchelf";
license = licenses.gpl3;
description = "Small utility to modify the dynamic linker and RPATH of ELF executables";
mainProgram = "patchelf";
maintainers = [ ];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,89 @@
{
lib,
stdenv,
fetchFromGitHub,
# build inputs
cacert,
libuuid,
# build inputs (darwin)
readline,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "premake5";
version = "5.0.0-beta4";
src = fetchFromGitHub {
owner = "premake";
repo = "premake-core";
rev = "v${finalAttrs.version}";
sha256 = "sha256-sNLCyIHWDW/8jIrMFCZAqtWsh4SRugqtPR4HaoW/Vzk=";
};
buildInputs = [
libuuid
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
readline
];
patches = [ ./no-curl-ca.patch ];
postPatch = ''
substituteInPlace contrib/curl/premake5.lua \
--replace-fail "ca = nil" "ca = '${cacert}/etc/ssl/certs/ca-bundle.crt'"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace premake5.lua \
--replace-fail '"-arch arm64"' '""' \
--replace-fail '"-arch x86_64"' '""'
''
+ lib.optionalString stdenv.hostPlatform.isStatic ''
substituteInPlace \
binmodules/example/premake5.lua \
binmodules/luasocket/premake5.lua \
--replace-fail SharedLib StaticLib
'';
buildPhase =
if stdenv.hostPlatform.isDarwin then
# Error compiling the builtin zlib source, but it's not used currently
''
make PREMAKE_OPTS="--zlib-src=none" \
PLATFORM="Universal" \
-f Bootstrap.mak osx
''
else
''
make PLATFORM=${stdenv.hostPlatform.linuxArch} \
-f Bootstrap.mak linux
'';
env.NIX_CFLAGS_COMPILE = toString (
lib.optionals stdenv.cc.isClang [
"-Wno-error=implicit-function-declaration"
]
);
installPhase = ''
install -Dm755 bin/release/premake5 $out/bin/premake5
'';
premake_cmd = "premake5";
setupHook = ./setup-hook.sh;
meta = {
homepage = "https://premake.github.io";
description = "Simple build configuration and project generation tool using lua";
mainProgram = "premake5";
license = lib.licenses.bsd3;
maintainers = [ lib.maintainers.sarahec ];
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
};
})

View File

@@ -0,0 +1,38 @@
{
lib,
stdenv,
fetchurl,
unzip,
}:
stdenv.mkDerivation rec {
pname = "premake";
version = "4.3";
src = fetchurl {
url = "mirror://sourceforge/premake/premake-${version}-src.zip";
sha256 = "1017rd0wsjfyq2jvpjjhpszaa7kmig6q1nimw76qx3cjz2868lrn";
};
nativeBuildInputs = [ unzip ];
buildPhase = ''
make -C build/gmake.unix/
'';
installPhase = ''
install -Dm755 bin/release/premake4 $out/bin/premake4
'';
premake_cmd = "premake4";
setupHook = ./setup-hook.sh;
meta = with lib; {
description = "Simple build configuration and project generation tool using lua";
homepage = "https://premake.github.io/";
license = lib.licenses.bsd3;
maintainers = [ maintainers.bjornfor ];
mainProgram = "premake4";
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,38 @@
From a26e36d55cd2447488e01b2ff4ac65e2596862cd Mon Sep 17 00:00:00 2001
From: Ellie Hermaszewska <git@monoid.al>
Date: Mon, 3 Oct 2022 16:50:33 +0800
Subject: [PATCH] Do not set CURL_CA_BUNDLE
---
contrib/curl/premake5.lua | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/contrib/curl/premake5.lua b/contrib/curl/premake5.lua
index 474f5cfa..553bbd02 100644
--- a/contrib/curl/premake5.lua
+++ b/contrib/curl/premake5.lua
@@ -36,21 +36,6 @@ project "curl-lib"
-- find the location of the ca bundle
local ca = nil
- for _, f in ipairs {
- "/etc/ssl/certs/ca-certificates.crt",
- "/etc/openssl/certs/ca-certificates.crt",
- "/etc/pki/tls/certs/ca-bundle.crt",
- "/usr/share/ssl/certs/ca-bundle.crt",
- "/usr/local/share/certs/ca-root.crt",
- "/usr/local/share/certs/ca-root-nss.crt",
- "/etc/certs/ca-certificates.crt",
- "/etc/ssl/cert.pem",
- "/boot/system/data/ssl/CARootCertificates.pem" } do
- if os.isfile(f) then
- ca = f
- break
- end
- end
if ca then
defines { 'CURL_CA_BUNDLE="' .. ca .. '"', 'CURL_CA_PATH="' .. path.getdirectory(ca) .. '"' }
end
--
2.37.2

View File

@@ -0,0 +1,20 @@
# shellcheck shell=bash
premakeConfigurePhase() {
runHook preConfigure
local flagsArray=(
${premakefile:+--file=$premakefile}
)
concatTo flagsArray premakeFlags premakeFlagsArray premakeBackend=gmake
echoCmd 'configure flags' "${flagsArray[@]}"
@premake_cmd@ "${flagsArray[@]}"
runHook postConfigure
}
if [ -z "${configurePhase-}" ]; then
configurePhase=premakeConfigurePhase
fi

View File

@@ -0,0 +1,72 @@
{
lib,
stdenv,
fetchsvn,
wrapQtAppsHook,
qtbase,
qttools,
qmake,
bison,
flex,
}:
stdenv.mkDerivation {
pname = "qtspim";
version = "9.1.23";
src = fetchsvn {
url = "https://svn.code.sf.net/p/spimsimulator/code/";
rev = "r749";
sha256 = "0iazl7mlcilrdbw8gb98v868a8ldw2lmkn1xs8hnfvr93l6aj0rp";
};
postPatch = ''
cd QtSpim
substituteInPlace QtSpim.pro --replace /usr/lib/qtspim/lib $out/lib
substituteInPlace menu.cpp \
--replace /usr/lib/qtspim/bin/assistant ${qttools.dev}/bin/assistant \
--replace /usr/lib/qtspim/help/qtspim.qhc $out/share/help/qtspim.qhc
substituteInPlace ../Setup/qtspim_debian_deployment/qtspim.desktop \
--replace /usr/bin/qtspim qtspim \
--replace /usr/lib/qtspim/qtspim.png qtspim
'';
nativeBuildInputs = [
wrapQtAppsHook
qttools
qmake
bison
flex
];
buildInputs = [ qtbase ];
QT_PLUGIN_PATH = "${qtbase}/${qtbase.qtPluginPrefix}";
qmakeFlags = [
"QtSpim.pro"
"-spec"
"linux-g++"
"CONFIG+=release"
];
installPhase = ''
runHook preInstall
install -D QtSpim $out/bin/qtspim
install -D ../Setup/qtspim_debian_deployment/copyright $out/share/licenses/qtspim/copyright
install -D ../Setup/qtspim_debian_deployment/qtspim.desktop $out/share/applications/qtspim.desktop
install -D ../Setup/NewIcon48x48.png $out/share/icons/hicolor/48x48/apps/qtspim.png
install -D ../Setup/NewIcon256x256.png $out/share/icons/hicolor/256x256/apps/qtspim.png
cp -r help $out/share/help
runHook postInstall
'';
meta = with lib; {
description = "New user interface for spim, a MIPS simulator";
mainProgram = "qtspim";
homepage = "https://spimsimulator.sourceforge.net/";
license = licenses.bsdOriginal;
maintainers = with maintainers; [ emilytrau ];
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,49 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
gdb,
kdePackages,
wrapQtAppsHook,
}:
stdenv.mkDerivation rec {
pname = "seer";
version = "2.5";
src = fetchFromGitHub {
owner = "epasveer";
repo = "seer";
rev = "v${version}";
sha256 = "sha256-+3yghoK8fAM6UFomv1Ga05kxwsLcoL2CpuIDXkFfWHc=";
};
preConfigure = ''
cd src
'';
patchPhase = ''
substituteInPlace src/{SeerGdbConfigPage,SeerMainWindow,SeerGdbWidget}.cpp \
--replace-fail "/usr/bin/gdb" "${gdb}/bin/gdb"
'';
buildInputs = with kdePackages; [
qtbase
qtcharts
qtsvg
];
nativeBuildInputs = [
cmake
kdePackages.wrapQtAppsHook
];
meta = with lib; {
description = "Qt gui frontend for GDB";
mainProgram = "seergdb";
homepage = "https://github.com/epasveer/seer";
license = licenses.gpl3Only;
platforms = platforms.linux;
maintainers = with maintainers; [ foolnotion ];
};
}

View File

@@ -0,0 +1,60 @@
{
stdenv,
lib,
perlPackages,
makeWrapper,
shortenPerlShebang,
mysqlSupport ? false,
postgresqlSupport ? false,
sqliteSupport ? false,
templateToolkitSupport ? false,
}:
let
sqitch = perlPackages.AppSqitch;
modules =
with perlPackages;
[ AlgorithmBackoff ]
++ lib.optional mysqlSupport DBDmysql
++ lib.optional postgresqlSupport DBDPg
++ lib.optional sqliteSupport DBDSQLite
++ lib.optional templateToolkitSupport TemplateToolkit;
in
stdenv.mkDerivation {
pname = "sqitch";
version = sqitch.version;
nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.hostPlatform.isDarwin shortenPerlShebang;
src = sqitch;
dontBuild = true;
installPhase = ''
mkdir -p $out/bin
for d in bin/sqitch etc lib share ; do
# make sure dest alreay exists before symlink
# this prevents installing a broken link into the path
if [ -e ${sqitch}/$d ]; then
ln -s ${sqitch}/$d $out/$d
fi
done
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
shortenPerlShebang $out/bin/sqitch
'';
dontStrip = true;
postFixup = ''
wrapProgram $out/bin/sqitch --prefix PERL5LIB : ${lib.escapeShellArg (perlPackages.makeFullPerlPath modules)}
'';
meta = {
inherit (sqitch.meta)
description
homepage
license
platforms
;
mainProgram = "sqitch";
};
}

View File

@@ -0,0 +1,141 @@
{
lib,
stdenv,
buildPackages,
fetchurl,
perl,
libintl,
bashNonInteractive,
updateAutotoolsGnuConfigScriptsHook,
gawk,
freebsd,
glibcLocales,
libiconv,
# we are a dependency of gcc, this simplifies bootstrapping
interactive ? false,
ncurses,
procps,
meta,
}:
{
version,
hash,
patches ? [ ],
}:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
let
inherit (lib)
getBin
getDev
getLib
optional
optionals
optionalString
versionOlder
;
crossBuildTools = stdenv.hostPlatform != stdenv.buildPlatform;
in
stdenv.mkDerivation {
pname = "texinfo${optionalString interactive "-interactive"}";
inherit version;
src = fetchurl {
url = "mirror://gnu/texinfo/texinfo-${version}.tar.xz";
inherit hash;
};
patches = patches ++ optional crossBuildTools ./cross-tools-flags.patch;
postPatch = ''
patchShebangs tp/maintain/regenerate_commands_perl_info.pl
'';
env = {
XFAIL_TESTS = toString (
optionals stdenv.hostPlatform.isMusl [
# musl does not support locales.
"different_languages_gen_master_menu.sh"
"test_scripts/formatting_documentlanguage_cmdline.sh"
"test_scripts/layout_formatting_fr_info.sh"
"test_scripts/layout_formatting_fr.sh"
"test_scripts/layout_formatting_fr_icons.sh"
]
++ optionals (!stdenv.hostPlatform.isMusl && versionOlder version "7") [
# Test is known to fail on various locales on texinfo-6.8:
# https://lists.gnu.org/r/bug-texinfo/2021-07/msg00012.html
"test_scripts/layout_formatting_fr_icons.sh"
]
);
}
// lib.optionalAttrs crossBuildTools {
# ncurses is required to build `makedoc'
# this feature is introduced by the ./cross-tools-flags.patch
NATIVE_TOOLS_CFLAGS = "-I${getDev buildPackages.ncurses}/include";
NATIVE_TOOLS_LDFLAGS = "-L${getLib buildPackages.ncurses}/lib";
};
strictDeps = true;
enableParallelBuilding = true;
# A native compiler is needed to build tools needed at build time
depsBuildBuild = [
buildPackages.stdenv.cc
perl
];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
buildInputs = [
bashNonInteractive
libintl
]
++ optionals stdenv.hostPlatform.isSunOS [
libiconv
gawk
]
++ optional interactive ncurses;
configureFlags = [
"PERL=${buildPackages.perl}/bin/perl"
]
# Perl XS modules are difficult to cross-compile and texinfo has pure Perl
# fallbacks.
# Also prevent the buildPlatform's awk being used in the texindex script
++ optionals crossBuildTools [
"--enable-perl-xs=no"
"TI_AWK=${getBin gawk}/bin/awk"
]
++ optionals (crossBuildTools && lib.versionAtLeast version "7.1") [
"texinfo_cv_sys_iconv_converts_euc_cn=yes"
]
++ optional stdenv.hostPlatform.isSunOS "AWK=${gawk}/bin/awk";
installFlags = [ "TEXMF=$(out)/texmf-dist" ];
installTargets = [
"install"
"install-tex"
];
nativeCheckInputs = [ procps ] ++ optionals stdenv.buildPlatform.isFreeBSD [ freebsd.locale ];
checkInputs = optionals (lib.versionAtLeast version "7.2") [ glibcLocales ];
doCheck = interactive && !stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isSunOS; # flaky
postFixup = optionalString crossBuildTools ''
for f in "$out"/bin/{pod2texi,texi2any}; do
substituteInPlace "$f" \
--replace-fail ${buildPackages.perl}/bin/perl ${perl}/bin/perl
done
'';
meta = meta // {
branch = version;
};
}

View File

@@ -0,0 +1,13 @@
diff -ur texinfo-6.5/configure texinfo-6.5-patched/configure
--- texinfo-6.5/configure 2017-09-13 03:50:18.000000000 +0900
+++ texinfo-6.5-patched/configure 2019-12-28 17:39:06.692818866 +0900
@@ -23281,7 +23281,7 @@
# env -i gives this build host configure a clean environment;
# consequently, we have to re-initialize $PATH.
- env -i CC="$BUILD_CC" AR="$BUILD_AR" RANLIB="$BUILD_RANLIB" \
- PATH="$PATH" \
+ env -i CC="$CC_FOR_BUILD" AR="$AR_FOR_BUILD" RANLIB="$RANLIB_FOR_BUILD" \
+ PATH="$PATH" CFLAGS="$NATIVE_TOOLS_CFLAGS" LDFLAGS="$NATIVE_TOOLS_LDFLAGS" \
tools_only=1 \
${confdir}/configure --build=${build} --host=${build} \
--disable-rpath --disable-nls

View File

@@ -0,0 +1,186 @@
Patch by Vitezslav Crhonek <vcrhonek@redhat.com>
Source: https://src.fedoraproject.org/rpms/texinfo/c/9b2cca4817fa4bd8d520fed05e9560fc7183dcdf?branch=rawhide
diff -up texinfo-6.8/gnulib/lib/cdefs.h.orig texinfo-6.8/gnulib/lib/cdefs.h
--- texinfo-6.8/gnulib/lib/cdefs.h.orig 2021-03-11 19:57:53.000000000 +0100
+++ texinfo-6.8/gnulib/lib/cdefs.h 2021-07-19 12:26:46.985176475 +0200
@@ -321,15 +321,15 @@
/* The nonnull function attribute marks pointer parameters that
must not be NULL. */
-#ifndef __attribute_nonnull__
+#ifndef __nonnull
# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
-# define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params))
+# define __nonnull(params) __attribute__ ((__nonnull__ params))
# else
-# define __attribute_nonnull__(params)
+# define __nonnull(params)
# endif
-#endif
-#ifndef __nonnull
-# define __nonnull(params) __attribute_nonnull__ (params)
+#elif !defined __GLIBC__
+# undef __nonnull
+# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params)
#endif
/* If fortification mode, we warn about unused results of certain
diff -up texinfo-6.8/gnulib/lib/libc-config.h.orig texinfo-6.8/gnulib/lib/libc-config.h
--- texinfo-6.8/gnulib/lib/libc-config.h.orig 2021-03-11 19:57:54.000000000 +0100
+++ texinfo-6.8/gnulib/lib/libc-config.h 2021-07-19 12:27:58.810590975 +0200
@@ -33,9 +33,9 @@
#include <config.h>
/* On glibc this includes <features.h> and <sys/cdefs.h> and #defines
- _FEATURES_H, __WORDSIZE, and __set_errno. On FreeBSD 11 and
- DragonFlyBSD 5.9 it includes <sys/cdefs.h> which defines __nonnull.
- Elsewhere it is harmless. */
+ _FEATURES_H, __WORDSIZE, and __set_errno. On FreeBSD 11 it
+ includes <sys/cdefs.h> which defines __nonnull. Elsewhere it
+ is harmless. */
#include <errno.h>
/* From glibc <errno.h>. */
diff -up texinfo-6.8/gnulib/lib/malloc/dynarray-skeleton.c.orig texinfo-6.8/gnulib/lib/malloc/dynarray-skeleton.c
--- texinfo-6.8/gnulib/lib/malloc/dynarray-skeleton.c.orig 2021-03-11 19:57:54.000000000 +0100
+++ texinfo-6.8/gnulib/lib/malloc/dynarray-skeleton.c 2021-07-19 12:24:46.878419397 +0200
@@ -192,7 +192,7 @@ DYNARRAY_NAME (free__array__) (struct DY
/* Initialize a dynamic array object. This must be called before any
use of the object. */
-__attribute_nonnull__ ((1))
+__nonnull ((1))
static void
DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list)
{
@@ -202,7 +202,7 @@ DYNARRAY_NAME (init) (struct DYNARRAY_ST
}
/* Deallocate the dynamic array and its elements. */
-__attribute_maybe_unused__ __attribute_nonnull__ ((1))
+__attribute_maybe_unused__ __nonnull ((1))
static void
DYNARRAY_FREE (struct DYNARRAY_STRUCT *list)
{
@@ -213,7 +213,7 @@ DYNARRAY_FREE (struct DYNARRAY_STRUCT *l
}
/* Return true if the dynamic array is in an error state. */
-__attribute_nonnull__ ((1))
+__nonnull ((1))
static inline bool
DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list)
{
@@ -222,7 +222,7 @@ DYNARRAY_NAME (has_failed) (const struct
/* Mark the dynamic array as failed. All elements are deallocated as
a side effect. */
-__attribute_nonnull__ ((1))
+__nonnull ((1))
static void
DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list)
{
@@ -236,7 +236,7 @@ DYNARRAY_NAME (mark_failed) (struct DYNA
/* Return the number of elements which have been added to the dynamic
array. */
-__attribute_nonnull__ ((1))
+__nonnull ((1))
static inline size_t
DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list)
{
@@ -245,7 +245,7 @@ DYNARRAY_NAME (size) (const struct DYNAR
/* Return a pointer to the array element at INDEX. Terminate the
process if INDEX is out of bounds. */
-__attribute_nonnull__ ((1))
+__nonnull ((1))
static inline DYNARRAY_ELEMENT *
DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index)
{
@@ -257,7 +257,7 @@ DYNARRAY_NAME (at) (struct DYNARRAY_STRU
/* Return a pointer to the first array element, if any. For a
zero-length array, the pointer can be NULL even though the dynamic
array has not entered the failure state. */
-__attribute_nonnull__ ((1))
+__nonnull ((1))
static inline DYNARRAY_ELEMENT *
DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list)
{
@@ -267,7 +267,7 @@ DYNARRAY_NAME (begin) (struct DYNARRAY_S
/* Return a pointer one element past the last array element. For a
zero-length array, the pointer can be NULL even though the dynamic
array has not entered the failure state. */
-__attribute_nonnull__ ((1))
+__nonnull ((1))
static inline DYNARRAY_ELEMENT *
DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list)
{
@@ -294,7 +294,7 @@ DYNARRAY_NAME (add__) (struct DYNARRAY_S
/* Add ITEM at the end of the array, enlarging it by one element.
Mark *LIST as failed if the dynamic array allocation size cannot be
increased. */
-__attribute_nonnull__ ((1))
+__nonnull ((1))
static inline void
DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item)
{
@@ -348,8 +348,7 @@ DYNARRAY_NAME (emplace__) (struct DYNARR
/* Allocate a place for a new element in *LIST and return a pointer to
it. The pointer can be NULL if the dynamic array cannot be
enlarged due to a memory allocation failure. */
-__attribute_maybe_unused__ __attribute_warn_unused_result__
-__attribute_nonnull__ ((1))
+__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1))
static
/* Avoid inlining with the larger initialization code. */
#if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE))
@@ -373,7 +372,7 @@ DYNARRAY_NAME (emplace) (struct DYNARRAY
existing size, new elements are added (which can be initialized).
Otherwise, the list is truncated, and elements are freed. Return
false on memory allocation failure (and mark *LIST as failed). */
-__attribute_maybe_unused__ __attribute_nonnull__ ((1))
+__attribute_maybe_unused__ __nonnull ((1))
static bool
DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size)
{
@@ -418,7 +417,7 @@ DYNARRAY_NAME (resize) (struct DYNARRAY_
}
/* Remove the last element of LIST if it is present. */
-__attribute_maybe_unused__ __attribute_nonnull__ ((1))
+__attribute_maybe_unused__ __nonnull ((1))
static void
DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list)
{
@@ -435,7 +434,7 @@ DYNARRAY_NAME (remove_last) (struct DYNA
/* Remove all elements from the list. The elements are freed, but the
list itself is not. */
-__attribute_maybe_unused__ __attribute_nonnull__ ((1))
+__attribute_maybe_unused__ __nonnull ((1))
static void
DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list)
{
@@ -453,8 +452,7 @@ DYNARRAY_NAME (clear) (struct DYNARRAY_S
stored in *RESULT if LIST refers to an empty list. On success, the
pointer in *RESULT is heap-allocated and must be deallocated using
free. */
-__attribute_maybe_unused__ __attribute_warn_unused_result__
-__attribute_nonnull__ ((1, 2))
+__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1, 2))
static bool
DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list,
DYNARRAY_FINAL_TYPE *result)
@@ -485,8 +483,7 @@ DYNARRAY_NAME (finalize) (struct DYNARRA
have a sentinel at the end). If LENGTHP is not NULL, the array
length is written to *LENGTHP. *LIST is re-initialized and can be
reused. */
-__attribute_maybe_unused__ __attribute_warn_unused_result__
-__attribute_nonnull__ ((1))
+__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1))
static DYNARRAY_ELEMENT *
DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp)
{

View File

@@ -0,0 +1,77 @@
{
lib,
stdenv,
buildPackages,
callPackage,
fetchurl,
perl,
libintl,
bashNonInteractive,
updateAutotoolsGnuConfigScriptsHook,
gawk,
freebsd,
libiconv,
# we are a dependency of gcc, this simplifies bootstrapping
interactive ? false,
ncurses,
procps,
}:
let
meta = {
description = "GNU documentation system";
homepage = "https://www.gnu.org/software/texinfo/";
changelog = "https://git.savannah.gnu.org/cgit/texinfo.git/plain/NEWS";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ oxij ];
longDescription = ''
Texinfo is the official documentation format of the GNU project.
It was invented by Richard Stallman and Bob Chassell many years
ago, loosely based on Brian Reid's Scribe and other formatting
languages of the time. It is used by many non-GNU projects as
well.
Texinfo uses a single source file to produce output in a number
of formats, both online and printed (dvi, html, info, pdf, xml,
etc.). This means that instead of writing different documents
for online information and another for a printed manual, you
need write only one document. And when the work is revised, you
need revise only that one document. The Texinfo system is
well-integrated with GNU Emacs.
'';
mainProgram = "texi2any";
};
buildTexinfo = callPackage ./common.nix {
inherit
lib
stdenv
buildPackages
updateAutotoolsGnuConfigScriptsHook
fetchurl
perl
libintl
libiconv
bashNonInteractive
gawk
freebsd
ncurses
procps
meta
interactive
;
};
in
{
texinfo6 = buildTexinfo {
version = "6.8";
hash = "sha256-jrdT7Si8oh+PVsGhgDYq7XiSKb1i//WL+DaOm+tZ/sQ=";
patches = [ ./fix-glibc-2.34.patch ];
};
texinfo7 = buildTexinfo {
version = "7.2";
hash = "sha256-AynXeI++8RP6gsuAiJyhl6NEzg33ZG/gAJdMXXFDY6Y=";
};
}

View File

@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'watson-ruby'

View File

@@ -0,0 +1,15 @@
GEM
remote: https://rubygems.org/
specs:
json (2.1.0)
watson-ruby (1.6.3)
json
PLATFORMS
ruby
DEPENDENCIES
watson-ruby
BUNDLED WITH
2.1.4

View File

@@ -0,0 +1,42 @@
{
lib,
stdenv,
bundlerEnv,
ruby,
bundlerUpdateScript,
}:
stdenv.mkDerivation rec {
pname = "watson-ruby";
version = (import ./gemset.nix).watson-ruby.version;
dontUnpack = true;
installPhase =
let
env = bundlerEnv {
name = "watson-ruby-gems-${version}";
inherit ruby;
# expects Gemfile, Gemfile.lock and gemset.nix in the same directory
gemdir = ./.;
};
in
''
mkdir -p $out/bin
ln -s ${env}/bin/watson $out/bin/watson
'';
passthru.updateScript = bundlerUpdateScript "watson-ruby";
meta = with lib; {
description = "Inline issue manager";
homepage = "https://goosecode.com/watson/";
license = with licenses; mit;
maintainers = with maintainers; [
robertodr
nicknovitski
];
mainProgram = "watson";
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,18 @@
{
json = {
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "01v6jjpvh3gnq6sgllpfqahlgxzj50ailwhj9b3cd20hi2dx0vxp";
type = "gem";
};
version = "2.1.0";
};
watson-ruby = {
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "1d5m29nr0i030q8ygmbapwri5ndcg2q6lf8a15bk79lfcp9xyj9w";
type = "gem";
};
version = "1.6.3";
};
}

View File

@@ -0,0 +1,39 @@
{
lib,
python3,
fetchFromGitHub,
clang-unwrapped,
}:
python3.pkgs.buildPythonApplication rec {
pname = "whatstyle";
version = "0.2.0";
format = "setuptools";
src = fetchFromGitHub {
owner = "mikr";
repo = pname;
rev = "v${version}";
sha256 = "sha256-4LCZAEUQFPl4CBPeuqsodiAlwd8uBg+SudF5d+Vz4Gc=";
};
# Fix references to previous version, to avoid confusion:
postPatch = ''
substituteInPlace setup.py --replace 0.1.6 ${version}
substituteInPlace ${pname}.py --replace 0.1.6 ${version}
'';
nativeCheckInputs = [
clang-unwrapped # clang-format
];
doCheck = false; # 3 or 4 failures depending on version, haven't investigated.
meta = with lib; {
description = "Find a code format style that fits given source files";
mainProgram = "whatstyle";
homepage = "https://github.com/mikr/whatstyle";
license = licenses.mit;
maintainers = [ ];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,68 @@
{
lib,
stdenv,
fetchFromGitHub,
docutils,
bison,
flex,
libsForQt5,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "xxdiff";
version = "5.1-unstable-2025-03-21";
src = fetchFromGitHub {
owner = "blais";
repo = "xxdiff";
rev = "a5593c1c675fb79d0ec2b6e353abba1fb0179aa7";
hash = "sha256-nRXvqhO128XsAFy4KrsrSYKpzWnciXGJV6QkuqRa07w=";
};
nativeBuildInputs = [
bison
docutils
flex
libsForQt5.qmake
libsForQt5.wrapQtAppsHook
];
buildInputs = [ libsForQt5.qtbase ];
dontUseQmakeConfigure = true;
# c++11 and above is needed for building with Qt 5.9+
env.NIX_CFLAGS_COMPILE = toString [ "-std=c++14" ];
sourceRoot = "${finalAttrs.src.name}/src";
postPatch = ''
substituteInPlace xxdiff.pro \
--replace-fail "../bin" "./bin"
'';
preConfigure = ''
make -f Makefile.bootstrap
'';
installPhase = ''
runHook preInstall
install -Dm555 -t $out/bin ./bin/xxdiff
install -Dm444 -t $out/share/doc/xxdiff ${finalAttrs.src}/README.rst
runHook postInstall
'';
meta = {
description = "Graphical file and directories comparator and merge tool";
mainProgram = "xxdiff";
homepage = "http://furius.ca/xxdiff/";
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [
pSub
raskin
];
platforms = lib.platforms.linux;
};
})

View File

@@ -0,0 +1,60 @@
{
lib,
buildPythonApplication,
fetchPypi,
stdenv,
click,
coloredlogs,
mido,
psutil,
pycyphal,
pysdl2,
python-rtmidi,
ruamel-yaml,
requests,
scipy,
simplejson,
}:
buildPythonApplication rec {
pname = "yakut";
version = "0.14.1";
format = "setuptools";
src = fetchPypi {
inherit pname version;
hash = "sha256-wCchb0bSnwlEwgb/Oe0gHnkEU3F+cotlvv/WXAr72i8=";
};
buildInputs = [
(lib.getLib stdenv.cc.cc)
];
dependencies = [
click
coloredlogs
psutil
pycyphal
ruamel-yaml
requests
scipy
simplejson
];
optional-dependencies.joystick = [
pysdl2
mido
python-rtmidi
];
# All these require extra permissions and/or actual hardware connected
doCheck = false;
meta = with lib; {
description = "Simple CLI tool for diagnostics and debugging of Cyphal networks";
longDescription = ''
Yakút is a simple cross-platform command-line interface (CLI) tool for diagnostics and debugging of Cyphal networks. By virtue of being based on PyCyphal, Yakut supports all Cyphal transports (UDP, serial, CAN, ...) and is compatible with all major features of the protocol. It is designed to be usable with GNU/Linux, Windows, and macOS.
'';
homepage = "https://github.com/OpenCyphal/yakut/";
license = licenses.mit;
teams = [ teams.ororatech ];
};
}