~ubuntu-branches/ubuntu/wily/libjna-java/wily-proposed

« back to all changes in this revision

Viewing changes to debian/patches/10-dynlink-and-cflags.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2009-11-02 14:14:51 UTC
  • mfrom: (4.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20091102141451-j5hdwzzq5zwxrp4n
* New upstream release.
* Fixed debian/repack-source.sh to correctly use mktemp.
* Make libjna-java Depends on *-headless packages.
* Moved package under pkg-java control.
* Added debian/README.source to describe quilt.
* Added myself as Uploader.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 01-dynlink-and-cflags.dpatch by Tiago Saboga <tiagosaboga@gmail.com>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: Dynamically link to system libffi instead of using own copy.
 
6
 
 
7
@DPATCH@
 
8
diff -urNad libjna-java-3.0.4~/build.xml libjna-java-3.0.4/build.xml
 
9
--- libjna-java-3.0.4~/build.xml        2008-07-25 00:33:37.000000000 -0300
 
10
+++ libjna-java-3.0.4/build.xml 2008-07-25 00:34:08.000000000 -0300
 
11
@@ -18,6 +18,8 @@
 
12
   <property name="debug" value="true"/>
 
13
   <property name="debug.native" value="false"/>
 
14
   <property name="native" location="native"/>
 
15
+  <property name="cflags_extra.native" value=""/>
 
16
+  <property name="dynlink.native" value="false"/>
 
17
   <property name="src" location="src"/>
 
18
   <property name="dist" location="dist"/>
 
19
   <property name="test.src" location="test"/>
 
20
@@ -321,11 +323,13 @@
 
21
     </condition>
 
22
     <!-- Default make program -->
 
23
     <property name="make" value="make"/>
 
24
-
 
25
+    
 
26
     <exec executable="${make}" dir="${native}" failonerror="true">
 
27
       <arg value="JAVA_HOME=${jdk.home}"/>
 
28
       <arg value="JAVAH=${build.native}"/>
 
29
       <arg value="DEBUG=${debug.native}"/>
 
30
+      <arg value="CFLAGS_EXTRA=${cflags_extra.native}"/>
 
31
+      <arg value="DYNAMIC_LINK=${dynlink.native}"/>
 
32
       <arg value="${make.CC}"/>
 
33
       <arg value="${make.BUILD}"/>
 
34
       <arg value="${make.SDKROOT}"/>
 
35
@@ -334,6 +338,19 @@
 
36
       <arg value="VERSION=${jni.version}"/>
 
37
       <arg value="CHECKSUM=${jni.md5}"/>
 
38
     </exec>
 
39
+    <antcall target="native-mixedjar"/>
 
40
+    <!-- For web start, native libraries may be provided in the root of -->
 
41
+    <!-- an included jar file -->
 
42
+    <jar jarfile="${build}/${native.jar}">
 
43
+      <fileset dir="${build.native}" includes="jnidispatch.dll,libjnidispatch.*"/>
 
44
+      <manifest>
 
45
+        <attribute name="Implementation-Version" value="${jni.version} b${jni.build}"/>
 
46
+        <attribute name="Specification-Version" value="${jni.version}"/>
 
47
+      </manifest>
 
48
+    </jar>
 
49
+  </target>
 
50
+
 
51
+  <target name="native-mixedjar" unless="nomixedjar.native">    
 
52
     <mkdir dir="${classes}/com/sun/jna/${os.prefix}"/>
 
53
     <copy todir="${classes}/com/sun/jna/${os.prefix}">
 
54
       <fileset dir="${build.native}" 
 
55
@@ -345,15 +362,6 @@
 
56
       <fileset dir="${build.native}" 
 
57
                includes="jnidispatch.dll,libjnidispatch.*"/>
 
58
     </copy>
 
59
-    <!-- For web start, native libraries may be provided in the root of -->
 
60
-    <!-- an included jar file -->
 
61
-    <jar jarfile="${build}/${native.jar}">
 
62
-      <fileset dir="${build.native}" includes="jnidispatch.dll,libjnidispatch.*"/>
 
63
-      <manifest>
 
64
-        <attribute name="Implementation-Version" value="${jni.version} b${jni.build}"/>
 
65
-        <attribute name="Specification-Version" value="${jni.version}"/>
 
66
-      </manifest>
 
67
-    </jar>
 
68
   </target>
 
69
 
 
70
   <target name="compile-tests" depends="compile,native"
 
71
diff -urNad libjna-java-3.0.4~/native/Makefile libjna-java-3.0.4/native/Makefile
 
72
--- libjna-java-3.0.4~/native/Makefile  2008-07-25 00:33:37.000000000 -0300
 
73
+++ libjna-java-3.0.4/native/Makefile   2008-07-25 00:36:10.000000000 -0300
 
74
@@ -38,10 +38,12 @@
 
75
 INSTALLDIR=../build/$(OS)
 
76
 JNIDISPATCH_OBJS=$(BUILD)/dispatch.o $(BUILD)/callback.o $(EXTRAOBJS)
 
77
 RSRC=$(BUILD)/rsrc.o
 
78
+ifneq ($(DYNAMIC_LINK),true)
 
79
 FFI_SRC=$(shell pwd)/libffi
 
80
 FFI_BUILD=$(BUILD)/libffi
 
81
 FFI_LIB=$(FFI_BUILD)/.libs/libffi_convenience.a
 
82
 FFI_CONFIG=--disable-static --with-pic=yes
 
83
+endif
 
84
 LIBRARY=$(BUILD)/$(LIBPFX)jnidispatch$(JNISFX)
 
85
 TESTLIB=$(BUILD)/$(LIBPFX)testlib$(LIBSFX)
 
86
 
 
87
@@ -51,6 +53,7 @@
 
88
 JNISFX=$(LIBSFX)
 
89
 CC=gcc
 
90
 LD=gcc
 
91
+LIBS=
 
92
 # Default to Sun recommendations for JNI compilation
 
93
 #COPT=-O2 -fomit-frame-pointer
 
94
 COPT=-fno-omit-frame-pointer -fno-strict-aliasing 
 
95
@@ -58,14 +61,22 @@
 
96
 ifeq ($(DEBUG),true)
 
97
 CDEBUG=-g
 
98
 endif
 
99
+CFLAGS_EXTRA=
 
100
 COUT=-o $@
 
101
 CINCLUDES=$(JAVA_INCLUDES) -I"$(JAVAH)" -I$(FFI_BUILD)/include
 
102
 CDEFINES=-D_REENTRANT
 
103
 PCFLAGS=-W -Wall -Wno-unused -Wno-parentheses
 
104
-CFLAGS=$(PCFLAGS) $(COPT) $(CDEBUG) $(CDEFINES) $(CINCLUDES) \
 
105
+CFLAGS=$(PCFLAGS) $(CFLAGS_EXTRA) $(COPT) $(CDEBUG) $(CDEFINES) $(CINCLUDES) \
 
106
        -DVERSION='"$(VERSION)"' -DCHECKSUM='"$(CHECKSUM)"'
 
107
+ifeq ($(DYNAMIC_LINK),true)
 
108
+CFLAGS += `pkg-config --cflags libffi`
 
109
+LIBS += `pkg-config --libs libffi` -ldl
 
110
+endif
 
111
+LDFLAGS=-o $@ -shared -Wl,-soname,$@ 
 
112
+ifneq ($(DYNAMIC_LINK),true)       
 
113
 # -static-libgcc avoids gcc library incompatibilities across linux systems
 
114
-LDFLAGS=-o $@ -shared -static-libgcc
 
115
+LDFLAGS += -static-libgcc
 
116
+endif
 
117
 # Avoid bug in X11-based 1.5/1.6 VMs; dynamically load instead of linking
 
118
 # See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6539705
 
119
 #LIBS=-L"$(LIBDIR)" -ljawt 
 
120
@@ -202,14 +213,16 @@
 
121
 $(TESTLIB): $(BUILD)/testlib.o 
 
122
        $(LD) $(LDFLAGS) $< $(TESTDEF)
 
123
 
 
124
+ifneq ($(DYNAMIC_LINK), true)
 
125
 $(FFI_LIB):
 
126
        @mkdir -p $(FFI_BUILD)
 
127
        @if [ ! -f $(FFI_BUILD)/Makefile ]; then \
 
128
          echo "Configuring libffi ($(ARCH))"; \
 
129
          (cd $(FFI_BUILD) \
 
130
            && CC="$(CC)" CFLAGS="$(CDEBUG)" CPPFLAGS="$(CDEFINES)" $(FFI_SRC)/configure $(FFI_CONFIG)); \
 
131
-       fi
 
132
+       fi 
 
133
        $(MAKE) -C $(FFI_BUILD)
 
134
+
 
135
 ifneq ($(SDKROOT),)
 
136
        @for arch in $(ALT_ARCHS); do \
 
137
          mkdir -p $(BUILD)/libffi.$$arch; \
 
138
@@ -225,7 +238,7 @@
 
139
        /usr/bin/libtool -static -o $@.tmp $(FFI_BUILD)/.libs/${@F} $(BUILD)/libffi.*/.libs/${@F}
 
140
        mv $@.tmp $@
 
141
 endif
 
142
-
 
143
+endif
 
144
 clean:
 
145
        $(RM) -rf $(BUILD) 
 
146