diff --git a/pkgs/by-name/ft/ftjam/package.nix b/pkgs/by-name/ft/ftjam/package.nix new file mode 100644 index 000000000000..7bfdc5f804a4 --- /dev/null +++ b/pkgs/by-name/ft/ftjam/package.nix @@ -0,0 +1,117 @@ +{ + lib, + bison, + buildPackages, + fetchurl, + installShellFiles, + pkgsBuildTarget, + stdenv, + testers, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "ftjam"; + version = "2.5.2"; + + src = fetchurl { + url = "https://downloads.sourceforge.net/project/freetype/ftjam/${finalAttrs.version}/ftjam-${finalAttrs.version}.tar.bz2"; + hash = "sha256-6JdzUAqSkS3pGOn+v/q+S2vOedaa8ZRDX04DK4ptZqM="; + }; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + + nativeBuildInputs = [ + bison + installShellFiles + ]; + + # 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}" + ]; + + makeFlags = [ + "CC=${buildPackages.stdenv.cc.targetPrefix}cc" + ]; + + env = { + LOCATE_TARGET = "bin.unix"; + # Jam uses c89 conventions + NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-std=c89"; + }; + + enableParallelBuilding = true; + + strictDeps = true; + + # Jambase expects ar to have flags. + preConfigure = '' + export AR="$AR rc" + ''; + + # When cross-compiling, we need to set the preprocessor macros + # OSMAJOR/OSMINOR/OSPLAT to the values from the target platform, not the host + # platform. This looks a little ridiculous because the vast majority of build + # tools don't embed target-specific information into their binary, but in this + # case we behave more like a compiler than a make(1)-alike. + postPatch = + '' + substituteInPlace Jamfile \ + --replace "strip" "${stdenv.cc.targetPrefix}strip" + '' + + lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) '' + cat >>jam.h <>jam.h <>jam.h <