Merge commit '3ab2949' from staging into master

Conflicts:
	pkgs/development/compilers/llvm/6/llvm.nix
	pkgs/servers/home-assistant/component-packages.nix
This commit is contained in:
Tuomas Tynkkynen 2018-03-15 22:30:56 +02:00
commit ef64208eba
323 changed files with 2064 additions and 3432 deletions

View File

@ -177,5 +177,19 @@ you need it.</para>
</section> </section>
<section xml:id="ssec-perl-cross-compilation"><title>Cross-compiling modules</title>
<para>Nixpkgs has experimental support for cross-compiling Perl
modules. In many cases, it will just work out of the box, even for
modules with native extensions. Sometimes, however, the Makefile.PL
for a module may (indirectly) import a native module. In that case,
you will need to make a stub for that module that will satisfy the
Makefile.PL and install it into
<filename>lib/perl5/site_perl/cross_perl/${perl.version}</filename>.
See the <varname>postInstall</varname> for <varname>DBI</varname> for
an example.</para>
</section>
</section> </section>

View File

@ -87,7 +87,7 @@ let
echo "for hints about the offending path)." echo "for hints about the offending path)."
exit 1 exit 1
fi fi
${libxslt.bin}/bin/xsltproc \ ${buildPackages.libxslt.bin}/bin/xsltproc \
--stringparam revision '${revision}' \ --stringparam revision '${revision}' \
-o $out ${./options-to-docbook.xsl} $optionsXML -o $out ${./options-to-docbook.xsl} $optionsXML
''; '';
@ -139,7 +139,7 @@ let
manual-combined = runCommand "nixos-manual-combined" manual-combined = runCommand "nixos-manual-combined"
{ inherit sources; { inherit sources;
buildInputs = [ libxml2 libxslt ]; nativeBuildInputs = [ buildPackages.libxml2 buildPackages.libxslt ];
meta.description = "The NixOS manual as plain docbook XML"; meta.description = "The NixOS manual as plain docbook XML";
} }
'' ''
@ -194,7 +194,7 @@ let
olinkDB = runCommand "manual-olinkdb" olinkDB = runCommand "manual-olinkdb"
{ inherit sources; { inherit sources;
buildInputs = [ libxml2 libxslt ]; nativeBuildInputs = [ buildPackages.libxml2 buildPackages.libxslt ];
} }
'' ''
xsltproc \ xsltproc \
@ -244,7 +244,7 @@ in rec {
# Generate the NixOS manual. # Generate the NixOS manual.
manual = runCommand "nixos-manual" manual = runCommand "nixos-manual"
{ inherit sources; { inherit sources;
buildInputs = [ libxml2 libxslt ]; nativeBuildInputs = [ buildPackages.libxml2 buildPackages.libxslt ];
meta.description = "The NixOS manual in HTML format"; meta.description = "The NixOS manual in HTML format";
allowedReferences = ["out"]; allowedReferences = ["out"];
} }
@ -302,7 +302,7 @@ in rec {
# Generate the NixOS manpages. # Generate the NixOS manpages.
manpages = runCommand "nixos-manpages" manpages = runCommand "nixos-manpages"
{ inherit sources; { inherit sources;
buildInputs = [ libxml2 libxslt ]; nativeBuildInputs = [ buildPackages.libxml2 buildPackages.libxslt ];
allowedReferences = ["out"]; allowedReferences = ["out"];
} }
'' ''

View File

@ -10,7 +10,7 @@ with lib;
i18n = { i18n = {
glibcLocales = mkOption { glibcLocales = mkOption {
type = types.path; type = types.path;
default = pkgs.glibcLocales.override { default = pkgs.buildPackages.glibcLocales.override {
allLocales = any (x: x == "all") config.i18n.supportedLocales; allLocales = any (x: x == "all") config.i18n.supportedLocales;
locales = config.i18n.supportedLocales; locales = config.i18n.supportedLocales;
}; };

View File

@ -36,6 +36,7 @@ with lib;
networkmanager-vpnc = pkgs.networkmanager-vpnc.override { withGnome = false; }; networkmanager-vpnc = pkgs.networkmanager-vpnc.override { withGnome = false; };
networkmanager-iodine = pkgs.networkmanager-iodine.override { withGnome = false; }; networkmanager-iodine = pkgs.networkmanager-iodine.override { withGnome = false; };
pinentry = pkgs.pinentry_ncurses; pinentry = pkgs.pinentry_ncurses;
gobjectIntrospection = pkgs.gobjectIntrospection.override { x11Support = false; };
}; };
}; };
} }

View File

@ -93,7 +93,7 @@ in
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
ExecStop = "${pkgs.stdenv.shell} -c 'echo 1 > /sys/class/block/${dev}/reset'"; ExecStop = "${pkgs.runtimeShell} -c 'echo 1 > /sys/class/block/${dev}/reset'";
}; };
script = '' script = ''
set -u set -u

View File

@ -75,10 +75,10 @@ in
# Create /dev/nvidia-uvm when the nvidia-uvm module is loaded. # Create /dev/nvidia-uvm when the nvidia-uvm module is loaded.
services.udev.extraRules = services.udev.extraRules =
'' ''
KERNEL=="nvidia", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidiactl c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 255'" KERNEL=="nvidia", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidiactl c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 255'"
KERNEL=="nvidia_modeset", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidia-modeset c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 254'" KERNEL=="nvidia_modeset", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidia-modeset c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 254'"
KERNEL=="card*", SUBSYSTEM=="drm", DRIVERS=="nvidia", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidia%n c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) %n'" KERNEL=="card*", SUBSYSTEM=="drm", DRIVERS=="nvidia", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidia%n c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) %n'"
KERNEL=="nvidia_uvm", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidia-uvm c $(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 0'" KERNEL=="nvidia_uvm", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidia-uvm c $(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 0'"
''; '';
boot.blacklistedKernelModules = [ "nouveau" "nvidiafb" ]; boot.blacklistedKernelModules = [ "nouveau" "nvidiafb" ];

View File

@ -61,7 +61,7 @@ in
inherit (config.nixpkgs) config overlays system; inherit (config.nixpkgs) config overlays system;
} }
''; '';
default = import ../../.. { inherit (cfg) config overlays system; }; default = import ../../.. { inherit (cfg) config overlays system crossSystem; };
type = pkgsType; type = pkgsType;
example = literalExample ''import <nixpkgs> {}''; example = literalExample ''import <nixpkgs> {}'';
description = '' description = ''
@ -130,6 +130,18 @@ in
''; '';
}; };
crossSystem = mkOption {
type = types.nullOr types.attrs;
default = null;
description = ''
The description of the system we're cross-compiling to, or null
if this isn't a cross-compile. See the description of the
crossSystem argument in the nixpkgs manual.
Ignored when <code>nixpkgs.pkgs</code> is set.
'';
};
system = mkOption { system = mkOption {
type = types.str; type = types.str;
example = "i686-linux"; example = "i686-linux";

View File

@ -6,7 +6,7 @@ let
cfg = config.programs.rootston; cfg = config.programs.rootston;
rootstonWrapped = pkgs.writeScriptBin "rootston" '' rootstonWrapped = pkgs.writeScriptBin "rootston" ''
#! ${pkgs.stdenv.shell} #! ${pkgs.runtimeShell}
if [[ "$#" -ge 1 ]]; then if [[ "$#" -ge 1 ]]; then
exec ${pkgs.rootston}/bin/rootston "$@" exec ${pkgs.rootston}/bin/rootston "$@"
else else

View File

@ -13,7 +13,7 @@ let
askPasswordWrapper = pkgs.writeScript "ssh-askpass-wrapper" askPasswordWrapper = pkgs.writeScript "ssh-askpass-wrapper"
'' ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
export DISPLAY="$(systemctl --user show-environment | ${pkgs.gnused}/bin/sed 's/^DISPLAY=\(.*\)/\1/; t; d')" export DISPLAY="$(systemctl --user show-environment | ${pkgs.gnused}/bin/sed 's/^DISPLAY=\(.*\)/\1/; t; d')"
exec ${askPassword} exec ${askPassword}
''; '';

View File

@ -13,7 +13,7 @@ let
}; };
disableScript = pkgs.writeScript "audit-disable" '' disableScript = pkgs.writeScript "audit-disable" ''
#!${pkgs.stdenv.shell} -eu #!${pkgs.runtimeShell} -eu
# Explicitly disable everything, as otherwise journald might start it. # Explicitly disable everything, as otherwise journald might start it.
auditctl -D auditctl -D
auditctl -e 0 -a task,never auditctl -e 0 -a task,never
@ -23,7 +23,7 @@ let
# put in the store like this. At the same time, it doesn't feel like a huge deal and working # put in the store like this. At the same time, it doesn't feel like a huge deal and working
# around that is a pain so I'm leaving it like this for now. # around that is a pain so I'm leaving it like this for now.
startScript = pkgs.writeScript "audit-start" '' startScript = pkgs.writeScript "audit-start" ''
#!${pkgs.stdenv.shell} -eu #!${pkgs.runtimeShell} -eu
# Clear out any rules we may start with # Clear out any rules we may start with
auditctl -D auditctl -D
@ -43,7 +43,7 @@ let
''; '';
stopScript = pkgs.writeScript "audit-stop" '' stopScript = pkgs.writeScript "audit-stop" ''
#!${pkgs.stdenv.shell} -eu #!${pkgs.runtimeShell} -eu
# Clear the rules # Clear the rules
auditctl -D auditctl -D

View File

@ -215,7 +215,7 @@ in
{ src = pkgs.writeText "sudoers-in" cfg.configFile; } { src = pkgs.writeText "sudoers-in" cfg.configFile; }
# Make sure that the sudoers file is syntactically valid. # Make sure that the sudoers file is syntactically valid.
# (currently disabled - NIXOS-66) # (currently disabled - NIXOS-66)
"${pkgs.sudo}/sbin/visudo -f $src -c && cp $src $out"; "${pkgs.buildPackages.sudo}/sbin/visudo -f $src -c && cp $src $out";
target = "sudoers"; target = "sudoers";
mode = "0440"; mode = "0440";
}; };

View File

@ -18,7 +18,7 @@ let
hooksDir = let hooksDir = let
mkHookEntry = name: value: '' mkHookEntry = name: value: ''
cat > $out/${name} <<EOF cat > $out/${name} <<EOF
#! ${pkgs.stdenv.shell} #! ${pkgs.runtimeShell}
set -e set -e
${value} ${value}
EOF EOF

View File

