1{
2 lib,
3 autoreconfHook,
4 bashNonInteractive,
5 libtool,
6 fetchFromGitHub,
7 nix-update-script,
8 perl,
9 stdenv,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "libxo";
14 version = "1.7.5";
15
16 src = fetchFromGitHub {
17 owner = "Juniper";
18 repo = "libxo";
19 rev = finalAttrs.version;
20 hash = "sha256-ElSxegY2ejw7IuIMznfVpl29Wyvpx9k1BdXregzYsoQ=";
21 };
22
23 postPatch = ''
24 substituteInPlace configure.ac \
25 --replace-fail LIBTOOL=glibtool 'LIBTOOL=${lib.getExe libtool}'
26
27 # Remove impurities
28 substituteInPlace libxo/Makefile.am \
29 --replace-fail '-L/opt/local/lib' ""
30 '';
31
32 outputs = [
33 "bin"
34 "out"
35 "dev"
36 "man"
37 ];
38
39 configureFlags = lib.optionals stdenv.hostPlatform.isDarwin [
40 # libxo misdetects malloc and realloc when cross-compiling on Darwin
41 "ac_cv_func_malloc_0_nonnull=yes"
42 "ac_cv_func_realloc_0_nonnull=yes"
43 ];
44
45 strictDeps = true;
46
47 nativeBuildInputs = [ autoreconfHook ];
48 buildInputs = [
49 autoreconfHook
50 # For patchShebangs in postInstall
51 bashNonInteractive
52 perl
53 ];
54
55 postInstall = ''
56 moveToOutput "bin/libxo-config" "$dev"
57 patchShebangs --host "$out/bin"
58 '';
59
60 __structuredAttrs = true;
61
62 passthru.updateScript = nix-update-script { };
63
64 meta = {
65 description = "Library to generate text, XML, JSON, and HTML";
66 license = lib.licenses.bsd2;
67 maintainers = [ lib.maintainers.reckenrode ];
68 platforms = lib.platforms.unix;
69 };
70})