Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 221 lines 5.7 kB view raw
1{ 2 lib, 3 stdenv, 4 recurseIntoAttrs, 5 fetchgit, 6 pkg-config, 7 autoreconfHook, 8 autoconf, 9 automake, 10 libiconv, 11 libtool, 12 texinfo, 13 gettext, 14 gawk, 15 rapidjson, 16 gd, 17 libharu, 18 lmdb, 19 gmp, 20 glibcLocales, 21 mpfr, 22 more, 23 libpq, 24 hiredis, 25 expat, 26 tre, 27}: 28 29let 30 buildExtension = lib.makeOverridable ( 31 { 32 name, 33 gawkextlib, 34 extraBuildInputs ? [ ], 35 doCheck ? true, 36 patches ? [ ], 37 extraPostPatch ? "", 38 env ? { }, 39 broken ? null, 40 }: 41 let 42 is_extension = gawkextlib != null; 43 in 44 stdenv.mkDerivation rec { 45 pname = "gawkextlib-${name}"; 46 version = "unstable-2022-10-20"; 47 48 src = fetchgit { 49 url = "git://git.code.sf.net/p/gawkextlib/code"; 50 rev = "f6c75b4ac1e0cd8d70c2f6c7a8d58b4d94cfde97"; 51 sha256 = "sha256-0p3CrQ3TBl7UcveZytK/9rkAzn69RRM2GwY2eCeqlkg="; 52 }; 53 54 inherit patches; 55 56 postPatch = '' 57 cd ${name} 58 '' 59 + extraPostPatch; 60 61 nativeBuildInputs = [ 62 autoconf 63 automake 64 libtool 65 autoreconfHook 66 pkg-config 67 texinfo 68 gettext 69 ]; 70 71 buildInputs = [ gawk ] ++ extraBuildInputs; 72 propagatedBuildInputs = lib.optional is_extension gawkextlib; 73 74 setupHook = if is_extension then ./setup-hook.sh else null; 75 inherit gawk; 76 77 inherit env; 78 79 inherit doCheck; 80 nativeCheckInputs = [ more ]; 81 82 meta = { 83 homepage = "https://sourceforge.net/projects/gawkextlib/"; 84 description = "Dynamically loaded extension libraries for GNU AWK"; 85 mainProgram = "xmlgawk"; 86 longDescription = '' 87 The gawkextlib project provides several extension libraries for 88 gawk (GNU AWK), as well as libgawkextlib containing some APIs that 89 are useful for building gawk extension libraries. These libraries 90 enable gawk to process XML data, interact with a PostgreSQL 91 database, use the GD graphics library, and perform unlimited 92 precision MPFR calculations. 93 ''; 94 license = lib.licenses.gpl3Plus; 95 platforms = lib.platforms.unix; 96 maintainers = with lib.maintainers; [ tomberek ]; 97 } 98 // lib.optionalAttrs (broken != null) { inherit broken; }; 99 } 100 ); 101 gawkextlib = buildExtension { 102 gawkextlib = null; 103 name = "lib"; 104 }; 105 libs = { 106 abort = buildExtension { 107 inherit gawkextlib; 108 name = "abort"; 109 }; 110 aregex = buildExtension { 111 inherit gawkextlib; 112 name = "aregex"; 113 extraBuildInputs = [ tre ]; 114 }; 115 csv = buildExtension { 116 inherit gawkextlib; 117 name = "csv"; 118 }; 119 errno = buildExtension { 120 inherit gawkextlib; 121 name = "errno"; 122 extraPostPatch = '' 123 substituteInPlace Makefile.am --replace-fail 'cpp -M' '${stdenv.cc.targetPrefix}cpp -M' 124 ''; 125 }; 126 gd = buildExtension { 127 inherit gawkextlib; 128 name = "gd"; 129 extraBuildInputs = [ gd ]; 130 # GCC 14 makes this an error by default, remove when fixed upstream 131 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; 132 }; 133 haru = buildExtension { 134 inherit gawkextlib; 135 name = "haru"; 136 extraBuildInputs = [ libharu ]; 137 patches = [ 138 # Renames references to two identifiers with typos that libharu fixed in 2.4.4 139 # https://github.com/libharu/libharu/commit/88271b73c68c521a49a15e3555ef00395aa40810 140 ./fix-typos-corrected-in-libharu-2.4.4.patch 141 ]; 142 # GCC 14 makes this an error by default, remove when fixed upstream 143 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; 144 }; 145 json = buildExtension { 146 inherit gawkextlib; 147 name = "json"; 148 extraBuildInputs = [ rapidjson ]; 149 }; 150 lmdb = buildExtension { 151 inherit gawkextlib; 152 name = "lmdb"; 153 extraPostPatch = '' 154 substituteInPlace Makefile.am --replace-fail 'cpp -M' '${stdenv.cc.targetPrefix}cpp -M' 155 ''; 156 extraBuildInputs = [ lmdb ]; 157 # mdb_env_open(env, /dev/null) 158 #! No such device 159 # mdb_env_open(env, /dev/null) 160 #! Operation not supported by device 161 doCheck = !stdenv.hostPlatform.isDarwin; 162 }; 163 mbs = buildExtension { 164 inherit gawkextlib; 165 name = "mbs"; 166 extraBuildInputs = [ glibcLocales ]; 167 #! "spät": length: 5, mbs_length: 6, wcswidth: 4 168 doCheck = !stdenv.hostPlatform.isDarwin; 169 }; 170 mpfr = buildExtension { 171 inherit gawkextlib; 172 name = "mpfr"; 173 extraBuildInputs = [ 174 gmp 175 mpfr 176 ]; 177 }; 178 nl_langinfo = buildExtension { 179 inherit gawkextlib; 180 name = "nl_langinfo"; 181 }; 182 pgsql = buildExtension { 183 inherit gawkextlib; 184 name = "pgsql"; 185 extraBuildInputs = [ libpq ]; 186 }; 187 redis = buildExtension { 188 inherit gawkextlib; 189 name = "redis"; 190 extraBuildInputs = [ hiredis ]; 191 }; 192 select = buildExtension { 193 inherit gawkextlib; 194 name = "select"; 195 extraPostPatch = '' 196 substituteInPlace Makefile.am --replace-fail 'cpp -M' '${stdenv.cc.targetPrefix}cpp -M' 197 ''; 198 }; 199 timex = buildExtension { 200 inherit gawkextlib; 201 name = "timex"; 202 }; 203 xml = buildExtension { 204 inherit gawkextlib; 205 name = "xml"; 206 extraBuildInputs = [ 207 expat 208 libiconv 209 ]; 210 # gawk: xmlbase:14: fatal: load_ext: cannot open library `../.libs/xml.so` 211 broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform; 212 }; 213 }; 214in 215recurseIntoAttrs ( 216 libs 217 // { 218 inherit gawkextlib buildExtension; 219 full = builtins.attrValues libs; 220 } 221)