Merge pull request #189487 from impl/fix-jam-cross

{jam,ftjam}: fix cross-compiling and refactor
This commit is contained in:
Anderson Torres 2022-09-05 23:38:57 -03:00 committed by GitHub
commit 449d92d413
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 91 additions and 91 deletions

View File

@ -5643,6 +5643,16 @@
githubId = 510202;
name = "Ismaël Bouya";
};
impl = {
email = "noah@noahfontes.com";
matrix = "@impl:matrix.org";
github = "impl";
githubId = 41129;
name = "Noah Fontes";
keys = [{
fingerprint = "F5B2 BE1B 9AAD 98FE 2916 5597 3665 FFF7 9D38 7BAA";
}];
};
imsofi = {
email = "sofi+git@mailbox.org";
github = "imsofi";

View File

@ -1,45 +1,88 @@
{ lib, stdenv, fetchurl, bison }:
{ lib, stdenv, fetchurl, bison, buildPackages }:
stdenv.mkDerivation rec {
pname = "jam";
version = "2.6.1";
let
mkJam = { meta ? { }, ... } @ args: stdenv.mkDerivation (args // {
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ bison ];
src = fetchurl {
url = "https://swarm.workshop.perforce.com/projects/perforce_software-jam/download/main/${pname}-${version}.tar";
sha256 = "19xkvkpycxfsncxvin6yqrql3x3z9ypc1j8kzls5k659q4kv5rmc";
# Jambase expects ar to have flags.
preConfigure = ''
export AR="$AR rc"
'';
LOCATE_TARGET = "bin.unix";
buildPhase = ''
runHook preBuild
make $makeFlags jam0
./jam0 -j$NIX_BUILD_CORES -sCC=${buildPackages.stdenv.cc.targetPrefix}cc jambase.c
./jam0 -j$NIX_BUILD_CORES
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/doc/jam
cp bin.unix/jam $out/bin/jam
cp *.html $out/doc/jam
runHook postInstall
'';
enableParallelBuilding = true;
meta = with lib; meta // {
license = licenses.free;
mainProgram = "jam";
platforms = platforms.unix;
};
});
in
{
jam = let
pname = "jam";
version = "2.6.1";
in mkJam {
inherit pname version;
src = fetchurl {
url = "https://swarm.workshop.perforce.com/projects/perforce_software-jam/download/main/${pname}-${version}.tar";
sha256 = "19xkvkpycxfsncxvin6yqrql3x3z9ypc1j8kzls5k659q4kv5rmc";
};
meta = with lib; {
description = "Just Another Make";
homepage = "https://www.perforce.com/resources/documentation/jam";
maintainers = with maintainers; [ impl orivej ];
};
};
nativeBuildInputs = [ bison ];
ftjam = let
pname = "ftjam";
version = "2.5.2";
in mkJam {
inherit pname version;
preConfigure = ''
unset AR
'';
src = fetchurl {
url = "https://downloads.sourceforge.net/project/freetype/${pname}/${version}/${pname}-${version}.tar.bz2";
hash = "sha256-6JdzUAqSkS3pGOn+v/q+S2vOedaa8ZRDX04DK4ptZqM=";
};
buildPhase = ''
runHook preBuild
postPatch = ''
substituteInPlace Jamfile --replace strip ${stdenv.cc.targetPrefix}strip
'';
make jam0
# Doesn't understand how to cross compile once bootstrapped, so we'll just
# use the Makefile for the bootstrapping portion.
configurePlatforms = [ "build" "target" ];
configureFlags = [
"CC=${buildPackages.stdenv.cc.targetPrefix}cc"
"--host=${stdenv.buildPlatform.config}"
];
runHook postBuild
'';
installPhase = ''
runHook preInstall
./jam0 -j$NIX_BUILD_CORES -sBINDIR=$out/bin install
mkdir -p $out/doc/jam
cp *.html $out/doc/jam
runHook postInstall
'';
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://www.perforce.com/resources/documentation/jam";
license = licenses.free;
description = "Just Another Make";
maintainers = with maintainers; [ orivej ];
platforms = platforms.unix;
meta = with lib; {
description = "FreeType's enhanced, backwards-compatible Jam clone";
homepage = "https://freetype.org/jam/";
maintainers = with maintainers; [ AndersonTorres impl ];
};
};
}

View File

@ -1,53 +0,0 @@
{ lib
, stdenv
, fetchurl
, bison
}:
stdenv.mkDerivation rec {
pname = "ftjam";
version = "2.5.2";
src = fetchurl {
url = "https://downloads.sourceforge.net/project/freetype/${pname}/${version}/${pname}-${version}.tar.bz2";
hash = "sha256-6JdzUAqSkS3pGOn+v/q+S2vOedaa8ZRDX04DK4ptZqM=";
};
nativeBuildInputs = [
bison
];
preConfigure = ''
unset AR
'';
buildPhase = ''
runHook preBuild
make jam0
runHook postBuild
'';
installPhase = ''
runHook preInstall
./jam0 -j$NIX_BUILD_CORES -sBINDIR=$out/bin install
mkdir -p $out/doc/jam
cp *.html $out/doc/jam
runHook postInstall
'';
enableParallelBuilding = true;
meta = with lib; {
description = "Freetype's enhanced, backwards-compatible Jam clone";
homepage = "https://freetype.org/jam/";
license = licenses.free;
maintainers = with maintainers; [ AndersonTorres ];
mainProgram = "jam";
platforms = platforms.unix;
};
}
# TODO: setup hook for Jam

View File

@ -16512,9 +16512,9 @@ with pkgs;
itstool = callPackage ../development/tools/misc/itstool { };
jam = callPackage ../development/tools/build-managers/jam { };
ftjam = callPackage ../development/tools/build-managers/jam/ftjam.nix { };
inherit (callPackage ../development/tools/build-managers/jam { })
jam
ftjam;
javacc = callPackage ../development/tools/parsing/javacc {
# Upstream doesn't support anything newer than Java 8.