1{ fetchurl, stdenv, lib
2, enableStatic ? stdenv.hostPlatform.isStatic
3, enableShared ? !stdenv.hostPlatform.isStatic
4}:
5
6# assert !stdenv.hostPlatform.isLinux || stdenv.hostPlatform != stdenv.buildPlatform; # TODO: improve on cross
7
8stdenv.mkDerivation rec {
9 pname = "libiconv";
10 version = "1.16";
11
12 src = fetchurl {
13 url = "mirror://gnu/libiconv/${pname}-${version}.tar.gz";
14 sha256 = "016c57srqr0bza5fxjxfrx6aqxkqy0s3gkhcg7p7fhk5i6sv38g6";
15 };
16
17 enableParallelBuilding = true;
18
19 setupHooks = [
20 ../../../build-support/setup-hooks/role.bash
21 ./setup-hook.sh
22 ];
23
24 postPatch =
25 lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
26 ''
27 sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h
28 ''
29 + lib.optionalString (!enableShared) ''
30 sed -i -e '/preload/d' Makefile.in
31 '';
32
33 configureFlags = [
34 (lib.enableFeature enableStatic "static")
35 (lib.enableFeature enableShared "shared")
36 ] ++ lib.optional stdenv.isFreeBSD "--with-pic";
37
38 meta = {
39 description = "An iconv(3) implementation";
40
41 longDescription = ''
42 Some programs, like mailers and web browsers, must be able to convert
43 between a given text encoding and the user's encoding. Other programs
44 internally store strings in Unicode, to facilitate internal processing,
45 and need to convert between internal string representation (Unicode)
46 and external string representation (a traditional encoding) when they
47 are doing I/O. GNU libiconv is a conversion library for both kinds of
48 applications.
49 '';
50
51 homepage = "https://www.gnu.org/software/libiconv/";
52 license = lib.licenses.lgpl2Plus;
53
54 maintainers = [ ];
55 mainProgram = "iconv";
56
57 # This library is not needed on GNU platforms.
58 hydraPlatforms = with lib.platforms; cygwin ++ darwin ++ freebsd;
59 };
60}