fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ version, sha256, patches ? [], patchFlags ? "" }:
2{ stdenv, fetchurl, fixDarwinDylibNames
3 # Cross-compiled icu4c requires a build-root of a native compile
4, buildRootOnly ? false, nativeBuildRoot
5}:
6
7let
8 pname = "icu4c";
9
10 baseAttrs = {
11 src = fetchurl {
12 url = "http://download.icu-project.org/files/${pname}/${version}/${pname}-"
13 + (stdenv.lib.replaceChars ["."] ["_"] version) + "-src.tgz";
14 inherit sha256;
15 };
16
17 postUnpack = ''
18 sourceRoot=''${sourceRoot}/source
19 echo Source root reset to ''${sourceRoot}
20 '';
21
22 # https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
23 postPatch = if (stdenv.hostPlatform.libc == "glibc" || stdenv.hostPlatform.libc == "musl")
24 then "substituteInPlace i18n/digitlst.cpp --replace '<xlocale.h>' '<locale.h>'"
25 else null; # won't find locale_t on darwin
26
27 inherit patchFlags patches;
28
29 preConfigure = ''
30 sed -i -e "s|/bin/sh|${stdenv.shell}|" configure
31
32 # $(includedir) is different from $(prefix)/include due to multiple outputs
33 sed -i -e 's|^\(CPPFLAGS = .*\) -I\$(prefix)/include|\1 -I$(includedir)|' config/Makefile.inc.in
34 '' + stdenv.lib.optionalString stdenv.isAarch32 ''
35 # From https://archlinuxarm.org/packages/armv7h/icu/files/icudata-stdlibs.patch
36 sed -e 's/LDFLAGSICUDT=-nodefaultlibs -nostdlib/LDFLAGSICUDT=/' -i config/mh-linux
37 '';
38
39 configureFlags = [ "--disable-debug" ]
40 ++ stdenv.lib.optional (stdenv.isFreeBSD || stdenv.isDarwin) "--enable-rpath"
41 ++ stdenv.lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--with-cross-build=${nativeBuildRoot}";
42
43 enableParallelBuilding = true;
44
45 meta = with stdenv.lib; {
46 description = "Unicode and globalization support library";
47 homepage = http://site.icu-project.org/;
48 maintainers = with maintainers; [ raskin ];
49 platforms = platforms.all;
50 };
51 };
52
53 realAttrs = baseAttrs // {
54 name = pname + "-" + version;
55
56 outputs = [ "out" "dev" ];
57 outputBin = "dev";
58
59 # FIXME: This fixes dylib references in the dylibs themselves, but
60 # not in the programs in $out/bin.
61 buildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
62
63 # remove dependency on bootstrap-tools in early stdenv build
64 postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
65 sed -i 's/INSTALL_CMD=.*install/INSTALL_CMD=install/' $out/lib/icu/${version}/pkgdata.inc
66 '' + ''
67 substituteInPlace "$dev/bin/icu-config" \
68 --replace \''${pkglibdir}/Makefile.inc "$dev/lib/icu/Makefile.inc"
69 '';
70
71 postFixup = ''moveToOutput lib/icu "$dev" '';
72 };
73
74 buildRootOnlyAttrs = baseAttrs // {
75 name = pname + "-build-root-" + version;
76
77 preConfigure = baseAttrs.preConfigure + ''
78 mkdir build
79 cd build
80 configureScript=../configure
81 '';
82
83 postBuild = ''
84 cd ..
85 mv build $out
86 echo "Doing build-root only, exiting now" >&2
87 exit 0
88 '';
89 };
90
91 attrs = if buildRootOnly
92 then buildRootOnlyAttrs
93 else realAttrs;
94in
95stdenv.mkDerivation attrs