diff --git a/pkgs/development/compilers/chicken/0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch b/pkgs/development/compilers/chicken/4/0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch similarity index 100% rename from pkgs/development/compilers/chicken/0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch rename to pkgs/development/compilers/chicken/4/0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch diff --git a/pkgs/development/compilers/chicken/default.nix b/pkgs/development/compilers/chicken/4/chicken.nix similarity index 100% rename from pkgs/development/compilers/chicken/default.nix rename to pkgs/development/compilers/chicken/4/chicken.nix diff --git a/pkgs/development/compilers/chicken/4/default.nix b/pkgs/development/compilers/chicken/4/default.nix new file mode 100644 index 000000000000..8d29c7c9a2b5 --- /dev/null +++ b/pkgs/development/compilers/chicken/4/default.nix @@ -0,0 +1,21 @@ +{ newScope } : +let + callPackage = newScope self; + + self = { + pkgs = self; + + fetchegg = callPackage ./fetchegg { }; + + eggDerivation = callPackage ./eggDerivation.nix { }; + + chicken = callPackage ./chicken.nix { + bootstrap-chicken = self.chicken.override { bootstrap-chicken = null; }; + }; + + chickenEggs = callPackage ./eggs.nix { }; + + egg2nix = callPackage ./egg2nix.nix { }; + }; + +in self diff --git a/pkgs/development/tools/egg2nix/default.nix b/pkgs/development/compilers/chicken/4/egg2nix.nix similarity index 100% rename from pkgs/development/tools/egg2nix/default.nix rename to pkgs/development/compilers/chicken/4/egg2nix.nix diff --git a/pkgs/development/compilers/chicken/eggDerivation.nix b/pkgs/development/compilers/chicken/4/eggDerivation.nix similarity index 89% rename from pkgs/development/compilers/chicken/eggDerivation.nix rename to pkgs/development/compilers/chicken/4/eggDerivation.nix index 2a14a997e57d..4dc7ebe66717 100644 --- a/pkgs/development/compilers/chicken/eggDerivation.nix +++ b/pkgs/development/compilers/chicken/4/eggDerivation.nix @@ -17,9 +17,8 @@ let in stdenv.mkDerivation ({ name = "chicken-${name}"; - propagatedBuildInputs = buildInputs ++ [ chicken ]; - propagatedUserEnvPkgs = buildInputs ++ [ chicken ]; - buildInputs = [ makeWrapper ]; + propagatedBuildInputs = buildInputs; + buildInputs = [ makeWrapper chicken ]; CSC_OPTIONS = stdenv.lib.concatStringsSep " " cscOptions; diff --git a/pkgs/development/tools/egg2nix/chicken-eggs.nix b/pkgs/development/compilers/chicken/4/eggs.nix similarity index 100% rename from pkgs/development/tools/egg2nix/chicken-eggs.nix rename to pkgs/development/compilers/chicken/4/eggs.nix diff --git a/pkgs/development/tools/egg2nix/chicken-eggs.scm b/pkgs/development/compilers/chicken/4/eggs.scm similarity index 100% rename from pkgs/development/tools/egg2nix/chicken-eggs.scm rename to pkgs/development/compilers/chicken/4/eggs.scm diff --git a/pkgs/build-support/fetchegg/builder.sh b/pkgs/development/compilers/chicken/4/fetchegg/builder.sh similarity index 100% rename from pkgs/build-support/fetchegg/builder.sh rename to pkgs/development/compilers/chicken/4/fetchegg/builder.sh diff --git a/pkgs/build-support/fetchegg/default.nix b/pkgs/development/compilers/chicken/4/fetchegg/default.nix similarity index 100% rename from pkgs/build-support/fetchegg/default.nix rename to pkgs/development/compilers/chicken/4/fetchegg/default.nix diff --git a/pkgs/development/compilers/chicken/overrides.nix b/pkgs/development/compilers/chicken/4/overrides.nix similarity index 100% rename from pkgs/development/compilers/chicken/overrides.nix rename to pkgs/development/compilers/chicken/4/overrides.nix diff --git a/pkgs/development/compilers/chicken/setup-hook.sh b/pkgs/development/compilers/chicken/4/setup-hook.sh similarity index 100% rename from pkgs/development/compilers/chicken/setup-hook.sh rename to pkgs/development/compilers/chicken/4/setup-hook.sh diff --git a/pkgs/development/compilers/chicken/5/chicken.nix b/pkgs/development/compilers/chicken/5/chicken.nix new file mode 100644 index 000000000000..ff0faf408394 --- /dev/null +++ b/pkgs/development/compilers/chicken/5/chicken.nix @@ -0,0 +1,62 @@ +{ stdenv, fetchurl, makeWrapper, bootstrap-chicken ? null }: + +let + version = "5.0.0"; + platform = with stdenv; + if isDarwin then "macosx" + else if isCygwin then "cygwin" + else if (isFreeBSD || isOpenBSD) then "bsd" + else if isSunOS then "solaris" + else "linux"; # Should be a sane default + lib = stdenv.lib; +in +stdenv.mkDerivation { + name = "chicken-${version}"; + + binaryVersion = 9; + + src = fetchurl { + url = "https://code.call-cc.org/releases/${version}/chicken-${version}.tar.gz"; + sha256 = "15b5yrzfa8aimzba79x7v6y282f898rxqxfxrr446sjx9jwlpfd8"; + }; + + setupHook = lib.ifEnable (bootstrap-chicken != null) ./setup-hook.sh; + + buildFlags = "PLATFORM=${platform} PREFIX=$(out) VARDIR=$(out)/var/lib"; + installFlags = "PLATFORM=${platform} PREFIX=$(out) VARDIR=$(out)/var/lib"; + + buildInputs = [ + makeWrapper + ] ++ (lib.ifEnable (bootstrap-chicken != null) [ + bootstrap-chicken + ]); + + postInstall = '' + for f in $out/bin/* + do + wrapProgram $f \ + --prefix PATH : ${stdenv.cc}/bin + done + + mv $out/var/lib/chicken $out/lib + rmdir $out/var/lib + rmdir $out/var + ''; + + # TODO: Assert csi -R files -p '(pathname-file (repository-path))' == binaryVersion + + meta = { + homepage = http://www.call-cc.org/; + license = stdenv.lib.licenses.bsd3; + maintainers = with stdenv.lib.maintainers; [ the-kenny ]; + platforms = stdenv.lib.platforms.linux; # Maybe other non-darwin Unix + description = "A portable compiler for the Scheme programming language"; + longDescription = '' + CHICKEN is a compiler for the Scheme programming language. + CHICKEN produces portable and efficient C, supports almost all + of the R5RS Scheme language standard, and includes many + enhancements and extensions. CHICKEN runs on Linux, macOS, + Windows, and many Unix flavours. + ''; + }; +} diff --git a/pkgs/development/compilers/chicken/5/default.nix b/pkgs/development/compilers/chicken/5/default.nix new file mode 100644 index 000000000000..8d29c7c9a2b5 --- /dev/null +++ b/pkgs/development/compilers/chicken/5/default.nix @@ -0,0 +1,21 @@ +{ newScope } : +let + callPackage = newScope self; + + self = { + pkgs = self; + + fetchegg = callPackage ./fetchegg { }; + + eggDerivation = callPackage ./eggDerivation.nix { }; + + chicken = callPackage ./chicken.nix { + bootstrap-chicken = self.chicken.override { bootstrap-chicken = null; }; + }; + + chickenEggs = callPackage ./eggs.nix { }; + + egg2nix = callPackage ./egg2nix.nix { }; + }; + +in self diff --git a/pkgs/development/compilers/chicken/5/egg2nix.nix b/pkgs/development/compilers/chicken/5/egg2nix.nix new file mode 100644 index 000000000000..21e12849b3ad --- /dev/null +++ b/pkgs/development/compilers/chicken/5/egg2nix.nix @@ -0,0 +1,29 @@ +{ stdenv, eggDerivation, fetchFromGitHub, chickenEggs }: + +# Note: This mostly reimplements the default.nix already contained in +# the tarball. Is there a nicer way than duplicating code? + +let + version = "c5-git"; +in +eggDerivation { + src = fetchFromGitHub { + owner = "corngood"; + repo = "egg2nix"; + rev = "chicken-5"; + sha256 = "1vfnhbcnyakywgjafhs0k5kpsdnrinzvdjxpz3fkwas1jsvxq3d1"; + }; + + name = "egg2nix-${version}"; + buildInputs = with chickenEggs; [ + args matchable + ]; + + meta = { + description = "Generate nix-expression from CHICKEN scheme eggs"; + homepage = https://github.com/the-kenny/egg2nix; + license = stdenv.lib.licenses.bsd3; + platforms = stdenv.lib.platforms.unix; + maintainers = [ stdenv.lib.maintainers.the-kenny ]; + }; +} diff --git a/pkgs/development/compilers/chicken/5/eggDerivation.nix b/pkgs/development/compilers/chicken/5/eggDerivation.nix new file mode 100644 index 000000000000..3dc1c4afce98 --- /dev/null +++ b/pkgs/development/compilers/chicken/5/eggDerivation.nix @@ -0,0 +1,41 @@ +{ stdenv, chicken, makeWrapper }: +{ name, src +, buildInputs ? [] +, chickenInstallFlags ? [] +, cscOptions ? [] +, ...} @ args: + +let + overrides = import ./overrides.nix; + baseName = (builtins.parseDrvName name).name; + override = if builtins.hasAttr baseName overrides + then + builtins.getAttr baseName overrides + else + {}; +in +stdenv.mkDerivation ({ + name = "chicken-${name}"; + propagatedBuildInputs = buildInputs; + buildInputs = [ makeWrapper chicken ]; + + CSC_OPTIONS = stdenv.lib.concatStringsSep " " cscOptions; + + installPhase = '' + runHook preInstall + + export CHICKEN_INSTALL_PREFIX=$out + export CHICKEN_INSTALL_REPOSITORY=$out/lib/chicken/${toString chicken.binaryVersion} + chicken-install ${stdenv.lib.concatStringsSep " " chickenInstallFlags} + + for f in $out/bin/* + do + wrapProgram $f \ + --prefix CHICKEN_REPOSITORY_PATH : "$out/lib/chicken/${toString chicken.binaryVersion}/:$CHICKEN_REPOSITORY_PATH" \ + --prefix CHICKEN_INCLUDE_PATH : "$CHICKEN_INCLUDE_PATH:$out/share/" \ + --prefix PATH : "$out/bin:${chicken}/bin:$CHICKEN_REPOSITORY_PATH" + done + + runHook postInstall + ''; +} // (builtins.removeAttrs args ["name" "buildInputs"]) // override) diff --git a/pkgs/development/compilers/chicken/5/eggs.nix b/pkgs/development/compilers/chicken/5/eggs.nix new file mode 100644 index 000000000000..04f7551f32d9 --- /dev/null +++ b/pkgs/development/compilers/chicken/5/eggs.nix @@ -0,0 +1,91 @@ +{ pkgs, stdenv }: +rec { + inherit (pkgs) eggDerivation fetchegg; + + args = eggDerivation { + name = "args-1.6.0"; + + src = fetchegg { + name = "args"; + version = "1.6.0"; + sha256 = "1y9sznh4kxqxvhd8k44bjx0s7xspp52sx4bn8i8i0f8lwch6r2g4"; + }; + + buildInputs = [ + srfi-1 + srfi-13 + srfi-37 + ]; + }; + + matchable = eggDerivation { + name = "matchable-1.0"; + + src = fetchegg { + name = "matchable"; + version = "1.0"; + sha256 = "01vy2ppq3sq0wirvsvl3dh0bwa5jqs1i6rdjdd7pnwj4nncxd1ga"; + }; + + buildInputs = [ + + ]; + }; + + srfi-1 = eggDerivation { + name = "srfi-1-0.5"; + + src = fetchegg { + name = "srfi-1"; + version = "0.5"; + sha256 = "0gh1h406xbxwm5gvc5znc93nxp9xjbhyqf7zzga08k5y6igxrlvk"; + }; + + buildInputs = [ + + ]; + }; + + srfi-13 = eggDerivation { + name = "srfi-13-0.2"; + + src = fetchegg { + name = "srfi-13"; + version = "0.2"; + sha256 = "0jazbdnn9bjm7wwxqq7xzqxc9zfvaapq565rf1czj6ayl96yvk3n"; + }; + + buildInputs = [ + srfi-14 + ]; + }; + + srfi-14 = eggDerivation { + name = "srfi-14-0.2"; + + src = fetchegg { + name = "srfi-14"; + version = "0.2"; + sha256 = "13nm4nn1d52nkvhjizy26z3s6q41x1ml4zm847xzf86x1zwvymni"; + }; + + buildInputs = [ + + ]; + }; + + srfi-37 = eggDerivation { + name = "srfi-37-1.4"; + + src = fetchegg { + name = "srfi-37"; + version = "1.4"; + sha256 = "17f593497n70gldkj6iab6ilgryiqar051v6azn1szhnm1lk7dwd"; + }; + + buildInputs = [ + + ]; + }; +} + diff --git a/pkgs/development/compilers/chicken/5/eggs.scm b/pkgs/development/compilers/chicken/5/eggs.scm new file mode 100644 index 000000000000..b743d6e3229d --- /dev/null +++ b/pkgs/development/compilers/chicken/5/eggs.scm @@ -0,0 +1,3 @@ +;; Eggs used by egg2nix +args +matchable diff --git a/pkgs/development/compilers/chicken/5/fetchegg/builder.sh b/pkgs/development/compilers/chicken/5/fetchegg/builder.sh new file mode 100644 index 000000000000..d9adf510f22d --- /dev/null +++ b/pkgs/development/compilers/chicken/5/fetchegg/builder.sh @@ -0,0 +1,10 @@ +source $stdenv/setup + +header "exporting egg ${eggName} (version $version) into $out" + +mkdir -p $out +CHICKEN_EGG_CACHE=. chicken-install -r "${eggName}:${version}" +rm ${eggName}/{STATUS,TIMESTAMP} +cp -r ${eggName}/* $out/ + +stopNest diff --git a/pkgs/development/compilers/chicken/5/fetchegg/default.nix b/pkgs/development/compilers/chicken/5/fetchegg/default.nix new file mode 100644 index 000000000000..24bfbd7a30f4 --- /dev/null +++ b/pkgs/development/compilers/chicken/5/fetchegg/default.nix @@ -0,0 +1,25 @@ +# Fetches a chicken egg from henrietta using `chicken-install -r' +# See: http://wiki.call-cc.org/chicken-projects/egg-index-5.html + +{ stdenvNoCC, chicken }: +{ name, version, md5 ? "", sha256 ? "" }: + +if md5 != "" then + throw "fetchegg does not support md5 anymore, please use sha256" +else +stdenvNoCC.mkDerivation { + name = "chicken-${name}-export"; + builder = ./builder.sh; + nativeBuildInputs = [ chicken ]; + + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = sha256; + + inherit version; + + eggName = name; + + impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars; +} + diff --git a/pkgs/development/compilers/chicken/5/overrides.nix b/pkgs/development/compilers/chicken/5/overrides.nix new file mode 100644 index 000000000000..2c63c0851048 --- /dev/null +++ b/pkgs/development/compilers/chicken/5/overrides.nix @@ -0,0 +1,2 @@ +{ +} diff --git a/pkgs/development/compilers/chicken/5/setup-hook.sh b/pkgs/development/compilers/chicken/5/setup-hook.sh new file mode 100644 index 000000000000..2447aeb0ceae --- /dev/null +++ b/pkgs/development/compilers/chicken/5/setup-hook.sh @@ -0,0 +1,6 @@ +addChickenRepositoryPath() { + addToSearchPathWithCustomDelimiter : CHICKEN_REPOSITORY_PATH "$1/lib/chicken/9/" + addToSearchPathWithCustomDelimiter : CHICKEN_INCLUDE_PATH "$1/share/" +} + +addEnvHooks "$targetOffset" addChickenRepositoryPath diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 75c8e4b67caf..64709155d1ba 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6623,17 +6623,15 @@ in colm = callPackage ../development/compilers/colm { }; - fetchegg = callPackage ../build-support/fetchegg { }; + chickenPackages_4 = callPackage ../development/compilers/chicken/4 { }; + chickenPackages_5 = callPackage ../development/compilers/chicken/5 { }; + chickenPackages = chickenPackages_5; - eggDerivation = callPackage ../development/compilers/chicken/eggDerivation.nix { }; - - chicken = callPackage ../development/compilers/chicken { - bootstrap-chicken = chicken.override { bootstrap-chicken = null; }; - }; - - egg2nix = callPackage ../development/tools/egg2nix { - chickenEggs = callPackage ../development/tools/egg2nix/chicken-eggs.nix { }; - }; + inherit (chickenPackages) + fetchegg + eggDerivation + chicken + egg2nix; ccl = callPackage ../development/compilers/ccl { inherit (buildPackages.darwin) bootstrap_cmds;