diff --git a/pkgs/tools/misc/ttmkfdir/cstring.patch b/pkgs/tools/misc/ttmkfdir/cstring.patch index 84f2621eaaae..6b65b44e8518 100644 --- a/pkgs/tools/misc/ttmkfdir/cstring.patch +++ b/pkgs/tools/misc/ttmkfdir/cstring.patch @@ -9,4 +9,82 @@ index 5f0d78a..b94cbe5 100644 +#include #include "directory.h" + +diff --git a/Makefile b/Makefile +index e65b64c..52af5ed 100644 +--- a/Makefile ++++ b/Makefile +@@ -41,8 +41,9 @@ all: ttmkfdir + .cpp.o: + libtool --mode=compile $(CXX) $(CXXFLAGS) -o $@ -c $^ + ++# ulgy hack for libtool to find .o files !! + ttmkfdir: ttmkfdir.o directory.o commandline.o ttf.o encoding.o parser.o builtin.o +- libtool --mode=link $(CXX) -o $@ $^ $(LDFLAGS) ++ libtool --mode=link $(CXX) -o $@ ./.libs/ttmkfdir.o ./.libs/directory.o ./.libs/commandline.o ./.libs/ttf.o ./.libs/encoding.o ./.libs/parser.o ./.libs/builtin.o $(LDFLAGS) + + parser.cpp: encoding.l + flex -i -8 -o$@ $< +diff --git a/encoding.cpp b/encoding.cpp +index 9035d35..b4e9733 100644 +--- a/encoding.cpp ++++ b/encoding.cpp +@@ -2,7 +2,9 @@ + #include + #include + #include +-#include "freetype/freetype.h" ++#include ++#include FT_FREETYPE_H ++#include + + #include "ttmkfdir.h" + #include "encoding.h" +diff --git a/encoding.h b/encoding.h +index fc618bc..e01518f 100644 +--- a/encoding.h ++++ b/encoding.h +@@ -6,7 +6,8 @@ + #include + #include + +-#include "freetype/freetype.h" ++#include ++#include FT_FREETYPE_H + + #include "util.h" + +diff --git a/ttf.cpp b/ttf.cpp +index 1dda774..97b37f3 100644 +--- a/ttf.cpp ++++ b/ttf.cpp +@@ -239,7 +239,7 @@ Face::FontFamilyName (void) const + for (i = 0; i < n; i++) { + if ((fterror = FT_Get_Sfnt_Name (face, i, &NamePtr)) != FT_Err_Ok) { + std::cout << "Warning: Can't SFNT name : " << FileName << "(" << fterror << ")" << std::endl; +- return; ++ return 0; + }; + platform = NamePtr.platform_id; + encoding = NamePtr.encoding_id; +diff --git a/ttf.h b/ttf.h +index 4261ef8..c4a0f1f 100644 +--- a/ttf.h ++++ b/ttf.h +@@ -3,13 +3,14 @@ + #define TTF_H__ + + #include ++#include ++#include FT_FREETYPE_H + #include "freetype/freetype.h" + #include "freetype/tttables.h" + #include "freetype/ftsnames.h" + #include "freetype/ttnameid.h" + #include "freetype/fterrors.h" +-#include "freetype/ftmodule.h" +- ++#include "freetype/ftmodapi.h" + #include "util.h" + #include "encoding.h" diff --git a/pkgs/tools/misc/ttmkfdir/default.nix b/pkgs/tools/misc/ttmkfdir/default.nix index 6f90ca8eb0d3..52b344e69bf9 100644 --- a/pkgs/tools/misc/ttmkfdir/default.nix +++ b/pkgs/tools/misc/ttmkfdir/default.nix @@ -9,7 +9,9 @@ debBuild ({ url = http://ftp.de.debian.org/debian/pool/main/t/ttmkfdir/ttmkfdir_3.0.9-5.1.diff.gz; sha256 = "1500kwvhxfq85zg7nwnn9dlvjxyg2ni7as17gdfm67pl9a45q3w4"; }; - patches = [ ./cstring.patch ]; + patches = [ + /* also fixes some other compilation issues (freetype includes) */ + ./cstring.patch ]; name = "ttf-mkfontdir-3.0.9-5.1"; buildInputs = [fontconfig freetype libunwind libtool flex bison]; diff --git a/pkgs/tools/misc/ttmkfdir/normal-builder.nix b/pkgs/tools/misc/ttmkfdir/normal-builder.nix new file mode 100644 index 000000000000..122ea47e33b5 --- /dev/null +++ b/pkgs/tools/misc/ttmkfdir/normal-builder.nix @@ -0,0 +1,29 @@ +args: with args; +stdenv.mkDerivation { + name = "ttf-mkfontdir-3.0.9-5.1"; + + src = fetchurl { + url = http://ftp.de.debian.org/debian/pool/main/t/ttmkfdir/ttmkfdir_3.0.9.orig.tar.gz; + sha256 = "0n6bmmndmp4c1myisvv7cby559gzgvwsw4rfw065a3f92m87jxiq"; + }; + # all the patches up from ttmkfdir-3.0.9/Makefile should be reviewed by someone + # who knows more about C/C++ .. + patches = [ + + (fetchurl { + url = http://ftp.de.debian.org/debian/pool/main/t/ttmkfdir/ttmkfdir_3.0.9-5.1.diff.gz; + sha256 = "1500kwvhxfq85zg7nwnn9dlvjxyg2ni7as17gdfm67pl9a45q3w4"; + }) + + ./cstring.patch /* also fixes some other compilation issues (freetype includes) */ ]; + + preInstall = '' + ensureDir $out; makeFlags="DESTDIR=$out BINDIR=/bin" + ''; + + buildInputs = [freetype fontconfig libunwind libtool flex bison]; + + meta = { + description = "Create fonts.dir for TTF font directory."; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 512b3a8d9af4..62215165e8f3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1379,10 +1379,16 @@ let wxGTK = wxGTK28; }; - ttmkfdir = import ../tools/misc/ttmkfdir { + /* don't have time to fix the builderDefs based expression + ttmkfdirX = import ../tools/misc/ttmkfdir { inherit debPackage freetype fontconfig libunwind libtool bison; flex = flex2534; }; + */ + ttmkfdir = import ../tools/misc/ttmkfdir/normal-builder.nix { + inherit stdenv fetchurl freetype fontconfig libunwind libtool bison; + flex = flex2534; + }; units = import ../tools/misc/units { inherit fetchurl stdenv;