@ -2,7 +2,7 @@
let let
cfg = config.services.fourStoreEndpoint; cfg = config.services.fourStoreEndpoint;
endpointUser = "fourstorehttp"; endpointUser = "fourstorehttp";
run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${endpointUser} -c"; run = "${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${endpointUser} -c";
in in
with lib; with lib;
{ {

View File

@ -3,7 +3,7 @@ let
cfg = config.services.fourStore; cfg = config.services.fourStore;
stateDir = "/var/lib/4store"; stateDir = "/var/lib/4store";
fourStoreUser = "fourstore"; fourStoreUser = "fourstore";
run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fourStoreUser}"; run = "${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${fourStoreUser}";
in in
with lib; with lib;
{ {

View File

@ -7,7 +7,7 @@ let
cfg = config.services.emacs; cfg = config.services.emacs;
editorScript = pkgs.writeScriptBin "emacseditor" '' editorScript = pkgs.writeScriptBin "emacseditor" ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
if [ -z "$1" ]; then if [ -z "$1" ]; then
exec ${cfg.package}/bin/emacsclient --create-frame --alternate-editor ${cfg.package}/bin/emacs exec ${cfg.package}/bin/emacsclient --create-frame --alternate-editor ${cfg.package}/bin/emacs
else else

View File

@ -146,7 +146,7 @@ let
echo "Generating hwdb database..." echo "Generating hwdb database..."
# hwdb --update doesn't return error code even on errors! # hwdb --update doesn't return error code even on errors!
res="$(${udev}/bin/udevadm hwdb --update --root=$(pwd) 2>&1)" res="$(${pkgs.buildPackages.udev}/bin/udevadm hwdb --update --root=$(pwd) 2>&1)"
echo "$res" echo "$res"
[ -z "$(echo "$res" | egrep '^Error')" ] [ -z "$(echo "$res" | egrep '^Error')" ]
mv etc/udev/hwdb.bin $out mv etc/udev/hwdb.bin $out

View File

@ -57,7 +57,7 @@ in {
chown ${fahUser} ${stateDir} chown ${fahUser} ${stateDir}
cp -f ${pkgs.writeText "client.cfg" cfg.config} ${stateDir}/client.cfg cp -f ${pkgs.writeText "client.cfg" cfg.config} ${stateDir}/client.cfg
''; '';
script = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fahUser} -c 'cd ${stateDir}; ${pkgs.foldingathome}/bin/fah6'"; script = "${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${fahUser} -c 'cd ${stateDir}; ${pkgs.foldingathome}/bin/fah6'";
}; };
services.foldingAtHome.config = '' services.foldingAtHome.config = ''

View File

@ -14,7 +14,7 @@ let
# ExecStart= command with '@' doesn't work because we start a shell (new # ExecStart= command with '@' doesn't work because we start a shell (new
# process) that creates a new argv[0].) # process) that creates a new argv[0].)
geoip-updater = pkgs.writeScriptBin "geoip-updater" '' geoip-updater = pkgs.writeScriptBin "geoip-updater" ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
skipExisting=0 skipExisting=0
debug() debug()
{ {

View File

@ -17,7 +17,7 @@ let
gititSh = hsPkgs: extras: with pkgs; let gititSh = hsPkgs: extras: with pkgs; let
env = gititWithPkgs hsPkgs extras; env = gititWithPkgs hsPkgs extras;
in writeScript "gitit" '' in writeScript "gitit" ''
#!${stdenv.shell} #!${runtimeShell}
cd $HOME cd $HOME
export NIX_GHC="${env}/bin/ghc" export NIX_GHC="${env}/bin/ghc"
export NIX_GHCPKG="${env}/bin/ghc-pkg" export NIX_GHCPKG="${env}/bin/ghc-pkg"

View File

@ -55,7 +55,7 @@ in
serviceConfig = { serviceConfig = {
User = config.users.extraUsers.ihaskell.name; User = config.users.extraUsers.ihaskell.name;
Group = config.users.extraGroups.ihaskell.name; Group = config.users.extraGroups.ihaskell.name;
ExecStart = "${pkgs.stdenv.shell} -c \"cd $HOME;${ihaskell}/bin/ihaskell-notebook\""; ExecStart = "${pkgs.runtimeShell} -c \"cd $HOME;${ihaskell}/bin/ihaskell-notebook\"";
}; };
}; };
}; };

View File

@ -188,7 +188,7 @@ in {
description = "Mesos Slave"; description = "Mesos Slave";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network.target" ]; after = [ "network.target" ];
path = [ pkgs.stdenv.shellPackage ]; path = [ pkgs.runtimeShellPackage ];
serviceConfig = { serviceConfig = {
ExecStart = '' ExecStart = ''
${pkgs.mesos}/bin/mesos-slave \ ${pkgs.mesos}/bin/mesos-slave \

View File

@ -30,7 +30,7 @@ let
# /bin/sh in the sandbox as a bind-mount to bash. This means we # /bin/sh in the sandbox as a bind-mount to bash. This means we
# also need to include the entire closure of bash. Nix >= 2.0 # also need to include the entire closure of bash. Nix >= 2.0
# provides a /bin/sh by default. # provides a /bin/sh by default.
sh = pkgs.stdenv.shell; sh = pkgs.runtimeShell;
binshDeps = pkgs.writeReferencesToFile sh; binshDeps = pkgs.writeReferencesToFile sh;
in in
pkgs.runCommand "nix.conf" { extraOptions = cfg.extraOptions; } '' pkgs.runCommand "nix.conf" { extraOptions = cfg.extraOptions; } ''

View File

@ -43,7 +43,7 @@ let
helpScript = pkgs.writeScriptBin "nixos-help" helpScript = pkgs.writeScriptBin "nixos-help"
'' ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
browser="$BROWSER" browser="$BROWSER"
if [ -z "$browser" ]; then if [ -z "$browser" ]; then
browser="$(type -P xdg-open || true)" browser="$(type -P xdg-open || true)"

View File

@ -8,7 +8,7 @@ let
# in nixpkgs doesn't seem to work properly on NixOS, so let's just fake the two fields SSM # in nixpkgs doesn't seem to work properly on NixOS, so let's just fake the two fields SSM
# looks for. See https://github.com/aws/amazon-ssm-agent/issues/38 for upstream fix. # looks for. See https://github.com/aws/amazon-ssm-agent/issues/38 for upstream fix.
fake-lsb-release = pkgs.writeScriptBin "lsb_release" '' fake-lsb-release = pkgs.writeScriptBin "lsb_release" ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
case "$1" in case "$1" in
-i) echo "nixos";; -i) echo "nixos";;

View File

@ -38,7 +38,7 @@ let
]; ];
shellCmdsForEventScript = eventname: commands: '' shellCmdsForEventScript = eventname: commands: ''
echo "#!${pkgs.stdenv.shell}" > "$out/${eventname}" echo "#!${pkgs.runtimeShell}" > "$out/${eventname}"
echo '${commands}' >> "$out/${eventname}" echo '${commands}' >> "$out/${eventname}"
chmod a+x "$out/${eventname}" chmod a+x "$out/${eventname}"
''; '';

View File

@ -14,7 +14,7 @@ let
nx = cfg.notifications.x11; nx = cfg.notifications.x11;
smartdNotify = pkgs.writeScript "smartd-notify.sh" '' smartdNotify = pkgs.writeScript "smartd-notify.sh" ''
#! ${pkgs.stdenv.shell} #! ${pkgs.runtimeShell}
${optionalString nm.enable '' ${optionalString nm.enable ''
{ {
${pkgs.coreutils}/bin/cat << EOF ${pkgs.coreutils}/bin/cat << EOF

View File

@ -11,7 +11,7 @@ let
home = cfg.homeDir; home = cfg.homeDir;
startupScript = class: configPath: pkgs.writeScript "xtreemfs-osd.sh" '' startupScript = class: configPath: pkgs.writeScript "xtreemfs-osd.sh" ''
#! ${pkgs.stdenv.shell} #! ${pkgs.runtimeShell}
JAVA_HOME="${pkgs.jdk}" JAVA_HOME="${pkgs.jdk}"
JAVADIR="${xtreemfs}/share/java" JAVADIR="${xtreemfs}/share/java"
JAVA_CALL="$JAVA_HOME/bin/java -ea -cp $JAVADIR/XtreemFS.jar:$JAVADIR/BabuDB.jar:$JAVADIR/Flease.jar:$JAVADIR/protobuf-java-2.5.0.jar:$JAVADIR/Foundation.jar:$JAVADIR/jdmkrt.jar:$JAVADIR/jdmktk.jar:$JAVADIR/commons-codec-1.3.jar" JAVA_CALL="$JAVA_HOME/bin/java -ea -cp $JAVADIR/XtreemFS.jar:$JAVADIR/BabuDB.jar:$JAVADIR/Flease.jar:$JAVADIR/protobuf-java-2.5.0.jar:$JAVADIR/Foundation.jar:$JAVADIR/jdmkrt.jar:$JAVADIR/jdmktk.jar:$JAVADIR/commons-codec-1.3.jar"

View File

@ -99,10 +99,10 @@ in
exit 1 exit 1
fi fi
${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${u} \ ${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${u} \
-c '${pkgs.yandex-disk}/bin/yandex-disk token -p ${cfg.password} ${cfg.username} ${dir}/token' -c '${pkgs.yandex-disk}/bin/yandex-disk token -p ${cfg.password} ${cfg.username} ${dir}/token'
${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${u} \ ${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${u} \
-c '${pkgs.yandex-disk}/bin/yandex-disk start --no-daemon -a ${dir}/token -d ${cfg.directory} --exclude-dirs=${cfg.excludes}' -c '${pkgs.yandex-disk}/bin/yandex-disk start --no-daemon -a ${dir}/token -d ${cfg.directory} --exclude-dirs=${cfg.excludes}'
''; '';

View File

@ -68,7 +68,7 @@ in
''; '';
script = '' script = ''
${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${user} \ ${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${user} \
-c 'HOME="${cfg.dataDir}" ${pkgs.amuleDaemon}/bin/amuled' -c 'HOME="${cfg.dataDir}" ${pkgs.amuleDaemon}/bin/amuled'
''; '';
}; };

View File

@ -54,7 +54,7 @@ let
''; '';
writeShScript = name: text: let dir = pkgs.writeScriptBin name '' writeShScript = name: text: let dir = pkgs.writeScriptBin name ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
${text} ${text}
''; in "${dir}/bin/${name}"; ''; in "${dir}/bin/${name}";

View File

@ -22,7 +22,7 @@ let
flashpolicydWrapper = pkgs.writeScriptBin "flashpolicyd" flashpolicydWrapper = pkgs.writeScriptBin "flashpolicyd"
'' ''
#! ${pkgs.stdenv.shell} #! ${pkgs.runtimeShell}
exec ${flashpolicyd}/Perl_xinetd/in.flashpolicyd.pl \ exec ${flashpolicyd}/Perl_xinetd/in.flashpolicyd.pl \
--file=${pkgs.writeText "flashpolixy.xml" cfg.policy} \ --file=${pkgs.writeText "flashpolixy.xml" cfg.policy} \
2> /dev/null 2> /dev/null

View File

@ -116,7 +116,7 @@ in
include "${cfg.rulesetFile}" include "${cfg.rulesetFile}"
''; '';
checkScript = pkgs.writeScript "nftables-check" '' checkScript = pkgs.writeScript "nftables-check" ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
if $(${pkgs.kmod}/bin/lsmod | grep -q ip_tables); then if $(${pkgs.kmod}/bin/lsmod | grep -q ip_tables); then
echo "Unload ip_tables before using nftables!" 1>&2 echo "Unload ip_tables before using nftables!" 1>&2
exit 1 exit 1

View File

@ -6,7 +6,7 @@
with lib; with lib;
let let
mergeHook = pkgs.writeScript "rdnssd-merge-hook" '' mergeHook = pkgs.writeScript "rdnssd-merge-hook" ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
${pkgs.openresolv}/bin/resolvconf -u ${pkgs.openresolv}/bin/resolvconf -u
''; '';
in in

View File

@ -124,7 +124,7 @@ in
listenAddresses = mkOption { listenAddresses = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ "127.0.0.1:631" ]; default = [ "localhost:631" ];
example = [ "*:631" ]; example = [ "*:631" ];
description = '' description = ''
A list of addresses and ports on which to listen. A list of addresses and ports on which to listen.
@ -321,7 +321,10 @@ in
''} ''}
''; '';
serviceConfig.PrivateTmp = true; serviceConfig = {
PrivateTmp = true;
RuntimeDirectory = [ "cups" ];
};
}; };
systemd.services.cups-browsed = mkIf avahiEnabled systemd.services.cups-browsed = mkIf avahiEnabled

View File

@ -7,7 +7,7 @@ let
torify = pkgs.writeTextFile { torify = pkgs.writeTextFile {
name = "tsocks"; name = "tsocks";
text = '' text = ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
TSOCKS_CONF_FILE=${pkgs.writeText "tsocks.conf" cfg.tsocks.config} LD_PRELOAD="${pkgs.tsocks}/lib/libtsocks.so $LD_PRELOAD" "$@" TSOCKS_CONF_FILE=${pkgs.writeText "tsocks.conf" cfg.tsocks.config} LD_PRELOAD="${pkgs.tsocks}/lib/libtsocks.so $LD_PRELOAD" "$@"
''; '';
executable = true; executable = true;

View File

@ -23,7 +23,7 @@ let
wrapTorsocks = name: server: pkgs.writeTextFile { wrapTorsocks = name: server: pkgs.writeTextFile {
name = name; name = name;
text = '' text = ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
TORSOCKS_CONF_FILE=${pkgs.writeText "torsocks.conf" (configFile server)} ${pkgs.torsocks}/bin/torsocks "$@" TORSOCKS_CONF_FILE=${pkgs.writeText "torsocks.conf" (configFile server)} ${pkgs.torsocks}/bin/torsocks "$@"
''; '';
executable = true; executable = true;

View File

@ -90,7 +90,7 @@ in
# 1) Only the "transmission" user and group have access to torrents. # 1) Only the "transmission" user and group have access to torrents.
# 2) Optionally update/force specific fields into the configuration file. # 2) Optionally update/force specific fields into the configuration file.
serviceConfig.ExecStartPre = '' serviceConfig.ExecStartPre = ''
${pkgs.stdenv.shell} -c "mkdir -p ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir} && chmod 770 ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir} && rm -f ${settingsDir}/settings.json && cp -f ${settingsFile} ${settingsDir}/settings.json" ${pkgs.runtimeShell} -c "mkdir -p ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir} && chmod 770 ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir} && rm -f ${settingsDir}/settings.json && cp -f ${settingsFile} ${settingsDir}/settings.json"
''; '';
serviceConfig.ExecStart = "${pkgs.transmission}/bin/transmission-daemon -f --port ${toString config.services.transmission.port}"; serviceConfig.ExecStart = "${pkgs.transmission}/bin/transmission-daemon -f --port ${toString config.services.transmission.port}";
serviceConfig.ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; serviceConfig.ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";

View File

@ -346,7 +346,7 @@ let
postgresql = serverInfo.fullConfig.services.postgresql.package; postgresql = serverInfo.fullConfig.services.postgresql.package;
setupDb = pkgs.writeScript "setup-owncloud-db" '' setupDb = pkgs.writeScript "setup-owncloud-db" ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
PATH="${postgresql}/bin" PATH="${postgresql}/bin"
createuser --no-superuser --no-createdb --no-createrole "${config.dbUser}" || true createuser --no-superuser --no-createdb --no-createrole "${config.dbUser}" || true
createdb "${config.dbName}" -O "${config.dbUser}" || true createdb "${config.dbName}" -O "${config.dbUser}" || true

View File

@ -128,7 +128,7 @@ in
# Set GTK_DATA_PREFIX so that GTK+ can find the Xfce themes. # Set GTK_DATA_PREFIX so that GTK+ can find the Xfce themes.
export GTK_DATA_PREFIX=${config.system.path} export GTK_DATA_PREFIX=${config.system.path}
${pkgs.stdenv.shell} ${pkgs.xfce.xinitrc} & ${pkgs.runtimeShell} ${pkgs.xfce.xinitrc} &
waitPID=$! waitPID=$!
''; '';
}]; }];

View File

@ -14,7 +14,7 @@ let
default_xserver ${dmcfg.xserverBin} default_xserver ${dmcfg.xserverBin}
xserver_arguments ${toString dmcfg.xserverArgs} xserver_arguments ${toString dmcfg.xserverArgs}
sessiondir ${dmcfg.session.desktops} sessiondir ${dmcfg.session.desktops}
login_cmd exec ${pkgs.stdenv.shell} ${dmcfg.session.script} "%session" login_cmd exec ${pkgs.runtimeShell} ${dmcfg.session.script} "%session"
halt_cmd ${config.systemd.package}/sbin/shutdown -h now halt_cmd ${config.systemd.package}/sbin/shutdown -h now
reboot_cmd ${config.systemd.package}/sbin/shutdown -r now reboot_cmd ${config.systemd.package}/sbin/shutdown -r now
logfile /dev/stderr logfile /dev/stderr

View File

@ -61,7 +61,7 @@ in
apply = set: { apply = set: {
script = script =
'' ''
#! ${pkgs.stdenv.shell} #! ${pkgs.runtimeShell}
systemConfig=@out@ systemConfig=@out@

View File

@ -1,21 +1,22 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
{ {
environment.systemPackages = [ pkgs.kexectools ]; config = lib.mkIf (pkgs.kexectools != null) {
environment.systemPackages = [ pkgs.kexectools ];
systemd.services."prepare-kexec" = systemd.services."prepare-kexec" =
{ description = "Preparation for kexec"; { description = "Preparation for kexec";
wantedBy = [ "kexec.target" ]; wantedBy = [ "kexec.target" ];
before = [ "systemd-kexec.service" ]; before = [ "systemd-kexec.service" ];
unitConfig.DefaultDependencies = false; unitConfig.DefaultDependencies = false;
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
path = [ pkgs.kexectools ]; path = [ pkgs.kexectools ];
script = script =
'' ''
p=$(readlink -f /nix/var/nix/profiles/system) p=$(readlink -f /nix/var/nix/profiles/system)
if ! [ -d $p ]; then exit 1; fi if ! [ -d $p ]; then exit 1; fi
exec kexec --load $p/kernel --initrd=$p/initrd --append="$(cat $p/kernel-params) init=$p/init" exec kexec --load $p/kernel --initrd=$p/initrd --append="$(cat $p/kernel-params) init=$p/init"
''; '';
}; };
};
} }

View File

@ -40,7 +40,7 @@ let
{ splashImage = f cfg.splashImage; { splashImage = f cfg.splashImage;
grub = f grub; grub = f grub;
grubTarget = f (grub.grubTarget or ""); grubTarget = f (grub.grubTarget or "");
shell = "${pkgs.stdenv.shell}"; shell = "${pkgs.runtimeShell}";
fullName = (builtins.parseDrvName realGrub.name).name; fullName = (builtins.parseDrvName realGrub.name).name;
fullVersion = (builtins.parseDrvName realGrub.name).version; fullVersion = (builtins.parseDrvName realGrub.name).version;
grubEfi = f grubEfi; grubEfi = f grubEfi;
@ -536,7 +536,7 @@ in
btrfsprogs = pkgs.btrfs-progs; btrfsprogs = pkgs.btrfs-progs;
}; };
in pkgs.writeScript "install-grub.sh" ('' in pkgs.writeScript "install-grub.sh" (''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
set -e set -e
export PERL5LIB=${makePerlPath (with pkgs.perlPackages; [ FileSlurp XMLLibXML XMLSAX XMLSAXBase ListCompare ])} export PERL5LIB=${makePerlPath (with pkgs.perlPackages; [ FileSlurp XMLLibXML XMLSAX XMLSAXBase ListCompare ])}
${optionalString cfg.enableCryptodisk "export GRUB_ENABLE_CRYPTODISK=y"} ${optionalString cfg.enableCryptodisk "export GRUB_ENABLE_CRYPTODISK=y"}

View File

@ -30,6 +30,50 @@ let
# mounting `/`, like `/` on a loopback). # mounting `/`, like `/` on a loopback).
fileSystems = filter utils.fsNeededForBoot config.system.build.fileSystems; fileSystems = filter utils.fsNeededForBoot config.system.build.fileSystems;
# A utility for enumerating the shared-library dependencies of a program
findLibs = pkgs.writeShellScriptBin "find-libs" ''
set -euo pipefail
declare -A seen
declare -a left
patchelf="${pkgs.buildPackages.patchelf}/bin/patchelf"
function add_needed {
rpath="$($patchelf --print-rpath $1)"
dir="$(dirname $1)"
for lib in $($patchelf --print-needed $1); do
left+=("$lib" "$rpath" "$dir")
done
}
add_needed $1
while [ ''${#left[@]} -ne 0 ]; do
next=''${left[0]}
rpath=''${left[1]}
ORIGIN=''${left[2]}
left=("''${left[@]:3}")
if [ -z ''${seen[$next]+x} ]; then
seen[$next]=1
IFS=: read -ra paths <<< $rpath
res=
for path in "''${paths[@]}"; do
path=$(eval "echo $path")
if [ -f "$path/$next" ]; then
res="$path/$next"
echo "$res"
add_needed "$res"
break
fi
done
if [ -z "$res" ]; then
echo "Couldn't satisfy dependency $next" >&2
exit 1
fi
fi
done
'';
# Some additional utilities needed in stage 1, like mount, lvm, fsck # Some additional utilities needed in stage 1, like mount, lvm, fsck
# etc. We don't want to bring in all of those packages, so we just # etc. We don't want to bring in all of those packages, so we just
@ -37,7 +81,7 @@ let
# we just copy what we need from Glibc and use patchelf to make it # we just copy what we need from Glibc and use patchelf to make it
# work. # work.
extraUtils = pkgs.runCommandCC "extra-utils" extraUtils = pkgs.runCommandCC "extra-utils"
{ buildInputs = [pkgs.nukeReferences]; { nativeBuildInputs = [pkgs.buildPackages.nukeReferences];
allowedReferences = [ "out" ]; # prevent accidents like glibc being included in the initrd allowedReferences = [ "out" ]; # prevent accidents like glibc being included in the initrd
} }
'' ''
@ -103,9 +147,7 @@ let
# Copy all of the needed libraries # Copy all of the needed libraries
find $out/bin $out/lib -type f | while read BIN; do find $out/bin $out/lib -type f | while read BIN; do
echo "Copying libs for executable $BIN" echo "Copying libs for executable $BIN"
LDD="$(ldd $BIN)" || continue for LIB in $(${findLibs}/bin/find-libs $BIN); do
LIBS="$(echo "$LDD" | awk '{print $3}' | sed '/^$/d')"
for LIB in $LIBS; do
TGT="$out/lib/$(basename $LIB)" TGT="$out/lib/$(basename $LIB)"
if [ ! -f "$TGT" ]; then if [ ! -f "$TGT" ]; then
SRC="$(readlink -e $LIB)" SRC="$(readlink -e $LIB)"
@ -132,6 +174,7 @@ let
fi fi
done done
if [ -z "${toString pkgs.stdenv.isCross}" ]; then
# Make sure that the patchelf'ed binaries still work. # Make sure that the patchelf'ed binaries still work.
echo "testing patched programs..." echo "testing patched programs..."
$out/bin/ash -c 'echo hello world' | grep "hello world" $out/bin/ash -c 'echo hello world' | grep "hello world"
@ -144,6 +187,7 @@ let
$out/bin/mdadm --version $out/bin/mdadm --version
${config.boot.initrd.extraUtilsCommandsTest} ${config.boot.initrd.extraUtilsCommandsTest}
fi
''; # */ ''; # */
@ -245,7 +289,7 @@ let
{ src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf"; } { src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf"; }
'' ''
target=$out target=$out
${pkgs.perl}/bin/perl -0pe 's/## file: iwlwifi.conf(.+?)##/##/s;' $src > $out ${pkgs.buildPackages.perl}/bin/perl -0pe 's/## file: iwlwifi.conf(.+?)##/##/s;' $src > $out
''; '';
symlink = "/etc/modprobe.d/ubuntu.conf"; symlink = "/etc/modprobe.d/ubuntu.conf";
} }

View File

@ -10,6 +10,7 @@ let
bootStage2 = pkgs.substituteAll { bootStage2 = pkgs.substituteAll {
src = ./stage-2-init.sh; src = ./stage-2-init.sh;
shellDebug = "${pkgs.bashInteractive}/bin/bash"; shellDebug = "${pkgs.bashInteractive}/bin/bash";
shell = "${pkgs.bash}/bin/bash";
isExecutable = true; isExecutable = true;
inherit (config.nix) readOnlyStore; inherit (config.nix) readOnlyStore;
inherit (config.networking) useHostResolvConf; inherit (config.networking) useHostResolvConf;

View File

@ -241,37 +241,37 @@ let
} }
(mkIf (config.preStart != "") (mkIf (config.preStart != "")
{ serviceConfig.ExecStartPre = makeJobScript "${name}-pre-start" '' { serviceConfig.ExecStartPre = makeJobScript "${name}-pre-start" ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
${config.preStart} ${config.preStart}
''; '';
}) })
(mkIf (config.script != "") (mkIf (config.script != "")
{ serviceConfig.ExecStart = makeJobScript "${name}-start" '' { serviceConfig.ExecStart = makeJobScript "${name}-start" ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
${config.script} ${config.script}
'' + " " + config.scriptArgs; '' + " " + config.scriptArgs;
}) })
(mkIf (config.postStart != "") (mkIf (config.postStart != "")
{ serviceConfig.ExecStartPost = makeJobScript "${name}-post-start" '' { serviceConfig.ExecStartPost = makeJobScript "${name}-post-start" ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
${config.postStart} ${config.postStart}
''; '';
}) })
(mkIf (config.reload != "") (mkIf (config.reload != "")
{ serviceConfig.ExecReload = makeJobScript "${name}-reload" '' { serviceConfig.ExecReload = makeJobScript "${name}-reload" ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
${config.reload} ${config.reload}
''; '';
}) })
(mkIf (config.preStop != "") (mkIf (config.preStop != "")
{ serviceConfig.ExecStop = makeJobScript "${name}-pre-stop" '' { serviceConfig.ExecStop = makeJobScript "${name}-pre-stop" ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
${config.preStop} ${config.preStop}
''; '';
}) })
(mkIf (config.postStop != "") (mkIf (config.postStop != "")
{ serviceConfig.ExecStopPost = makeJobScript "${name}-post-stop" '' { serviceConfig.ExecStopPost = makeJobScript "${name}-post-stop" ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
${config.postStop} ${config.postStop}
''; '';
}) })

View File

@ -13,7 +13,7 @@ let
isUnicode = hasSuffix "UTF-8" (toUpper config.i18n.defaultLocale); isUnicode = hasSuffix "UTF-8" (toUpper config.i18n.defaultLocale);
optimizedKeymap = pkgs.runCommand "keymap" { optimizedKeymap = pkgs.runCommand "keymap" {
nativeBuildInputs = [ pkgs.kbd ]; nativeBuildInputs = [ pkgs.buildPackages.kbd ];
LOADKEYS_KEYMAP_PATH = "${kbdEnv}/share/keymaps/**"; LOADKEYS_KEYMAP_PATH = "${kbdEnv}/share/keymaps/**";
} '' } ''
loadkeys -b ${optionalString isUnicode "-u"} "${config.i18n.consoleKeyMap}" > $out loadkeys -b ${optionalString isUnicode "-u"} "${config.i18n.consoleKeyMap}" > $out

View File

@ -26,7 +26,7 @@ let
executable = true; executable = true;
destination = "/bin/bridge-stp"; destination = "/bin/bridge-stp";
text = '' text = ''
#!${pkgs.stdenv.shell} -e #!${pkgs.runtimeShell} -e
export PATH="${pkgs.mstpd}/bin" export PATH="${pkgs.mstpd}/bin"
BRIDGES=(${concatStringsSep " " (attrNames rstpBridges)}) BRIDGES=(${concatStringsSep " " (attrNames rstpBridges)})
@ -64,7 +64,7 @@ let
# udev script that configures a physical wlan device and adds virtual interfaces # udev script that configures a physical wlan device and adds virtual interfaces
wlanDeviceUdevScript = device: interfaceList: pkgs.writeScript "wlan-${device}-udev-script" '' wlanDeviceUdevScript = device: interfaceList: pkgs.writeScript "wlan-${device}-udev-script" ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
# Change the wireless phy device to a predictable name. # Change the wireless phy device to a predictable name.
if [ -e "/sys/class/net/${device}/phy80211/name" ]; then if [ -e "/sys/class/net/${device}/phy80211/name" ]; then
@ -1158,7 +1158,7 @@ in
# The script creates the required, new WLAN interfaces interfaces and configures the # The script creates the required, new WLAN interfaces interfaces and configures the
# existing, default interface. # existing, default interface.
curInterfaceScript = device: current: new: pkgs.writeScript "udev-run-script-wlan-interfaces-${device}.sh" '' curInterfaceScript = device: current: new: pkgs.writeScript "udev-run-script-wlan-interfaces-${device}.sh" ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
# Change the wireless phy device to a predictable name. # Change the wireless phy device to a predictable name.
${pkgs.iw}/bin/iw phy `${pkgs.coreutils}/bin/cat /sys/class/net/$INTERFACE/phy80211/name` set name ${device} ${pkgs.iw}/bin/iw phy `${pkgs.coreutils}/bin/cat /sys/class/net/$INTERFACE/phy80211/name` set name ${device}
@ -1177,7 +1177,7 @@ in
# Udev script to execute for a new WLAN interface. The script configures the new WLAN interface. # Udev script to execute for a new WLAN interface. The script configures the new WLAN interface.
newInterfaceScript = device: new: pkgs.writeScript "udev-run-script-wlan-interfaces-${new._iName}.sh" '' newInterfaceScript = device: new: pkgs.writeScript "udev-run-script-wlan-interfaces-${new._iName}.sh" ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
# Configure the new interface # Configure the new interface
${pkgs.iw}/bin/iw dev ${new._iName} set type ${new.type} ${pkgs.iw}/bin/iw dev ${new._iName} set type ${new.type}
${optionalString (new.type == "mesh" && new.meshID!=null) "${pkgs.iw}/bin/iw dev ${device} set meshid ${new.meshID}"} ${optionalString (new.type == "mesh" && new.meshID!=null) "${pkgs.iw}/bin/iw dev ${device} set meshid ${new.meshID}"}

View File

@ -2,7 +2,7 @@
let let
script = '' script = ''
#!${pkgs.stdenv.shell} -eu #!${pkgs.runtimeShell} -eu
echo "attempting to fetch configuration from EC2 user data..." echo "attempting to fetch configuration from EC2 user data..."

View File

@ -47,7 +47,7 @@ let
}; };
provisionedHook = pkgs.writeScript "provisioned-hook" '' provisionedHook = pkgs.writeScript "provisioned-hook" ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
${config.systemd.package}/bin/systemctl start provisioned.target ${config.systemd.package}/bin/systemctl start provisioned.target
''; '';

View File

@ -33,7 +33,7 @@ let
in in
pkgs.writeScript "container-init" pkgs.writeScript "container-init"
'' ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
# Initialise the container side of the veth pair. # Initialise the container side of the veth pair.
if [ "$PRIVATE_NETWORK" = 1 ]; then if [ "$PRIVATE_NETWORK" = 1 ]; then
@ -223,7 +223,7 @@ let
serviceDirectives = cfg: { serviceDirectives = cfg: {
ExecReload = pkgs.writeScript "reload-container" ExecReload = pkgs.writeScript "reload-container"
'' ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.runtimeShell} -e
${pkgs.nixos-container}/bin/nixos-container run "$INSTANCE" -- \ ${pkgs.nixos-container}/bin/nixos-container run "$INSTANCE" -- \
bash --login -c "''${SYSTEM_PATH:-/nix/var/nix/profiles/system}/bin/switch-to-configuration test" bash --login -c "''${SYSTEM_PATH:-/nix/var/nix/profiles/system}/bin/switch-to-configuration test"
''; '';

View File

@ -169,7 +169,7 @@ in {
mkdir -p ${runDir}/ipsec/{etc/racoon,etc/init.d/,usr/sbin/} mkdir -p ${runDir}/ipsec/{etc/racoon,etc/init.d/,usr/sbin/}
ln -fs ${pkgs.ipsecTools}/bin/setkey ${runDir}/ipsec/usr/sbin/setkey ln -fs ${pkgs.ipsecTools}/bin/setkey ${runDir}/ipsec/usr/sbin/setkey
ln -fs ${pkgs.writeScript "racoon-restart" '' ln -fs ${pkgs.writeScript "racoon-restart" ''
#!${pkgs.stdenv.shell} #!${pkgs.runtimeShell}
/var/run/current-system/sw/bin/systemctl $1 racoon /var/run/current-system/sw/bin/systemctl $1 racoon
''} ${runDir}/ipsec/etc/init.d/racoon ''} ${runDir}/ipsec/etc/init.d/racoon
''; '';

View File

@ -30,7 +30,7 @@ let
# Shell script to start the VM. # Shell script to start the VM.
startVM = startVM =
'' ''
#! ${pkgs.stdenv.shell} #! ${pkgs.runtimeShell}
NIX_DISK_IMAGE=$(readlink -f ''${NIX_DISK_IMAGE:-${config.virtualisation.diskImage}}) NIX_DISK_IMAGE=$(readlink -f ''${NIX_DISK_IMAGE:-${config.virtualisation.diskImage}})

View File

@ -39,7 +39,9 @@ import ./make-test.nix ({pkgs, ... }: {
$client->waitForUnit("cups.service"); $client->waitForUnit("cups.service");
$client->sleep(10); # wait until cups is fully initialized $client->sleep(10); # wait until cups is fully initialized
$client->succeed("lpstat -r") =~ /scheduler is running/ or die; $client->succeed("lpstat -r") =~ /scheduler is running/ or die;
$client->succeed("lpstat -H") =~ "localhost:631" or die; # Test that UNIX socket is used for connections.
$client->succeed("lpstat -H") =~ "/var/run/cups/cups.sock" or die;
# Test that HTTP server is available too.
$client->succeed("curl --fail http://localhost:631/"); $client->succeed("curl --fail http://localhost:631/");
$client->succeed("curl --fail http://server:631/"); $client->succeed("curl --fail http://server:631/");
$server->fail("curl --fail --connect-timeout 2 http://client:631/"); $server->fail("curl --fail --connect-timeout 2 http://client:631/");

View File

@ -28,6 +28,8 @@ stdenv.mkDerivation rec {
"--sysconfdir=/etc" "--sysconfdir=/etc"
] ++ stdenv.lib.optional useGTK2 "--with-gtk2"; ] ++ stdenv.lib.optional useGTK2 "--with-gtk2";
NIX_CFLAGS_COMPILE = [ "-Wno-error=deprecated-declarations" ];
installFlags = [ installFlags = [
"localstatedir=\${TMPDIR}" "localstatedir=\${TMPDIR}"
"sysconfdir=\${out}/etc" "sysconfdir=\${out}/etc"

View File

@ -1,18 +1,18 @@
{ stdenv, fetchFromGitHub, perl, python2Packages, sqlite, gpsbabel { stdenv, fetchFromGitHub, perl, python, sqlite, gpsbabel
, withWebKit ? false }: , withWebKit ? false }:
let let
# Pytrainer needs a matplotlib with GTK backend. Also ensure we are # Pytrainer needs a matplotlib with GTK backend. Also ensure we are
# using the pygtk with glade support as needed by pytrainer. # using the pygtk with glade support as needed by pytrainer.
matplotlibGtk = python2Packages.matplotlib.override { matplotlibGtk = python.pkgs.matplotlib.override {
enableGtk2 = true; enableGtk2 = true;
pygtk = python2Packages.pyGtkGlade; pygtk = python.pkgs.pyGtkGlade;
}; };
in in
python2Packages.buildPythonApplication rec { python.pkgs.buildPythonApplication rec {
name = "pytrainer-${version}"; name = "pytrainer-${version}";
version = "1.12.0"; version = "1.12.0";
@ -40,7 +40,7 @@ python2Packages.buildPythonApplication rec {
--replace "'mysqlclient'," "" --replace "'mysqlclient'," ""
''; '';
propagatedBuildInputs = with python2Packages; [ propagatedBuildInputs = with python.pkgs; [
dateutil lxml matplotlibGtk pyGtkGlade sqlalchemy sqlalchemy_migrate psycopg2 dateutil lxml matplotlibGtk pyGtkGlade sqlalchemy sqlalchemy_migrate psycopg2
] ++ stdenv.lib.optional withWebKit [ pywebkitgtk ]; ] ++ stdenv.lib.optional withWebKit [ pywebkitgtk ];
@ -50,6 +50,10 @@ python2Packages.buildPythonApplication rec {
dontPatchELF = true; dontPatchELF = true;
dontStrip = true; dontStrip = true;
checkPhase = ''
${python.interpreter} -m unittest discover
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = https://github.com/pytrainer/pytrainer/wiki; homepage = https://github.com/pytrainer/pytrainer/wiki;
description = "Application for logging and graphing sporting excursions"; description = "Application for logging and graphing sporting excursions";

View File

@ -10,11 +10,11 @@
buildPythonApplication rec { buildPythonApplication rec {
pname = "spyder"; pname = "spyder";
version = "3.2.6"; version = "3.2.7";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "87d6a4f5ee1aac4284461ee3584c3ade50cb53feb3fe35abebfdfb9be18c526a"; sha256 = "b5bb8fe0a556930dc09b68fa2741a0de3da6488843ec960e0c62f1f3b2e08e2f";
}; };
# Somehow setuptools can't find pyqt5. Maybe because the dist-info folder is missing? # Somehow setuptools can't find pyqt5. Maybe because the dist-info folder is missing?

View File

@ -3,7 +3,7 @@
with python2Packages; with python2Packages;
buildPythonApplication rec { buildPythonApplication rec {
name = "${pname}-${version}"; name = "${pname}-${version}";
version = "0.3.0"; version = "0.3.1";
pname = "nbstripout"; pname = "nbstripout";
# Mercurial should be added as a build input but because it's a Python # Mercurial should be added as a build input but because it's a Python
@ -14,7 +14,7 @@ buildPythonApplication rec {
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "126xhjma4a0k7gq58hbqglhb3rai0a576azz7g8gmqjr3kl0264v"; sha256 = "b997c99b8bbb865988202d2f005cdaabb2598b07dad891c302a147a5871a4a95";
}; };
# for some reason, darwin uses /bin/sh echo native instead of echo binary, so # for some reason, darwin uses /bin/sh echo native instead of echo binary, so

View File

@ -5,7 +5,8 @@
# script that sets up the right environment variables so that the # script that sets up the right environment variables so that the
# compiler and the linker just "work". # compiler and the linker just "work".
{ name ? "", stdenvNoCC, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" { name ? ""
, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
, bintools ? null, libc ? null , bintools ? null, libc ? null
, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null , coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null
, extraPackages ? [], extraBuildCommands ? "" , extraPackages ? [], extraBuildCommands ? ""
@ -15,7 +16,7 @@
with stdenvNoCC.lib; with stdenvNoCC.lib;
assert nativeTools -> nativePrefix != ""; assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools -> assert !nativeTools ->
bintools != null && coreutils != null && gnugrep != null; bintools != null && coreutils != null && gnugrep != null;
assert !(nativeLibc && noLibc); assert !(nativeLibc && noLibc);
@ -83,7 +84,7 @@ stdenv.mkDerivation {
inherit targetPrefix infixSalt; inherit targetPrefix infixSalt;
outputs = [ "out" "info" "man" ]; outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ];
passthru = { passthru = {
inherit bintools libc nativeTools nativeLibc nativePrefix; inherit bintools libc nativeTools nativeLibc nativePrefix;
@ -111,7 +112,7 @@ stdenv.mkDerivation {
'' ''
set -u set -u
mkdir -p $out/bin {$out,$info,$man}/nix-support mkdir -p $out/bin $out/nix-support
wrap() { wrap() {
local dst="$1" local dst="$1"
@ -244,28 +245,27 @@ stdenv.mkDerivation {
'') '')
+ optionalString (!nativeTools) '' + optionalString (!nativeTools) ''
## ##
## User env support ## User env support
## ##
# Propagate the underling unwrapped bintools so that if you # Propagate the underling unwrapped bintools so that if you
# install the wrapper, you get tools like objdump, the manpages, # install the wrapper, you get tools like objdump (same for any
# etc. as well (same for any binaries of libc). # binaries of libc).
printWords ${bintools_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages printWords ${bintools_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages
''
+ optionalString propagateDoc ''
## ##
## Man page and info support ## Man page and info support
## ##
printWords ${bintools.info or ""} \ mkdir -p $man/nix-support $info/nix-support
>> $info/nix-support/propagated-build-inputs printWords ${bintools.man or ""} >> $man/nix-support/propagated-build-inputs
printWords ${bintools.man or ""} \ printWords ${bintools.info or ""} >> $info/nix-support/propagated-build-inputs
>> $man/nix-support/propagated-build-inputs
'' ''
+ '' + ''
## ##
## Hardening support ## Hardening support
## ##
@ -293,8 +293,8 @@ stdenv.mkDerivation {
## ##
## Extra custom steps ## Extra custom steps
## ##
'' ''
+ extraBuildCommands; + extraBuildCommands;
inherit dynamicLinker expand-response-params; inherit dynamicLinker expand-response-params;

View File

@ -9,7 +9,6 @@ var_templates_list=(
NIX+CFLAGS_LINK NIX+CFLAGS_LINK
NIX+CXXSTDLIB_COMPILE NIX+CXXSTDLIB_COMPILE
NIX+CXXSTDLIB_LINK NIX+CXXSTDLIB_LINK
NIX+GNATFLAGS_COMPILE
) )
var_templates_bool=( var_templates_bool=(
NIX+ENFORCE_NO_NATIVE NIX+ENFORCE_NO_NATIVE
@ -51,10 +50,6 @@ if [ -e @out@/nix-support/cc-cflags ]; then
NIX_@infixSalt@_CFLAGS_COMPILE="$(< @out@/nix-support/cc-cflags) $NIX_@infixSalt@_CFLAGS_COMPILE" NIX_@infixSalt@_CFLAGS_COMPILE="$(< @out@/nix-support/cc-cflags) $NIX_@infixSalt@_CFLAGS_COMPILE"
fi fi
if [ -e @out@/nix-support/gnat-cflags ]; then
NIX_@infixSalt@_GNATFLAGS_COMPILE="$(< @out@/nix-support/gnat-cflags) $NIX_@infixSalt@_GNATFLAGS_COMPILE"
fi
if [ -e @out@/nix-support/cc-ldflags ]; then if [ -e @out@/nix-support/cc-ldflags ]; then
NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/cc-ldflags)" NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/cc-ldflags)"
fi fi

View File

@ -5,24 +5,22 @@
# script that sets up the right environment variables so that the # script that sets up the right environment variables so that the
# compiler and the linker just "work". # compiler and the linker just "work".
{ name ? "", stdenvNoCC, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" { name ? ""
, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
, cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell , cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell
, zlib ? null, extraPackages ? [], extraBuildCommands ? "" , extraPackages ? [], extraBuildCommands ? ""
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
, buildPackages ? {} , buildPackages ? {}
}: }:
with stdenvNoCC.lib; with stdenvNoCC.lib;
assert nativeTools -> nativePrefix != ""; assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools -> assert !nativeTools ->
cc != null && coreutils != null && gnugrep != null; cc != null && coreutils != null && gnugrep != null;
assert !(nativeLibc && noLibc); assert !(nativeLibc && noLibc);
assert (noLibc || nativeLibc) == (libc == null); assert (noLibc || nativeLibc) == (libc == null);
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
assert cc.langVhdl or false -> zlib != null;
let let
stdenv = stdenvNoCC; stdenv = stdenvNoCC;
inherit (stdenv) hostPlatform targetPlatform; inherit (stdenv) hostPlatform targetPlatform;
@ -84,7 +82,7 @@ stdenv.mkDerivation {
inherit targetPrefix infixSalt; inherit targetPrefix infixSalt;
outputs = [ "out" "man" ]; outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ];
passthru = { passthru = {
# "cc" is the generic name for a C compiler, but there is no one for package # "cc" is the generic name for a C compiler, but there is no one for package
@ -115,7 +113,7 @@ stdenv.mkDerivation {
'' ''
set -u set -u
mkdir -p $out/bin $out/nix-support $man/nix-support mkdir -p $out/bin $out/nix-support
wrap() { wrap() {
local dst="$1" local dst="$1"
@ -188,17 +186,6 @@ stdenv.mkDerivation {
+ optionalString cc.langGo or false '' + optionalString cc.langGo or false ''
wrap ${targetPrefix}gccgo ${./cc-wrapper.sh} $ccPath/${targetPrefix}gccgo wrap ${targetPrefix}gccgo ${./cc-wrapper.sh} $ccPath/${targetPrefix}gccgo
''
+ optionalString cc.langAda or false ''
wrap ${targetPrefix}gnatgcc ${./cc-wrapper.sh} $ccPath/${targetPrefix}gnatgcc
wrap ${targetPrefix}gnatmake ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatmake
wrap ${targetPrefix}gnatbind ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatbind
wrap ${targetPrefix}gnatlink ${./gnatlink-wrapper.sh} $ccPath/${targetPrefix}gnatlink
''
+ optionalString cc.langVhdl or false ''
ln -s $ccPath/${targetPrefix}ghdl $out/bin/${targetPrefix}ghdl
''; '';
propagatedBuildInputs = [ bintools ]; propagatedBuildInputs = [ bintools ];
@ -246,7 +233,6 @@ stdenv.mkDerivation {
'' ''
+ optionalString (!nativeTools) '' + optionalString (!nativeTools) ''
## ##
## Initial CFLAGS ## Initial CFLAGS
## ##
@ -262,33 +248,21 @@ stdenv.mkDerivation {
ccLDFlags+=" -L${cc_solib}/lib" ccLDFlags+=" -L${cc_solib}/lib"
ccCFlags+=" -B${cc_solib}/lib" ccCFlags+=" -B${cc_solib}/lib"
${optionalString cc.langVhdl or false ''
ccLDFlags+=" -L${zlib.out}/lib"
''}
# Find the gcc libraries path (may work only without multilib).
${optionalString cc.langAda or false ''
basePath=`echo ${cc_solib}/lib/*/*/*`
ccCFlags+=" -B$basePath -I$basePath/adainclude"
gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib"
echo "$gnatCFlags" > $out/nix-support/gnat-cflags
''}
echo "$ccLDFlags" > $out/nix-support/cc-ldflags echo "$ccLDFlags" > $out/nix-support/cc-ldflags
echo "$ccCFlags" > $out/nix-support/cc-cflags echo "$ccCFlags" > $out/nix-support/cc-cflags
''
+ optionalString propagateDoc ''
## ##
## User env support ## Man page and info support
## ##
# Propagate the wrapped cc so that if you install the wrapper, mkdir -p $man/nix-support $info/nix-support
# you get tools like gcov, the manpages, etc. as well (including
# for binutils and Glibc).
printWords ${cc.man or ""} > $man/nix-support/propagated-user-env-packages printWords ${cc.man or ""} > $man/nix-support/propagated-user-env-packages
printWords ${cc.info or ""} > $info/nix-support/propagated-user-env-packages
'' ''
+ '' + ''
## ##
## Hardening support ## Hardening support
## ##
@ -308,8 +282,8 @@ stdenv.mkDerivation {
## ##
## Extra custom steps ## Extra custom steps
## ##
'' ''
+ extraBuildCommands; + extraBuildCommands;
inherit expand-response-params; inherit expand-response-params;

View File

@ -1,122 +0,0 @@
#! @shell@
set -eu -o pipefail +o posix
shopt -s nullglob
if (( "${NIX_DEBUG:-0}" >= 7 )); then
set -x
fi
# N.B. Gnat is not used during bootstrapping, so we don't need to
# worry about the old bash empty array `set -u` workarounds.
path_backup="$PATH"
# phase separation makes this look useless
# shellcheck disable=SC2157
if [ -n "@coreutils_bin@" ]; then
PATH="@coreutils_bin@/bin"
fi
source @out@/nix-support/utils.sh
if [ -z "${NIX_@infixSalt@_GNAT_WRAPPER_FLAGS_SET:-}" ]; then
source @out@/nix-support/add-flags.sh
fi
# Figure out if linker flags should be passed. GCC prints annoying
# warnings when they are not needed.
dontLink=0
nonFlagArgs=0
for i in "$@"; do
if [ "$i" = -c ]; then
dontLink=1
elif [ "$i" = -M ]; then
dontLink=1
elif [ "${i:0:1}" != - ]; then
nonFlagArgs=1
fi
done
# If we pass a flag like -Wl, then gcc will call the linker unless it
# can figure out that it has to do something else (e.g., because of a
# "-c" flag). So if no non-flag arguments are given, don't pass any
# linker flags. This catches cases like "gcc" (should just print
# "gcc: no input files") and "gcc -v" (should print the version).
if [ "$nonFlagArgs" = 0 ]; then
dontLink=1
fi
# Optionally filter out paths not refering to the store.
params=("$@")
if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "$NIX_STORE" ]]; then
rest=()
for p in "${params[@]}"; do
if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
skip "${p:2}"
elif [ "${p:0:3}" = -I/ ] && badPath "${p:2}"; then
skip "${p:2}"
elif [ "${p:0:4}" = -aI/ ] && badPath "${p:3}"; then
skip "${p:2}"
elif [ "${p:0:4}" = -aO/ ] && badPath "${p:3}"; then
skip "${p:2}"
else
rest+=("$p")
fi
done
params=("${rest[@]}")
fi
# Clear march/mtune=native -- they bring impurity.
if [ "$NIX_@infixSalt@_ENFORCE_NO_NATIVE" = 1 ]; then
rest=()
for p in "${params[@]}"; do
if [[ "$p" = -m*=native ]]; then
skip "$p"
else
rest+=("$p")
fi
done
params=("${rest[@]}")
fi
# Add the flags for the GNAT compiler proper.
extraAfter=($NIX_@infixSalt@_GNATFLAGS_COMPILE)
extraBefore=()
if [ "$(basename "$0")x" = "gnatmakex" ]; then
extraBefore=("--GNATBIND=@out@/bin/gnatbind" "--GNATLINK=@out@/bin/gnatlink ")
fi
#if [ "$dontLink" != 1 ]; then
# # Add the flags that should be passed to the linker (and prevent
# # `ld-wrapper' from adding NIX_@infixSalt@_LDFLAGS again).
# for i in $NIX_@infixSalt@_LDFLAGS_BEFORE; do
# extraBefore+=("-largs" "$i")
# done
# for i in $NIX_@infixSalt@_LDFLAGS; do
# if [ "${i:0:3}" = -L/ ]; then
# extraAfter+=("$i")
# else
# extraAfter+=("-largs" "$i")
# fi
# done
# export NIX_@infixSalt@_LDFLAGS_SET=1
#fi
# Optionally print debug info.
if (( "${NIX_DEBUG:-0}" >= 1 )); then
echo "extra flags before to @prog@:" >&2
printf " %q\n" "${extraBefore[@]}" >&2
echo "original flags to @prog@:" >&2
printf " %q\n" "${params[@]}" >&2
echo "extra flags after to @prog@:" >&2
printf " %q\n" "${extraAfter[@]}" >&2
fi
PATH="$path_backup"
exec @prog@ "${extraBefore[@]}" "${params[@]}" "${extraAfter[@]}"

View File

@ -1,40 +0,0 @@
#! @shell@
set -eu -o pipefail +o posix
shopt -s nullglob
if (( "${NIX_DEBUG:-0}" >= 7 )); then
set -x
fi
# N.B. Gnat is not used during bootstrapping, so we don't need to
# worry about the old bash empty array `set -u` workarounds.
# Add the flags for the GNAT compiler proper.
extraAfter=("--GCC=@out@/bin/gcc")
extraBefore=()
## Add the flags that should be passed to the linker (and prevent
## `ld-wrapper' from adding NIX_@infixSalt@_LDFLAGS again).
#for i in $NIX_@infixSalt@_LDFLAGS_BEFORE; do
# extraBefore+=("-largs" "$i")
#done
#for i in $NIX_@infixSalt@_LDFLAGS; do
# if [ "${i:0:3}" = -L/ ]; then
# extraAfter+=("$i")
# else
# extraAfter+=("-largs" "$i")
# fi
#done
#export NIX_@infixSalt@_LDFLAGS_SET=1
# Optionally print debug info.
if (( "${NIX_DEBUG:-0}" >= 1 )); then
echo "extra flags before to @prog@:" >&2
printf " %q\n" "${extraBefore[@]}" >&2
echo "original flags to @prog@:" >&2
printf " %q\n" "$@" >&2
echo "extra flags after to @prog@:" >&2
printf " %q\n" "${extraAfter[@]}" >&2
fi
exec @prog@ "${extraBefore[@]}" "$@" "${extraAfter[@]}"

View File

@ -25,7 +25,11 @@ mangleVarBool() {
for infix in "${role_infixes[@]}"; do for infix in "${role_infixes[@]}"; do
local inputVar="${var/+/${infix}}" local inputVar="${var/+/${infix}}"
if [ -v "$inputVar" ]; then if [ -v "$inputVar" ]; then
let "${outputVar} |= ${!inputVar}" # "1" in the end makes `let` return success error code when
# expression itself evaluates to zero.
# We don't use `|| true` because that would silence actual
# syntax errors from bad variable values.
let "${outputVar} |= ${!inputVar:-0}" "1"
fi fi
done done
} }

View File

@ -1,28 +0,0 @@
# `-B@out@/bin' forces cc to use ld-wrapper.sh when calling ld.
export NIX_CFLAGS_COMPILE="-B@out@/bin/ $NIX_CFLAGS_COMPILE"
if test -e @out@/nix-support/libc-cflags; then
export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE"
fi
if test -e @out@/nix-support/cc-cflags; then
export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE"
fi
if test -e @out@/nix-support/gnat-cflags; then
export NIX_GNATFLAGS_COMPILE="$(cat @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE"
fi
if test -e @out@/nix-support/libc-ldflags; then
export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/libc-ldflags)"
fi
if test -e @out@/nix-support/cc-ldflags; then
export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/cc-ldflags)"
fi
if test -e @out@/nix-support/libc-ldflags-before; then
export NIX_LDFLAGS_BEFORE="$(cat @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE"
fi
export NIX_CC_WRAPPER_FLAGS_SET=1

View File

@ -1,215 +0,0 @@
source $stdenv/setup
mkdir -p $out/bin
mkdir -p $out/nix-support
if test -z "$nativeLibc"; then
dynamicLinker="$libc/lib/$dynamicLinker"
echo $dynamicLinker > $out/nix-support/dynamic-linker
if test -e $libc/lib/32/ld-linux.so.2; then
echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
fi
# The "-B$libc/lib/" flag is a quick hack to force gcc to link
# against the crt1.o from our own glibc, rather than the one in
# /usr/lib. (This is only an issue when using an `impure'
# compiler/linker, i.e., one that searches /usr/lib and so on.)
#
# Unfortunately, setting -B appears to override the default search
# path. Thus, the gcc-specific "../includes-fixed" directory is
# now longer searched and glibc's <limits.h> header fails to
# compile, because it uses "#include_next <limits.h>" to find the
# limits.h file in ../includes-fixed. To remedy the problem,
# another -idirafter is necessary to add that directory again.
echo "-B$libc/lib/ -idirafter $libc_dev/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
echo "-L$libc/lib" > $out/nix-support/libc-ldflags
# The dynamic linker is passed in `ldflagsBefore' to allow
# explicit overrides of the dynamic linker by callers to gcc/ld
# (the *last* value counts, so ours should come first).
echo "-dynamic-linker" $dynamicLinker > $out/nix-support/libc-ldflags-before
fi
if test -n "$nativeTools"; then
gccPath="$nativePrefix/bin"
ldPath="$nativePrefix/bin"
else
if test -e "$gcc/lib64"; then
gccLDFlags="$gccLDFlags -L$gcc_lib/lib64"
fi
gccLDFlags="$gccLDFlags -L$gcc_lib/lib"
if [ -n "$langVhdl" ]; then
gccLDFlags="$gccLDFlags -L$zlib/lib"
fi
echo "$gccLDFlags" > $out/nix-support/cc-ldflags
# GCC shows $gcc/lib in `gcc -print-search-dirs', but not
# $gcc/lib64 (even though it does actually search there...)..
# This confuses libtool. So add it to the compiler tool search
# path explicitly.
if test -e "$gcc/lib64"; then
gccCFlags="$gccCFlags -B$gcc/lib64"
fi
# Find the gcc libraries path (may work only without multilib)
if [ -n "$langAda" ]; then
basePath=`echo $gcc/lib/*/*/*`
gccCFlags="$gccCFlags -B$basePath -I$basePath/adainclude"
gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib"
echo "$gnatCFlags" > $out/nix-support/gnat-cflags
fi
echo "$gccCFlags" > $out/nix-support/cc-cflags
gccPath="$gcc/bin"
# On Illumos/Solaris we might prefer native ld
if test -n "$nativePrefix"; then
ldPath="$nativePrefix/bin"
else
ldPath="$binutils/bin"
fi;
fi
doSubstitute() {
local src=$1
local dst=$2
local ld="$ldPath/ld"
if $ld -V 2>&1 |grep Solaris; then
# Use Solaris specific linker wrapper
ld="$out/bin/ld-solaris"
fi
# Can't use substitute() here, because replace may not have been
# built yet (in the bootstrap).
sed \
-e "s^@out@^$out^g" \
-e "s^@shell@^$shell^g" \
-e "s^@gcc@^$gcc^g" \
-e "s^@gccProg@^$gccProg^g" \
-e "s^@gnatProg@^$gnatProg^g" \
-e "s^@gnatlinkProg@^$gnatlinkProg^g" \
-e "s^@binutils@^$binutils^g" \
-e "s^@coreutils@^$coreutils^g" \
-e "s^@libc@^$libc^g" \
-e "s^@libc_bin@^$libc_bin^g" \
-e "s^@ld@^$ld^g" \
< "$src" > "$dst"
}
# Make wrapper scripts around gcc, g++, and gfortran. Also make symlinks
# cc, c++, and f77.
mkGccWrapper() {
local dst=$1
local src=$2
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return 1
fi
gccProg="$src"
doSubstitute "$gccWrapper" "$dst"
chmod +x "$dst"
}
mkGnatWrapper() {
local dst=$1
local src=$2
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return 1
fi
gnatProg="$src"
doSubstitute "$gnatWrapper" "$dst"
chmod +x "$dst"
}
mkGnatLinkWrapper() {
local dst=$1
local src=$2
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return 1
fi
gnatlinkProg="$src"
doSubstitute "$gnatlinkWrapper" "$dst"
chmod +x "$dst"
}
if mkGccWrapper $out/bin/gcc $gccPath/gcc
then
ln -sv gcc $out/bin/cc
fi
if mkGccWrapper $out/bin/g++ $gccPath/g++
then
ln -sv g++ $out/bin/c++
fi
mkGccWrapper $out/bin/cpp $gccPath/cpp || true
if mkGccWrapper $out/bin/gfortran $gccPath/gfortran
then
ln -sv gfortran $out/bin/g77
ln -sv gfortran $out/bin/f77
fi
mkGccWrapper $out/bin/gcj $gccPath/gcj || true
mkGccWrapper $out/bin/gccgo $gccPath/gccgo || true
mkGccWrapper $out/bin/gnatgcc $gccPath/gnatgcc || true
mkGnatWrapper $out/bin/gnatmake $gccPath/gnatmake || true
mkGnatWrapper $out/bin/gnatbind $gccPath/gnatbind || true
mkGnatLinkWrapper $out/bin/gnatlink $gccPath/gnatlink || true
if [ -f $gccPath/ghdl ]; then
ln -sf $gccPath/ghdl $out/bin/ghdl
fi
# Create a symlink to as (the assembler). This is useful when a
# gcc-wrapper is installed in a user environment, as it ensures that
# the right assembler is called.
ln -s $ldPath/as $out/bin/as
# Make a wrapper around the linker.
doSubstitute "$ldWrapper" "$out/bin/ld"
chmod +x "$out/bin/ld"
# Copy solaris ld wrapper if needed
if $ldPath/ld -V 2>&1 |grep Solaris; then
# Use Solaris specific linker wrapper
sed -e "s^@ld@^$ldPath/ld^g" < "$ldSolarisWrapper" > "$out/bin/ld-solaris"
chmod +x "$out/bin/ld-solaris"
fi
# Emit a setup hook. Also store the path to the original GCC and
# Glibc.
test -n "$gcc" && echo $gcc > $out/nix-support/orig-cc
test -n "$libc" && echo $libc > $out/nix-support/orig-libc
doSubstitute "$addFlags" "$out/nix-support/add-flags.sh"
doSubstitute "$setupHook" "$out/nix-support/setup-hook"
cp -p $utils $out/nix-support/utils.sh
# Propagate the wrapped gcc so that if you install the wrapper, you get
# tools like gcov, the manpages, etc. as well (including for binutils
# and Glibc).
if test -z "$nativeTools"; then
printWords $gcc $binutils $libc $libc_bin > $out/nix-support/propagated-user-env-packages
fi

View File

@ -1,76 +0,0 @@
# The Nix `gcc' stdenv.mkDerivation is not directly usable, since it doesn't
# know where the C library and standard header files are. Therefore
# the compiler produced by that package cannot be installed directly
# in a user environment and used from the command line. This
# stdenv.mkDerivation provides a wrapper that sets up the right environment
# variables so that the compiler and the linker just "work".
{ name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? ""
, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell
, zlib ? null
, hostPlatform, targetPlatform, targetPackages
}:
assert nativeTools -> nativePrefix != "";
assert !nativeTools -> gcc != null && binutils != null && coreutils != null;
assert !nativeLibc -> libc != null;
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper
assert (gcc != null && gcc ? langVhdl && gcc.langVhdl) -> zlib != null;
let
gccVersion = (builtins.parseDrvName gcc.name).version;
gccName = (builtins.parseDrvName gcc.name).name;
langGo = if nativeTools then false else gcc ? langGo && gcc.langGo;
in
stdenv.mkDerivation {
name =
(if name != "" then name else gccName + "-wrapper") +
(if gcc != null && gccVersion != "" then "-" + gccVersion else "");
builder = ./builder.sh;
setupHook = ./setup-hook.sh;
gccWrapper = ./gcc-wrapper.sh;
gnatWrapper = ./gnat-wrapper.sh;
gnatlinkWrapper = ./gnatlink-wrapper.sh;
ldWrapper = ./ld-wrapper.sh;
ldSolarisWrapper = ./ld-solaris-wrapper.sh;
utils = ./utils.sh;
addFlags = ./add-flags;
inherit nativeTools nativeLibc nativePrefix gcc;
gcc_lib = lib.getLib gcc;
libc = if nativeLibc then null else libc;
libc_dev = if nativeLibc then null else lib.getDev libc;
libc_bin = if nativeLibc then null else lib.getBin libc;
binutils = if nativeTools then null else lib.getBin binutils;
# The wrapper scripts use 'cat', so we may need coreutils
coreutils = if nativeTools then null else lib.getBin coreutils;
langC = if nativeTools then true else gcc.langC;
langCC = if nativeTools then true else gcc.langCC;
langFortran = if nativeTools then false else gcc ? langFortran;
langAda = if nativeTools then false else gcc ? langAda && gcc.langAda;
langVhdl = if nativeTools then false else gcc ? langVhdl && gcc.langVhdl;
zlib = if gcc != null && gcc ? langVhdl then zlib else null;
shell = shell + shell.shellPath or "";
preferLocalBuild = true;
meta =
let gcc_ = if gcc != null then gcc else {}; in
(if gcc_ ? meta then removeAttrs gcc.meta ["priority"] else {}) //
{ description =
stdenv.lib.attrByPath ["meta" "description"] "System C compiler" gcc_
+ " (wrapper script)";
};
# The dynamic linker has different names on different platforms.
dynamicLinker =
if !nativeLibc then
targetPackages.stdenv.cc.bintools.dynamicLinker
else "";
}

View File

@ -1,146 +0,0 @@
#! @shell@ -e
if [ -n "$NIX_CC_WRAPPER_START_HOOK" ]; then
source "$NIX_CC_WRAPPER_START_HOOK"
fi
if [ -z "$NIX_CC_WRAPPER_FLAGS_SET" ]; then
source @out@/nix-support/add-flags.sh
fi
source @out@/nix-support/utils.sh
# Figure out if linker flags should be passed. GCC prints annoying
# warnings when they are not needed.
dontLink=0
getVersion=0
nonFlagArgs=0
for i in "$@"; do
if [ "$i" = -c ]; then
dontLink=1
elif [ "$i" = -S ]; then
dontLink=1
elif [ "$i" = -E ]; then
dontLink=1
elif [ "$i" = -E ]; then
dontLink=1
elif [ "$i" = -M ]; then
dontLink=1
elif [ "$i" = -MM ]; then
dontLink=1
elif [ "$i" = -x ]; then
# At least for the cases c-header or c++-header we should set dontLink.
# I expect no one use -x other than making precompiled headers.
dontLink=1
elif [ "${i:0:1}" != - ]; then
nonFlagArgs=1
elif [ "$i" = -m32 ]; then
if [ -e @out@/nix-support/dynamic-linker-m32 ]; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi
fi
done
# If we pass a flag like -Wl, then gcc will call the linker unless it
# can figure out that it has to do something else (e.g., because of a
# "-c" flag). So if no non-flag arguments are given, don't pass any
# linker flags. This catches cases like "gcc" (should just print
# "gcc: no input files") and "gcc -v" (should print the version).
if [ "$nonFlagArgs" = 0 ]; then
dontLink=1
fi
# Optionally filter out paths not refering to the store.
params=("$@")
if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
rest=()
n=0
while [ $n -lt ${#params[*]} ]; do
p=${params[n]}
p2=${params[$((n+1))]}
if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
skip $p
elif [ "$p" = -L ] && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif [ "${p:0:3}" = -I/ ] && badPath "${p:2}"; then
skip $p
elif [ "$p" = -I ] && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif [ "$p" = -isystem ] && badPath "$p2"; then
n=$((n + 1)); skip $p2
else
rest=("${rest[@]}" "$p")
fi
n=$((n + 1))
done
params=("${rest[@]}")
fi
# Add the flags for the C compiler proper.
extraAfter=($NIX_CFLAGS_COMPILE)
extraBefore=()
# When enforcing purity, pretend gcc can't find the current date and
# time
if [ "$NIX_ENFORCE_PURITY" = 1 ]; then
extraAfter+=('-D__DATE__="Jan 01 1970"'
'-D__TIME__="00:00:01"'
)
fi
if [ "$dontLink" != 1 ]; then
# Add the flags that should only be passed to the compiler when
# linking.
extraAfter+=($NIX_CFLAGS_LINK)
# Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_LDFLAGS again).
for i in $NIX_LDFLAGS_BEFORE; do
extraBefore=(${extraBefore[@]} "-Wl,$i")
done
for i in $NIX_LDFLAGS; do
if [ "${i:0:3}" = -L/ ]; then
extraAfter+=("$i")
else
extraAfter+=("-Wl,$i")
fi
done
export NIX_LDFLAGS_SET=1
fi
# As a very special hack, if the arguments are just `-v', then don't
# add anything. This is to prevent `gcc -v' (which normally prints
# out the version number and returns exit code 0) from printing out
# `No input files specified' and returning exit code 1.
if [ "$*" = -v ]; then
extraAfter=()
extraBefore=()
fi
# Optionally print debug info.
if [ -n "$NIX_DEBUG" ]; then
echo "original flags to @prog@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extraBefore flags to @prog@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @prog@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if [ -n "$NIX_CC_WRAPPER_EXEC_HOOK" ]; then
source "$NIX_CC_WRAPPER_EXEC_HOOK"
fi
exec @prog@ ${extraBefore[@]} "${params[@]}" "${extraAfter[@]}"

View File

@ -1,147 +0,0 @@
#! @shell@ -e
if test -n "$NIX_CC_WRAPPER_START_HOOK"; then
source "$NIX_CC_WRAPPER_START_HOOK"
fi
if test -z "$NIX_CC_WRAPPER_FLAGS_SET"; then
source @out@/nix-support/add-flags.sh
fi
source @out@/nix-support/utils.sh
# Figure out if linker flags should be passed. GCC prints annoying
# warnings when they are not needed.
dontLink=0
getVersion=0
nonFlagArgs=0
for i in "$@"; do
if test "$i" = "-c"; then
dontLink=1
elif test "$i" = "-S"; then
dontLink=1
elif test "$i" = "-E"; then
dontLink=1
elif test "$i" = "-E"; then
dontLink=1
elif test "$i" = "-M"; then
dontLink=1
elif test "$i" = "-MM"; then
dontLink=1
elif test "$i" = "-x"; then
# At least for the cases c-header or c++-header we should set dontLink.
# I expect no one use -x other than making precompiled headers.
dontLink=1
elif test "${i:0:1}" != "-"; then
nonFlagArgs=1
elif test "$i" = "-m32"; then
if test -e @out@/nix-support/dynamic-linker-m32; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi
fi
done
# If we pass a flag like -Wl, then gcc will call the linker unless it
# can figure out that it has to do something else (e.g., because of a
# "-c" flag). So if no non-flag arguments are given, don't pass any
# linker flags. This catches cases like "gcc" (should just print
# "gcc: no input files") and "gcc -v" (should print the version).
if test "$nonFlagArgs" = "0"; then
dontLink=1
fi
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
rest=()
n=0
while test $n -lt ${#params[*]}; do
p=${params[n]}
p2=${params[$((n+1))]}
if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
skip $p
elif test "$p" = "-L" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
skip $p
elif test "$p" = "-I" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "$p" = "-isystem" && badPath "$p2"; then
n=$((n + 1)); skip $p2
else
rest=("${rest[@]}" "$p")
fi
n=$((n + 1))
done
params=("${rest[@]}")
fi
# Add the flags for the C compiler proper.
extraAfter=($NIX_CFLAGS_COMPILE)
extraBefore=()
if test "$dontLink" != "1"; then
# Add the flags that should only be passed to the compiler when
# linking.
extraAfter=(${extraAfter[@]} $NIX_CFLAGS_LINK)
# Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_LDFLAGS again).
for i in $NIX_LDFLAGS_BEFORE; do
extraBefore=(${extraBefore[@]} "-Wl,$i")
done
for i in $NIX_LDFLAGS; do
if test "${i:0:3}" = "-L/"; then
extraAfter=(${extraAfter[@]} "$i")
else
extraAfter=(${extraAfter[@]} "-Wl,$i")
fi
done
export NIX_LDFLAGS_SET=1
fi
# As a very special hack, if the arguments are just `-v', then don't
# add anything. This is to prevent `gcc -v' (which normally prints
# out the version number and returns exit code 0) from printing out
# `No input files specified' and returning exit code 1.
if test "$*" = "-v"; then
extraAfter=()
extraBefore=()
fi
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @gccProg@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extraBefore flags to @gccProg@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @gccProg@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_CC_WRAPPER_EXEC_HOOK"; then
source "$NIX_CC_WRAPPER_EXEC_HOOK"
fi
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_CC_NEEDS_GREP"; then
@gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
else
(@gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi

View File

@ -1,113 +0,0 @@
#! @shell@ -e
if test -n "$NIX_GNAT_WRAPPER_START_HOOK"; then
source "$NIX_GNAT_WRAPPER_START_HOOK"
fi
if test -z "$NIX_GNAT_WRAPPER_FLAGS_SET"; then
source @out@/nix-support/add-flags.sh
fi
source @out@/nix-support/utils.sh
# Figure out if linker flags should be passed. GCC prints annoying
# warnings when they are not needed.
dontLink=0
getVersion=0
nonFlagArgs=0
for i in "$@"; do
if test "$i" = "-c"; then
dontLink=1
elif test "$i" = "-M"; then
dontLink=1
elif test "${i:0:1}" != "-"; then
nonFlagArgs=1
elif test "$i" = "-m32"; then
if test -e @out@/nix-support/dynamic-linker-m32; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi
fi
done
# If we pass a flag like -Wl, then gcc will call the linker unless it
# can figure out that it has to do something else (e.g., because of a
# "-c" flag). So if no non-flag arguments are given, don't pass any
# linker flags. This catches cases like "gcc" (should just print
# "gcc: no input files") and "gcc -v" (should print the version).
if test "$nonFlagArgs" = "0"; then
dontLink=1
fi
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
rest=()
n=0
while test $n -lt ${#params[*]}; do
p=${params[n]}
p2=${params[$((n+1))]}
if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
skip $p
elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
skip $p
elif test "${p:0:4}" = "-aI/" && badPath "${p:3}"; then
skip $p
elif test "${p:0:4}" = "-aO/" && badPath "${p:3}"; then
skip $p
else
rest=("${rest[@]}" "$p")
fi
n=$((n + 1))
done
params=("${rest[@]}")
fi
# Add the flags for the GNAT compiler proper.
extraAfter=($NIX_GNATFLAGS_COMPILE)
extraBefore=()
if [ "`basename $0`x" = "gnatmakex" ]; then
extraBefore=("--GNATBIND=@out@/bin/gnatbind --GNATLINK=@out@/bin/gnatlink ")
fi
# Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_LDFLAGS again).
#for i in $NIX_LDFLAGS_BEFORE; do
# extraBefore=(${extraBefore[@]} "-largs $i")
#done
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @gnatProg@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extraBefore flags to @gnatProg@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @gnatProg@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_GNAT_WRAPPER_EXEC_HOOK"; then
source "$NIX_GNAT_WRAPPER_EXEC_HOOK"
fi
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_GNAT_NEEDS_GREP"; then
@gnatProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
else
(@gnatProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi

View File

@ -1,43 +0,0 @@
#! @shell@ -e
# Add the flags for the GNAT compiler proper.
extraAfter="--GCC=@out@/bin/gcc"
extraBefore=()
# Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_LDFLAGS again).
#for i in $NIX_LDFLAGS_BEFORE; do
# extraBefore=(${extraBefore[@]} "-largs $i")
#done
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @gnatlinkProg@:" >&2
for i in "$@"; do
echo " $i" >&2
done
echo "extraBefore flags to @gnatlinkProg@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @gnatlinkProg@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_GNAT_WRAPPER_EXEC_HOOK"; then
source "$NIX_GNAT_WRAPPER_EXEC_HOOK"
fi
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_GNAT_NEEDS_GREP"; then
@gnatlinkProg@ ${extraBefore[@]} "$@" ${extraAfter[@]}
else
(@gnatlinkProg@ ${extraBefore[@]} "$@" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi

View File

@ -1,40 +0,0 @@
#!@shell@
set -e
set -u
# I've also tried adding -z direct and -z lazyload, but it gave too many problems with C++ exceptions :'(
# Also made sure libgcc would not be lazy-loaded, as suggested here: https://www.illumos.org/issues/2534#note-3
# but still no success.
cmd="@ld@ -z ignore"
args=("$@");
# This loop makes sure all -L arguments are before -l arguments, or ld may complain it cannot find a library.
# GNU binutils does not have this problem:
# http://stackoverflow.com/questions/5817269/does-the-order-of-l-and-l-options-in-the-gnu-linker-matter
i=0;
while [[ $i -lt $# ]]; do
case "${args[$i]}" in
-L) cmd="$cmd ${args[$i]} ${args[($i+1)]}"; i=($i+1); ;;
-L*) cmd="$cmd ${args[$i]}" ;;
*) ;;
esac
i=($i+1);
done
i=0;
while [[ $i -lt $# ]]; do
case "${args[$i]}" in
-L) i=($i+1); ;;
-L*) ;;
*) cmd="$cmd ${args[$i]}" ;;
esac
i=($i+1);
done
# Trace:
set -x
exec $cmd
exit 0

View File

@ -1,166 +0,0 @@
#! @shell@ -e
if test -n "$NIX_LD_WRAPPER_START_HOOK"; then
source "$NIX_LD_WRAPPER_START_HOOK"
fi
if test -z "$NIX_CC_WRAPPER_FLAGS_SET"; then
source @out@/nix-support/add-flags.sh
fi
source @out@/nix-support/utils.sh
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE" \
-a \( -z "$NIX_IGNORE_LD_THROUGH_GCC" -o -z "$NIX_LDFLAGS_SET" \); then
rest=()
n=0
while test $n -lt ${#params[*]}; do
p=${params[n]}
p2=${params[$((n+1))]}
if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
skip $p
elif test "$p" = "-L" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "$p" = "-rpath" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "$p" = "-dynamic-linker" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "${p:0:1}" = "/" && badPath "$p"; then
# We cannot skip this; barf.
echo "impure path \`$p' used in link" >&2
exit 1
elif test "${p:0:9}" = "--sysroot"; then
# Our ld is not built with sysroot support (Can we fix that?)
:
else
rest=("${rest[@]}" "$p")
fi
n=$((n + 1))
done
params=("${rest[@]}")
fi
extra=()
extraBefore=()
if test -z "$NIX_LDFLAGS_SET"; then
extra+=($NIX_LDFLAGS)
extraBefore+=($NIX_LDFLAGS_BEFORE)
fi
extra+=($NIX_LDFLAGS_AFTER)
# Add all used dynamic libraries to the rpath.
if test "$NIX_DONT_SET_RPATH" != "1"; then
libPath=""
addToLibPath() {
local path="$1"
if test "${path:0:1}" != "/"; then return 0; fi
case "$path" in
*..*|*./*|*/.*|*//*)
local path2
if path2=$(readlink -f "$path"); then
path="$path2"
fi
;;
esac
case $libPath in
*\ $path\ *) return 0 ;;
esac
libPath="$libPath $path "
}
addToRPath() {
# If the path is not in the store, don't add it to the rpath.
# This typically happens for libraries in /tmp that are later
# copied to $out/lib. If not, we're screwed.
if test "${1:0:${#NIX_STORE}}" != "$NIX_STORE"; then return 0; fi
case $rpath in
*\ $1\ *) return 0 ;;
esac
rpath="$rpath $1 "
}
libs=""
addToLibs() {
libs="$libs $1"
}
rpath=""
# First, find all -L... switches.
allParams=("${params[@]}" ${extra[@]})
n=0
while test $n -lt ${#allParams[*]}; do
p=${allParams[n]}
p2=${allParams[$((n+1))]}
if test "${p:0:3}" = "-L/"; then
addToLibPath ${p:2}
elif test "$p" = "-L"; then
addToLibPath ${p2}
n=$((n + 1))
elif test "$p" = "-l"; then
addToLibs ${p2}
n=$((n + 1))
elif test "${p:0:2}" = "-l"; then
addToLibs ${p:2}
elif test "$p" = "-dynamic-linker"; then
# Ignore the dynamic linker argument, or it
# will get into the next 'elif'. We don't want
# the dynamic linker path rpath to go always first.
n=$((n + 1))
elif [[ "$p" =~ ^[^-].*\.so($|\.) ]]; then
# This is a direct reference to a shared library, so add
# its directory to the rpath.
path="$(dirname "$p")";
addToRPath "${path}"
fi
n=$((n + 1))
done
# Second, for each directory in the library search path (-L...),
# see if it contains a dynamic library used by a -l... flag. If
# so, add the directory to the rpath.
# It's important to add the rpath in the order of -L..., so
# the link time chosen objects will be those of runtime linking.
for i in $libPath; do
for j in $libs; do
if test -f "$i/lib$j.so"; then
addToRPath $i
break
fi
done
done
# Finally, add `-rpath' switches.
for i in $rpath; do
extra=(${extra[@]} -rpath $i)
done
fi
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @ld@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extra flags to @ld@:" >&2
for i in ${extra[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_LD_WRAPPER_EXEC_HOOK"; then
source "$NIX_LD_WRAPPER_EXEC_HOOK"
fi
exec @ld@ ${extraBefore[@]} "${params[@]}" ${extra[@]}

View File

@ -1,33 +0,0 @@
gccWrapperOld_addCVars () {
if test -d $1/include; then
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
fi
if test -d $1/lib64; then
export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib64"
fi
if test -d $1/lib; then
export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib"
fi
}
envBuildBuildHooks+=(gccWrapperOld_addCVars)
# Note: these come *after* $out in the PATH (see setup.sh).
if test -n "@gcc@"; then
addToSearchPath PATH @gcc@/bin
fi
if test -n "@binutils@"; then
addToSearchPath PATH @binutils@/bin
fi
if test -n "@libc@"; then
addToSearchPath PATH @libc_bin@/bin
fi
if test -n "@coreutils@"; then
addToSearchPath PATH @coreutils@/bin
fi

View File

@ -1,26 +0,0 @@
skip () {
if test "$NIX_DEBUG" = "1"; then
echo "skipping impure path $1" >&2
fi
}
# Checks whether a path is impure. E.g., `/lib/foo.so' is impure, but
# `/nix/store/.../lib/foo.so' isn't.
badPath() {
local p=$1
# Relative paths are okay (since they're presumably relative to
# the temporary build directory).
if test "${p:0:1}" != "/"; then return 1; fi
@extraPathTests@
# Otherwise, the path should refer to the store or some temporary
# directory (including the build directory).
test \
"$p" != "/dev/null" -a \
"${p:0:${#NIX_STORE}}" != "$NIX_STORE" -a \
"${p:0:4}" != "/tmp" -a \
"${p:0:${#NIX_BUILD_TOP}}" != "$NIX_BUILD_TOP"
}

View File

@ -9,7 +9,7 @@
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
name = kernel.name + "-shrunk"; name = kernel.name + "-shrunk";
builder = ./modules-closure.sh; builder = ./modules-closure.sh;
buildInputs = [ nukeReferences kmod ]; nativeBuildInputs = [ nukeReferences kmod ];
inherit kernel firmware rootModules allowMissing; inherit kernel firmware rootModules allowMissing;
allowedReferences = ["out"]; allowedReferences = ["out"];
} }

View File

@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
src = nss.src; src = nss.src;
outputs = [ "out" "unbundled" ];
nativeBuildInputs = [ python ]; nativeBuildInputs = [ python ];
configurePhase = '' configurePhase = ''
@ -50,6 +52,10 @@ stdenv.mkDerivation rec {
installPhase = '' installPhase = ''
mkdir -pv $out/etc/ssl/certs mkdir -pv $out/etc/ssl/certs
cp -v ca-bundle.crt $out/etc/ssl/certs cp -v ca-bundle.crt $out/etc/ssl/certs
# install individual certs in unbundled output
mkdir -pv $unbundled/etc/ssl/certs
cp -v *.crt $unbundled/etc/ssl/certs
rm -f $unbundled/etc/ssl/certs/ca-bundle.crt # not wanted in unbundled
''; '';
setupHook = ./setup-hook.sh; setupHook = ./setup-hook.sh;

View File

@ -1,18 +1,14 @@
{ fetchurl, stdenv }: { fetchurl, stdenv, cmake, ninja }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "poppler-data-0.4.7"; name = "poppler-data-0.4.8";
src = fetchurl { src = fetchurl {
url = "http://poppler.freedesktop.org/${name}.tar.gz"; url = "http://poppler.freedesktop.org/${name}.tar.gz";
sha256 = "1pm7wg6xqj4sppb5az4pa7psfdk4yxxkw52j85bm9fksibcb0lp7"; sha256 = "0wi8yyynladny51r4q53z7ygh7y491ayp8nqqv6wqqzjc60s35hh";
}; };
postPatch = '' nativeBuildInputs = [ cmake ninja ];
sed -i 's,$(datadir)/pkgconfig,$(prefix)/lib/pkgconfig,g' Makefile
'';
installFlags = [ "prefix=$(out)" ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = https://poppler.freedesktop.org/; homepage = https://poppler.freedesktop.org/;

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl }: { stdenv, fetchurl, buildPackages }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "tzdata-${version}"; name = "tzdata-${version}";
@ -28,8 +28,23 @@ stdenv.mkDerivation rec {
"MANDIR=$(man)/share/man" "MANDIR=$(man)/share/man"
"AWK=awk" "AWK=awk"
"CFLAGS=-DHAVE_LINK=0" "CFLAGS=-DHAVE_LINK=0"
"cc=${stdenv.cc.targetPrefix}cc"
"AR=${stdenv.cc.targetPrefix}ar"
]; ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
installFlags = [ "ZIC=./zic-native" ];
preInstall = ''
mv zic.o zic.o.orig
mv zic zic.orig
make $makeFlags cc=cc AR=ar zic
mv zic zic-native
mv zic.o.orig zic.o
mv zic.orig zic
'';
postInstall = postInstall =
'' ''
rm $out/share/zoneinfo-posix rm $out/share/zoneinfo-posix

View File

@ -1,472 +0,0 @@
{ stdenv, targetPackages, fetchurl, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langJava ? false
, langAda ? false
, langVhdl ? false
, profiledCompiler ? false
, staticCompiler ? false
, enableShared ? true
, texinfo ? null
, perl ? null # optional, for texi2pod (then pod2man); required for Java
, gmp, mpfr, libmpc, gettext, which
, libelf # optional, for link-time optimizations (LTO)
, ppl ? null, cloogppl ? null # optional, for the Graphite optimization framework
, zlib ? null, boehmgc ? null
, zip ? null, unzip ? null, pkgconfig ? null, gtk2 ? null, libart_lgpl ? null
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
, gnatboot ? null
, enableMultilib ? false
, name ? "gcc"
, libcCross ? null
, crossStageStatic ? false
, gnat ? null
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
, stripped ? true
, buildPlatform, hostPlatform, targetPlatform
, buildPackages
}:
assert langJava -> zip != null && unzip != null
&& zlib != null && boehmgc != null
&& perl != null; # for `--enable-java-home'
assert langAda -> gnatboot != null;
assert langVhdl -> gnat != null;
# LTO needs libelf and zlib.
assert libelf != null -> zlib != null;
with stdenv.lib;
with builtins;
let version = "4.5.4";
javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
# `configure' time.
# XXX: Eventually we might want to take it from upstream.
url = "ftp://sourceware.org/pub/java/ecj-4.3.jar";
sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx";
};
# Antlr (optional) allows the Java `gjdoc' tool to be built. We want a
# binary distribution here to allow the whole chain to be bootstrapped.
javaAntlr = fetchurl {
url = http://www.antlr.org/download/antlr-3.1.3.jar;
sha256 = "1f41j0y4kjydl71lqlvr73yagrs2jsg1fjymzjz66mjy7al5lh09";
};
xlibs = [
libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
xproto renderproto xextproto inputproto randrproto
];
javaAwtGtk = langJava && gtk2 != null;
/* Platform flags */
platformFlags = let
gccArch = targetPlatform.platform.gcc.arch or null;
gccCpu = targetPlatform.platform.gcc.cpu or null;
gccAbi = targetPlatform.platform.gcc.abi or null;
gccFpu = targetPlatform.platform.gcc.fpu or null;
gccFloat = targetPlatform.platform.gcc.float or null;
gccMode = targetPlatform.platform.gcc.mode or null;
in
optional (gccArch != null) "--with-arch=${gccArch}" ++
optional (gccCpu != null) "--with-cpu=${gccCpu}" ++
optional (gccAbi != null) "--with-abi=${gccAbi}" ++
optional (gccFpu != null) "--with-fpu=${gccFpu}" ++
optional (gccFloat != null) "--with-float=${gccFloat}" ++
optional (gccMode != null) "--with-mode=${gccMode}";
/* Cross-gcc settings */
crossMingw = (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt");
crossConfigureFlags =
# Ensure that -print-prog-name is able to find the correct programs.
[ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
"--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
(if crossMingw && crossStageStatic then [
"--with-headers=${libcCross}/include"
"--with-gcc"
"--with-gnu-as"
"--with-gnu-ld"
"--with-gnu-ld"
"--disable-shared"
"--disable-nls"
"--disable-debug"
"--enable-sjlj-exceptions"
"--enable-threads=win32"
"--disable-win32-registry"
] else if crossStageStatic then [
"--disable-libssp"
"--disable-nls"
"--without-headers"
"--disable-threads"
"--disable-libmudflap"
"--disable-libgomp"
"--disable-shared"
"--disable-decimal-float" # libdecnumber requires libc
] else [
"--with-headers=${libcCross}/include"
"--enable-__cxa_atexit"
"--enable-long-long"
] ++
(if crossMingw then [
"--enable-threads=win32"
"--enable-sjlj-exceptions"
"--enable-hash-synchronization"
"--enable-version-specific-runtime-libs"
"--enable-libssp"
"--disable-nls"
"--with-dwarf2"
] else [
"--enable-threads=posix"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]));
stageNameAddon = if crossStageStatic then "-stage-static" else
"-stage-final";
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
in
# We need all these X libraries when building AWT with GTK+.
assert gtk2 != null -> (filter (x: x == null) xlibs) == [];
stdenv.mkDerivation ({
name = "${name}-${version}" + crossNameAddon;
builder = ../builder.sh;
src = (import ./sources.nix) {
inherit fetchurl optional version;
inherit langC langCC langFortran langJava langAda;
};
hardeningDisable = [ "format" ] ++ optional (name != "gnat") "all";
outputs = [ "out" "man" "info" ]
++ optional (!(hostPlatform.is64bit && langAda)) "lib";
setOutputFlags = false;
NIX_NO_SELF_RPATH = true;
libc_dev = stdenv.cc.libc_dev;
patches =
[ ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ./no-sys-dirs.patch
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
# target libraries and tools.
++ optional langAda ../gnat-cflags.patch
++ optional langVhdl ./ghdl-ortho-cflags.patch
++ [ ../struct-ucontext-4.5.patch ] # glibc-2.26
;
postPatch =
if (stdenv.system == "i586-pc-gnu"
|| (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu")
|| (targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu"
&& libcCross != null))
then
# On GNU/Hurd glibc refers to Hurd & Mach headers and libpthread is not
# in glibc, so add the right `-I' flags to the default spec string.
assert libcCross != null -> libpthreadCross != null;
let
libc = if libcCross != null then libcCross else stdenv.glibc;
gnu_h = "gcc/config/gnu.h";
i386_gnu_h = "gcc/config/i386/gnu.h";
extraCPPDeps =
libc.propagatedBuildInputs
++ stdenv.lib.optional (libpthreadCross != null) libpthreadCross
++ stdenv.lib.optional (libpthread != null) libpthread;
extraCPPSpec =
concatStrings (intersperse " "
(map (x: "-I${x.dev or x}/include") extraCPPDeps));
extraLibSpec =
if libpthreadCross != null
then "-L${libpthreadCross}/lib ${libpthreadCross.TARGET_LDFLAGS}"
else "-L${libpthread}/lib";
in
'' echo "augmenting \`CPP_SPEC' in \`${i386_gnu_h}' with \`${extraCPPSpec}'..."
sed -i "${i386_gnu_h}" \
-es'|CPP_SPEC *"\(.*\)$|CPP_SPEC "${extraCPPSpec} \1|g'
echo "augmenting \`LIB_SPEC' in \`${gnu_h}' with \`${extraLibSpec}'..."
sed -i "${gnu_h}" \
-es'|LIB_SPEC *"\(.*\)$|LIB_SPEC "${extraLibSpec} \1|g'
echo "setting \`NATIVE_SYSTEM_HEADER_DIR' and \`STANDARD_INCLUDE_DIR' to \`${libc.dev}/include'..."
sed -i "${gnu_h}" \
-es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc.dev}/include"|g'
sed -i gcc/config/t-gnu \
-es'|NATIVE_SYSTEM_HEADER_DIR.*$|NATIVE_SYSTEM_HEADER_DIR = ${libc.dev}/include|g'
''
else if targetPlatform != hostPlatform || stdenv.cc.libc != null then
# On NixOS, use the right path to the dynamic linker instead of
# `/lib/ld*.so'.
let
libc = if libcCross != null then libcCross else stdenv.cc.libc;
in
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..."
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
do
grep -q LIBC_DYNAMIC_LINKER "$header" || continue
echo " fixing \`$header'..."
sed -i "$header" \
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'
done
''
else null;
# TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild,
crossStageStatic = targetPlatform == hostPlatform || crossStageStatic;
inherit noSysDirs profiledCompiler staticCompiler langJava
libcCross crossMingw;
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ texinfo which gettext ]
++ optional (perl != null) perl;
# For building runtime libs
depsBuildTarget =
if hostPlatform == buildPlatform then [
targetPackages.stdenv.cc.bintools # newly-built gcc will be used
] else assert targetPlatform == hostPlatform; [ # build != host == target
stdenv.cc
];
buildInputs = [
gmp mpfr libmpc libelf
targetPackages.stdenv.cc.bintools # For linking code at run-time
] ++ (optional (ppl != null) ppl)
++ (optional (cloogppl != null) cloogppl)
++ (optional (zlib != null) zlib)
++ (optional langJava boehmgc)
++ (optionals langJava [zip unzip])
++ (optionals javaAwtGtk ([gtk2 pkgconfig libart_lgpl] ++ xlibs))
++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools])
++ (optionals langAda [gnatboot])
++ (optionals langVhdl [gnat])
;
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms =
# TODO(@Ericson2314): Figure out what's going wrong with Arm
if buildPlatform == hostPlatform && hostPlatform == targetPlatform && targetPlatform.isArm
then []
else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
configureFlags =
# Basic dependencies
[
"--with-gmp=${gmp.dev}"
"--with-mpfr=${mpfr.dev}"
"--with-mpc=${libmpc}"
] ++
optional (libelf != null) "--with-libelf=${libelf}" ++
optional (!(crossMingw && crossStageStatic))
"--with-native-system-header-dir=${getDev stdenv.cc.libc}/include" ++
# Basic configuration
[
"--disable-libstdcxx-pch"
"--without-included-gettext"
"--with-system-zlib"
"--enable-languages=${
concatStrings (intersperse ","
( optional langC "c"
++ optional langCC "c++"
++ optional langFortran "fortran"
++ optional langJava "java"
++ optional langAda "ada"
++ optional langVhdl "vhdl"
)
)
}"
] ++
optional (!enableMultilib) "--disable-multilib" ++
optional (!enableShared) "--disable-shared" ++
# Optional features
optional (cloogppl != null) "--with-cloog=${cloogppl}" ++
optional (ppl != null) "--with-ppl=${ppl}" ++
# Java options
optionals langJava [
"--with-ecj-jar=${javaEcj}"
# Follow Sun's layout for the convenience of IcedTea/OpenJDK. See
# <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2010-April/008888.html>.
"--enable-java-home"
"--with-java-home=\${prefix}/lib/jvm/jre"
] ++
optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++
# Ada
optional langAda "--enable-libada" ++
platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
# Platform-specific flags
optional (targetPlatform == hostPlatform && targetPlatform.isi686) "--with-arch=i686" ++
# Trick that should be taken out once we have a mipsel-linux not loongson2f
optional (targetPlatform == hostPlatform && stdenv.system == "mipsel-linux") "--with-arch=loongson2f"
;
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
/* For cross-built gcc (build != host == target) */
crossAttrs = {
dontStrip = true;
};
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
# library headers and binaries, regarless of the language being compiled.
#
# Note: When building the Java AWT GTK+ peer, the build system doesn't honor
# `--with-gmp' et al., e.g., when building
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
# them to $CPATH and $LIBRARY_PATH in this case.
#
# Likewise, the LTO code doesn't find zlib.
#
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
# compiler (after the specs for the cross-gcc are created). Having
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
++ optional (zlib != null) zlib
++ optional langJava boehmgc
++ optionals javaAwtGtk xlibs
++ optionals javaAwtGtk [ gmp mpfr ]
++ optional (libpthread != null) libpthread
++ optional (libpthreadCross != null) libpthreadCross
# On GNU/Hurd glibc refers to Mach & Hurd
# headers.
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
libcCross.propagatedBuildInputs
));
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
++ optional (zlib != null) zlib
++ optional langJava boehmgc
++ optionals javaAwtGtk xlibs
++ optionals javaAwtGtk [ gmp mpfr ]
++ optional (libpthread != null) libpthread)
);
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${libcCross.dev}/include"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}/lib"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}/lib"
] ++ (if crossStageStatic then [
"-B${libcCross.out}/lib"
] else [
"-Wl,-rpath,${libcCross.out}/lib"
"-Wl,-rpath-link,${libcCross.out}/lib"
]) ++ optionals (libpthreadCross != null) [
"-L${libpthreadCross}/lib"
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
]);
passthru = {
inherit langC langCC langAda langFortran langVhdl enableMultilib version;
isGNU = true;
hardeningUnsupportedFlags = [ "stackprotector" ];
};
enableParallelBuilding = !langAda;
meta = {
homepage = http://gcc.gnu.org/;
license = stdenv.lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+
description = "GNU Compiler Collection, version ${version}"
+ (if stripped then "" else " (with debugging info)");
longDescription = ''
The GNU Compiler Collection includes compiler front ends for C, C++,
Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well
as libraries for these languages (libstdc++, libgcj, libgomp,...).
GCC development is a part of the GNU Project, aiming to improve the
compiler used in the GNU system including the GNU/Linux variant.
'';
maintainers = [
stdenv.lib.maintainers.viric
];
# Volunteers needed for the {Cyg,Dar}win ports of *PPL.
# gnatboot is not available out of linux platforms, so we disable the darwin build
# for the gnat (ada compiler).
platforms = stdenv.lib.platforms.linux ++ optionals (langAda == false) [ "i686-darwin" ];
};
}
// optionalAttrs (targetPlatform != hostPlatform || libcCross != null) {
# `builder.sh' sets $CPP, which leads configure to use "gcc -E" instead of,
# say, "i586-pc-gnu-gcc -E" when building `gcc.crossDrv'.
# FIXME: Fix `builder.sh' directly in the next stdenv-update.
postUnpack = "unset CPP";
}
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
makeFlags = [ "all-gcc" "all-target-libgcc" ];
installTargets = "install-gcc install-target-libgcc";
}
# GCC 4.5.2 doesn't support the `install-strip' target, so let `stdenv' do
# the stripping by default.
// optionalAttrs (!stripped) { dontStrip = true; }
// optionalAttrs langVhdl rec {
name = "ghdl-0.29";
ghdlSrc = fetchurl {
url = "http://ghdl.free.fr/ghdl-0.29.tar.bz2";
sha256 = "15mlinr1lwljwll9ampzcfcrk9bk0qpdks1kxlvb70xf9zhh2jva";
};
# Ghdl has some timestamps checks, storing file timestamps in '.cf' files.
# As we will change the timestamps to 1970-01-01 00:00:01, we also set the
# content of that .cf to that value. This way ghdl does not complain on
# the installed object files from the basic libraries (ieee, ...)
postInstallGhdl = ''
pushd $out
find . -name "*.cf" -exec \
sed 's/[0-9]*\.000" /19700101000001.000" /g' -i {} \;
popd
'';
postUnpack = ''
tar xvf ${ghdlSrc}
mv ghdl-*/vhdl gcc*/gcc
rm -Rf ghdl-*
'';
meta = {
homepage = http://ghdl.free.fr/;
license = stdenv.lib.licenses.gpl2Plus;
description = "Complete VHDL simulator, using the GCC technology (gcc ${version})";
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
})

View File

@ -1,111 +0,0 @@
diff --git a/gcc/vhdl/Make-lang.in b/gcc/vhdl/Make-lang.in
index 8f481df..681ac59 100644
--- a/gcc/vhdl/Make-lang.in
+++ b/gcc/vhdl/Make-lang.in
@@ -96,7 +96,7 @@ AGCC_GCCOBJ_DIR=../
AGCC_INC_FLAGS=-I$(AGCC_GCCOBJ_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/include \
-I$(AGCC_GCCSRC_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/gcc/config \
-I$(AGCC_GCCSRC_DIR)/libcpp/include
-AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS)
+AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS) $(CFLAGS) $(INCLUDES)
AGCC_LOCAL_OBJS=ortho-lang.o
@@ -140,7 +140,7 @@ ghdl$(exeext): force
# Ghdl libraries.
ghdllib: ghdl$(exeext) $(GCC_PASSES) force
- $(MAKE_IN_VHDL) GRT_FLAGS="-O -g" ghdllib
+ $(MAKE_IN_VHDL) GRT_FLAGS="-O -g $(CFLAGS)" ghdllib
# Build hooks:
diff --git a/gcc/vhdl/Makefile.in b/gcc/vhdl/Makefile.in
index d754c6c..07abc4a 100644
--- a/gcc/vhdl/Makefile.in
+++ b/gcc/vhdl/Makefile.in
@@ -80,7 +80,8 @@ T_CPPFLAGS =
X_ADAFLAGS =
T_ADAFLAGS =
-ADAC = $(CC)
+# Never use the bootstrapped compiler, as it may not be built for ada
+ADAC = gcc
ECHO = echo
CHMOD = chmod
diff --git a/gcc/vhdl/ortho-lang.c b/gcc/vhdl/ortho-lang.c
index 84aeb92..8eddd42 100644
--- a/gcc/vhdl/ortho-lang.c
+++ b/gcc/vhdl/ortho-lang.c
@@ -16,6 +16,7 @@
#include "options.h"
#include "real.h"
-#include "tree-gimple.h"
+#include "gimple.h"
+#include "tree.h"
#include "function.h"
#include "cgraph.h"
#include "target.h"
@@ -680,38 +681,10 @@ type_for_mode (enum machine_mode mode, int unsignedp)
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
-/* Tree code classes. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-
-const enum tree_code_class tree_code_type[] = {
-#include "tree.def"
- 'x'
-};
-#undef DEFTREECODE
-
-/* Table indexed by tree code giving number of expression
- operands beyond the fixed part of the node structure.
- Not used for types or decls. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
-
-const unsigned char tree_code_length[] = {
-#include "tree.def"
- 0
-};
-#undef DEFTREECODE
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) NAME,
-const char * const tree_code_name[] = {
-#include "tree.def"
- "@@dummy"
-};
-#undef DEFTREECODE
union lang_tree_node
GTY((desc ("0"),
- chain_next ("(union lang_tree_node *) GENERIC_NEXT (&%h.generic)")))
+ chain_next ("(union lang_tree_node *) TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY ((tag ("0"))) generic;
};
@@ -1162,7 +1135,7 @@ new_access_type (tree dtype)
res = make_node (POINTER_TYPE);
TREE_TYPE (res) = NULL_TREE;
/* Seems necessary. */
- TYPE_MODE (res) = Pmode;
+ SET_TYPE_MODE (res, Pmode);
layout_type (res);
return res;
}
diff --git a/gcc/vhdl/Make-lang.in b/gcc/vhdl/Make-lang.in
index e201f64..f36fb97 100644
--- a/gcc/vhdl/Make-lang.in
+++ b/gcc/vhdl/Make-lang.in
@@ -132,7 +132,7 @@ ghdl1$(exeext): $(AGCC_OBJS) $(AGCC_DEPS) force
-cargs $(CFLAGS) $(GHDL_ADAFLAGS)
$(GNATMAKE) -o $@ -aI$(srcdir)/vhdl -aOvhdl ortho_gcc-main \
-bargs -E -cargs $(CFLAGS) $(GHDL_ADAFLAGS) \
- -largs $(AGCC_OBJS) $(LIBS) $(GMPLIBS)
+ -largs $(AGCC_OBJS) $(LIBS) $(GMPLIBS) $(CLOOGLIBS) $(PPLLIBS)
# The driver for ghdl.
ghdl$(exeext): force

View File

@ -1,54 +0,0 @@
diff -ru gcc-4.3.1-orig/gcc/cppdefault.c gcc-4.3.1/gcc/cppdefault.c
--- gcc-4.3.1-orig/gcc/cppdefault.c 2007-07-26 10:37:01.000000000 +0200
+++ gcc-4.3.1/gcc/cppdefault.c 2008-06-25 17:48:23.000000000 +0200
@@ -41,6 +41,10 @@
# undef CROSS_INCLUDE_DIR
#endif
+#undef LOCAL_INCLUDE_DIR
+#undef SYSTEM_INCLUDE_DIR
+#undef STANDARD_INCLUDE_DIR
+
const struct default_include cpp_include_defaults[]
#ifdef INCLUDE_DEFAULTS
= INCLUDE_DEFAULTS;
diff -ru gcc-4.3.1-orig/gcc/gcc.c gcc-4.3.1/gcc/gcc.c
--- gcc-4.3.1-orig/gcc/gcc.c 2008-03-02 23:55:19.000000000 +0100
+++ gcc-4.3.1/gcc/gcc.c 2008-06-25 17:52:53.000000000 +0200
@@ -1478,10 +1478,10 @@
/* Default prefixes to attach to command names. */
#ifndef STANDARD_STARTFILE_PREFIX_1
-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
+#define STANDARD_STARTFILE_PREFIX_1 ""
#endif
#ifndef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
+#define STANDARD_STARTFILE_PREFIX_2 ""
#endif
#ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
--- gcc-4.3.1-orig/gcc/Makefile.in 2008-05-11 20:54:15.000000000 +0200
+++ gcc-4.3.1/gcc/Makefile.in 2008-06-25 17:48:23.000000000 +0200
@@ -378,7 +378,11 @@
MD5_H = $(srcdir)/../include/md5.h
# Default native SYSTEM_HEADER_DIR, to be overridden by targets.
-NATIVE_SYSTEM_HEADER_DIR = /usr/include
+# Nix: we override NATIVE_SYSTEM_HEADER_DIR in order to prevent
+# `fixinc' from fixing header files in /usr/include. However,
+# NATIVE_SYSTEM_HEADER_DIR must point to an existing directory, so set
+# it to some dummy directory.
+NATIVE_SYSTEM_HEADER_DIR = $(NIX_FIXINC_DUMMY)
# Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
@@ -3277,7 +3281,7 @@
-DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
-DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
-DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
- -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
+ -DLOCAL_INCLUDE_DIR=\"/no-such-dir\" \
-DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
-DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
-DPREFIX=\"$(prefix)/\" \

View File

@ -1,26 +0,0 @@
/* Automatically generated by `update-gcc.sh', do not edit.
For GCC 4.5.4. */
{ fetchurl, optional, version, langC, langCC, langFortran, langJava, langAda }:
assert version == "4.5.4";
optional /* langC */ true (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
sha256 = "894d90f72cbfc8707e330fa2b1847c443fa97cf9b7f26e86be554709510e624a";
}) ++
optional langCC (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
sha256 = "f7e3bab5e22713fbce46c2acb35fb727748473a34a942ce00393d75e1b09b6b9";
}) ++
optional langFortran (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-fortran-${version}.tar.bz2";
sha256 = "cf0803b4f5334a526dd8da1b2171d6724f50c17346b2d5c509b6abc973d2ef34";
}) ++
optional langJava (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-java-${version}.tar.bz2";
sha256 = "c98398da6f8c4c7d1758e291089d99853fdd27112cd3f146b7a8c26e6d762a23";
}) ++
optional langAda (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-ada-${version}.tar.bz2";
sha256 = "8abddae15be65572b4d639bd9818057019bb4a45da4decfc6451511c8d580c5e";
}) ++
[]

View File

@ -3,8 +3,6 @@
, langObjC ? targetPlatform.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? targetPlatform.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false
, langVhdl ? false
, langGo ? false , langGo ? false
, profiledCompiler ? false , profiledCompiler ? false
, staticCompiler ? false , staticCompiler ? false
@ -21,13 +19,11 @@
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null , libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null , libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
, x11Support ? langJava , x11Support ? langJava
, gnatboot ? null
, enableMultilib ? false , enableMultilib ? false
, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins
, name ? "gcc" , name ? "gcc"
, libcCross ? null , libcCross ? null
, crossStageStatic ? false , crossStageStatic ? false
, gnat ? null
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd , libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
, stripped ? true , stripped ? true
, gnused ? null , gnused ? null
@ -39,8 +35,6 @@
assert langJava -> zip != null && unzip != null assert langJava -> zip != null && unzip != null
&& zlib != null && boehmgc != null && zlib != null && boehmgc != null
&& perl != null; # for `--enable-java-home' && perl != null; # for `--enable-java-home'
assert langAda -> gnatboot != null;
assert langVhdl -> gnat != null;
# We enable the isl cloog backend. # We enable the isl cloog backend.
assert cloog != null -> isl != null; assert cloog != null -> isl != null;
@ -68,9 +62,6 @@ let version = "4.8.5";
++ optional enableParallelBuilding ../parallel-bconfig.patch ++ optional enableParallelBuilding ../parallel-bconfig.patch
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch ++ optional noSysDirs ../no-sys-dirs.patch
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
# target libraries and tools.
++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch ++ optional langFortran ../gfortran-driving.patch
++ optional hostPlatform.isDarwin ../gfortran-darwin-NXConstStr.patch ++ optional hostPlatform.isDarwin ../gfortran-darwin-NXConstStr.patch
++ [(fetchpatch { ++ [(fetchpatch {
@ -279,8 +270,6 @@ stdenv.mkDerivation ({
++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals langJava [ boehmgc zip unzip ])
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools]) ++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools])
++ (optionals langAda [gnatboot])
++ (optionals langVhdl [gnat])
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # The builder relies on GNU sed (for instance, Darwin's `sed' fails with
# "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
@ -330,8 +319,6 @@ stdenv.mkDerivation ({
++ optional langCC "c++" ++ optional langCC "c++"
++ optional langFortran "fortran" ++ optional langFortran "fortran"
++ optional langJava "java" ++ optional langJava "java"
++ optional langAda "ada"
++ optional langVhdl "vhdl"
++ optional langGo "go" ++ optional langGo "go"
++ optional langObjC "objc" ++ optional langObjC "objc"
++ optional langObjCpp "obj-c++" ++ optional langObjCpp "obj-c++"
@ -369,9 +356,6 @@ stdenv.mkDerivation ({
optional javaAwtGtk "--enable-java-awt=gtk" ++ optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++ optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++
# Ada
optional langAda "--enable-libada" ++
platformFlags ++ platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++ optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++ optional (!bootstrap) "--disable-bootstrap" ++
@ -464,7 +448,7 @@ stdenv.mkDerivation ({
]); ]);
passthru = { passthru = {
inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; inherit langC langCC langObjC langObjCpp langFortran langGo version;
isGNU = true; isGNU = true;
hardeningUnsupportedFlags = [ "stackprotector" ]; hardeningUnsupportedFlags = [ "stackprotector" ];
}; };
@ -490,13 +474,11 @@ stdenv.mkDerivation ({
maintainers = with stdenv.lib.maintainers; [ viric peti ]; maintainers = with stdenv.lib.maintainers; [ viric peti ];
# gnatboot is not available out of linux platforms, so we disable the darwin build
# for the gnat (ada compiler).
platforms = platforms =
stdenv.lib.platforms.linux ++ stdenv.lib.platforms.linux ++
stdenv.lib.platforms.freebsd ++ stdenv.lib.platforms.freebsd ++
stdenv.lib.platforms.illumos ++ stdenv.lib.platforms.illumos ++
optionals (langAda == false) stdenv.lib.platforms.darwin; stdenv.lib.platforms.darwin;
}; };
} }

View File

@ -3,8 +3,6 @@
, langObjC ? targetPlatform.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? targetPlatform.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false
, langVhdl ? false
, langGo ? false , langGo ? false
, profiledCompiler ? false , profiledCompiler ? false
, staticCompiler ? false , staticCompiler ? false
@ -21,13 +19,11 @@
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null , libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null , libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
, x11Support ? langJava , x11Support ? langJava
, gnatboot ? null
, enableMultilib ? false , enableMultilib ? false
, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins
, name ? "gcc" , name ? "gcc"
, libcCross ? null , libcCross ? null
, crossStageStatic ? false , crossStageStatic ? false
, gnat ? null
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd , libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
, stripped ? true , stripped ? true
, gnused ? null , gnused ? null
@ -39,8 +35,6 @@
assert langJava -> zip != null && unzip != null assert langJava -> zip != null && unzip != null
&& zlib != null && boehmgc != null && zlib != null && boehmgc != null
&& perl != null; # for `--enable-java-home' && perl != null; # for `--enable-java-home'
assert langAda -> gnatboot != null;
assert langVhdl -> gnat != null;
# We enable the isl cloog backend. # We enable the isl cloog backend.
assert cloog != null -> isl != null; assert cloog != null -> isl != null;
@ -69,9 +63,6 @@ let version = "4.9.4";
++ optionals enableParallelBuilding [ ../parallel-bconfig.patch ./parallel-strsignal.patch ] ++ optionals enableParallelBuilding [ ../parallel-bconfig.patch ./parallel-strsignal.patch ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch ++ optional noSysDirs ../no-sys-dirs.patch
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
# target libraries and tools.
++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch ++ optional langFortran ../gfortran-driving.patch
++ [ ../struct-ucontext.patch ../struct-sigaltstack-4.9.patch ] # glibc-2.26 ++ [ ../struct-ucontext.patch ../struct-sigaltstack-4.9.patch ] # glibc-2.26
; ;
@ -284,8 +275,6 @@ stdenv.mkDerivation ({
++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals langJava [ boehmgc zip unzip ])
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools]) ++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools])
++ (optionals langAda [gnatboot])
++ (optionals langVhdl [gnat])
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # The builder relies on GNU sed (for instance, Darwin's `sed' fails with
# "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
@ -338,8 +327,6 @@ stdenv.mkDerivation ({
++ optional langCC "c++" ++ optional langCC "c++"
++ optional langFortran "fortran" ++ optional langFortran "fortran"
++ optional langJava "java" ++ optional langJava "java"
++ optional langAda "ada"
++ optional langVhdl "vhdl"
++ optional langGo "go" ++ optional langGo "go"
++ optional langObjC "objc" ++ optional langObjC "objc"
++ optional langObjCpp "obj-c++" ++ optional langObjCpp "obj-c++"
@ -377,9 +364,6 @@ stdenv.mkDerivation ({
optional javaAwtGtk "--enable-java-awt=gtk" ++ optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++ optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++
# Ada
optional langAda "--enable-libada" ++
platformFlags ++ platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++ optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++ optional (!bootstrap) "--disable-bootstrap" ++
@ -472,7 +456,7 @@ stdenv.mkDerivation ({
]); ]);
passthru = passthru =
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; }; { inherit langC langCC langObjC langObjCpp langFortran langGo version; isGNU = true; };
inherit enableParallelBuilding enableMultilib; inherit enableParallelBuilding enableMultilib;
@ -495,13 +479,11 @@ stdenv.mkDerivation ({
maintainers = with stdenv.lib.maintainers; [ viric peti ]; maintainers = with stdenv.lib.maintainers; [ viric peti ];
# gnatboot is not available out of linux platforms, so we disable the darwin build
# for the gnat (ada compiler).
platforms = platforms =
stdenv.lib.platforms.linux ++ stdenv.lib.platforms.linux ++
stdenv.lib.platforms.freebsd ++ stdenv.lib.platforms.freebsd ++
stdenv.lib.platforms.illumos ++ stdenv.lib.platforms.illumos ++
optionals (langAda == false) stdenv.lib.platforms.darwin; stdenv.lib.platforms.darwin;
}; };
} }

View File

@ -3,8 +3,6 @@
, langObjC ? targetPlatform.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? targetPlatform.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false
, langVhdl ? false
, langGo ? false , langGo ? false
, profiledCompiler ? false , profiledCompiler ? false
, staticCompiler ? false , staticCompiler ? false
@ -21,13 +19,11 @@
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null , libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null , libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
, x11Support ? langJava , x11Support ? langJava
, gnatboot ? null
, enableMultilib ? false , enableMultilib ? false
, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins
, name ? "gcc" , name ? "gcc"
, libcCross ? null , libcCross ? null
, crossStageStatic ? false , crossStageStatic ? false
, gnat ? null
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd , libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
, stripped ? true , stripped ? true
, gnused ? null , gnused ? null
@ -40,8 +36,6 @@
assert langJava -> zip != null && unzip != null assert langJava -> zip != null && unzip != null
&& zlib != null && boehmgc != null && zlib != null && boehmgc != null
&& perl != null; # for `--enable-java-home' && perl != null; # for `--enable-java-home'
assert langAda -> gnatboot != null;
assert langVhdl -> gnat != null;
# LTO needs libelf and zlib. # LTO needs libelf and zlib.
assert libelf != null -> zlib != null; assert libelf != null -> zlib != null;
@ -67,9 +61,6 @@ let version = "5.5.0";
[ ../use-source-date-epoch.patch ] [ ../use-source-date-epoch.patch ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch ++ optional noSysDirs ../no-sys-dirs.patch
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
# target libraries and tools.
++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch ++ optional langFortran ../gfortran-driving.patch
# This could be applied unconditionally but I don't want to cause a full # This could be applied unconditionally but I don't want to cause a full
@ -306,8 +297,6 @@ stdenv.mkDerivation ({
++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals langJava [ boehmgc zip unzip ])
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools]) ++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools])
++ (optionals langAda [gnatboot])
++ (optionals langVhdl [gnat])
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # The builder relies on GNU sed (for instance, Darwin's `sed' fails with
# "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
@ -359,8 +348,6 @@ stdenv.mkDerivation ({
++ optional langCC "c++" ++ optional langCC "c++"
++ optional langFortran "fortran" ++ optional langFortran "fortran"
++ optional langJava "java" ++ optional langJava "java"
++ optional langAda "ada"
++ optional langVhdl "vhdl"
++ optional langGo "go" ++ optional langGo "go"
++ optional langObjC "objc" ++ optional langObjC "objc"
++ optional langObjCpp "obj-c++" ++ optional langObjCpp "obj-c++"
@ -393,9 +380,6 @@ stdenv.mkDerivation ({
optional javaAwtGtk "--enable-java-awt=gtk" ++ optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++ optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++
# Ada
optional langAda "--enable-libada" ++
platformFlags ++ platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++ optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++ optional (!bootstrap) "--disable-bootstrap" ++
@ -489,7 +473,7 @@ stdenv.mkDerivation ({
]); ]);
passthru = passthru =
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; }; { inherit langC langCC langObjC langObjCpp langFortran langGo version; isGNU = true; };
inherit enableParallelBuilding enableMultilib; inherit enableParallelBuilding enableMultilib;
@ -512,12 +496,10 @@ stdenv.mkDerivation ({
maintainers = with stdenv.lib.maintainers; [ viric peti ]; maintainers = with stdenv.lib.maintainers; [ viric peti ];
# gnatboot is not available out of linux platforms, so we disable the darwin build
# for the gnat (ada compiler).
platforms = platforms =
stdenv.lib.platforms.linux ++ stdenv.lib.platforms.linux ++
stdenv.lib.platforms.freebsd ++ stdenv.lib.platforms.freebsd ++
optionals (langAda == false) stdenv.lib.platforms.darwin; stdenv.lib.platforms.darwin;
}; };
} }

View File

@ -3,8 +3,6 @@
, langObjC ? targetPlatform.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? targetPlatform.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false
, langVhdl ? false
, langGo ? false , langGo ? false
, profiledCompiler ? false , profiledCompiler ? false
, staticCompiler ? false , staticCompiler ? false
@ -21,13 +19,11 @@
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null , libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null , libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
, x11Support ? langJava , x11Support ? langJava
, gnatboot ? null
, enableMultilib ? false , enableMultilib ? false
, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins
, name ? "gcc" , name ? "gcc"
, libcCross ? null , libcCross ? null
, crossStageStatic ? false , crossStageStatic ? false
, gnat ? null
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd , libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
, stripped ? true , stripped ? true
, gnused ? null , gnused ? null
@ -40,8 +36,6 @@
assert langJava -> zip != null && unzip != null assert langJava -> zip != null && unzip != null
&& zlib != null && boehmgc != null && zlib != null && boehmgc != null
&& perl != null; # for `--enable-java-home' && perl != null; # for `--enable-java-home'
assert langAda -> gnatboot != null;
assert langVhdl -> gnat != null;
# LTO needs libelf and zlib. # LTO needs libelf and zlib.
assert libelf != null -> zlib != null; assert libelf != null -> zlib != null;
@ -66,9 +60,6 @@ let version = "6.4.0";
[ ../use-source-date-epoch.patch ] [ ../use-source-date-epoch.patch ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch ++ optional noSysDirs ../no-sys-dirs.patch
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
# target libraries and tools.
++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch ++ optional langFortran ../gfortran-driving.patch
++ [ ../struct-ucontext.patch ../struct-sigaltstack.patch ] # glibc-2.26 ++ [ ../struct-ucontext.patch ../struct-sigaltstack.patch ] # glibc-2.26
++ optional langJava [ ../struct-ucontext-libjava.patch ] # glibc-2.26 ++ optional langJava [ ../struct-ucontext-libjava.patch ] # glibc-2.26
@ -306,8 +297,6 @@ stdenv.mkDerivation ({
++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals langJava [ boehmgc zip unzip ])
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools]) ++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools])
++ (optionals langAda [gnatboot])
++ (optionals langVhdl [gnat])
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # The builder relies on GNU sed (for instance, Darwin's `sed' fails with
# "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
@ -363,8 +352,6 @@ stdenv.mkDerivation ({
++ optional langCC "c++" ++ optional langCC "c++"
++ optional langFortran "fortran" ++ optional langFortran "fortran"
++ optional langJava "java" ++ optional langJava "java"
++ optional langAda "ada"
++ optional langVhdl "vhdl"
++ optional langGo "go" ++ optional langGo "go"
++ optional langObjC "objc" ++ optional langObjC "objc"
++ optional langObjCpp "obj-c++" ++ optional langObjCpp "obj-c++"
@ -397,9 +384,6 @@ stdenv.mkDerivation ({
optional javaAwtGtk "--enable-java-awt=gtk" ++ optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++ optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++
# Ada
optional langAda "--enable-libada" ++
platformFlags ++ platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++ optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++ optional (!bootstrap) "--disable-bootstrap" ++
@ -492,7 +476,7 @@ stdenv.mkDerivation ({
]); ]);
passthru = passthru =
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; }; { inherit langC langCC langObjC langObjCpp langFortran langGo version; isGNU = true; };
inherit enableParallelBuilding enableMultilib; inherit enableParallelBuilding enableMultilib;
@ -515,12 +499,10 @@ stdenv.mkDerivation ({
maintainers = with stdenv.lib.maintainers; [ viric peti ]; maintainers = with stdenv.lib.maintainers; [ viric peti ];
# gnatboot is not available out of linux platforms, so we disable the darwin build
# for the gnat (ada compiler).
platforms = platforms =
stdenv.lib.platforms.linux ++ stdenv.lib.platforms.linux ++
stdenv.lib.platforms.freebsd ++ stdenv.lib.platforms.freebsd ++
optionals (langAda == false) stdenv.lib.platforms.darwin; stdenv.lib.platforms.darwin;
}; };
} }

View File

@ -3,8 +3,6 @@
, langObjC ? targetPlatform.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? targetPlatform.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false
, langVhdl ? false
, langGo ? false , langGo ? false
, profiledCompiler ? false , profiledCompiler ? false
, staticCompiler ? false , staticCompiler ? false
@ -21,13 +19,11 @@
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null , libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null , libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
, x11Support ? langJava , x11Support ? langJava
, gnatboot ? null
, enableMultilib ? false , enableMultilib ? false
, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins
, name ? "gcc" , name ? "gcc"
, libcCross ? null , libcCross ? null
, crossStageStatic ? false , crossStageStatic ? false
, gnat ? null
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd , libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
, stripped ? true , stripped ? true
, gnused ? null , gnused ? null
@ -40,8 +36,6 @@
assert langJava -> zip != null && unzip != null assert langJava -> zip != null && unzip != null
&& zlib != null && boehmgc != null && zlib != null && boehmgc != null
&& perl != null; # for `--enable-java-home' && perl != null; # for `--enable-java-home'
assert langAda -> gnatboot != null;
assert langVhdl -> gnat != null;
# LTO needs libelf and zlib. # LTO needs libelf and zlib.
assert libelf != null -> zlib != null; assert libelf != null -> zlib != null;
@ -70,10 +64,9 @@ let version = "7.3.0";
url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02"; url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02";
sha256 = "0mrvxsdwip2p3l17dscpc1x8vhdsciqw1z5q9i6p5g9yg1cqnmgs"; sha256 = "0mrvxsdwip2p3l17dscpc1x8vhdsciqw1z5q9i6p5g9yg1cqnmgs";
}) })
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its ++ optional langFortran ../gfortran-driving.patch
# target libraries and tools. # https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00633.html
++ optional langAda ../gnat-cflags.patch ++ optional targetPlatform.isRiscV ./riscv-pthread-reentrant.patch;
++ optional langFortran ../gfortran-driving.patch;
javaEcj = fetchurl { javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@ -306,8 +299,6 @@ stdenv.mkDerivation ({
++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals langJava [ boehmgc zip unzip ])
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools]) ++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools])
++ (optionals langAda [gnatboot])
++ (optionals langVhdl [gnat])
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # The builder relies on GNU sed (for instance, Darwin's `sed' fails with
# "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
@ -359,8 +350,6 @@ stdenv.mkDerivation ({
++ optional langCC "c++" ++ optional langCC "c++"
++ optional langFortran "fortran" ++ optional langFortran "fortran"
++ optional langJava "java" ++ optional langJava "java"
++ optional langAda "ada"
++ optional langVhdl "vhdl"
++ optional langGo "go" ++ optional langGo "go"
++ optional langObjC "objc" ++ optional langObjC "objc"
++ optional langObjCpp "obj-c++" ++ optional langObjCpp "obj-c++"
@ -393,8 +382,6 @@ stdenv.mkDerivation ({
optional javaAwtGtk "--enable-java-awt=gtk" ++ optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++ optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++
# Ada
optional langAda "--enable-libada" ++
platformFlags ++ platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++ optional (targetPlatform != hostPlatform) crossConfigureFlags ++
@ -488,7 +475,7 @@ stdenv.mkDerivation ({
]); ]);
passthru = passthru =
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; }; { inherit langC langCC langObjC langObjCpp langFortran langGo version; isGNU = true; };
inherit enableParallelBuilding enableMultilib; inherit enableParallelBuilding enableMultilib;
@ -511,12 +498,10 @@ stdenv.mkDerivation ({
maintainers = with stdenv.lib.maintainers; [ ]; maintainers = with stdenv.lib.maintainers; [ ];
# gnatboot is not available out of linux platforms, so we disable the darwin build
# for the gnat (ada compiler).
platforms = platforms =
stdenv.lib.platforms.linux ++ stdenv.lib.platforms.linux ++
stdenv.lib.platforms.freebsd ++ stdenv.lib.platforms.freebsd ++
optionals (langAda == false) stdenv.lib.platforms.darwin; stdenv.lib.platforms.darwin;
}; };
} }

View File

@ -0,0 +1,13 @@
Index: gcc/config/riscv/linux.h
===================================================================
--- a/gcc/config/riscv/linux.h (revision 257620)
+++ b/gcc/config/riscv/linux.h (revision 257621)
@@ -47,6 +47,8 @@
#define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
+#define CPP_SPEC "%{pthread:-D_REENTRANT}"
+
#define LINK_SPEC "\
-melf" XLEN_SPEC "lriscv \
%{shared} \

View File

@ -287,8 +287,6 @@ postInstall() {
# See https://bugs.gentoo.org/show_bug.cgi?id=301299#c31 # See https://bugs.gentoo.org/show_bug.cgi?id=301299#c31
paxmark r $out/libexec/gcc/*/*/{cc1,cc1plus} paxmark r $out/libexec/gcc/*/*/{cc1,cc1plus}
eval "$postInstallGhdl"
# Two identical man pages are shipped (moving and compressing is done later) # Two identical man pages are shipped (moving and compressing is done later)
ln -sf gcc.1 "$out"/share/man/man1/g++.1 ln -sf gcc.1 "$out"/share/man/man1/g++.1
} }

View File

@ -1,33 +0,0 @@
diff --git a/libada/Makefile.in b/libada/Makefile.in
index f5057a0..337e0c6 100644
--- a/libada/Makefile.in
+++ b/libada/Makefile.in
@@ -55,7 +55,7 @@ GCC_WARN_CFLAGS = $(LOOSE_WARN)
WARN_CFLAGS = @warn_cflags@
TARGET_LIBGCC2_CFLAGS=
-GNATLIBCFLAGS= -g -O2
+GNATLIBCFLAGS= -g -O2 $(CFLAGS)
GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \
-DIN_RTS @have_getipinfo@
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -105,7 +105,7 @@ ADAFLAGS = -W -Wall -gnatpg -gnata
SOME_ADAFLAGS =-gnata
FORCE_DEBUG_ADAFLAGS = -g
GNATLIBFLAGS = -gnatpg -nostdinc
-GNATLIBCFLAGS = -g -O2
+GNATLIBCFLAGS = -g -O2 $(CFLAGS_FOR_TARGET)
# Pretend that _Unwind_GetIPInfo is available for the target by default. This
# should be autodetected during the configuration of libada and passed down to
# here, but we need something for --disable-libada and hope for the best.
@@ -193,7 +193,7 @@ RTSDIR = rts$(subst /,_,$(MULTISUBDIR))
# Link flags used to build gnat tools. By default we prefer to statically
# link with libgcc to avoid a dependency on shared libgcc (which is tricky
# to deal with as it may conflict with the libgcc provided by the system).
-GCC_LINK_FLAGS=-static-libgcc
+GCC_LINK_FLAGS=-static-libgcc $(CFLAGS_FOR_TARGET)
# End of variables for you to override.

View File

@ -3,8 +3,6 @@
, langObjC ? targetPlatform.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? targetPlatform.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false
, langVhdl ? false
, langGo ? false , langGo ? false
, profiledCompiler ? false , profiledCompiler ? false
, staticCompiler ? false , staticCompiler ? false
@ -21,13 +19,11 @@
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null , libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null , libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
, x11Support ? langJava , x11Support ? langJava
, gnatboot ? null
, enableMultilib ? false , enableMultilib ? false
, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins
, name ? "gcc" , name ? "gcc"
, libcCross ? null , libcCross ? null
, crossStageStatic ? false , crossStageStatic ? false
, gnat ? null
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd , libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
, stripped ? true , stripped ? true
, gnused ? null , gnused ? null
@ -41,8 +37,6 @@
assert langJava -> zip != null && unzip != null assert langJava -> zip != null && unzip != null
&& zlib != null && boehmgc != null && zlib != null && boehmgc != null
&& perl != null; # for `--enable-java-home' && perl != null; # for `--enable-java-home'
assert langAda -> gnatboot != null;
assert langVhdl -> gnat != null;
# LTO needs libelf and zlib. # LTO needs libelf and zlib.
assert libelf != null -> zlib != null; assert libelf != null -> zlib != null;
@ -67,9 +61,6 @@ let version = "7-20170409";
[ ] [ ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch ++ optional noSysDirs ../no-sys-dirs.patch
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
# target libraries and tools.
++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch; ++ optional langFortran ../gfortran-driving.patch;
javaEcj = fetchurl { javaEcj = fetchurl {
@ -278,8 +269,6 @@ stdenv.mkDerivation ({
++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals langJava [ boehmgc zip unzip ])
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools]) ++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools])
++ (optionals langAda [gnatboot])
++ (optionals langVhdl [gnat])
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # The builder relies on GNU sed (for instance, Darwin's `sed' fails with
# "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
@ -331,8 +320,6 @@ stdenv.mkDerivation ({
++ optional langCC "c++" ++ optional langCC "c++"
++ optional langFortran "fortran" ++ optional langFortran "fortran"
++ optional langJava "java" ++ optional langJava "java"
++ optional langAda "ada"
++ optional langVhdl "vhdl"
++ optional langGo "go" ++ optional langGo "go"
++ optional langObjC "objc" ++ optional langObjC "objc"
++ optional langObjCpp "obj-c++" ++ optional langObjCpp "obj-c++"
@ -365,9 +352,6 @@ stdenv.mkDerivation ({
optional javaAwtGtk "--enable-java-awt=gtk" ++ optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++ optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" ++
# Ada
optional langAda "--enable-libada" ++
platformFlags ++ platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++ optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++ optional (!bootstrap) "--disable-bootstrap" ++
@ -460,7 +444,7 @@ stdenv.mkDerivation ({
]); ]);
passthru = passthru =
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; }; { inherit langC langCC langObjC langObjCpp langFortran langGo version; isGNU = true; };
inherit enableParallelBuilding enableMultilib; inherit enableParallelBuilding enableMultilib;
@ -483,12 +467,10 @@ stdenv.mkDerivation ({
maintainers = with stdenv.lib.maintainers; [ ]; maintainers = with stdenv.lib.maintainers; [ ];
# gnatboot is not available out of linux platforms, so we disable the darwin build
# for the gnat (ada compiler).
platforms = platforms =
stdenv.lib.platforms.linux ++ stdenv.lib.platforms.linux ++
stdenv.lib.platforms.freebsd ++ stdenv.lib.platforms.freebsd ++
optionals (langAda == false) stdenv.lib.platforms.darwin; stdenv.lib.platforms.darwin;
broken = true; broken = true;
}; };

View File

@ -1,44 +0,0 @@
{ stdenv, fetchFromGitHub, gnat, zlib, llvm_35, ncurses, clang, flavour ? "mcode" }:
# mcode only works on x86, while the llvm flavour works on both x86 and x86_64.
assert flavour == "llvm" || flavour == "mcode";
let
inherit (stdenv.lib) optional;
inherit (stdenv.lib) optionals;
version = "0.33";
in
stdenv.mkDerivation rec {
name = "ghdl-${flavour}-${version}";
src = fetchFromGitHub {
owner = "tgingold";
repo = "ghdl";
rev = "v${version}";
sha256 = "0g72rk2yzr0lrpncq2c1qcv71w3mi2hjq84r1yzgjr6d0qm87r2a";
};
buildInputs = [ gnat zlib ] ++ optionals (flavour == "llvm") [ clang ncurses ];
configureFlags = optional (flavour == "llvm") "--with-llvm=${llvm_35}";
patchPhase = ''
# Disable warnings-as-errors, because there are warnings (unused things)
sed -i s/-gnatwae/-gnatwa/ Makefile.in ghdl.gpr.in
'';
hardeningDisable = [ "all" ];
enableParallelBuilding = true;
meta = {
homepage = https://sourceforge.net/p/ghdl-updates/wiki/Home/;
description = "Free VHDL simulator";
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; (if flavour == "llvm" then [ "i686-linux" "x86_64-linux" ]
else [ "i686-linux" ]);
license = stdenv.lib.licenses.gpl2Plus;
};
}

View File

@ -1,48 +0,0 @@
{stdenv, fetchurl}:
stdenv.mkDerivation {
name = "gentoo-gnatboot-4.1";
src = if stdenv.system == "i686-linux" then
fetchurl {
url = "mirror://gentoo/distfiles/gnatboot-4.1-i386.tar.bz2";
sha256 = "0665zk71598204bf521vw68i5y6ccqarq9fcxsqp7ccgycb4lysr";
}
else if stdenv.system == "x86_64-linux" then
fetchurl {
url = "mirror://gentoo/distfiles/gnatboot-4.1-amd64.tar.bz2";
sha256 = "1li4d52lmbnfs6llcshlbqyik2q2q4bvpir0f7n38nagp0h6j0d4";
} else throw "Platform not supported";
dontStrip=1;
installPhase = ''
mkdir -p $out
cp -R * $out
set +e
for a in $out/bin/* ; do
patchelf --interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
--set-rpath $(cat $NIX_CC/nix-support/orig-libc)/lib:$(cat $NIX_CC/nix-support/orig-cc)/lib64:$(cat $NIX_CC/nix-support/orig-cc)/lib $a
done
set -e
mv $out/bin/gnatgcc_2wrap $out/bin/gnatgcc
ln -s $out/bin/gnatgcc $out/bin/gcc
'';
passthru = {
langC = true; /* TRICK for gcc-wrapper to wrap it */
langCC = false;
langFortran = false;
langAda = true;
};
meta = {
homepage = http://gentoo.org;
license = stdenv.lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+
maintainers = [
stdenv.lib.maintainers.viric
];
platforms = stdenv.lib.platforms.linux;
};
}

View File

@ -0,0 +1,39 @@
From c7a9aa3a697c81432786a5583bf973771c7be15e Mon Sep 17 00:00:00 2001
From: Don Hinton <hintonda@gmail.com>
Date: Wed, 12 Jul 2017 01:15:46 +0000
Subject: [PATCH] Fix minor typo introduced in r276404
Summary:
A space was added between '-' and 'help' when emitting help output.
See https://reviews.llvm.org/D22621 for details.
Reviewers: MaggieYi, vsk
Reviewed By: vsk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D35283
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307745 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/Support/CommandLine.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index 3889902eea5..79defa5c36c 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -1236,7 +1236,7 @@ bool CommandLineParser::ParseCommandLineOptions(int argc,
<< ": Not enough positional command line arguments specified!\n"
<< "Must specify at least " << NumPositionalRequired
<< " positional argument" << (NumPositionalRequired > 1 ? "s" : "")
- << ": See: " << argv[0] << " - help\n";
+ << ": See: " << argv[0] << " -help\n";
}
ErrorParsing = true;
--
2.14.0

View File

@ -78,6 +78,9 @@ in stdenv.mkDerivation (rec {
substituteInPlace lib/esan/esan_sideline_linux.cpp \ substituteInPlace lib/esan/esan_sideline_linux.cpp \
--replace 'struct sigaltstack' 'stack_t' --replace 'struct sigaltstack' 'stack_t'
) )
'' + # Fix extra space printed in commandline help sometimes, "- help"
''
patch -p1 -i ${./cmdline-help.patch}
'' + stdenv.lib.optionalString stdenv.isAarch64 '' '' + stdenv.lib.optionalString stdenv.isAarch64 ''
patch -p0 < ${../aarch64.patch} patch -p0 < ${../aarch64.patch}
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl '' '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''

View File

@ -16,6 +16,7 @@
, debugVersion ? false , debugVersion ? false
, enableManpages ? false , enableManpages ? false
, enableSharedLibraries ? true , enableSharedLibraries ? true
, enableWasm ? true
, darwin , darwin
}: }:
@ -113,7 +114,9 @@ in stdenv.mkDerivation (rec {
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}"
"-DTARGET_TRIPLE=${stdenv.targetPlatform.config}" "-DTARGET_TRIPLE=${stdenv.targetPlatform.config}"
]; ] ++ stdenv.lib.optional enableWasm
"-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly"
;
postBuild = '' postBuild = ''
rm -fR $out rm -fR $out

