changeset 1791:aa9281d9ff51

package libidn: add "-liconv" to libidn.pc This is necessary for static linking, as demonstrated by the test program that this patch also adds.
author Martin Lambers <marlam@marlam.de>
date Wed, 27 Apr 2011 16:11:54 +0200
parents ef65f54d0a8d
children cd31a7f7bf6f
files src/libidn-1-fix-pc.patch src/libidn-test.c src/libidn.mk
diffstat 3 files changed, 39 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/libidn-1-fix-pc.patch	Wed Apr 27 16:11:54 2011 +0200
@@ -0,0 +1,14 @@
+This file is part of mingw-cross-env.
+See doc/index.html for further information.
+
+Hack to use pkg-config with static linking.
+
+--- a/libidn.pc.in
++++ b/libidn.pc.in
+@@ -19,5 +19,5 @@
+ Description: IETF stringprep, nameprep, punycode, IDNA text processing.
+ URL: http://www.gnu.org/software/libidn/
+ Version: @VERSION@
+-Libs: -L${libdir} -lidn
++Libs: -L${libdir} -lidn -liconv
+ Cflags: -I${includedir}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/libidn-test.c	Wed Apr 27 16:11:54 2011 +0200
@@ -0,0 +1,20 @@
+/* This file is part of mingw-cross-env.       */
+/* See doc/index.html for further information. */
+
+#include <stdlib.h>
+#include <idna.h>
+
+int main(int argc, char *argv[])
+{
+    char *hostname_ascii;
+
+    (void)argc;
+    (void)argv;
+
+    if (idna_to_ascii_lz("www.google.com", &hostname_ascii, 0) == IDNA_SUCCESS)
+    {
+        free(hostname_ascii);
+    }
+
+    return 0;
+}
--- a/src/libidn.mk	Wed Apr 27 09:14:46 2011 +0200
+++ b/src/libidn.mk	Wed Apr 27 16:11:54 2011 +0200
@@ -29,4 +29,9 @@
         --prefix='$(PREFIX)/$(TARGET)' \
         --with-libiconv-prefix='$(PREFIX)/$(TARGET)'
     $(MAKE) -C '$(1)' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS=
+
+    '$(TARGET)-gcc' \
+        -W -Wall -Werror -ansi -pedantic \
+        '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-libidn.exe' \
+        `'$(TARGET)-pkg-config' libidn --cflags --libs`
 endef