2017-03-26 11:35:10 +03:00
|
|
|
{ stdenv, darwin, fetchurl, makeWrapper, pkgconfig
|
2019-06-06 06:00:49 +03:00
|
|
|
, harfbuzz, icu, lpeg, luaexpat, lua-zlib, luafilesystem, luasocket, luasec
|
2017-02-04 20:30:00 +03:00
|
|
|
, fontconfig, lua, libiconv
|
2019-03-05 13:03:59 +03:00
|
|
|
, makeFontsConf, gentium, gentium-book-basic, dejavu_fonts
|
2017-02-04 20:30:00 +03:00
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2019-06-06 06:00:49 +03:00
|
|
|
libs = [ lpeg luaexpat lua-zlib luafilesystem luasocket luasec ];
|
2017-02-04 20:30:00 +03:00
|
|
|
getPath = lib : type : "${lib}/lib/lua/${lua.luaversion}/?.${type};${lib}/share/lua/${lua.luaversion}/?.${type}";
|
|
|
|
getLuaPath = lib : getPath lib "lua";
|
|
|
|
getLuaCPath = lib : getPath lib "so";
|
|
|
|
luaPath = concatStringsSep ";" (map getLuaPath libs);
|
|
|
|
luaCPath = concatStringsSep ";" (map getLuaCPath libs);
|
|
|
|
|
2017-02-11 17:52:50 +03:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "sile-${version}";
|
2019-01-27 10:38:36 +03:00
|
|
|
version = "0.9.5.1";
|
2017-02-11 17:52:50 +03:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/simoncozens/sile/releases/download/v${version}/${name}.tar.bz2";
|
2019-01-27 10:38:36 +03:00
|
|
|
sha256 = "0fh0jbpsyqyq0hzq4midn7yw2z11hqdgqb9mmgz766cp152wrkb0";
|
2017-02-11 17:52:50 +03:00
|
|
|
};
|
2017-02-04 20:30:00 +03:00
|
|
|
|
|
|
|
nativeBuildInputs = [pkgconfig makeWrapper];
|
2019-01-12 12:02:38 +03:00
|
|
|
buildInputs = [ harfbuzz icu lua fontconfig libiconv ]
|
|
|
|
++ libs
|
2017-03-26 11:35:10 +03:00
|
|
|
++ optional stdenv.isDarwin darwin.apple_sdk.frameworks.AppKit
|
|
|
|
;
|
|
|
|
|
|
|
|
preConfigure = optionalString stdenv.isDarwin ''
|
|
|
|
sed -i -e 's|@import AppKit;|#import <AppKit/AppKit.h>|' src/macfonts.m
|
|
|
|
'';
|
|
|
|
|
|
|
|
NIX_LDFLAGS = optionalString stdenv.isDarwin "-framework AppKit";
|
2017-02-04 20:30:00 +03:00
|
|
|
|
|
|
|
LUA_PATH = luaPath;
|
|
|
|
LUA_CPATH = luaCPath;
|
|
|
|
|
2019-03-05 13:03:59 +03:00
|
|
|
FONTCONFIG_FILE = makeFontsConf {
|
|
|
|
fontDirectories = [
|
|
|
|
gentium
|
|
|
|
gentium-book-basic
|
|
|
|
dejavu_fonts
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
doCheck = stdenv.targetPlatform == stdenv.hostPlatform
|
|
|
|
&& ! stdenv.isAarch64 # random seg. faults
|
|
|
|
&& ! stdenv.isDarwin; # dy lib not found
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
make documentation/developers.pdf documentation/sile.pdf
|
|
|
|
'';
|
|
|
|
|
2017-02-04 20:30:00 +03:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/sile \
|
|
|
|
--set LUA_PATH "${luaPath};" \
|
|
|
|
--set LUA_CPATH "${luaCPath};" \
|
2019-03-05 13:03:59 +03:00
|
|
|
|
|
|
|
install -D -t $out/share/doc/sile documentation/*.pdf
|
2017-02-04 20:30:00 +03:00
|
|
|
'';
|
|
|
|
|
2017-05-18 12:39:00 +03:00
|
|
|
# Hack to avoid TMPDIR in RPATHs.
|
|
|
|
preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
|
|
|
|
|
2019-03-05 13:03:59 +03:00
|
|
|
outputs = [ "out" "doc" ];
|
|
|
|
|
2017-02-04 20:30:00 +03:00
|
|
|
meta = {
|
|
|
|
description = "A typesetting system";
|
|
|
|
longDescription = ''
|
2017-02-11 17:52:50 +03:00
|
|
|
SILE is a typesetting system; its job is to produce beautiful
|
|
|
|
printed documents. Conceptually, SILE is similar to TeX—from
|
|
|
|
which it borrows some concepts and even syntax and
|
|
|
|
algorithms—but the similarities end there. Rather than being a
|
|
|
|
derivative of the TeX family SILE is a new typesetting and
|
|
|
|
layout engine written from the ground up using modern
|
|
|
|
technologies and borrowing some ideas from graphical systems
|
|
|
|
such as InDesign.
|
2017-02-04 20:30:00 +03:00
|
|
|
'';
|
2017-03-26 11:35:10 +03:00
|
|
|
homepage = http://www.sile-typesetter.org;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
license = licenses.mit;
|
2017-02-04 20:30:00 +03:00
|
|
|
};
|
|
|
|
}
|