View File

@ -2,11 +2,11 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "nasm-${version}"; name = "nasm-${version}";
version = "2.13.02"; version = "2.13.03";
src = fetchurl { src = fetchurl {
url = "http://www.nasm.us/pub/nasm/releasebuilds/${version}/${name}.tar.bz2"; url = "http://www.nasm.us/pub/nasm/releasebuilds/${version}/${name}.tar.bz2";
sha256 = "1gmvjckxvkmx1kbglgrakc98qhy55xlqlk5flrdihz5yhv92hc4d"; sha256 = "04bh736zfj3xy5ihh1whshpjxsisv7hqkz954clzdw6kg93qdv33";
}; };
nativeBuildInputs = [ perl ]; nativeBuildInputs = [ perl ];

View File

@ -14,9 +14,9 @@ let
* The JRE libraries are in directories that depend on the CPU. * The JRE libraries are in directories that depend on the CPU.
*/ */
architecture = architecture =
if stdenv.system == "i686-linux" then if stdenv.hostPlatform.system == "i686-linux" then
"i386" "i386"
else if stdenv.system == "x86_64-linux" then else if stdenv.hostPlatform.system == "x86_64-linux" then
"amd64" "amd64"
else else
throw "openjdk requires i686-linux or x86_64 linux"; throw "openjdk requires i686-linux or x86_64 linux";

