Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchurl,
5 freetype,
6 libtool,
7 flex,
8 bison,
9 pkg-config,
10}:
11
12stdenv.mkDerivation {
13 pname = "ttf-mkfontdir";
14 version = "3.0.9-6";
15
16 src = fetchurl {
17 url = "http://mirror.fsf.org/trisquel/pool/main/t/ttmkfdir/ttmkfdir_3.0.9.orig.tar.gz";
18 sha256 = "0n6bmmndmp4c1myisvv7cby559gzgvwsw4rfw065a3f92m87jxiq";
19 };
20
21 # all the patches up from ttmkfdir-3.0.9/Makefile should be reviewed by someone
22 # who knows more about C/C++ ..
23 patches = [
24 (fetchurl {
25 url = "http://mirror.fsf.org/trisquel/pool/main/t/ttmkfdir/ttmkfdir_3.0.9-6.diff.gz";
26 sha256 = "141kxaf2by8nf87hqyszaxi0n7nnmswr1nh2i5r5bsvxxmaj9633";
27 })
28
29 ./cstring.patch # also fixes some other compilation issues (freetype includes)
30 ];
31
32 # cross-compilation fixes:
33 # - fix libtool, the reason it does not work in nativeBuildInputs is complicated
34 # see https://github.com/NixOS/nixpkgs/pull/192878 for more info
35 # - freetype-config doesn't properly support cross-compilation, but is just a thin
36 # wrapper around pkg-config anyways
37 postPatch = ''
38 substituteInPlace Makefile \
39 --replace "libtool " "${libtool}/bin/libtool --tag=CXX " \
40 --replace "freetype-config" "${stdenv.cc.targetPrefix}pkg-config freetype2"
41 '';
42
43 makeFlags = [
44 "DESTDIR=${placeholder "out"}"
45 "BINDIR=/bin"
46 "CXX=${stdenv.cc.targetPrefix}c++"
47 ];
48
49 nativeBuildInputs = [
50 flex
51 bison
52 pkg-config
53 ];
54 buildInputs = [ freetype ];
55
56 meta = {
57 description = "Create fonts.dir for TTF font directory";
58 platforms = lib.platforms.linux;
59 mainProgram = "ttmkfdir";
60 };
61}