1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 pkg-config,
7 autoreconfHook,
8 xorg,
9 freetype,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "libotf";
14 version = "0.9.16";
15
16 src = fetchurl {
17 url = "mirror://savannah/m17n/${pname}-${version}.tar.gz";
18 sha256 = "0sq6g3xaxw388akws6qrllp3kp2sxgk2dv4j79k6mm52rnihrnv8";
19 };
20
21 patches = [
22 # https://salsa.debian.org/debian/libotf/-/tree/master/debian/patches
23 # Fix cross-compilation
24 (fetchpatch {
25 url = "https://salsa.debian.org/debian/libotf/-/raw/1be04cedf887720eb8f5efb3594dc2cefd96b1f1/debian/patches/0002-use-pkg-config-not-freetype-config.patch";
26 sha256 = "sha256-VV9iGoNWIEie6UiLLTJBD+zxpvj0acgqkcBeAN1V6Kc=";
27 })
28 # these 2 are required by the above patch
29 (fetchpatch {
30 url = "https://salsa.debian.org/debian/libotf/-/raw/1be04cedf887720eb8f5efb3594dc2cefd96b1f1/debian/patches/0001-do-not-add-flags-for-required-packages-to-pc-file.patch";
31 sha256 = "sha256-3kzqNPAHNVJQ1F4fyifq3AqLdChWli/k7wOq+ha+iDs=";
32 })
33 (fetchpatch {
34 url = "https://salsa.debian.org/debian/libotf/-/raw/1be04cedf887720eb8f5efb3594dc2cefd96b1f1/debian/patches/0001-libotf-config-modify-to-support-multi-arch.patch";
35 sha256 = "sha256-SUlI87h+MtYWWtrAegzAnSds8JhxZwTJltDcj/se/Qc=";
36 })
37 ];
38
39 strictDeps = true;
40
41 nativeBuildInputs = [
42 pkg-config
43 autoreconfHook
44 ];
45
46 buildInputs = [
47 xorg.libXaw
48 freetype
49 ];
50
51 outputs = [
52 "out"
53 "dev"
54 ];
55
56 postInstall = ''
57 mkdir -p $dev/bin
58 mv $out/bin/libotf-config $dev/bin/
59 substituteInPlace $dev/bin/libotf-config \
60 --replace "pkg-config" "${pkg-config}/bin/pkg-config"
61 '';
62
63 meta = {
64 homepage = "https://www.nongnu.org/m17n/";
65 description = "Multilingual text processing library (libotf)";
66 license = lib.licenses.lgpl21Plus;
67 platforms = lib.platforms.linux;
68 maintainers = with lib.maintainers; [ bendlas ];
69 };
70}