View File

@ -1,11 +1,14 @@
{ stdenv, runCommand, glibc, fetchurl, file { stdenv
, runCommand, fetchurl, file
, version , version
}: }:
assert stdenv.hostPlatform.libc == "glibc";
let let
# !!! These should be on nixos.org # !!! These should be on nixos.org
src = if glibc.system == "x86_64-linux" then src = if stdenv.hostPlatform.system == "x86_64-linux" then
(if version == "8" then (if version == "8" then
fetchurl { fetchurl {
url = "https://www.dropbox.com/s/a0lsq2ig4uguky5/openjdk8-bootstrap-x86_64-linux.tar.xz?dl=1"; url = "https://www.dropbox.com/s/a0lsq2ig4uguky5/openjdk8-bootstrap-x86_64-linux.tar.xz?dl=1";
@ -17,7 +20,7 @@ let
sha256 = "024gg2sgg4labxbc1nhn8lxls2p7d9h3b82hnsahwaja2pm1hbra"; sha256 = "024gg2sgg4labxbc1nhn8lxls2p7d9h3b82hnsahwaja2pm1hbra";
} }
else throw "No bootstrap for version") else throw "No bootstrap for version")
else if glibc.system == "i686-linux" then else if stdenv.hostPlatform.system == "i686-linux" then
(if version == "8" then (if version == "8" then
fetchurl { fetchurl {
url = "https://www.dropbox.com/s/rneqjhlerijsw74/openjdk8-bootstrap-i686-linux.tar.xz?dl=1"; url = "https://www.dropbox.com/s/rneqjhlerijsw74/openjdk8-bootstrap-i686-linux.tar.xz?dl=1";
@ -39,22 +42,18 @@ let
LIBDIRS="$(find $out -name \*.so\* -exec dirname {} \; | sort | uniq | tr '\n' ':')" LIBDIRS="$(find $out -name \*.so\* -exec dirname {} \; | sort | uniq | tr '\n' ':')"
for i in $out/bin/*; do find "$out" -type f -print0 | while IFS= read -r -d "" elf; do
patchelf --set-interpreter ${glibc.out}/lib/ld-linux*.so.2 $i || true isELF "$elf" || continue
patchelf --set-rpath "${glibc.out}/lib:$LIBDIRS" $i || true patchelf --set-interpreter $(cat "${stdenv.cc}/nix-support/dynamic-linker") "$elf" || true
done patchelf --set-rpath "${stdenv.cc.libc}/lib:${stdenv.cc.cc.lib}/lib:$LIBDIRS" "$elf" || true
find $out -name \*.so\* | while read lib; do
patchelf --set-interpreter ${glibc.out}/lib/ld-linux*.so.2 $lib || true
patchelf --set-rpath "${glibc.out}/lib:${stdenv.cc.cc.lib}/lib:$LIBDIRS" $lib || true
done done
# Temporarily, while NixOS's OpenJDK bootstrap tarball doesn't have PaX markings: # Temporarily, while NixOS's OpenJDK bootstrap tarball doesn't have PaX markings:
exes=$(${file}/bin/file $out/bin/* 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//') find "$out/bin" -type f -print0 | while IFS= read -r -d "" elf; do
for file in $exes; do isELF "$elf" || continue
paxmark m "$file" paxmark m "$elf"
# On x86 for heap sizes over 700MB disable SEGMEXEC and PAGEEXEC as well. # On x86 for heap sizes over 700MB disable SEGMEXEC and PAGEEXEC as well.
${stdenv.lib.optionalString stdenv.isi686 ''paxmark msp "$file"''} ${stdenv.lib.optionalString stdenv.isi686 ''paxmark msp "$elf"''}
done done
''; '';
in bootstrap in bootstrap

Some files were not shown because too many files have changed in this diff Show More