Include nixpkgs-mozilla
parent
6370f16b48
commit
5b0d1c302b
@ -1 +0,0 @@
|
|||||||
Subproject commit 086d3beecab64c7fda215788eb1379fb665b462b
|
|
@ -0,0 +1 @@
|
|||||||
|
/result*
|
@ -0,0 +1,32 @@
|
|||||||
|
language: nix
|
||||||
|
addons:
|
||||||
|
ssh_known_hosts: floki.garbas.si
|
||||||
|
env:
|
||||||
|
- STDENV=clang
|
||||||
|
- STDENV=clang36
|
||||||
|
- STDENV=clang37
|
||||||
|
- STDENV=clang38
|
||||||
|
- STDENV=gcc
|
||||||
|
- STDENV=gcc49
|
||||||
|
- STDENV=gcc48
|
||||||
|
script:
|
||||||
|
- if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then
|
||||||
|
nix-shell update.nix --pure;
|
||||||
|
fi
|
||||||
|
- if [ "$TRAVIS_PULL_REQUEST" != "true" -a "$TRAVIS_BRANCH" = "master" ]; then
|
||||||
|
nix-build release.nix -A gecko."x86_64-linux"."$STDENV";
|
||||||
|
mkdir nars/;
|
||||||
|
nix-push --dest "$PWD/nars/" --force ./result;
|
||||||
|
fi
|
||||||
|
before_install:
|
||||||
|
- openssl aes-256-cbc -K $encrypted_be02022e0814_key -iv $encrypted_be02022e0814_iv -in deploy_rsa.enc -out deploy_rsa -d
|
||||||
|
before_deploy:
|
||||||
|
- eval "$(ssh-agent -s)"
|
||||||
|
- chmod 600 $TRAVIS_BUILD_DIR/deploy_rsa
|
||||||
|
- ssh-add $TRAVIS_BUILD_DIR/deploy_rsa
|
||||||
|
deploy:
|
||||||
|
provider: script
|
||||||
|
skip_cleanup: true
|
||||||
|
script: rsync -avh --ignore-existing $TRAVIS_BUILD_DIR/nars/ travis@floki.garbas.si:/var/travis/nixpkgs-mozilla/
|
||||||
|
on:
|
||||||
|
branch: master
|
@ -0,0 +1,19 @@
|
|||||||
|
Copyright 2017 Mozilla
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -0,0 +1,47 @@
|
|||||||
|
nixpkgs-mozilla
|
||||||
|
===============
|
||||||
|
|
||||||
|
Gathering nix efforts in one repository.
|
||||||
|
|
||||||
|
|
||||||
|
Current packages
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- servo (https://github.com/servo/servo)
|
||||||
|
- gecko (https://github.com/mozilla/gecko-dev)
|
||||||
|
- firefox-dev-bin (`Firefox Developer Edition <https://www.mozilla.org/en-US/firefox/developer/>`)
|
||||||
|
- VidyoDesktop ()
|
||||||
|
|
||||||
|
Rust overlay
|
||||||
|
------------
|
||||||
|
|
||||||
|
**NOTE:** Nix overlays only works on up-to-date versions of NixOS/nixpkgs, starting from 17.03.
|
||||||
|
|
||||||
|
A nixpkgs overlay is provided to contains all of the latest rust releases.
|
||||||
|
|
||||||
|
To use the rust overlay run the ``./rust-overlay-install.sh`` command. It will
|
||||||
|
link the current ``./rust-overlay.nix`` into you ``~/.config/nixpkgs/overlays`` folders.
|
||||||
|
|
||||||
|
Once this is done, use ``nix-env -iA nixpkgs.rustChannels.nightly.rust`` for
|
||||||
|
example. Replace the ``nixpkgs.`` prefix with ``nixos.`` on NixOS.
|
||||||
|
|
||||||
|
TODO
|
||||||
|
----
|
||||||
|
|
||||||
|
- setup hydra and have to have binary channels
|
||||||
|
|
||||||
|
- make sure pinned revisions get updated automatically (if build passes we
|
||||||
|
should update revisions in default.nix)
|
||||||
|
|
||||||
|
- pin to specific (working) nixpkgs revision (as we do for other sources
|
||||||
|
|
||||||
|
- servo can currently only be used with nix-shell. its build system tries to
|
||||||
|
dowload quite few things (it is doing ``pip install`` and ``cargo install``).
|
||||||
|
it should be possible to replace that with nix
|
||||||
|
|
||||||
|
- can we make this work on darwin as well?
|
||||||
|
|
||||||
|
- assign maintainers for our packages that will montior that it "always" builds
|
||||||
|
|
||||||
|
- hook it with vulnix report to monitor CVEs (once vulnix is ready, it must be
|
||||||
|
ready soon :P)
|
@ -0,0 +1,49 @@
|
|||||||
|
# This script extends nixpkgs with mozilla packages.
|
||||||
|
#
|
||||||
|
# First it imports the <nixpkgs> in the environment and depends on it
|
||||||
|
# providing fetchFromGitHub and lib.importJSON.
|
||||||
|
#
|
||||||
|
# After that it loads a pinned release of nixos-unstable and uses that as the
|
||||||
|
# base for the rest of packaging. One can pass it's own pkgs attribute if
|
||||||
|
# desired, probably in the context of hydra.
|
||||||
|
let
|
||||||
|
_pkgs = import <nixpkgs> {};
|
||||||
|
_nixpkgs = _pkgs.fetchFromGitHub (_pkgs.lib.importJSON ./pkgs/nixpkgs.json);
|
||||||
|
in
|
||||||
|
|
||||||
|
{ pkgs ? import _nixpkgs {}
|
||||||
|
, geckoSrc ? null
|
||||||
|
, servoSrc ? null
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
callPackage = (extra: pkgs.lib.callPackageWith
|
||||||
|
({ inherit geckoSrc servoSrc; } // self // extra)) {};
|
||||||
|
|
||||||
|
self = {
|
||||||
|
|
||||||
|
lib = callPackage ./pkgs/lib/default.nix { };
|
||||||
|
|
||||||
|
rustPlatform = pkgs.rustUnstable;
|
||||||
|
|
||||||
|
pkgs = pkgs // {
|
||||||
|
name = "nixpkgs";
|
||||||
|
updateScript = self.lib.updateFromGitHub {
|
||||||
|
owner = "NixOS";
|
||||||
|
repo = "nixpkgs-channels";
|
||||||
|
branch = "nixos-unstable-small";
|
||||||
|
path = "pkgs/nixpkgs.json";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
gecko = callPackage ./pkgs/gecko { };
|
||||||
|
|
||||||
|
servo = callPackage ./pkgs/servo { };
|
||||||
|
|
||||||
|
firefox-nightly-bin = _pkgs.lowPrio (callPackage ./pkgs/firefox-nightly-bin/default.nix { });
|
||||||
|
|
||||||
|
VidyoDesktop = callPackage ./pkgs/VidyoDesktop { };
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
in self
|
Binary file not shown.
@ -0,0 +1,158 @@
|
|||||||
|
with builtins;
|
||||||
|
let
|
||||||
|
layout_pat = "[ \n]+";
|
||||||
|
layout_pat_opt = "[ \n]*";
|
||||||
|
token_pat = ''=|[[][[][a-zA-Z0-9_."*-]+[]][]]|[[][a-zA-Z0-9_."*-]+[]]|[a-zA-Z0-9_-]+|"[^"]*"'';
|
||||||
|
tokenizer_rec = len: prevTokens: patterns: str:
|
||||||
|
let
|
||||||
|
pattern = head patterns;
|
||||||
|
layoutAndTokens = match pattern str;
|
||||||
|
matchLength = stringLength (head layoutAndTokens);
|
||||||
|
tokens = prevTokens ++ tail layoutAndTokens;
|
||||||
|
in
|
||||||
|
if layoutAndTokens == null then
|
||||||
|
# if we cannot reduce the pattern, return the list of token
|
||||||
|
if tail patterns == [] then prevTokens
|
||||||
|
# otherwise, take the next pattern, which only captures half the token.
|
||||||
|
else tokenizer_rec len prevTokens (tail patterns) str
|
||||||
|
else tokenizer_rec len tokens patterns (substring matchLength len str);
|
||||||
|
|
||||||
|
avgTokenSize = 100;
|
||||||
|
ceilLog2 = v:
|
||||||
|
let inner = n: i: if i < v then inner (n + 1) (i * 2) else n; in
|
||||||
|
inner 1 1;
|
||||||
|
|
||||||
|
# The builtins.match function match the entire string, and generate a list of all captured
|
||||||
|
# elements. This is the most efficient way to make a tokenizer, if we can make a pattern which
|
||||||
|
# capture all token of the file. Unfortunately C++ std::regex does not support captures in
|
||||||
|
# repeated patterns. As a work-around, we generate patterns which are matching tokens in multiple
|
||||||
|
# of 2, such that we can avoid iterating too many times over the content.
|
||||||
|
generatePatterns = str:
|
||||||
|
let
|
||||||
|
depth = ceilLog2 (stringLength str / avgTokenSize);
|
||||||
|
inner = depth:
|
||||||
|
if depth == 0 then [ "(${token_pat})" ]
|
||||||
|
else
|
||||||
|
let next = inner (depth - 1); in
|
||||||
|
[ "${head next}${layout_pat}${head next}" ] ++ next;
|
||||||
|
in
|
||||||
|
map (pat: "(${layout_pat_opt}${pat}).*" ) (inner depth);
|
||||||
|
|
||||||
|
tokenizer = str: tokenizer_rec (stringLength str) [] (generatePatterns str) str;
|
||||||
|
|
||||||
|
unescapeString = str:
|
||||||
|
# Let's ignore any escape character for the moment.
|
||||||
|
assert match ''"[^"]*"'' str != null;
|
||||||
|
substring 1 (stringLength str - 2) str;
|
||||||
|
|
||||||
|
tokenToValue = token:
|
||||||
|
if token == "true" then true
|
||||||
|
else if token == "false" then false
|
||||||
|
else unescapeString token;
|
||||||
|
|
||||||
|
# Match the content of TOML format section names, and add the grouping such that:
|
||||||
|
# match header_pat "a.b.c" == [ "a" ".b" "b" ".c" "c" ]
|
||||||
|
#
|
||||||
|
# Note, this implementation is limited to 11 identifiers.
|
||||||
|
ident_pat = ''[a-zA-Z0-9_-]+|"[^"]*"'';
|
||||||
|
header_pat =
|
||||||
|
foldl' (pat: n: "(${ident_pat})([.]${pat})?")
|
||||||
|
"(${ident_pat})" (genList (n: 0) 10);
|
||||||
|
|
||||||
|
headerToPath = token: wrapLen:
|
||||||
|
let
|
||||||
|
token' = substring wrapLen (stringLength token - 2 * wrapLen) token;
|
||||||
|
matchPath = match header_pat token';
|
||||||
|
filterDot = filter (s: substring 0 1 s != ".") matchPath;
|
||||||
|
path =
|
||||||
|
map (s:
|
||||||
|
if substring 0 1 s != ''"'' then s
|
||||||
|
else unescapeString s
|
||||||
|
) filterDot;
|
||||||
|
in
|
||||||
|
assert matchPath != null;
|
||||||
|
# assert trace "Path: ${token'}; match as ${toString path}" true;
|
||||||
|
path;
|
||||||
|
|
||||||
|
parserInitState = {
|
||||||
|
idx = 0;
|
||||||
|
path = [];
|
||||||
|
isList = false;
|
||||||
|
output = [];
|
||||||
|
elem = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Imported from nixpkgs library.
|
||||||
|
setAttrByPath = attrPath: value:
|
||||||
|
if attrPath == [] then value
|
||||||
|
else listToAttrs
|
||||||
|
[ { name = head attrPath; value = setAttrByPath (tail attrPath) value; } ];
|
||||||
|
|
||||||
|
closeSection = state:
|
||||||
|
state // {
|
||||||
|
output = state.output ++ [ (setAttrByPath state.path (
|
||||||
|
if state.isList then [ state.elem ]
|
||||||
|
else state.elem
|
||||||
|
)) ];
|
||||||
|
};
|
||||||
|
|
||||||
|
readToken = state: token:
|
||||||
|
# assert trace "Read '${token}'" true;
|
||||||
|
if state.idx == 0 then
|
||||||
|
if substring 0 2 token == "[[" then
|
||||||
|
(closeSection state) // {
|
||||||
|
path = headerToPath token 2;
|
||||||
|
isList = true;
|
||||||
|
elem = {};
|
||||||
|
}
|
||||||
|
else if substring 0 1 token == "[" then
|
||||||
|
(closeSection state) // {
|
||||||
|
path = headerToPath token 1;
|
||||||
|
isList = false;
|
||||||
|
elem = {};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
assert match "[a-zA-Z0-9_-]+" token != null;
|
||||||
|
state // { idx = 1; name = token; }
|
||||||
|
else if state.idx == 1 then
|
||||||
|
assert token == "=";
|
||||||
|
state // { idx = 2; }
|
||||||
|
else
|
||||||
|
assert state.idx == 2;
|
||||||
|
state // {
|
||||||
|
idx = 0;
|
||||||
|
elem = state.elem // {
|
||||||
|
"${state.name}" = tokenToValue token;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# aggregate each section as individual attribute sets.
|
||||||
|
parser = str:
|
||||||
|
closeSection (foldl' readToken parserInitState (tokenizer str));
|
||||||
|
|
||||||
|
fromTOML = toml:
|
||||||
|
let
|
||||||
|
sections = (parser toml).output;
|
||||||
|
# Inlined from nixpkgs library functions.
|
||||||
|
zipAttrs = sets:
|
||||||
|
listToAttrs (map (n: {
|
||||||
|
name = n;
|
||||||
|
value =
|
||||||
|
let v = catAttrs n sets; in
|
||||||
|
# assert trace "Visiting ${n}" true;
|
||||||
|
if tail v == [] then head v
|
||||||
|
else if isList (head v) then concatLists v
|
||||||
|
else if isAttrs (head v) then zipAttrs v
|
||||||
|
else throw "cannot merge sections";
|
||||||
|
}) (concatLists (map attrNames sets)));
|
||||||
|
in
|
||||||
|
zipAttrs sections;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
testing = fromTOML (builtins.readFile ./channel-rust-nightly.toml);
|
||||||
|
testing_url = fromTOML (builtins.readFile (builtins.fetchurl
|
||||||
|
https://static.rust-lang.org/dist/channel-rust-nightly.toml));
|
||||||
|
inherit fromTOML;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
source $stdenv/setup
|
||||||
|
PATH=$dpkg/bin:$PATH
|
||||||
|
|
||||||
|
dpkg -x $src unpacked
|
||||||
|
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp -r unpacked/* $out/
|
||||||
|
|
||||||
|
ln -s $out/usr/bin/VidyoDesktop $out/bin/VidyoDesktop
|
||||||
|
touch $out/etc/issue
|
||||||
|
|
||||||
|
#wrapProgram $out/bin/VidyoDesktop \
|
||||||
|
# --set PULSE_LATENCY_MSEC "60" \
|
||||||
|
# --set VIDYO_AUDIO_FRAMEWORK "ALSA"
|
@ -0,0 +1,36 @@
|
|||||||
|
{ pkgs
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inherit (pkgs) fetchurl buildFHSUserEnv makeWrapper dpkg alsaLib
|
||||||
|
alsaUtils alsaOss alsaTools alsaPlugins libidn utillinux mesa_glu qt4
|
||||||
|
zlib patchelf xorg;
|
||||||
|
inherit (pkgs.stdenv) mkDerivation;
|
||||||
|
|
||||||
|
VidyoDesktopDeb = mkDerivation {
|
||||||
|
name = "VidyoDesktopDeb-123";
|
||||||
|
builder = ./builder.sh;
|
||||||
|
inherit dpkg;
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://v.mozilla.com/upload/VidyoDesktopInstaller-ubuntu64-TAG_VD_3_3_0_027.deb";
|
||||||
|
sha256 = "045f9z421qpcm45bmh98f3h7bd46rdjvcbdpv4rlw9ribncv66dc";
|
||||||
|
};
|
||||||
|
buildInputs = [ makeWrapper ];
|
||||||
|
};
|
||||||
|
|
||||||
|
in buildFHSUserEnv {
|
||||||
|
name = "VidyoDesktop-123";
|
||||||
|
targetPkgs = pkgs: [ VidyoDesktopDeb ];
|
||||||
|
multiPkgs = pkgs: [
|
||||||
|
patchelf dpkg alsaLib alsaUtils alsaOss alsaTools alsaPlugins
|
||||||
|
libidn utillinux mesa_glu qt4 zlib xorg.libXext xorg.libXv xorg.libX11
|
||||||
|
xorg.libXfixes xorg.libXrandr xorg.libXScrnSaver
|
||||||
|
];
|
||||||
|
extraBuildCommands = ''
|
||||||
|
ln -s ${VidyoDesktopDeb}/opt $out/opt
|
||||||
|
'';
|
||||||
|
runScript = "VidyoDesktop";
|
||||||
|
# for debugging
|
||||||
|
#runScript = "bash";
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
diff -x _inst -x _build -x .svn -ur libcxx.old/include/cstdio libcxx.new/include/cstdio
|
||||||
|
--- libcxx.old/include/cstdio 2016-07-08 12:47:12.964181871 +0000
|
||||||
|
+++ libcxx.new/include/cstdio 2016-07-08 12:47:27.540149147 +0000
|
||||||
|
@@ -109,15 +109,15 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef getc
|
||||||
|
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
|
||||||
|
+inline __attribute__ ((__always_inline__)) int __libcpp_getc(FILE* __stream) {return getc(__stream);}
|
||||||
|
#undef getc
|
||||||
|
-inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
|
||||||
|
+inline __attribute__ ((__always_inline__)) int getc(FILE* __stream) {return __libcpp_getc(__stream);}
|
||||||
|
#endif // getc
|
||||||
|
|
||||||
|
#ifdef putc
|
||||||
|
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
|
||||||
|
+inline __attribute__ ((__always_inline__)) int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
|
||||||
|
#undef putc
|
||||||
|
-inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
|
||||||
|
+inline __attribute__ ((__always_inline__)) int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
|
||||||
|
#endif // putc
|
||||||
|
|
||||||
|
#ifdef clearerr
|
||||||
|
diff -x _inst -x _build -x .svn -ur libcxx.old/include/utility libcxx.new/include/utility
|
||||||
|
--- libcxx.old/include/utility 2016-07-08 12:46:02.570334913 +0000
|
||||||
|
+++ libcxx.new/include/utility 2016-07-08 12:51:00.760636878 +0000
|
||||||
|
@@ -217,7 +217,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _Tp, size_t _Np>
|
||||||
|
-inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
+inline __attribute__ ((__always_inline__))
|
||||||
|
void
|
||||||
|
swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||||
|
{
|
@ -0,0 +1,28 @@
|
|||||||
|
{ pkgs
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
unwrapped = pkgs.callPackage "${pkgs.path}/pkgs/applications/networking/browsers/firefox-bin" {
|
||||||
|
inherit (pkgs) stdenv;
|
||||||
|
channel = "nightly";
|
||||||
|
generated = import (./. + "/sources.nix");
|
||||||
|
gconf = pkgs.gnome2.GConf;
|
||||||
|
inherit (pkgs.gnome2) libgnome libgnomeui;
|
||||||
|
inherit (pkgs.gnome3) defaultIconTheme;
|
||||||
|
};
|
||||||
|
|
||||||
|
name = "firefox-nightly-bin-${(builtins.parseDrvName unwrapped.name).version}";
|
||||||
|
|
||||||
|
self = pkgs.wrapFirefox unwrapped {
|
||||||
|
browserName = "firefox";
|
||||||
|
desktopName = "Firefox Nightly";
|
||||||
|
inherit name;
|
||||||
|
};
|
||||||
|
|
||||||
|
in self // {
|
||||||
|
updateScript = import ./update.nix {
|
||||||
|
inherit name;
|
||||||
|
inherit (pkgs) writeScript xidel coreutils gnused gnugrep curl jq;
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
version = "56.0a1" + "-" + "20170717100212";
|
||||||
|
sources = [
|
||||||
|
{ url = "http://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/firefox-56.0a1.en-US.linux-x86_64.tar.bz2";
|
||||||
|
locale = "en-US";
|
||||||
|
arch = "linux-x86_64";
|
||||||
|
sha512 = "389ada65229fa6225a918041f77eed26cff321d649b8e9206835364e967fe3312dba9f7de9fbea52daf934265b804de447dddee60932d5019f8361884c9f3bde";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
{ name
|
||||||
|
, writeScript
|
||||||
|
, xidel
|
||||||
|
, coreutils
|
||||||
|
, gnused
|
||||||
|
, gnugrep
|
||||||
|
, curl
|
||||||
|
, jq
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
version = (builtins.parseDrvName name).version;
|
||||||
|
in writeScript "update-firefox-nightly-bin" ''
|
||||||
|
PATH=${coreutils}/bin:${gnused}/bin:${gnugrep}/bin:${xidel}/bin:${curl}/bin:${jq}/bin
|
||||||
|
|
||||||
|
#set -eux
|
||||||
|
pushd pkgs/firefox-nightly-bin
|
||||||
|
|
||||||
|
tmpfile=`mktemp`
|
||||||
|
url=http://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
|
||||||
|
|
||||||
|
nightly_file=`xidel -q $url --extract //a | \
|
||||||
|
grep firefox | \
|
||||||
|
grep linux-x86_64.json | \
|
||||||
|
tail -1 | \
|
||||||
|
sed -e 's/.json//'`
|
||||||
|
nightly_json=`curl --silent $url$nightly_file.json`
|
||||||
|
|
||||||
|
cat > $tmpfile <<EOF
|
||||||
|
{
|
||||||
|
version = `echo $nightly_json | jq ."moz_app_version"` + "-" + `echo $nightly_json | jq ."buildid"`;
|
||||||
|
sources = [
|
||||||
|
{ url = "$url$nightly_file.tar.bz2";
|
||||||
|
locale = "`echo $nightly_file | cut -d"." -f3`";
|
||||||
|
arch = "`echo $nightly_file | cut -d"." -f4`";
|
||||||
|
sha512 = "`curl --silent $url$nightly_file.checksums | grep $nightly_file.tar.bz2$ | grep sha512 | cut -d" " -f1`";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
mv $tmpfile sources.nix
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
''
|
@ -0,0 +1,230 @@
|
|||||||
|
Index: gcc-4_7-branch/libstdc++-v3/configure.host
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/libstdc++-v3/configure.host (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/libstdc++-v3/configure.host (revision 194580)
|
||||||
|
@@ -340,7 +340,7 @@
|
||||||
|
fi
|
||||||
|
esac
|
||||||
|
case "${host}" in
|
||||||
|
- arm*-*-linux-*eabi)
|
||||||
|
+ arm*-*-linux-*eabi*)
|
||||||
|
port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
Index: gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc (revision 194580)
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums" }
|
||||||
|
-// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||||
|
+// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||||
|
|
||||||
|
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
//
|
||||||
|
Index: gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc (revision 194580)
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums" }
|
||||||
|
-// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||||
|
+// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||||
|
|
||||||
|
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
//
|
||||||
|
Index: gcc-4_7-branch/libjava/configure.ac
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/libjava/configure.ac (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/libjava/configure.ac (revision 194580)
|
||||||
|
@@ -931,7 +931,7 @@
|
||||||
|
# on Darwin -single_module speeds up loading of the dynamic libraries.
|
||||||
|
extra_ldflags_libjava=-Wl,-single_module
|
||||||
|
;;
|
||||||
|
-arm*linux*eabi)
|
||||||
|
+arm*-*-linux*eabi*)
|
||||||
|
# Some of the ARM unwinder code is actually in libstdc++. We
|
||||||
|
# could in principle replicate it in libgcj, but it's better to
|
||||||
|
# have a dependency on libstdc++.
|
||||||
|
Index: gcc-4_7-branch/libjava/configure
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/libjava/configure (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/libjava/configure (revision 194580)
|
||||||
|
@@ -20542,7 +20542,7 @@
|
||||||
|
# on Darwin -single_module speeds up loading of the dynamic libraries.
|
||||||
|
extra_ldflags_libjava=-Wl,-single_module
|
||||||
|
;;
|
||||||
|
-arm*linux*eabi)
|
||||||
|
+arm*-*-linux*eabi*)
|
||||||
|
# Some of the ARM unwinder code is actually in libstdc++. We
|
||||||
|
# could in principle replicate it in libgcj, but it's better to
|
||||||
|
# have a dependency on libstdc++.
|
||||||
|
Index: gcc-4_7-branch/libgcc/config.host
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/libgcc/config.host (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/libgcc/config.host (revision 194580)
|
||||||
|
@@ -327,7 +327,7 @@
|
||||||
|
arm*-*-linux*) # ARM GNU/Linux with ELF
|
||||||
|
tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix"
|
||||||
|
case ${host} in
|
||||||
|
- arm*-*-linux-*eabi)
|
||||||
|
+ arm*-*-linux-*eabi*)
|
||||||
|
tmake_file="${tmake_file} arm/t-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc"
|
||||||
|
tm_file="$tm_file arm/bpabi-lib.h"
|
||||||
|
unwind_header=config/arm/unwind-arm.h
|
||||||
|
Index: gcc-4_7-branch/gcc/doc/install.texi
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/gcc/doc/install.texi (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/gcc/doc/install.texi (revision 194580)
|
||||||
|
@@ -3222,7 +3222,7 @@
|
||||||
|
@heading @anchor{arm-x-eabi}arm-*-eabi
|
||||||
|
ARM-family processors. Subtargets that use the ELF object format
|
||||||
|
require GNU binutils 2.13 or newer. Such subtargets include:
|
||||||
|
-@code{arm-*-netbsdelf}, @code{arm-*-*linux-gnueabi}
|
||||||
|
+@code{arm-*-netbsdelf}, @code{arm-*-*linux-gnueabi*}
|
||||||
|
and @code{arm-*-rtemseabi}.
|
||||||
|
|
||||||
|
@html
|
||||||
|
Index: gcc-4_7-branch/gcc/testsuite/gcc.target/arm/synchronize.c
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/gcc/testsuite/gcc.target/arm/synchronize.c (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/gcc/testsuite/gcc.target/arm/synchronize.c (revision 194580)
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-/* { dg-final { scan-assembler "__sync_synchronize|dmb|mcr" { target arm*-*-linux-*eabi } } } */
|
||||||
|
+/* { dg-final { scan-assembler "__sync_synchronize|dmb|mcr" { target arm*-*-linux-*eabi* } } } */
|
||||||
|
|
||||||
|
void *foo (void)
|
||||||
|
{
|
||||||
|
Index: gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.jason/enum6.C
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.jason/enum6.C (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.jason/enum6.C (revision 194580)
|
||||||
|
@@ -7,10 +7,10 @@
|
||||||
|
// enum-size attributes should only be emitted if there are values of
|
||||||
|
// enum type that can escape the compilation unit, gcc cannot currently
|
||||||
|
// detect this; if this facility is added then this linker option should
|
||||||
|
-// not be needed. arm-*-linux*eabi should be a good approximation to
|
||||||
|
+// not be needed. arm-*-linux*eabi* should be a good approximation to
|
||||||
|
// those platforms where the EABI supplement defines enum values to be
|
||||||
|
// 32 bits wide.
|
||||||
|
-// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||||
|
+// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
Index: gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.other/enum4.C
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.other/enum4.C (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.other/enum4.C (revision 194580)
|
||||||
|
@@ -9,10 +9,10 @@
|
||||||
|
// enum-size attributes should only be emitted if there are values of
|
||||||
|
// enum type that can escape the compilation unit, gcc cannot currently
|
||||||
|
// detect this; if this facility is added then this linker option should
|
||||||
|
-// not be needed. arm-*-linux*eabi should be a good approximation to
|
||||||
|
+// not be needed. arm-*-linux*eabi* should be a good approximation to
|
||||||
|
// those platforms where the EABI supplement defines enum values to be
|
||||||
|
// 32 bits wide.
|
||||||
|
-// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||||
|
+// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||||
|
|
||||||
|
enum E {
|
||||||
|
a = -312
|
||||||
|
Index: gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.law/enum9.C
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.law/enum9.C (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.law/enum9.C (revision 194580)
|
||||||
|
@@ -7,10 +7,10 @@
|
||||||
|
// enum-size attributes should only be emitted if there are values of
|
||||||
|
// enum type that can escape the compilation unit, gcc cannot currently
|
||||||
|
// detect this; if this facility is added then this linker option should
|
||||||
|
-// not be needed. arm-*-linux*eabi should be a good approximation to
|
||||||
|
+// not be needed. arm-*-linux*eabi* should be a good approximation to
|
||||||
|
// those platforms where the EABI supplement defines enum values to be
|
||||||
|
// 32 bits wide.
|
||||||
|
-// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||||
|
+// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||||
|
|
||||||
|
// GROUPS passed enums
|
||||||
|
extern "C" int printf (const char *, ...);
|
||||||
|
Index: gcc-4_7-branch/gcc/testsuite/lib/target-supports.exp
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/gcc/testsuite/lib/target-supports.exp (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/gcc/testsuite/lib/target-supports.exp (revision 194580)
|
||||||
|
@@ -3818,7 +3818,7 @@
|
||||||
|
}
|
||||||
|
} ""
|
||||||
|
}]
|
||||||
|
- } elseif { [istarget arm*-*-linux-gnueabi] } {
|
||||||
|
+ } elseif { [istarget arm*-*-linux-gnueabi*] } {
|
||||||
|
return [check_runtime sync_longlong_runtime {
|
||||||
|
#include <stdlib.h>
|
||||||
|
int main ()
|
||||||
|
@@ -3860,7 +3860,7 @@
|
||||||
|
|| [istarget i?86-*-*]
|
||||||
|
|| [istarget x86_64-*-*]
|
||||||
|
|| [istarget alpha*-*-*]
|
||||||
|
- || [istarget arm*-*-linux-gnueabi]
|
||||||
|
+ || [istarget arm*-*-linux-gnueabi*]
|
||||||
|
|| [istarget bfin*-*linux*]
|
||||||
|
|| [istarget hppa*-*linux*]
|
||||||
|
|| [istarget s390*-*-*]
|
||||||
|
@@ -3890,7 +3890,7 @@
|
||||||
|
|| [istarget i?86-*-*]
|
||||||
|
|| [istarget x86_64-*-*]
|
||||||
|
|| [istarget alpha*-*-*]
|
||||||
|
- || [istarget arm*-*-linux-gnueabi]
|
||||||
|
+ || [istarget arm*-*-linux-gnueabi*]
|
||||||
|
|| [istarget hppa*-*linux*]
|
||||||
|
|| [istarget s390*-*-*]
|
||||||
|
|| [istarget powerpc*-*-*]
|
||||||
|
Index: gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_9.f90
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_9.f90 (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_9.f90 (revision 194580)
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
! { dg-do run }
|
||||||
|
! { dg-options "-fshort-enums" }
|
||||||
|
-! { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||||
|
+! { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||||
|
! Program to test enumerations when option -fshort-enums is given
|
||||||
|
|
||||||
|
program main
|
||||||
|
Index: gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_10.f90
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_10.f90 (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_10.f90 (revision 194580)
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
! { dg-do run }
|
||||||
|
! { dg-additional-sources enum_10.c }
|
||||||
|
! { dg-options "-fshort-enums -w" }
|
||||||
|
-! { dg-options "-fshort-enums -w -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||||
|
+! { dg-options "-fshort-enums -w -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||||
|
! Make sure short enums are indeed interoperable with the
|
||||||
|
! corresponding C type.
|
||||||
|
|
||||||
|
Index: gcc-4_7-branch/gcc/ada/gcc-interface/Makefile.in
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/gcc/ada/gcc-interface/Makefile.in (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/gcc/ada/gcc-interface/Makefile.in (revision 194580)
|
||||||
|
@@ -1866,7 +1866,7 @@
|
||||||
|
LIBRARY_VERSION := $(LIB_VERSION)
|
||||||
|
endif
|
||||||
|
|
||||||
|
-ifeq ($(strip $(filter-out arm% linux-gnueabi,$(arch) $(osys)-$(word 4,$(targ)))),)
|
||||||
|
+ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(word 4,$(targ))),,$(word 4,$(targ)))),)
|
||||||
|
LIBGNAT_TARGET_PAIRS = \
|
||||||
|
a-intnam.ads<a-intnam-linux.ads \
|
||||||
|
s-inmaop.adb<s-inmaop-posix.adb \
|
||||||
|
Index: gcc-4_7-branch/gcc/config.gcc
|
||||||
|
===================================================================
|
||||||
|
--- gcc-4_7-branch/gcc/config.gcc (revision 194579)
|
||||||
|
+++ gcc-4_7-branch/gcc/config.gcc (revision 194580)
|
||||||
|
@@ -855,7 +855,7 @@
|
||||||
|
esac
|
||||||
|
tmake_file="${tmake_file} arm/t-arm"
|
||||||
|
case ${target} in
|
||||||
|
- arm*-*-linux-*eabi)
|
||||||
|
+ arm*-*-linux-*eabi*)
|
||||||
|
tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
|
||||||
|
tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
|
||||||
|
# Define multilib configuration for arm-linux-androideabi.
|
@ -0,0 +1,245 @@
|
|||||||
|
source $stdenv/setup
|
||||||
|
|
||||||
|
|
||||||
|
export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
|
||||||
|
mkdir $NIX_FIXINC_DUMMY
|
||||||
|
|
||||||
|
|
||||||
|
if test "$staticCompiler" = "1"; then
|
||||||
|
EXTRA_LDFLAGS="-static"
|
||||||
|
else
|
||||||
|
EXTRA_LDFLAGS=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# GCC interprets empty paths as ".", which we don't want.
|
||||||
|
if test -z "$CPATH"; then unset CPATH; fi
|
||||||
|
if test -z "$LIBRARY_PATH"; then unset LIBRARY_PATH; fi
|
||||||
|
echo "\$CPATH is \`$CPATH'"
|
||||||
|
echo "\$LIBRARY_PATH is \`$LIBRARY_PATH'"
|
||||||
|
|
||||||
|
if test "$noSysDirs" = "1"; then
|
||||||
|
|
||||||
|
if test -e $NIX_GCC/nix-support/orig-libc; then
|
||||||
|
|
||||||
|
# Figure out what extra flags to pass to the gcc compilers
|
||||||
|
# being generated to make sure that they use our glibc.
|
||||||
|
extraFlags="$(cat $NIX_GCC/nix-support/libc-cflags)"
|
||||||
|
extraLDFlags="$(cat $NIX_GCC/nix-support/libc-ldflags) $(cat $NIX_GCC/nix-support/libc-ldflags-before)"
|
||||||
|
|
||||||
|
# Use *real* header files, otherwise a limits.h is generated
|
||||||
|
# that does not include Glibc's limits.h (notably missing
|
||||||
|
# SSIZE_MAX, which breaks the build).
|
||||||
|
export NIX_FIXINC_DUMMY=$(cat $NIX_GCC/nix-support/orig-libc)/include
|
||||||
|
|
||||||
|
# The path to the Glibc binaries such as `crti.o'.
|
||||||
|
glibc_libdir="$(cat $NIX_GCC/nix-support/orig-libc)/lib"
|
||||||
|
|
||||||
|
else
|
||||||
|
# Hack: support impure environments.
|
||||||
|
extraFlags="-isystem /usr/include"
|
||||||
|
extraLDFlags="-L/usr/lib64 -L/usr/lib"
|
||||||
|
glibc_libdir="/usr/lib"
|
||||||
|
export NIX_FIXINC_DUMMY=/usr/include
|
||||||
|
fi
|
||||||
|
|
||||||
|
extraFlags="-I$NIX_FIXINC_DUMMY $extraFlags"
|
||||||
|
extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
|
||||||
|
|
||||||
|
# BOOT_CFLAGS defaults to `-g -O2'; since we override it below,
|
||||||
|
# make sure to explictly add them so that files compiled with the
|
||||||
|
# bootstrap compiler are optimized and (optionally) contain
|
||||||
|
# debugging information (info "(gccinstall) Building").
|
||||||
|
if test -n "$dontStrip"; then
|
||||||
|
extraFlags="-O2 -g $extraFlags"
|
||||||
|
else
|
||||||
|
# Don't pass `-g' at all; this saves space while building.
|
||||||
|
extraFlags="-O2 $extraFlags"
|
||||||
|
fi
|
||||||
|
|
||||||
|
EXTRA_FLAGS="$extraFlags"
|
||||||
|
for i in $extraLDFlags; do
|
||||||
|
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i"
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -n "$targetConfig"; then
|
||||||
|
# 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. Having this variable comes from the default.nix code to bring
|
||||||
|
# gcj in.
|
||||||
|
unset LIBRARY_PATH
|
||||||
|
unset CPATH
|
||||||
|
if test -z "$crossStageStatic"; then
|
||||||
|
EXTRA_TARGET_CFLAGS="-B${libcCross}/lib -idirafter ${libcCross}/include"
|
||||||
|
EXTRA_TARGET_LDFLAGS="-Wl,-L${libcCross}/lib -Wl,-rpath,${libcCross}/lib -Wl,-rpath-link,${libcCross}/lib"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if test -z "$NIX_GCC_CROSS"; then
|
||||||
|
EXTRA_TARGET_CFLAGS="$EXTRA_FLAGS"
|
||||||
|
EXTRA_TARGET_CXXFLAGS="$EXTRA_FLAGS"
|
||||||
|
EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS"
|
||||||
|
else
|
||||||
|
# This the case of cross-building the gcc.
|
||||||
|
# We need special flags for the target, different than those of the build
|
||||||
|
# Assertion:
|
||||||
|
test -e $NIX_GCC_CROSS/nix-support/orig-libc
|
||||||
|
|
||||||
|
# Figure out what extra flags to pass to the gcc compilers
|
||||||
|
# being generated to make sure that they use our glibc.
|
||||||
|
extraFlags="$(cat $NIX_GCC_CROSS/nix-support/libc-cflags)"
|
||||||
|
extraLDFlags="$(cat $NIX_GCC_CROSS/nix-support/libc-ldflags) $(cat $NIX_GCC_CROSS/nix-support/libc-ldflags-before)"
|
||||||
|
|
||||||
|
# Use *real* header files, otherwise a limits.h is generated
|
||||||
|
# that does not include Glibc's limits.h (notably missing
|
||||||
|
# SSIZE_MAX, which breaks the build).
|
||||||
|
NIX_FIXINC_DUMMY_CROSS=$(cat $NIX_GCC_CROSS/nix-support/orig-libc)/include
|
||||||
|
|
||||||
|
# The path to the Glibc binaries such as `crti.o'.
|
||||||
|
glibc_dir="$(cat $NIX_GCC_CROSS/nix-support/orig-libc)"
|
||||||
|
glibc_libdir="$glibc_dir/lib"
|
||||||
|
configureFlags="$configureFlags --with-native-system-header-dir=$glibc_dir/include"
|
||||||
|
|
||||||
|
extraFlags="-I$NIX_FIXINC_DUMMY_CROSS $extraFlags"
|
||||||
|
extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
|
||||||
|
|
||||||
|
EXTRA_TARGET_CFLAGS="$extraFlags"
|
||||||
|
for i in $extraLDFlags; do
|
||||||
|
EXTRA_TARGET_LDFLAGS="$EXTRA_TARGET_LDFLAGS -Wl,$i"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
|
||||||
|
# the startfiles.
|
||||||
|
# FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
|
||||||
|
# for the startfiles.
|
||||||
|
makeFlagsArray=( \
|
||||||
|
"${makeFlagsArray[@]}" \
|
||||||
|
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||||
|
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||||
|
CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
||||||
|
CXXFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
||||||
|
CFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
||||||
|
CXXFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
||||||
|
FLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
||||||
|
LDFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
||||||
|
LDFLAGS_FOR_TARGET="$EXTRA_TARGET_LDFLAGS $EXTRA_TARGET_LDFLAGS" \
|
||||||
|
)
|
||||||
|
|
||||||
|
if test -z "$targetConfig"; then
|
||||||
|
makeFlagsArray=( \
|
||||||
|
"${makeFlagsArray[@]}" \
|
||||||
|
BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
||||||
|
BOOT_LDFLAGS="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -n "$targetConfig" -a "$crossStageStatic" == 1; then
|
||||||
|
# We don't want the gcc build to assume there will be a libc providing
|
||||||
|
# limits.h in this stagae
|
||||||
|
makeFlagsArray=( \
|
||||||
|
"${makeFlagsArray[@]}" \
|
||||||
|
LIMITS_H_TEST=false \
|
||||||
|
)
|
||||||
|
else
|
||||||
|
makeFlagsArray=( \
|
||||||
|
"${makeFlagsArray[@]}" \
|
||||||
|
LIMITS_H_TEST=true \
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -n "$targetConfig"; then
|
||||||
|
# The host strip will destroy some important details of the objects
|
||||||
|
dontStrip=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
providedPreConfigure="$preConfigure";
|
||||||
|
preConfigure() {
|
||||||
|
if test -n "$newlibSrc"; then
|
||||||
|
tar xvf "$newlibSrc" -C ..
|
||||||
|
ln -s ../newlib-*/newlib newlib
|
||||||
|
# Patch to get armvt5el working:
|
||||||
|
sed -i -e 's/ arm)/ arm*)/' newlib/configure.host
|
||||||
|
fi
|
||||||
|
# Bug - they packaged zlib
|
||||||
|
if test -d "zlib"; then
|
||||||
|
# This breaks the build without-headers, which should build only
|
||||||
|
# the target libgcc as target libraries.
|
||||||
|
# See 'configure:5370'
|
||||||
|
rm -Rf zlib
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -f "$NIX_GCC/nix-support/orig-libc"; then
|
||||||
|
# Patch the configure script so it finds glibc headers. It's
|
||||||
|
# important for example in order not to get libssp built,
|
||||||
|
# because its functionality is in glibc already.
|
||||||
|
glibc_headers="$(cat $NIX_GCC/nix-support/orig-libc)/include"
|
||||||
|
sed -i \
|
||||||
|
-e "s,glibc_header_dir=/usr/include,glibc_header_dir=$glibc_headers", \
|
||||||
|
gcc/configure
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -n "$crossMingw" -a -n "$crossStageStatic"; then
|
||||||
|
mkdir -p ../mingw
|
||||||
|
# --with-build-sysroot expects that:
|
||||||
|
cp -R $libcCross/include ../mingw
|
||||||
|
configureFlags="$configureFlags --with-build-sysroot=`pwd`/.."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Eval the preConfigure script from nix expression.
|
||||||
|
eval $providedPreConfigure;
|
||||||
|
env;
|
||||||
|
# Perform the build in a different directory.
|
||||||
|
mkdir ../build
|
||||||
|
cd ../build
|
||||||
|
configureScript=../$sourceRoot/configure
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
postConfigure() {
|
||||||
|
# Don't store the configure flags in the resulting executables.
|
||||||
|
sed -e '/TOPLEVEL_CONFIGURE_ARGUMENTS=/d' -i Makefile
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
postInstall() {
|
||||||
|
# Remove precompiled headers for now. They are very big and
|
||||||
|
# probably not very useful yet.
|
||||||
|
find $out/include -name "*.gch" -exec rm -rf {} \; -prune
|
||||||
|
|
||||||
|
# Remove `fixincl' to prevent a retained dependency on the
|
||||||
|
# previous gcc.
|
||||||
|
rm -rf $out/libexec/gcc/*/*/install-tools
|
||||||
|
rm -rf $out/lib/gcc/*/*/install-tools
|
||||||
|
|
||||||
|
# More dependencies with the previous gcc or some libs (gccbug stores the build command line)
|
||||||
|
rm -rf $out/bin/gccbug
|
||||||
|
# Take out the bootstrap-tools from the rpath, as it's not needed at all having $out
|
||||||
|
for i in $out/libexec/gcc/*/*/*; do
|
||||||
|
if PREV_RPATH=`patchelf --print-rpath $i`; then
|
||||||
|
patchelf --set-rpath `echo $PREV_RPATH | sed 's,:[^:]*bootstrap-tools/lib,,'` $i
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Get rid of some "fixed" header files
|
||||||
|
rm -rf $out/lib/gcc/*/*/include/root
|
||||||
|
|
||||||
|
# Replace hard links for i686-pc-linux-gnu-gcc etc. with symlinks.
|
||||||
|
for i in $out/bin/*-gcc*; do
|
||||||
|
if cmp -s $out/bin/gcc $i; then
|
||||||
|
ln -sfn gcc $i
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in $out/bin/c++ $out/bin/*-c++* $out/bin/*-g++*; do
|
||||||
|
if cmp -s $out/bin/g++ $i; then
|
||||||
|
ln -sfn g++ $i
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
eval "$postInstallGhdl"
|
||||||
|
}
|
||||||
|
|
||||||
|
genericBuild
|
@ -0,0 +1,533 @@
|
|||||||
|
{ stdenv, fetchurl, noSysDirs
|
||||||
|
, langC ? true, langCC ? true, langFortran ? false
|
||||||
|
, langJava ? false
|
||||||
|
, langAda ? false
|
||||||
|
, langVhdl ? false
|
||||||
|
, langGo ? false
|
||||||
|
, profiledCompiler ? false
|
||||||
|
, staticCompiler ? false
|
||||||
|
, enableShared ? true
|
||||||
|
, texinfo ? null
|
||||||
|
, perl ? null # optional, for texi2pod (then pod2man); required for Java
|
||||||
|
, gmp, mpfr, mpc, gettext, which
|
||||||
|
, libelf # optional, for link-time optimizations (LTO)
|
||||||
|
, ppl ? null, cloog ? null # optional, for the Graphite optimization framework.
|
||||||
|
, zlib ? null, boehmgc ? null
|
||||||
|
, zip ? null, unzip ? null, pkgconfig ? null, gtk ? 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
|
||||||
|
, enablePlugin ? true # whether to support user-supplied plug-ins
|
||||||
|
, name ? "gcc"
|
||||||
|
, cross ? null
|
||||||
|
, binutilsCross ? null
|
||||||
|
, libcCross ? null
|
||||||
|
, crossStageStatic ? true
|
||||||
|
, gnat ? null
|
||||||
|
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
|
||||||
|
, stripped ? true
|
||||||
|
, gnused ? null
|
||||||
|
}:
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
# Make sure we get GNU sed.
|
||||||
|
assert stdenv.isDarwin -> gnused != null;
|
||||||
|
|
||||||
|
# The go frontend is written in c++
|
||||||
|
assert langGo -> langCC;
|
||||||
|
|
||||||
|
with stdenv.lib;
|
||||||
|
with builtins;
|
||||||
|
|
||||||
|
let version = "4.7.3";
|
||||||
|
|
||||||
|
# Whether building a cross-compiler for GNU/Hurd.
|
||||||
|
crossGNU = cross != null && cross.config == "i586-pc-gnu";
|
||||||
|
|
||||||
|
/* gccinstall.info says that "parallel make is currently not supported since
|
||||||
|
collisions in profile collecting may occur".
|
||||||
|
|
||||||
|
Parallel make of gfortran is disabled because of an apparent race
|
||||||
|
condition concerning the generation of "bconfig.h". Please try and
|
||||||
|
re-enable parallel make for a later release of gfortran to check whether
|
||||||
|
the error has been fixed.
|
||||||
|
*/
|
||||||
|
enableParallelBuilding = !profiledCompiler && !langFortran;
|
||||||
|
|
||||||
|
patches = []
|
||||||
|
++ optional enableParallelBuilding ./parallel-bconfig-4.7.patch
|
||||||
|
++ optional stdenv.isArm [ ./arm-eabi.patch ]
|
||||||
|
++ optional (cross != null) ./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 langFortran ./gfortran-driving.patch;
|
||||||
|
|
||||||
|
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 && gtk != null;
|
||||||
|
|
||||||
|
/* Platform flags */
|
||||||
|
platformFlags = let
|
||||||
|
gccArch = stdenv.lib.attrByPath [ "platform" "gcc" "arch" ] null stdenv;
|
||||||
|
gccCpu = stdenv.lib.attrByPath [ "platform" "gcc" "cpu" ] null stdenv;
|
||||||
|
gccAbi = stdenv.lib.attrByPath [ "platform" "gcc" "abi" ] null stdenv;
|
||||||
|
gccFpu = stdenv.lib.attrByPath [ "platform" "gcc" "fpu" ] null stdenv;
|
||||||
|
gccFloat = stdenv.lib.attrByPath [ "platform" "gcc" "float" ] null stdenv;
|
||||||
|
gccMode = stdenv.lib.attrByPath [ "platform" "gcc" "mode" ] null stdenv;
|
||||||
|
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
|
||||||
|
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
|
||||||
|
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
|
||||||
|
withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
|
||||||
|
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
|
||||||
|
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
|
||||||
|
in
|
||||||
|
(withArch +
|
||||||
|
withCpu +
|
||||||
|
withAbi +
|
||||||
|
withFpu +
|
||||||
|
withFloat +
|
||||||
|
withMode);
|
||||||
|
|
||||||
|
/* Cross-gcc settings */
|
||||||
|
crossMingw = (cross != null && cross.libc == "msvcrt");
|
||||||
|
crossConfigureFlags = let
|
||||||
|
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
|
||||||
|
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
|
||||||
|
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
|
||||||
|
gccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null cross;
|
||||||
|
gccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null cross;
|
||||||
|
gccMode = stdenv.lib.attrByPath [ "gcc" "mode" ] null cross;
|
||||||
|
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
|
||||||
|
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
|
||||||
|
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
|
||||||
|
withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
|
||||||
|
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
|
||||||
|
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
|
||||||
|
in
|
||||||
|
"--target=${cross.config}" +
|
||||||
|
withArch +
|
||||||
|
withCpu +
|
||||||
|
withAbi +
|
||||||
|
withFpu +
|
||||||
|
withFloat +
|
||||||
|
withMode +
|
||||||
|
(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-libquadmath" +
|
||||||
|
" --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" +
|
||||||
|
" --disable-libssp" +
|
||||||
|
" --disable-nls" +
|
||||||
|
" --with-dwarf2" +
|
||||||
|
# I think noone uses shared gcc libs in mingw, so we better do the same.
|
||||||
|
# In any case, mingw32 g++ linking is broken by default with shared libs,
|
||||||
|
# unless adding "-lsupc++" to any linking command. I don't know why.
|
||||||
|
" --disable-shared" +
|
||||||
|
(if cross.config == "x86_64-w64-mingw32" then
|
||||||
|
# To keep ABI compatibility with upstream mingw-w64
|
||||||
|
" --enable-fully-dynamic-string"
|
||||||
|
else "")
|
||||||
|
else (if cross.libc == "uclibc" then
|
||||||
|
# In uclibc cases, libgomp needs an additional '-ldl'
|
||||||
|
# and as I don't know how to pass it, I disable libgomp.
|
||||||
|
" --disable-libgomp" 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 cross != null then "-${cross.config}" + stageNameAddon else "";
|
||||||
|
|
||||||
|
bootstrap = cross == null && !stdenv.isArm && !stdenv.isMips;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
# We need all these X libraries when building AWT with GTK+.
|
||||||
|
assert gtk != null -> (filter (x: x == null) xlibs) == [];
|
||||||
|
|
||||||
|
stdenv.mkDerivation ({
|
||||||
|
name = "${name}${if stripped then "" else "-debug"}-${version}" + crossNameAddon;
|
||||||
|
|
||||||
|
builder = ./builder.sh;
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
|
||||||
|
sha256 = "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g";
|
||||||
|
};
|
||||||
|
|
||||||
|
inherit patches;
|
||||||
|
|
||||||
|
postPatch =
|
||||||
|
if (stdenv.isGNU
|
||||||
|
|| (libcCross != null # e.g., building `gcc.crossDrv'
|
||||||
|
&& libcCross ? crossConfig
|
||||||
|
&& libcCross.crossConfig == "i586-pc-gnu")
|
||||||
|
|| (crossGNU && 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";
|
||||||
|
extraCPPDeps =
|
||||||
|
libc.propagatedBuildInputs
|
||||||
|
++ stdenv.lib.optional (libpthreadCross != null) libpthreadCross
|
||||||
|
++ stdenv.lib.optional (libpthread != null) libpthread;
|
||||||
|
extraCPPSpec =
|
||||||
|
concatStrings (intersperse " "
|
||||||
|
(map (x: "-I${x}/include") extraCPPDeps));
|
||||||
|
extraLibSpec =
|
||||||
|
if libpthreadCross != null
|
||||||
|
then "-L${libpthreadCross}/lib ${libpthreadCross.TARGET_LDFLAGS}"
|
||||||
|
else "-L${libpthread}/lib";
|
||||||
|
in
|
||||||
|
'' echo "augmenting \`CPP_SPEC' in \`${gnu_h}' with \`${extraCPPSpec}'..."
|
||||||
|
sed -i "${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}/include'..."
|
||||||
|
sed -i "${gnu_h}" \
|
||||||
|
-es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc}/include"|g'
|
||||||
|
''
|
||||||
|
else if cross != null || stdenv.gcc.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.gcc.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}\3"|g'
|
||||||
|
done
|
||||||
|
''
|
||||||
|
else null;
|
||||||
|
|
||||||
|
inherit noSysDirs staticCompiler langJava crossStageStatic
|
||||||
|
libcCross crossMingw;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ texinfo which gettext ]
|
||||||
|
++ (optional (perl != null) perl)
|
||||||
|
++ (optional javaAwtGtk pkgconfig);
|
||||||
|
|
||||||
|
buildInputs = [ gmp mpfr mpc libelf ]
|
||||||
|
++ (optional (ppl != null) ppl)
|
||||||
|
++ (optional (cloog != null) cloog)
|
||||||
|
++ (optional (zlib != null) zlib)
|
||||||
|
++ (optionals langJava [ boehmgc zip unzip ])
|
||||||
|
++ (optionals javaAwtGtk ([ gtk libart_lgpl ] ++ xlibs))
|
||||||
|
++ (optionals (cross != null) [binutilsCross])
|
||||||
|
++ (optionals langAda [gnatboot])
|
||||||
|
++ (optionals langVhdl [gnat])
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
++ (optional stdenv.isDarwin gnused)
|
||||||
|
;
|
||||||
|
|
||||||
|
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl";
|
||||||
|
|
||||||
|
preConfigure = ''
|
||||||
|
configureFlagsArray=(
|
||||||
|
${stdenv.lib.optionalString (ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic)
|
||||||
|
"'--with-host-libstdcxx=-lstdc++ -lgcc_s'"}
|
||||||
|
${stdenv.lib.optionalString (ppl != null && stdenv.isSunOS)
|
||||||
|
"\"--with-host-libstdcxx=-Wl,-rpath,\$prefix/lib/amd64 -lstdc++\"
|
||||||
|
\"--with-boot-ldflags=-L../prev-x86_64-pc-solaris2.11/libstdc++-v3/src/.libs\""}
|
||||||
|
);
|
||||||
|
${stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit)
|
||||||
|
''
|
||||||
|
export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
|
||||||
|
export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
|
||||||
|
export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
|
||||||
|
export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET"
|
||||||
|
''}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# 'iant' at #go-nuts@freenode, gccgo maintainer, said that
|
||||||
|
# they have a bug in 4.7.1 if adding "--disable-static"
|
||||||
|
dontDisableStatic = langGo || staticCompiler;
|
||||||
|
|
||||||
|
configureFlags = "
|
||||||
|
${if stdenv.isSunOS then
|
||||||
|
" --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
|
||||||
|
# On Illumos/Solaris GNU as is preferred
|
||||||
|
" --with-gnu-as --without-gnu-ld "
|
||||||
|
else ""}
|
||||||
|
--enable-lto
|
||||||
|
${if enableMultilib then "" else "--disable-multilib"}
|
||||||
|
${if enableShared then "" else "--disable-shared"}
|
||||||
|
${if enablePlugin then "--enable-plugin" else "--disable-plugin"}
|
||||||
|
${if ppl != null then "--with-ppl=${ppl} --disable-ppl-version-check" else ""}
|
||||||
|
${if cloog != null then
|
||||||
|
"--with-cloog=${cloog} --disable-cloog-version-check --enable-cloog-backend=isl"
|
||||||
|
else ""}
|
||||||
|
${if langJava then
|
||||||
|
"--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 "
|
||||||
|
else ""}
|
||||||
|
${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
|
||||||
|
${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr}" else ""}
|
||||||
|
--with-gmp=${gmp}
|
||||||
|
--with-mpfr=${mpfr}
|
||||||
|
--with-mpc=${mpc}
|
||||||
|
${if libelf != null then "--with-libelf=${libelf}" else ""}
|
||||||
|
--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 langGo "go"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
${if (stdenv ? glibc && cross == null)
|
||||||
|
then " --with-native-system-header-dir=${stdenv.glibc}/include"
|
||||||
|
else ""}
|
||||||
|
${if langAda then " --enable-libada" else ""}
|
||||||
|
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||||
|
${if cross != null then crossConfigureFlags else ""}
|
||||||
|
${if !bootstrap then "--disable-bootstrap" else ""}
|
||||||
|
${if cross == null then platformFlags else ""}
|
||||||
|
";
|
||||||
|
|
||||||
|
targetConfig = if cross != null then cross.config else null;
|
||||||
|
|
||||||
|
buildFlags = if bootstrap then
|
||||||
|
(if profiledCompiler then "profiledbootstrap" else "bootstrap")
|
||||||
|
else "";
|
||||||
|
|
||||||
|
installTargets =
|
||||||
|
if stripped
|
||||||
|
then "install-strip"
|
||||||
|
else "install";
|
||||||
|
|
||||||
|
crossAttrs = let
|
||||||
|
xgccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null stdenv.cross;
|
||||||
|
xgccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null stdenv.cross;
|
||||||
|
xgccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null stdenv.cross;
|
||||||
|
xgccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null stdenv.cross;
|
||||||
|
xgccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null stdenv.cross;
|
||||||
|
xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else "";
|
||||||
|
xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else "";
|
||||||
|
xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else "";
|
||||||
|
xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else "";
|
||||||
|
xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else "";
|
||||||
|
in {
|
||||||
|
AR = "${stdenv.cross.config}-ar";
|
||||||
|
LD = "${stdenv.cross.config}-ld";
|
||||||
|
CC = "${stdenv.cross.config}-gcc";
|
||||||
|
CXX = "${stdenv.cross.config}-gcc";
|
||||||
|
AR_FOR_TARGET = "${stdenv.cross.config}-ar";
|
||||||
|
LD_FOR_TARGET = "${stdenv.cross.config}-ld";
|
||||||
|
CC_FOR_TARGET = "${stdenv.cross.config}-gcc";
|
||||||
|
NM_FOR_TARGET = "${stdenv.cross.config}-nm";
|
||||||
|
CXX_FOR_TARGET = "${stdenv.cross.config}-g++";
|
||||||
|
# If we are making a cross compiler, cross != null
|
||||||
|
NIX_GCC_CROSS = if cross == null then "${stdenv.gccCross}" else "";
|
||||||
|
dontStrip = true;
|
||||||
|
configureFlags = ''
|
||||||
|
${if enableMultilib then "" else "--disable-multilib"}
|
||||||
|
${if enableShared then "" else "--disable-shared"}
|
||||||
|
${if ppl != null then "--with-ppl=${ppl.crossDrv}" else ""}
|
||||||
|
${if cloog != null then "--with-cloog=${cloog.crossDrv} --enable-cloog-backend=isl" else ""}
|
||||||
|
${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""}
|
||||||
|
${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
|
||||||
|
${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""}
|
||||||
|
--with-gmp=${gmp.crossDrv}
|
||||||
|
--with-mpfr=${mpfr.crossDrv}
|
||||||
|
--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 langGo "go"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
${if langAda then " --enable-libada" else ""}
|
||||||
|
--target=${stdenv.cross.config}
|
||||||
|
${xwithArch}
|
||||||
|
${xwithCpu}
|
||||||
|
${xwithAbi}
|
||||||
|
${xwithFpu}
|
||||||
|
${xwithFloat}
|
||||||
|
'';
|
||||||
|
buildFlags = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
# Needed for the cross compilation to work
|
||||||
|
AR = "ar";
|
||||||
|
LD = "ld";
|
||||||
|
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||||
|
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64"
|
||||||
|
else "gcc";
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
CPATH = concatStrings
|
||||||
|
(intersperse ":" (map (x: x + "/include")
|
||||||
|
(optionals (zlib != null) [ zlib ]
|
||||||
|
++ optionals 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 &&
|
||||||
|
hasAttr "propagatedBuildInputs" libcCross)
|
||||||
|
libcCross.propagatedBuildInputs)));
|
||||||
|
|
||||||
|
LIBRARY_PATH = concatStrings
|
||||||
|
(intersperse ":" (map (x: x + "/lib")
|
||||||
|
(optionals (zlib != null) [ zlib ]
|
||||||
|
++ optionals langJava [ boehmgc ]
|
||||||
|
++ optionals javaAwtGtk xlibs
|
||||||
|
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||||
|
++ optional (libpthread != null) libpthread)));
|
||||||
|
|
||||||
|
EXTRA_TARGET_CFLAGS =
|
||||||
|
if cross != null && libcCross != null
|
||||||
|
then "-idirafter ${libcCross}/include"
|
||||||
|
else null;
|
||||||
|
|
||||||
|
EXTRA_TARGET_LDFLAGS =
|
||||||
|
if cross != null && libcCross != null
|
||||||
|
then "-B${libcCross}/lib -Wl,-L${libcCross}/lib" +
|
||||||
|
(optionalString (libpthreadCross != null)
|
||||||
|
" -L${libpthreadCross}/lib -Wl,${libpthreadCross.TARGET_LDFLAGS}")
|
||||||
|
else null;
|
||||||
|
|
||||||
|
passthru = { inherit langC langCC langAda langFortran langVhdl
|
||||||
|
langGo enableMultilib version; };
|
||||||
|
|
||||||
|
inherit enableParallelBuilding;
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
homepage = http://gcc.gnu.org/;
|
||||||
|
license = "GPLv3+"; # 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.ludo
|
||||||
|
stdenv.lib.maintainers.viric
|
||||||
|
stdenv.lib.maintainers.shlevy
|
||||||
|
];
|
||||||
|
|
||||||
|
# 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 && libelf == null) [ "i686-darwin" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// optionalAttrs (cross != null && cross.libc == "msvcrt" && crossStageStatic) {
|
||||||
|
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||||
|
installTargets = "install-gcc install-target-libgcc";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Strip kills static libs of other archs (hence cross != null)
|
||||||
|
// optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
|
||||||
|
)
|
@ -0,0 +1,20 @@
|
|||||||
|
This patch fixes interaction with Libtool.
|
||||||
|
See <http://thread.gmane.org/gmane.comp.gcc.patches/258777>, for details.
|
||||||
|
|
||||||
|
--- a/gcc/fortran/gfortranspec.c
|
||||||
|
+++ b/gcc/fortran/gfortranspec.c
|
||||||
|
@@ -461,8 +461,15 @@ For more information about these matters, see the file named COPYING\n\n"));
|
||||||
|
{
|
||||||
|
fprintf (stderr, _("Driving:"));
|
||||||
|
for (i = 0; i < g77_newargc; i++)
|
||||||
|
+ {
|
||||||
|
+ if (g77_new_decoded_options[i].opt_index == OPT_l)
|
||||||
|
+ /* Make sure no white space is inserted after `-l'. */
|
||||||
|
+ fprintf (stderr, " -l%s",
|
||||||
|
+ g77_new_decoded_options[i].canonical_option[1]);
|
||||||
|
+ else
|
||||||
|
fprintf (stderr, " %s",
|
||||||
|
g77_new_decoded_options[i].orig_option_with_args_text);
|
||||||
|
+ }
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
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.
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
Patch to make the target libraries 'configure' scripts find the proper CPP.
|
||||||
|
I noticed that building the mingw32 cross compiler.
|
||||||
|
Looking at the build script for mingw in archlinux, I think that only nixos
|
||||||
|
needs this patch. I don't know why.
|
||||||
|
diff --git a/Makefile.in b/Makefile.in
|
||||||
|
index 93f66b6..d691917 100644
|
||||||
|
--- a/Makefile.in
|
||||||
|
+++ b/Makefile.in
|
||||||
|
@@ -266,6 +266,7 @@ BASE_TARGET_EXPORTS = \
|
||||||
|
AR="$(AR_FOR_TARGET)"; export AR; \
|
||||||
|
AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
|
||||||
|
CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
|
||||||
|
+ CPP="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CC; \
|
||||||
|
CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
|
||||||
|
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
|
||||||
|
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
|
||||||
|
@@ -291,11 +292,13 @@ BASE_TARGET_EXPORTS = \
|
||||||
|
RAW_CXX_TARGET_EXPORTS = \
|
||||||
|
$(BASE_TARGET_EXPORTS) \
|
||||||
|
CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
|
||||||
|
- CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
||||||
|
+ CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
||||||
|
+ CXXCPP="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
||||||
|
|
||||||
|
NORMAL_TARGET_EXPORTS = \
|
||||||
|
$(BASE_TARGET_EXPORTS) \
|
||||||
|
- CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
||||||
|
+ CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
||||||
|
+ CXXCPP="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
||||||
|
|
||||||
|
# Where to find GMP
|
||||||
|
HOST_GMPLIBS = @gmplibs@
|
@ -0,0 +1,41 @@
|
|||||||
|
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
|
||||||
|
@@ -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)/\" \
|
@ -0,0 +1,30 @@
|
|||||||
|
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
|
||||||
|
index 0f6735a..ba93e9b 100644
|
||||||
|
--- a/gcc/Makefile.in
|
||||||
|
+++ b/gcc/Makefile.in
|
||||||
|
@@ -3904,21 +3904,21 @@ build/genflags.o : genflags.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H) \
|
||||||
|
$(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
|
||||||
|
build/gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
|
||||||
|
gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
|
||||||
|
-gengtype-lex.o: $(CONFIG_H)
|
||||||
|
+gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H)
|
||||||
|
build/gengtype-lex.o: $(BCONFIG_H)
|
||||||
|
gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
|
||||||
|
$(SYSTEM_H)
|
||||||
|
-gengtype-parse.o: $(CONFIG_H)
|
||||||
|
+gengtype-parse.o: $(CONFIG_H) $(BCONFIG_H)
|
||||||
|
build/gengtype-parse.o: $(BCONFIG_H)
|
||||||
|
gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
|
||||||
|
gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
|
||||||
|
$(XREGEX_H)
|
||||||
|
-gengtype-state.o: $(CONFIG_H)
|
||||||
|
+gengtype-state.o: $(CONFIG_H) $(BCONFIG_H)
|
||||||
|
build/gengtype-state.o: $(BCONFIG_H)
|
||||||
|
gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h \
|
||||||
|
rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
|
||||||
|
$(OBSTACK_H) $(XREGEX_H)
|
||||||
|
-gengtype.o: $(CONFIG_H)
|
||||||
|
+gengtype.o: $(CONFIG_H) $(BCONFIG_H)
|
||||||
|
build/gengtype.o: $(BCONFIG_H)
|
||||||
|
build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
|
||||||
|
errors.h $(READ_MD_H)
|
@ -0,0 +1,119 @@
|
|||||||
|
{ geckoSrc ? null
|
||||||
|
, lib
|
||||||
|
, pkgs
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inherit (lib) updateFromGitHub;
|
||||||
|
inherit (pkgs) fetchFromGitHub pythonFull which autoconf213
|
||||||
|
perl unzip zip gnumake yasm pkgconfig xlibs gnome2 pango dbus dbus_glib
|
||||||
|
alsaLib libpulseaudio gstreamer gst_plugins_base gtk3 glib
|
||||||
|
gobjectIntrospection git mercurial openssl cmake;
|
||||||
|
inherit (pkgs) valgrind gdb rr;
|
||||||
|
inherit (pkgs.pythonPackages) setuptools;
|
||||||
|
inherit (pkgs.stdenv) mkDerivation;
|
||||||
|
inherit (pkgs.lib) importJSON optionals inNixShell;
|
||||||
|
inherit (pkgs.rust) rustc cargo;
|
||||||
|
|
||||||
|
# Gecko sources are huge, we do not want to import them in the nix-store when
|
||||||
|
# we use this expression for making a build environment.
|
||||||
|
src =
|
||||||
|
if inNixShell then
|
||||||
|
null
|
||||||
|
else if geckoSrc == null then
|
||||||
|
fetchFromGitHub (importJSON ./source.json)
|
||||||
|
else
|
||||||
|
geckoSrc;
|
||||||
|
|
||||||
|
version = "HEAD"; # XXX: builtins.readFile "${src}/browser/config/version.txt";
|
||||||
|
|
||||||
|
in mkDerivation {
|
||||||
|
name = "gecko-dev-${version}";
|
||||||
|
inherit src;
|
||||||
|
buildInputs = [
|
||||||
|
|
||||||
|
# Expected by "mach"
|
||||||
|
pythonFull setuptools which autoconf213
|
||||||
|
|
||||||
|
# Expected by the configure script
|
||||||
|
perl unzip zip gnumake yasm pkgconfig
|
||||||
|
|
||||||
|
xlibs.libICE xlibs.libSM xlibs.libX11 xlibs.libXau xlibs.libxcb
|
||||||
|
xlibs.libXdmcp xlibs.libXext xlibs.libXt xlibs.printproto
|
||||||
|
xlibs.renderproto xlibs.xextproto xlibs.xproto xlibs.libXcomposite
|
||||||
|
xlibs.compositeproto xlibs.libXfixes xlibs.fixesproto
|
||||||
|
xlibs.damageproto xlibs.libXdamage xlibs.libXrender xlibs.kbproto
|
||||||
|
|
||||||
|
gnome2.libart_lgpl gnome2.libbonobo gnome2.libbonoboui
|
||||||
|
gnome2.libgnome gnome2.libgnomecanvas gnome2.libgnomeui
|
||||||
|
gnome2.libIDL
|
||||||
|
|
||||||
|
pango
|
||||||
|
|
||||||
|
dbus dbus_glib
|
||||||
|
|
||||||
|
alsaLib libpulseaudio
|
||||||
|
gstreamer gst_plugins_base
|
||||||
|
|
||||||
|
gtk3 glib gobjectIntrospection
|
||||||
|
|
||||||
|
rustc cargo
|
||||||
|
|
||||||
|
# "mach vendor rust" wants to list modified files by using the vcs.
|
||||||
|
git mercurial
|
||||||
|
|
||||||
|
# needed for compiling cargo-vendor and its dependencies
|
||||||
|
openssl cmake
|
||||||
|
|
||||||
|
] ++ optionals inNixShell [
|
||||||
|
valgrind gdb rr
|
||||||
|
];
|
||||||
|
|
||||||
|
# Useful for debugging this Nix expression.
|
||||||
|
tracePhases = true;
|
||||||
|
|
||||||
|
configurePhase = ''
|
||||||
|
export MOZBUILD_STATE_PATH=$(pwd)/.mozbuild
|
||||||
|
export MOZ_CONFIG=$(pwd)/.mozconfig
|
||||||
|
export builddir=$(pwd)/builddir
|
||||||
|
|
||||||
|
mkdir -p $MOZBUILD_STATE_PATH $builddir
|
||||||
|
echo > $MOZ_CONFIG "
|
||||||
|
. $src/build/mozconfig.common
|
||||||
|
|
||||||
|
mk_add_options MOZ_OBJDIR=$builddir
|
||||||
|
mk_add_options AUTOCONF=${autoconf213}/bin/autoconf
|
||||||
|
ac_add_options --prefix=$out
|
||||||
|
ac_add_options --enable-application=browser
|
||||||
|
ac_add_options --enable-official-branding
|
||||||
|
export AUTOCONF=${autoconf213}/bin/autoconf
|
||||||
|
"
|
||||||
|
'';
|
||||||
|
|
||||||
|
AUTOCONF = "${autoconf213}/bin/autoconf";
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
cd $builddir
|
||||||
|
$src/mach build
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
cd $builddir
|
||||||
|
$src/mach install
|
||||||
|
'';
|
||||||
|
|
||||||
|
# TODO: are there tests we would like to run? or should we package them separately?
|
||||||
|
doCheck = false;
|
||||||
|
doInstallCheck = false;
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
export MOZBUILD_STATE_PATH=$PWD/.mozbuild
|
||||||
|
'';
|
||||||
|
passthru.updateScript = updateFromGitHub {
|
||||||
|
owner = "mozilla";
|
||||||
|
repo = "gecko-dev";
|
||||||
|
branch = "master";
|
||||||
|
path = "pkgs/gecko/source.json";
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"owner": "mozilla",
|
||||||
|
"repo": "gecko-dev",
|
||||||
|
"rev": "fee636af734a0ce6dc7335691cc94664bafc385d",
|
||||||
|
"sha256": "0nnkqmglbi2znkz1avnyn064i5hngvsqrmhw8ccg6g4ga9bac8fv"
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
update = import ./update.nix { inherit pkgs; };
|
||||||
|
in
|
||||||
|
{ inherit update; }
|
||||||
|
// update
|
@ -0,0 +1,50 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs) cacert nix jq curl gnused gnugrep coreutils;
|
||||||
|
in {
|
||||||
|
|
||||||
|
updateFromGitHub = { owner, repo, path, branch }: ''
|
||||||
|
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
|
||||||
|
|
||||||
|
github_rev() {
|
||||||
|
${curl.bin}/bin/curl -sSf "https://api.github.com/repos/$1/$2/branches/$3" | \
|
||||||
|
${jq}/bin/jq '.commit.sha' | \
|
||||||
|
${gnused}/bin/sed 's/"//g'
|
||||||
|
}
|
||||||
|
|
||||||
|
github_sha256() {
|
||||||
|
${nix}/bin/nix-prefetch-url \
|
||||||
|
--unpack \
|
||||||
|
--type sha256 \
|
||||||
|
"https://github.com/$1/$2/archive/$3.tar.gz" 2>&1 | \
|
||||||
|
tail -1
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "=== ${owner}/${repo}@${branch} ==="
|
||||||
|
|
||||||
|
echo -n "Looking up latest revision ... "
|
||||||
|
rev=$(github_rev "${owner}" "${repo}" "${branch}");
|
||||||
|
echo "revision is \`$rev\`."
|
||||||
|
|
||||||
|
sha256=$(github_sha256 "${owner}" "${repo}" "$rev");
|
||||||
|
echo "sha256 is \`$sha256\`."
|
||||||
|
|
||||||
|
if [ "$sha256" == "" ]; then
|
||||||
|
echo "sha256 is not valid!"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
source_file=${path}
|
||||||
|
echo "Content of source file (``$source_file``) written."
|
||||||
|
cat <<REPO | ${coreutils}/bin/tee "$source_file"
|
||||||
|
{
|
||||||
|
"owner": "${owner}",
|
||||||
|
"repo": "${repo}",
|
||||||
|
"rev": "$rev",
|
||||||
|
"sha256": "$sha256"
|
||||||
|
}
|
||||||
|
REPO
|
||||||
|
echo
|
||||||
|
'';
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs-channels",
|
||||||
|
"rev": "ed070354a9e307fdf20a94cb2af749738562385d",
|
||||||
|
"sha256": "05pqwg7s4w34v99yykb27031kc21x4n3f33szdi6wv11k4asjyfp"
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
{ servoSrc ? null
|
||||||
|
, lib
|
||||||
|
, rustPlatform
|
||||||
|
, pkgs
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inherit (lib) updateFromGitHub;
|
||||||
|
inherit (pkgs) fetchFromGitHub curl dbus fontconfig freeglut freetype
|
||||||
|
gperf libxmi llvm mesa mesa_glu openssl pkgconfig makeWrapper writeText
|
||||||
|
xorg;
|
||||||
|
inherit (pkgs.stdenv) mkDerivation;
|
||||||
|
inherit (pkgs.lib) importJSON;
|
||||||
|
inherit (rustPlatform) buildRustPackage;
|
||||||
|
inherit (rustPlatform.rust) rustc cargo;
|
||||||
|
|
||||||
|
pythonPackages = pkgs.python3Packages;
|
||||||
|
|
||||||
|
src =
|
||||||
|
if servoSrc == null then
|
||||||
|
fetchFromGitHub (importJSON ./source.json)
|
||||||
|
else
|
||||||
|
servoSrc;
|
||||||
|
|
||||||
|
# TODO: figure out version from servoSrc
|
||||||
|
version = "latest";
|
||||||
|
|
||||||
|
# TODO: add possibility to test against wayland
|
||||||
|
xorgCompositorLibs = "${xorg.libXcursor.out}/lib:${xorg.libXi.out}/lib";
|
||||||
|
|
||||||
|
servobuild = writeText "servobuild" ''
|
||||||
|
[tools]
|
||||||
|
cache-dir = "./downloads"
|
||||||
|
cargo-home-dir = "./.downloads/clones
|
||||||
|
system-rust = true
|
||||||
|
rust-root = "${rustc}/bin/rustc"
|
||||||
|
system-cargo = true
|
||||||
|
cargo-root = "${cargo}/bin/cargo"
|
||||||
|
[build]
|
||||||
|
'';
|
||||||
|
|
||||||
|
servoRust = buildRustPackage rec {
|
||||||
|
inherit src;
|
||||||
|
name = "servo-rust-${version}";
|
||||||
|
postUnpack = ''
|
||||||
|
pwd
|
||||||
|
ls -la
|
||||||
|
exit 100
|
||||||
|
'';
|
||||||
|
sourceRoot = "servo/components/servo";
|
||||||
|
|
||||||
|
depsSha256 = "0ca0lc8mm8kczll5m03n5fwsr0540c2xbfi4nn9ksn0s4sap50yn";
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
in mkDerivation rec {
|
||||||
|
name = "servo-${version}";
|
||||||
|
src = servoSrc;
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
#cmake
|
||||||
|
curl
|
||||||
|
dbus
|
||||||
|
fontconfig
|
||||||
|
freeglut
|
||||||
|
freetype
|
||||||
|
gperf
|
||||||
|
libxmi
|
||||||
|
llvm
|
||||||
|
mesa
|
||||||
|
mesa_glu
|
||||||
|
openssl
|
||||||
|
pkgconfig
|
||||||
|
pythonPackages.pip
|
||||||
|
pythonPackages.virtualenv
|
||||||
|
xorg.libX11
|
||||||
|
xorg.libXmu
|
||||||
|
|
||||||
|
# nix stuff
|
||||||
|
makeWrapper
|
||||||
|
servoRust
|
||||||
|
];
|
||||||
|
preConfigure = ''
|
||||||
|
ln -s ${servobuild} .servobuild
|
||||||
|
'';
|
||||||
|
postInstall = ''
|
||||||
|
wrapProgram "$out/bin/servo" --prefix LD_LIBRARY_PATH : "${xorgCompositorLibs}"
|
||||||
|
'';
|
||||||
|
shellHook = ''
|
||||||
|
# Servo tries to switch between libX11 and wayland at runtime so we have
|
||||||
|
# to provide a path
|
||||||
|
export LD_LIBRARY_PATH=${xorgCompositorLibs}:$LD_LIBRARY_PATH
|
||||||
|
'';
|
||||||
|
passthru.updateScript = updateFromGitHub {
|
||||||
|
owner = "servo";
|
||||||
|
repo = "servo";
|
||||||
|
branch = "master";
|
||||||
|
path = "pkgs/servo/source.json";
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"owner": "servo",
|
||||||
|
"repo": "servo",
|
||||||
|
"rev": "f2efc0011ab229718181175a2637bbc4ce70cd0c",
|
||||||
|
"sha256": "0cp1d5cmdb2alyvnd7ry9p6z1pvpc938n7ngbcphqm5dww8isrmm"
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "$(dirname "$0")" || exit
|
||||||
|
../../update-repo.sh ./repo.json "$@"
|
@ -0,0 +1,156 @@
|
|||||||
|
let
|
||||||
|
_pkgs = import <nixpkgs> {};
|
||||||
|
_nixpkgs = _pkgs.fetchFromGitHub (_pkgs.lib.importJSON ./pkgs/nixpkgs.json);
|
||||||
|
in
|
||||||
|
|
||||||
|
{ nixpkgsSrc ? _nixpkgs
|
||||||
|
, supportedSystems ? [ "x86_64-linux" "i686-linux" /* "x86_64-darwin" */ ]
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
# Make an attribute set for each system, the builder is then specialized to
|
||||||
|
# use the selected system.
|
||||||
|
forEachSystem = systems: builder:
|
||||||
|
_pkgs.lib.genAttrs systems (system:
|
||||||
|
builder (import _nixpkgs { inherit system; })
|
||||||
|
);
|
||||||
|
|
||||||
|
# Make an attribute set for each compiler, the builder is then be specialized
|
||||||
|
# to use the selected compiler.
|
||||||
|
forEachCompiler = compilers: builder: pkgs:
|
||||||
|
with pkgs;
|
||||||
|
let
|
||||||
|
|
||||||
|
# Override, in a non-recursive matter to avoid recompilations, the standard
|
||||||
|
# environment used for building packages.
|
||||||
|
builderWithStdenv = stdenv: builder (pkgs // { inherit stdenv; });
|
||||||
|
|
||||||
|
noSysDirs = (system != "x86_64-darwin"
|
||||||
|
&& system != "x86_64-freebsd" && system != "i686-freebsd"
|
||||||
|
&& system != "x86_64-kfreebsd-gnu");
|
||||||
|
crossSystem = null;
|
||||||
|
|
||||||
|
gcc473 = wrapCC (callPackage ./pkgs/gcc-4.7 {
|
||||||
|
inherit noSysDirs;
|
||||||
|
texinfo = texinfo4;
|
||||||
|
# I'm not sure if profiling with enableParallelBuilding helps a lot.
|
||||||
|
# We can enable it back some day. This makes the *gcc* builds faster now.
|
||||||
|
profiledCompiler = false;
|
||||||
|
|
||||||
|
# When building `gcc.crossDrv' (a "Canadian cross", with host == target
|
||||||
|
# and host != build), `cross' must be null but the cross-libc must still
|
||||||
|
# be passed.
|
||||||
|
cross = null;
|
||||||
|
libcCross = if crossSystem != null then libcCross else null;
|
||||||
|
libpthreadCross =
|
||||||
|
if crossSystem != null && crossSystem.config == "i586-pc-gnu"
|
||||||
|
then gnu.libpthreadCross
|
||||||
|
else null;
|
||||||
|
});
|
||||||
|
|
||||||
|
# By default wrapCC keep the same header files, but NixOS is using the
|
||||||
|
# latest header files from GCC, which are not supported by clang, because
|
||||||
|
# clang implement a different set of locking primitives than GCC. This
|
||||||
|
# expression is used to wrap clang with a matching verion of the libc++.
|
||||||
|
maybeWrapClang = cc:
|
||||||
|
if cc ? clang then clangWrapCC cc
|
||||||
|
else cc;
|
||||||
|
clangWrapCC = llvmPackages:
|
||||||
|
let libcxx =
|
||||||
|
pkgs.lib.overrideDerivation llvmPackages.libcxx (drv: {
|
||||||
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1277619
|
||||||
|
# https://llvm.org/bugs/show_bug.cgi?id=14435
|
||||||
|
patches = drv.patches ++ [ ./pkgs/clang/bug-14435.patch ];
|
||||||
|
});
|
||||||
|
in
|
||||||
|
callPackage <nixpkgs/pkgs/build-support/cc-wrapper> {
|
||||||
|
cc = llvmPackages.clang-unwrapped or llvmPackages.clang;
|
||||||
|
isClang = true;
|
||||||
|
stdenv = clangStdenv;
|
||||||
|
libc = glibc;
|
||||||
|
# cc-wrapper pulls gcc headers, which are not compatible with features
|
||||||
|
# implemented in clang. These packages are used to override that.
|
||||||
|
extraPackages = [ libcxx llvmPackages.libcxxabi ];
|
||||||
|
nativeTools = false;
|
||||||
|
nativeLibc = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
buildWithCompiler = cc: builderWithStdenv
|
||||||
|
(stdenvAdapters.overrideCC stdenv (maybeWrapClang cc));
|
||||||
|
chgCompilerSource = cc: name: src:
|
||||||
|
cc.override (conf:
|
||||||
|
if conf ? gcc then # Nixpkgs 14.12
|
||||||
|
{ gcc = lib.overrideDerivation conf.gcc (old: { inherit name src; }); }
|
||||||
|
else # Nixpkgs 15.05
|
||||||
|
{ cc = lib.overrideDerivation conf.cc (old: { inherit name src; }); }
|
||||||
|
);
|
||||||
|
|
||||||
|
compilersByName = {
|
||||||
|
clang = llvmPackages;
|
||||||
|
clang36 = llvmPackages_36;
|
||||||
|
clang37 = llvmPackages_37;
|
||||||
|
clang38 = llvmPackages_38; # not working yet.
|
||||||
|
gcc = gcc;
|
||||||
|
gcc49 = gcc49;
|
||||||
|
gcc48 = gcc48;
|
||||||
|
gcc474 = chgCompilerSource gcc473 "gcc-4.7.4" (fetchurl {
|
||||||
|
url = "mirror://gnu/gcc/gcc-4.7.4/gcc-4.7.4.tar.bz2";
|
||||||
|
sha256 = "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj";
|
||||||
|
});
|
||||||
|
gcc473 = gcc473;
|
||||||
|
# Version used on Linux slaves, except Linux x64 ASAN.
|
||||||
|
gcc472 = chgCompilerSource gcc473 "gcc-4.7.2" (fetchurl {
|
||||||
|
url = "mirror://gnu/gcc/gcc-4.7.2/gcc-4.7.2.tar.bz2";
|
||||||
|
sha256 = "115h03hil99ljig8lkrq4qk426awmzh0g99wrrggxf8g07bq74la";
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
in builtins.listToAttrs (map (x: { name = x; value = buildWithCompiler (builtins.getAttr x compilersByName); }) compilers);
|
||||||
|
|
||||||
|
build = name: { systems ? supportedSystems, compilers ? null }:
|
||||||
|
forEachSystem systems (
|
||||||
|
let
|
||||||
|
builder = pkgs: builtins.getAttr name (import ./default.nix { inherit pkgs; });
|
||||||
|
in
|
||||||
|
if compilers == null
|
||||||
|
then builder
|
||||||
|
else forEachCompiler compilers builder
|
||||||
|
);
|
||||||
|
|
||||||
|
geckoCompilers = [
|
||||||
|
"clang"
|
||||||
|
"clang36"
|
||||||
|
"clang37"
|
||||||
|
"clang38"
|
||||||
|
"gcc"
|
||||||
|
"gcc49"
|
||||||
|
"gcc48"
|
||||||
|
#"gcc474"
|
||||||
|
#"gcc473"
|
||||||
|
#"gcc472"
|
||||||
|
];
|
||||||
|
|
||||||
|
jobs = {
|
||||||
|
|
||||||
|
# For each system, and each compiler, create an attribute with the name of
|
||||||
|
# the system and compiler. Use this attribute name to select which
|
||||||
|
# environment you are interested in for building firefox. These can be
|
||||||
|
# build using the following command:
|
||||||
|
#
|
||||||
|
# $ nix-build release.nix -A gecko.x86_64-linux.clang -o firefox-x64
|
||||||
|
# $ nix-build release.nix -A gecko.i686-linux.gcc48 -o firefox-x86
|
||||||
|
#
|
||||||
|
# If you are only interested in getting a build environment, the use the
|
||||||
|
# nix-shell command instead, which will skip the copy of Firefox sources,
|
||||||
|
# and pull the the dependencies needed for building firefox with this
|
||||||
|
# environment.
|
||||||
|
#
|
||||||
|
# $ nix-shell release.nix -A gecko.i686-linux.gcc472 --pure --command 'gcc --version'
|
||||||
|
# $ nix-shell release.nix -A gecko.x86_64-linux.clang --pure
|
||||||
|
#
|
||||||
|
gecko = build "gecko" { compilers = geckoCompilers; };
|
||||||
|
servo = build "servo";
|
||||||
|
VidyoDesktop = build "VidyoDesktop";
|
||||||
|
};
|
||||||
|
|
||||||
|
in jobs
|
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
cd "$(dirname "$0")" || exit
|
||||||
|
|
||||||
|
overlay_dir=$HOME/.config/nixpkgs/overlays
|
||||||
|
name=rust-overlay.nix
|
||||||
|
|
||||||
|
echo Installing $name as an overlay
|
||||||
|
|
||||||
|
set -x
|
||||||
|
mkdir -p "$overlay_dir"
|
||||||
|
ln -s "$PWD/$name" "$overlay_dir/$name"
|
@ -0,0 +1,276 @@
|
|||||||
|
# This file provide a Rust overlay, which provides pre-packaged bleeding edge versions of rustc
|
||||||
|
# and cargo.
|
||||||
|
self: super:
|
||||||
|
|
||||||
|
let
|
||||||
|
fromTOML = (import ./lib/parseTOML.nix).fromTOML;
|
||||||
|
|
||||||
|
# See https://github.com/rust-lang-nursery/rustup.rs/blob/master/src/rustup-dist/src/dist.rs
|
||||||
|
defaultDistRoot = "https://static.rust-lang.org";
|
||||||
|
manifest_v1_url = {
|
||||||
|
dist_root ? defaultDistRoot + "/dist",
|
||||||
|
date ? null,
|
||||||
|
staging ? false,
|
||||||
|
# A channel can be "nightly", "beta", "stable", "\d{1}.\d{1}.\d{1}", or "\d{1}.\d{2\d{1}".
|
||||||
|
channel ? "nightly"
|
||||||
|
}:
|
||||||
|
if date == null && staging == false
|
||||||
|
then "${dist_root}/channel-rust-${channel}"
|
||||||
|
else if date != null && staging == false
|
||||||
|
then "${dist_root}/${date}/channel-rust-${channel}"
|
||||||
|
else if date == null && staging == true
|
||||||
|
then "${dist_root}/staging/channel-rust-${channel}"
|
||||||
|
else throw "not a real-world case";
|
||||||
|
|
||||||
|
manifest_v2_url = args: (manifest_v1_url args) + ".toml";
|
||||||
|
|
||||||
|
# Intersection of rustup-dist/src/dist.rs listed platforms and stdenv/default.nix.
|
||||||
|
hostTripleOf = system: { # switch
|
||||||
|
"i686-linux" = "i686-unknown-linux-gnu";
|
||||||
|
"x86_64-linux" = "x86_64-unknown-linux-gnu";
|
||||||
|
"armv5tel-linux" = "arm-unknown-linux-gnueabi";
|
||||||
|
"armv6l-linux" = "arm-unknown-linux-gnueabi";
|
||||||
|
"armv7l-linux" = "armv7-unknown-linux-gnueabihf";
|
||||||
|
"aarch64-linux" = "aarch64-unknown-linux-gnu";
|
||||||
|
"mips64el-linux" = "mips64el-unknown-linux-gnuabi64";
|
||||||
|
"x86_64-darwin" = "x86_64-apple-darwin";
|
||||||
|
"i686-cygwin" = "i686-pc-windows-gnu"; # or msvc?
|
||||||
|
"x86_64-cygwin" = "x86_64-pc-windows-gnu"; # or msvc?
|
||||||
|
"x86_64-freebsd" = "x86_64-unknown-freebsd";
|
||||||
|
}.${system} or (throw "Rust overlay does not support ${system} yet.");
|
||||||
|
|
||||||
|
getComponentsWithFixedPlatform = pkgs: pkgname: stdenv:
|
||||||
|
let
|
||||||
|
pkg = pkgs.${pkgname};
|
||||||
|
srcInfo = pkg.target.${hostTripleOf stdenv.system} or pkg.target."*";
|
||||||
|
components = srcInfo.components or [];
|
||||||
|
componentNamesList =
|
||||||
|
builtins.map (pkg: pkg.pkg) (builtins.filter (pkg: (pkg.target != "*")) components);
|
||||||
|
in
|
||||||
|
componentNamesList;
|
||||||
|
|
||||||
|
getExtensions = pkgs: pkgname: stdenv:
|
||||||
|
let
|
||||||
|
inherit (super.lib) unique;
|
||||||
|
pkg = pkgs.${pkgname};
|
||||||
|
srcInfo = pkg.target.${hostTripleOf stdenv.system} or pkg.target."*";
|
||||||
|
extensions = srcInfo.extensions or [];
|
||||||
|
extensionNamesList = unique (builtins.map (pkg: pkg.pkg) extensions);
|
||||||
|
in
|
||||||
|
extensionNamesList;
|
||||||
|
|
||||||
|
hasTarget = pkgs: pkgname: target:
|
||||||
|
pkgs ? ${pkgname}.target.${target};
|
||||||
|
|
||||||
|
getTuples = pkgs: name: targets:
|
||||||
|
builtins.map (target: { inherit name target; }) (builtins.filter (target: hasTarget pkgs name target) targets);
|
||||||
|
|
||||||
|
# In the manifest, a package might have different components which are bundled with it, as opposed as the extensions which can be added.
|
||||||
|
# By default, a package will include the components for the same architecture, and offers them as extensions for other architectures.
|
||||||
|
#
|
||||||
|
# This functions returns a list of { name, target } attribute sets, which includes the current system package, and all its components for the selected targets.
|
||||||
|
# The list contains the package for the pkgTargets as well as the packages for components for all compTargets
|
||||||
|
getTargetPkgTuples = pkgs: pkgname: pkgTargets: compTargets: stdenv:
|
||||||
|
let
|
||||||
|
inherit (builtins) elem;
|
||||||
|
inherit (super.lib) intersectLists;
|
||||||
|
components = getComponentsWithFixedPlatform pkgs pkgname stdenv;
|
||||||
|
extensions = getExtensions pkgs pkgname stdenv;
|
||||||
|
compExtIntersect = intersectLists components extensions;
|
||||||
|
tuples = (getTuples pkgs pkgname pkgTargets) ++ (builtins.map (name: getTuples pkgs name compTargets) compExtIntersect);
|
||||||
|
in
|
||||||
|
tuples;
|
||||||
|
|
||||||
|
getFetchUrl = pkgs: pkgname: target: stdenv: fetchurl:
|
||||||
|
let
|
||||||
|
pkg = pkgs.${pkgname};
|
||||||
|
srcInfo = pkg.target.${target};
|
||||||
|
in
|
||||||
|
(fetchurl { url = srcInfo.url; sha256 = srcInfo.hash; });
|
||||||
|
|
||||||
|
checkMissingExtensions = pkgs: pkgname: stdenv: extensions:
|
||||||
|
let
|
||||||
|
inherit (builtins) head;
|
||||||
|
inherit (super.lib) concatStringsSep subtractLists;
|
||||||
|
availableExtensions = getExtensions pkgs pkgname stdenv;
|
||||||
|
missingExtensions = subtractLists availableExtensions extensions;
|
||||||
|
extensionsToInstall =
|
||||||
|
if missingExtensions == [] then extensions else throw ''
|
||||||
|
While compiling ${pkgname}: the extension ${head missingExtensions} is not available.
|
||||||
|
Select extensions from the following list:
|
||||||
|
${concatStringsSep "\n" availableExtensions}'';
|
||||||
|
in
|
||||||
|
extensionsToInstall;
|
||||||
|
|
||||||
|
getSrcs = pkgs: pkgname: targets: extensions: targetExtensions: stdenv: fetchurl:
|
||||||
|
let
|
||||||
|
inherit (builtins) head map;
|
||||||
|
inherit (super.lib) flatten remove subtractLists unique;
|
||||||
|
targetExtensionsToInstall = checkMissingExtensions pkgs pkgname stdenv targetExtensions;
|
||||||
|
extensionsToInstall = checkMissingExtensions pkgs pkgname stdenv extensions;
|
||||||
|
hostTargets = [ "*" (hostTripleOf stdenv.system)];
|
||||||
|
pkgTuples = flatten (getTargetPkgTuples pkgs pkgname hostTargets targets stdenv);
|
||||||
|
extensionTuples = flatten (map (name: getTargetPkgTuples pkgs name hostTargets targets stdenv) extensionsToInstall);
|
||||||
|
targetExtensionTuples = flatten (map (name: getTargetPkgTuples pkgs name targets targets stdenv) targetExtensionsToInstall);
|
||||||
|
pkgsTuples = pkgTuples ++ extensionTuples ++ targetExtensionTuples;
|
||||||
|
missingTargets = subtractLists (map (tuple: tuple.target) pkgsTuples) (remove "*" targets);
|
||||||
|
pkgsTuplesToInstall =
|
||||||
|
if missingTargets == [] then pkgsTuples else throw ''
|
||||||
|
While compiling ${pkgname}: the target ${head missingTargets} is not available for any package.'';
|
||||||
|
in
|
||||||
|
map (tuple: (getFetchUrl pkgs tuple.name tuple.target stdenv fetchurl)) pkgsTuplesToInstall;
|
||||||
|
|
||||||
|
# Manifest files are organized as follow:
|
||||||
|
# { date = "2017-03-03";
|
||||||
|
# pkg.cargo.version= "0.18.0-nightly (5db6d64 2017-03-03)";
|
||||||
|
# pkg.cargo.target.x86_64-unknown-linux-gnu = {
|
||||||
|
# available = true;
|
||||||
|
# hash = "abce..."; # sha256
|
||||||
|
# url = "https://static.rust-lang.org/dist/....tar.gz";
|
||||||
|
# };
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# The packages available usually are:
|
||||||
|
# cargo, rust-analysis, rust-docs, rust-src, rust-std, rustc, and
|
||||||
|
# rust, which aggregates them in one package.
|
||||||
|
#
|
||||||
|
# For each package the following options are available:
|
||||||
|
# extensions - The extensions that should be installed for the package.
|
||||||
|
# For example, install the package rust and add the extension rust-src.
|
||||||
|
# targets - The package will always be installed for the host system, but with this option
|
||||||
|
# extra targets can be specified, e.g. "mips-unknown-linux-musl". The target
|
||||||
|
# will only apply to components of the package that support being installed for
|
||||||
|
# a different architecture. For example, the rust package will install rust-std
|
||||||
|
# for the host system and the targets.
|
||||||
|
# targetExtensions - If you want to force extensions to be installed for the given targets, this is your option.
|
||||||
|
# All extensions in this list will be installed for the target architectures.
|
||||||
|
# *Attention* If you want to install an extension like rust-src, that has no fixed architecture (arch *),
|
||||||
|
# you will need to specify this extension in the extensions options or it will not be installed!
|
||||||
|
fromManifestFile = manifest: { stdenv, fetchurl, patchelf }:
|
||||||
|
let
|
||||||
|
inherit (builtins) elemAt;
|
||||||
|
inherit (super) makeOverridable;
|
||||||
|
inherit (super.lib) flip mapAttrs;
|
||||||
|
pkgs = fromTOML (builtins.readFile manifest);
|
||||||
|
in
|
||||||
|
flip mapAttrs pkgs.pkg (name: pkg:
|
||||||
|
makeOverridable ({extensions, targets, targetExtensions}:
|
||||||
|
let
|
||||||
|
version' = builtins.match "([^ ]*) [(]([^ ]*) ([^ ]*)[)]" pkg.version;
|
||||||
|
version = "${elemAt version' 0}-${elemAt version' 2}-${elemAt version' 1}";
|
||||||
|
srcs = getSrcs pkgs.pkg name targets extensions targetExtensions stdenv fetchurl;
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = name + "-" + version;
|
||||||
|
inherit srcs;
|
||||||
|
sourceRoot = ".";
|
||||||
|
# (@nbp) TODO: Check on Windows and Mac.
|
||||||
|
# This code is inspired by patchelf/setup-hook.sh to iterate over all binaries.
|
||||||
|
installPhase = ''
|
||||||
|
for i in * ; do
|
||||||
|
if [ -d "$i" ]; then
|
||||||
|
cd $i
|
||||||
|
patchShebangs install.sh
|
||||||
|
CFG_DISABLE_LDCONFIG=1 ./install.sh --prefix=$out --verbose
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
setInterpreter() {
|
||||||
|
local dir="$1"
|
||||||
|
[ -e "$dir" ] || return 0
|
||||||
|
|
||||||
|
header "Patching interpreter of ELF executables and libraries in $dir"
|
||||||
|
local i
|
||||||
|
while IFS= read -r -d ''$'\0' i; do
|
||||||
|
if [[ "$i" =~ .build-id ]]; then continue; fi
|
||||||
|
if ! isELF "$i"; then continue; fi
|
||||||
|
echo "setting interpreter of $i"
|
||||||
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$i" || true
|
||||||
|
done < <(find "$dir" -type f -print0)
|
||||||
|
}
|
||||||
|
|
||||||
|
setInterpreter $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
# Function moves well-known files from etc/
|
||||||
|
handleEtc() {
|
||||||
|
local oldIFS="$IFS"
|
||||||
|
|
||||||
|
# Directories we are aware of, given as substitution lists
|
||||||
|
for paths in \
|
||||||
|
"etc/bash_completion.d","share/bash_completion/completions","etc/bash_completions.d","share/bash_completions/completions";
|
||||||
|
do
|
||||||
|
# Some directoties may be missing in some versions. If so we just skip them.
|
||||||
|
# See https://github.com/mozilla/nixpkgs-mozilla/issues/48 for more infomation.
|
||||||
|
if [ ! -e $paths ]; then continue; fi
|
||||||
|
|
||||||
|
IFS=","
|
||||||
|
set -- $paths
|
||||||
|
IFS="$oldIFS"
|
||||||
|
|
||||||
|
local orig_path="$1"
|
||||||
|
local wanted_path="$2"
|
||||||
|
|
||||||
|
# Rename the files
|
||||||
|
if [ -d ./"$orig_path" ]; then
|
||||||
|
mkdir -p "$(dirname ./"$wanted_path")"
|
||||||
|
fi
|
||||||
|
mv -v ./"$orig_path" ./"$wanted_path"
|
||||||
|
|
||||||
|
# Fail explicitly if etc is not empty so we can add it to the list and/or report it upstream
|
||||||
|
rmdir ./etc || {
|
||||||
|
echo Installer tries to install to /etc:
|
||||||
|
find ./etc
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -d "$out"/etc ]; then
|
||||||
|
pushd "$out"
|
||||||
|
handleEtc
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
) { extensions = []; targets = []; targetExtensions = []; }
|
||||||
|
);
|
||||||
|
|
||||||
|
fromManifest = manifest: { stdenv, fetchurl, patchelf }:
|
||||||
|
fromManifestFile (builtins.fetchurl manifest) { inherit stdenv fetchurl patchelf; };
|
||||||
|
|
||||||
|
in rec
|
||||||
|
|
||||||
|
{
|
||||||
|
lib = super.lib // {
|
||||||
|
inherit fromTOML;
|
||||||
|
rustLib = {
|
||||||
|
inherit fromManifest fromManifestFile manifest_v2_url;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
rustChannelOf = manifest_args: fromManifest
|
||||||
|
(manifest_v2_url manifest_args)
|
||||||
|
{ inherit (self) stdenv fetchurl patchelf; }
|
||||||
|
;
|
||||||
|
|
||||||
|
rustChannels = {
|
||||||
|
nightly = rustChannelOf { channel = "nightly"; };
|
||||||
|
beta = rustChannelOf { channel = "beta"; };
|
||||||
|
stable = rustChannelOf { channel = "stable"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
# For each channel:
|
||||||
|
# rustChannels.nightly.cargo
|
||||||
|
# rustChannels.nightly.rust # Aggregate all others. (recommended)
|
||||||
|
# rustChannels.nightly.rustc
|
||||||
|
# rustChannels.nightly.rust-analysis
|
||||||
|
# rustChannels.nightly.rust-docs
|
||||||
|
# rustChannels.nightly.rust-src
|
||||||
|
# rustChannels.nightly.rust-std
|
||||||
|
|
||||||
|
# For a specific date:
|
||||||
|
# rustChannelOf { date = "2017-06-06"; channel = "beta"; }.rust
|
||||||
|
}
|
@ -0,0 +1,144 @@
|
|||||||
|
let
|
||||||
|
_pkgs = import <nixpkgs> {};
|
||||||
|
_nixpkgs = _pkgs.fetchFromGitHub (_pkgs.lib.importJSON ./pkgs/nixpkgs.json);
|
||||||
|
in
|
||||||
|
|
||||||
|
{ pkgs ? import _nixpkgs {}
|
||||||
|
, package ? null
|
||||||
|
, maintainer ? null
|
||||||
|
, dont_prompt ? false
|
||||||
|
}:
|
||||||
|
|
||||||
|
# TODO: add assert statements
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
pkgs-mozilla = import ./default.nix { inherit pkgs; };
|
||||||
|
|
||||||
|
dont_prompt_str = if dont_prompt then "yes" else "no";
|
||||||
|
|
||||||
|
packagesWith = cond: return: set:
|
||||||
|
pkgs.lib.flatten
|
||||||
|
(pkgs.lib.mapAttrsToList
|
||||||
|
(name: pkg:
|
||||||
|
let
|
||||||
|
result = builtins.tryEval (
|
||||||
|
if pkgs.lib.isDerivation pkg && cond name pkg
|
||||||
|
then [(return name pkg)]
|
||||||
|
else if pkg.recurseForDerivations or false || pkg.recurseForRelease or false
|
||||||
|
then packagesWith cond return pkg
|
||||||
|
else []
|
||||||
|
);
|
||||||
|
in
|
||||||
|
if result.success then result.value
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
set
|
||||||
|
);
|
||||||
|
|
||||||
|
packagesWithUpdateScriptAndMaintainer = maintainer':
|
||||||
|
let
|
||||||
|
maintainer =
|
||||||
|
if ! builtins.hasAttr maintainer' pkgs.lib.maintainers then
|
||||||
|
builtins.throw "Maintainer with name `${maintainer'} does not exist in `lib/maintainers.nix`."
|
||||||
|
else
|
||||||
|
builtins.getAttr maintainer' pkgs.lib.maintainers;
|
||||||
|
in
|
||||||
|
packagesWith (name: pkg: builtins.hasAttr "updateScript" pkg &&
|
||||||
|
(if builtins.hasAttr "maintainers" pkg.meta
|
||||||
|
then (if builtins.isList pkg.meta.maintainers
|
||||||
|
then builtins.elem maintainer pkg.meta.maintainers
|
||||||
|
else maintainer == pkg.meta.maintainers
|
||||||
|
)
|
||||||
|
else false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(name: pkg: pkg)
|
||||||
|
pkgs-mozilla;
|
||||||
|
|
||||||
|
packageByName = name:
|
||||||
|
let
|
||||||
|
package = pkgs.lib.attrByPath (pkgs.lib.splitString "." name) null pkgs-mozilla;
|
||||||
|
in
|
||||||
|
if package == null then
|
||||||
|
builtins.throw "Package with an attribute name `${name}` does not exists."
|
||||||
|
else if ! builtins.hasAttr "updateScript" package then
|
||||||
|
builtins.throw "Package with an attribute name `${name}` does have an `passthru.updateScript` defined."
|
||||||
|
else
|
||||||
|
package;
|
||||||
|
|
||||||
|
packages =
|
||||||
|
if package != null then
|
||||||
|
[ (packageByName package) ]
|
||||||
|
else if maintainer != null then
|
||||||
|
packagesWithUpdateScriptAndMaintainer maintainer
|
||||||
|
else
|
||||||
|
builtins.throw "No arguments provided.\n\n${helpText}";
|
||||||
|
|
||||||
|
helpText = ''
|
||||||
|
Please run:
|
||||||
|
|
||||||
|
% nix-shell maintainers/scripts/update.nix --argstr maintainer garbas
|
||||||
|
|
||||||
|
to run all update scripts for all packages that lists \`garbas\` as a maintainer
|
||||||
|
and have \`updateScript\` defined, or:
|
||||||
|
|
||||||
|
% nix-shell maintainers/scripts/update.nix --argstr package garbas
|
||||||
|
|
||||||
|
to run update script for specific package.
|
||||||
|
'';
|
||||||
|
|
||||||
|
runUpdateScript = package: ''
|
||||||
|
echo -ne " - ${package.name}: UPDATING ..."\\r
|
||||||
|
${package.updateScript} &> ${(builtins.parseDrvName package.name).name}.log
|
||||||
|
CODE=$?
|
||||||
|
if [ "$CODE" != "0" ]; then
|
||||||
|
echo " - ${package.name}: ERROR "
|
||||||
|
echo ""
|
||||||
|
echo "--- SHOWING ERROR LOG FOR ${package.name} ----------------------"
|
||||||
|
echo ""
|
||||||
|
cat ${(builtins.parseDrvName package.name).name}.log
|
||||||
|
echo ""
|
||||||
|
echo "--- SHOWING ERROR LOG FOR ${package.name} ----------------------"
|
||||||
|
exit $CODE
|
||||||
|
else
|
||||||
|
rm ${(builtins.parseDrvName package.name).name}.log
|
||||||
|
fi
|
||||||
|
echo " - ${package.name}: DONE. "
|
||||||
|
'';
|
||||||
|
|
||||||
|
in pkgs.stdenv.mkDerivation {
|
||||||
|
name = "nixpkgs-mozilla-update-script";
|
||||||
|
buildCommand = ''
|
||||||
|
echo ""
|
||||||
|
echo "----------------------------------------------------------------"
|
||||||
|
echo ""
|
||||||
|
echo "Not possible to update packages using \`nix-build\`"
|
||||||
|
echo ""
|
||||||
|
echo "${helpText}"
|
||||||
|
echo "----------------------------------------------------------------"
|
||||||
|
exit 1
|
||||||
|
'';
|
||||||
|
shellHook = ''
|
||||||
|
echo ""
|
||||||
|
echo "Going to be running update for following packages:"
|
||||||
|
echo "${builtins.concatStringsSep "\n" (map (x: " - ${x.name}") packages)}"
|
||||||
|
echo ""
|
||||||
|
if [ "${dont_prompt_str}" = "no" ]; then
|
||||||
|
read -n1 -r -p "Press space to continue..." confirm
|
||||||
|
else
|
||||||
|
confirm=""
|
||||||
|
fi
|
||||||
|
if [ "$confirm" = "" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "Running update for:"
|
||||||
|
${builtins.concatStringsSep "\n" (map runUpdateScript packages)}
|
||||||
|
echo ""
|
||||||
|
echo "Packages updated!"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Aborting!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in New Issue