sword: enable Windows building

Modify build techniques for SWORD so that it compiles on Windows and we
can remove the platforms tag

+122 -47
+109 -47
pkgs/by-name/sw/sword/package.nix
··· 5 5 pkg-config, 6 6 icu, 7 7 clucene_core, 8 + 9 + autoreconfHook, 10 + bzip2, 8 11 curl, 12 + xz, 9 13 }: 10 14 11 - stdenv.mkDerivation (finalAttrs: { 12 - pname = "sword"; 13 - version = "1.9.0"; 15 + stdenv.mkDerivation ( 16 + finalAttrs: 17 + let 18 + # Used on Windows, where libpsl doesn't compile, yet 19 + curlDep = curl.override { pslSupport = false; }; 20 + in 21 + { 22 + pname = "sword"; 23 + version = "1.9.0"; 14 24 15 - src = fetchurl { 16 - url = "https://www.crosswire.org/ftpmirror/pub/sword/source/v${lib.versions.majorMinor finalAttrs.version}/sword-${finalAttrs.version}.tar.gz"; 17 - hash = "sha256-QkCc894vrxEIUj4sWsB0XSH57SpceO2HjuncwwNCa4o="; 18 - }; 25 + src = fetchurl { 26 + url = "https://www.crosswire.org/ftpmirror/pub/sword/source/v${lib.versions.majorMinor finalAttrs.version}/sword-${finalAttrs.version}.tar.gz"; 27 + hash = "sha256-QkCc894vrxEIUj4sWsB0XSH57SpceO2HjuncwwNCa4o="; 28 + }; 19 29 20 - nativeBuildInputs = [ pkg-config ]; 21 - buildInputs = [ 22 - icu 23 - clucene_core 24 - curl 25 - ]; 26 - 27 - outputs = [ 28 - "out" 29 - "dev" 30 - ]; 30 + nativeBuildInputs = 31 + [ 32 + pkg-config 33 + ] 34 + ++ (lib.optionals stdenv.hostPlatform.isWindows [ 35 + autoreconfHook # The Windows patch modifies autotools files 36 + ]); 31 37 32 - prePatch = '' 33 - patchShebangs .; 34 - ''; 38 + buildInputs = 39 + [ 40 + icu 41 + ] 42 + ++ (lib.optionals stdenv.hostPlatform.isUnix [ 43 + clucene_core 44 + curl 45 + ]) 46 + ++ (lib.optionals stdenv.hostPlatform.isWindows [ 47 + bzip2 48 + curlDep 49 + xz 50 + ]); 35 51 36 - configureFlags = [ 37 - "--without-conf" 38 - "--enable-tests=no" 39 - ]; 52 + outputs = [ 53 + "out" 54 + "dev" 55 + ]; 40 56 41 - CXXFLAGS = [ 42 - "-Wno-unused-but-set-variable" 43 - "-Wno-unknown-warning-option" 44 - # compat with icu61+ https://github.com/unicode-org/icu/blob/release-64-2/icu4c/readme.html#L554 45 - "-DU_USING_ICU_NAMESPACE=1" 46 - ]; 57 + prePatch = '' 58 + patchShebangs .; 59 + ''; 47 60 48 - meta = { 49 - description = "Software framework that allows research manipulation of Biblical texts"; 50 - homepage = "https://www.crosswire.org/sword/"; 51 - longDescription = '' 52 - The SWORD Project is the CrossWire Bible Society's free Bible software 53 - project. Its purpose is to create cross-platform open-source tools -- 54 - covered by the GNU General Public License -- that allow programmers and 55 - Bible societies to write new Bible software more quickly and easily. We 56 - also create Bible study software for all readers, students, scholars, and 57 - translators of the Bible, and have a growing collection of many hundred 58 - texts in around 100 languages. 61 + preConfigure = lib.optionalString stdenv.hostPlatform.isWindows '' 62 + substituteInPlace configure --replace-fail "-no-undefined" "-Wl,-no-undefined" 59 63 ''; 60 - license = lib.licenses.gpl2; 61 - maintainers = with lib.maintainers; [ AndersonTorres greg ]; 62 - platforms = lib.platforms.unix; 63 - }; 64 - }) 64 + 65 + patches = lib.optional stdenv.hostPlatform.isWindows ./sword-1.9.0-diatheke-includes.patch; 66 + 67 + configureFlags = 68 + [ 69 + "--without-conf" 70 + "--enable-tests=no" 71 + ] 72 + ++ (lib.optionals stdenv.hostPlatform.isWindows [ 73 + "--with-xz" 74 + "--with-bzip2" 75 + "--with-icuregex" 76 + ]); 77 + 78 + makeFlags = lib.optionals stdenv.hostPlatform.isWindows [ 79 + "LDFLAGS=-no-undefined" 80 + ]; 81 + 82 + env = { 83 + # When placed in nativeBuildInputs, icu.dev is finding the native ICU libs, but setting it 84 + # explicitly here has it finding the platform appropriate version 85 + ICU_CONFIG = lib.optionalString stdenv.hostPlatform.isWindows "${icu.dev}/bin/icu-config --noverify"; 86 + CURL_CONFIG = lib.optionalString stdenv.hostPlatform.isWindows "${lib.getDev curlDep}/bin/curl-config"; 87 + 88 + CXXFLAGS = ( 89 + builtins.concatStringsSep " " ( 90 + [ 91 + "-Wno-unused-but-set-variable" 92 + "-Wno-unknown-warning-option" 93 + # compat with icu61+ https://github.com/unicode-org/icu/blob/release-64-2/icu4c/readme.html#L554 94 + "-DU_USING_ICU_NAMESPACE=1" 95 + ] 96 + ++ (lib.optionals stdenv.hostPlatform.isWindows [ 97 + "-Wint-to-pointer-cast" 98 + "-fpermissive" 99 + "-D_ICUSWORD_" 100 + "-DCURL_STATICLIB" 101 + ]) 102 + ) 103 + ); 104 + }; 105 + 106 + meta = { 107 + description = "Software framework that allows research manipulation of Biblical texts"; 108 + homepage = "https://www.crosswire.org/sword/"; 109 + longDescription = '' 110 + The SWORD Project is the CrossWire Bible Society's free Bible software 111 + project. Its purpose is to create cross-platform open-source tools -- 112 + covered by the GNU General Public License -- that allow programmers and 113 + Bible societies to write new Bible software more quickly and easily. We 114 + also create Bible study software for all readers, students, scholars, and 115 + translators of the Bible, and have a growing collection of many hundred 116 + texts in around 100 languages. 117 + ''; 118 + license = lib.licenses.gpl2; 119 + maintainers = with lib.maintainers; [ 120 + AndersonTorres 121 + greg 122 + ]; 123 + platforms = lib.platforms.all; 124 + }; 125 + } 126 + )
+13
pkgs/by-name/sw/sword/sword-1.9.0-diatheke-includes.patch
··· 1 + diff --git a/utilities/diatheke/Makefile.am b/utilities/diatheke/Makefile.am 2 + index 8ba34e5..545af2c 100644 3 + --- a/utilities/diatheke/Makefile.am 4 + +++ b/utilities/diatheke/Makefile.am 5 + @@ -1,5 +1,8 @@ 6 + AUTOMAKE_OPTIONS = 1.6 7 + 8 + +if USE_INTERNAL_REGEX 9 + +AM_CPPFLAGS = -I$(top_srcdir)/include/internal/regex 10 + +endif 11 + LDADD = $(top_builddir)/lib/libsword.la 12 + 13 + bin_PROGRAMS = diatheke