12 stdenv.mkDerivation (finalAttrs: {
17 url = "https://swarm.workshop.perforce.com/downloads/guest/perforce_software/jam/jam-${finalAttrs.version}.tar";
18 hash = "sha256-rOayJ8GpmFk0/RPJwK5Pf/RBccbe2Lg7s9p15u/cs6c=";
26 depsBuildBuild = [ buildPackages.stdenv.cc ];
34 "CC=${buildPackages.stdenv.cc.targetPrefix}cc"
38 LOCATE_TARGET = "bin.unix";
39 # Jam uses c89 conventions
40 NIX_CFLAGS_COMPILE = "-std=c89";
43 enableParallelBuilding = true;
47 # Jambase expects ar to have flags.
54 substituteInPlace jam.h --replace-fail 'ifdef linux' 'ifdef __linux__'
57 # When cross-compiling, we need to set the preprocessor macros
58 # OSMAJOR/OSMINOR/OSPLAT to the values from the target platform, not the host
59 # platform. This looks a little ridiculous because the vast majority of build
60 # tools don't embed target-specific information into their binary, but in this
61 # case we behave more like a compiler than a make(1)-alike.
62 lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) ''
68 ${pkgsBuildTarget.targetPackages.stdenv.cc}/bin/${pkgsBuildTarget.targetPackages.stdenv.cc.targetPrefix}cc -E -dM jam.h | grep -E '^#define (OSMAJOR|OSMINOR|OSPLAT) '
76 ./jam0 -j$NIX_BUILD_CORES -sCC=${buildPackages.stdenv.cc.targetPrefix}cc jambase.c
77 ./jam0 -j$NIX_BUILD_CORES
84 installBin bin.unix/jam
85 install -Dm644 -t ''${!outputDoc}/share/doc/jam-${finalAttrs.version}/ *.html
91 tests.version = testers.testVersion {
92 package = finalAttrs.finalPackage;
95 tests.os = testers.runCommand {
96 name = "${finalAttrs.finalPackage.name}-os";
97 nativeBuildInputs = [ finalAttrs.finalPackage ];
99 echo 'echo $(OS) ;' > Jamfile
101 [[ $os != UNKNOWN* ]] && touch $out
107 homepage = "https://swarm.workshop.perforce.com/projects/perforce_software-jam";
108 description = "Just Another Make";
110 Jam is a program construction tool, like make(1).
112 Jam recursively builds target files from source files, using dependency
113 information and updating actions expressed in the Jambase file, which is
114 written in jam's own interpreted language. The default Jambase is compiled
115 into jam and provides a boilerplate for common use, relying on a
116 user-provide file "Jamfile" to enumerate actual targets and sources.
118 license = lib.licenses.free;
120 maintainers = with lib.maintainers; [
125 platforms = lib.platforms.unix;