Initial import

This commit is contained in:
Colin Walters 2008-04-04 23:46:58 +00:00
parent 74df8f1a4a
commit 316df79523
5 changed files with 273 additions and 0 deletions

View File

@ -0,0 +1 @@
jna-3.0.2.tar.bz2

View File

@ -0,0 +1,128 @@
--- jna-3.0.2.default/build.xml 2008-02-28 14:34:44.000000000 -0500
+++ jna-3.0.2/build.xml 2008-04-03 23:20:07.000000000 -0400
@@ -17,6 +17,8 @@
<property name="jar" value="${name}.jar"/>
<property name="debug" value="true"/>
<property name="debug.native" value="false"/>
+ <property name="cflags_extra.native" value=""/>
+ <property name="dynlink.native" value="false"/>
<property name="native" location="native"/>
<property name="src" location="src"/>
<property name="dist" location="dist"/>
@@ -311,6 +313,8 @@
<arg value="JAVA_HOME=${jdk.home}"/>
<arg value="JAVAH=${build.native}"/>
<arg value="DEBUG=${debug.native}"/>
+ <arg value="CFLAGS_EXTRA=${cflags_extra.native}"/>
+ <arg value="DYNAMIC_LINK=${dynlink.native}"/>
<arg value="${make.CC}"/>
<arg value="${make.BUILD}"/>
<arg value="${make.SDKROOT}"/>
@@ -319,6 +323,19 @@
<arg value="VERSION=${jni.version}"/>
<arg value="CHECKSUM=${jni.md5}"/>
</exec>
+ <antcall target="native-mixedjar"/>
+ <!-- For web start, native libraries may be provided in the root of -->
+ <!-- an included jar file -->
+ <jar jarfile="${build}/${native.jar}">
+ <fileset dir="${build.native}" includes="jnidispatch.dll,libjnidispatch.*"/>
+ <manifest>
+ <attribute name="Implementation-Version" value="${jni.version} b${jni.build}"/>
+ <attribute name="Specification-Version" value="${jni.version}"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="native-mixedjar" unless="nomixedjar.native">
<mkdir dir="${classes}/com/sun/jna/${os.prefix}"/>
<copy todir="${classes}/com/sun/jna/${os.prefix}">
<fileset dir="${build.native}"
@@ -330,15 +347,6 @@
<fileset dir="${build.native}"
includes="jnidispatch.dll,libjnidispatch.*"/>
</copy>
- <!-- For web start, native libraries may be provided in the root of -->
- <!-- an included jar file -->
- <jar jarfile="${build}/${native.jar}">
- <fileset dir="${build.native}" includes="jnidispatch.dll,libjnidispatch.*"/>
- <manifest>
- <attribute name="Implementation-Version" value="${jni.version} b${jni.build}"/>
- <attribute name="Specification-Version" value="${jni.version}"/>
- </manifest>
- </jar>
</target>
<target name="compile-tests" depends="compile,native"
--- jna-3.0.2.default/native/Makefile 2008-02-27 23:28:13.000000000 -0500
+++ jna-3.0.2/native/Makefile 2008-04-03 21:45:21.000000000 -0400
@@ -38,10 +38,12 @@
INSTALLDIR=../build/$(OS)
JNIDISPATCH_OBJS=$(BUILD)/dispatch.o $(BUILD)/callback.o $(EXTRAOBJS)
RSRC=$(BUILD)/rsrc.o
+ifneq ($(DYNAMIC_LINK),true)
FFI_SRC=$(shell pwd)/libffi
FFI_BUILD=$(BUILD)/libffi
FFI_LIB=$(FFI_BUILD)/.libs/libffi_convenience.a
FFI_CONFIG=--disable-static --with-pic=yes
+endif
LIBRARY=$(BUILD)/$(LIBPFX)jnidispatch$(JNISFX)
TESTLIB=$(BUILD)/$(LIBPFX)testlib$(LIBSFX)
@@ -51,6 +53,7 @@
JNISFX=$(LIBSFX)
CC=gcc
LD=gcc
+LIBS=
# Default to Sun recommendations for JNI compilation
#COPT=-O2 -fomit-frame-pointer
COPT=-fno-omit-frame-pointer -fno-strict-aliasing
@@ -58,14 +61,22 @@
ifeq ($(DEBUG),true)
CDEBUG=-g
endif
+CFLAGS_EXTRA=
COUT=-o $@
CINCLUDES=$(JAVA_INCLUDES) -I"$(JAVAH)" -I$(FFI_BUILD)/include
CDEFINES=-D_REENTRANT
PCFLAGS=-W -Wall -Wno-unused -Wno-parentheses
-CFLAGS=$(PCFLAGS) $(COPT) $(CDEBUG) $(CDEFINES) $(CINCLUDES) \
+CFLAGS=$(PCFLAGS) $(CFLAGS_EXTRA) $(COPT) $(CDEBUG) $(CDEFINES) $(CINCLUDES) \
-DVERSION='"$(VERSION)"' -DCHECKSUM='"$(CHECKSUM)"'
+ifeq ($(DYNAMIC_LINK),true)
+CFLAGS += `pkg-config --cflags libffi`
+LIBS += `pkg-config --libs libffi`
+endif
+LDFLAGS=-o $@ -shared -Wl,-soname,$@
+ifneq ($(DYNAMIC_LINK),true)
# -static-libgcc avoids gcc library incompatibilities across linux systems
-LDFLAGS=-o $@ -shared -Wl,-soname,$@ -static-libgcc
+LDFLAGS += -static-libgcc
+endif
# Avoid bug in X11-based 1.5/1.6 VMs; dynamically load instead of linking
# See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6539705
#LIBS=-L"$(LIBDIR)" -ljawt
@@ -187,6 +198,7 @@
$(CC) $(CFLAGS) -c $< $(COUT)
endif
+
all: $(LIBRARY) $(TESTLIB)
install:
@@ -202,6 +214,7 @@
$(TESTLIB): $(BUILD)/testlib.o
$(LD) $(LDFLAGS) $< $(TESTDEF)
+ifneq ($(DYNAMIC_LINK),true)
$(FFI_LIB):
@mkdir -p $(FFI_BUILD)
@if [ ! -f $(FFI_BUILD)/Makefile ]; then \
@@ -225,6 +238,7 @@
/usr/bin/libtool -static -o $@.tmp $(FFI_BUILD)/.libs/${@F} $(BUILD)/libffi.*/.libs/${@F}
mv $@.tmp $@
endif
+endif
clean:
$(RM) -rf $(BUILD)

View File

@ -0,0 +1,11 @@
--- jna-3.0.2.default/src/com/sun/jna/Native.java 2008-02-11 16:04:47.000000000 -0500
+++ jna-3.0.2/src/com/sun/jna/Native.java 2008-04-03 23:30:03.000000000 -0400
@@ -85,7 +85,7 @@
public static final int WCHAR_SIZE;
static {
try {
- System.loadLibrary("jnidispatch");
+ System.load("@JNIPATH@/" + System.mapLibraryName("jnidispatch"));
}
catch(UnsatisfiedLinkError e) {
loadNativeLibrary();

132
jna.spec Normal file
View File

@ -0,0 +1,132 @@
Name: jna
Version: 3.0.2
Release: 7%{?dist}
Summary: Pure Java access to native libraries
Group: Development/Libraries
License: LGPLv2+
URL: https://jna.dev.java.net/
# The source for this package was pulled from upstream's vcs. Use the
# following commands to generate the tarball:
# svn export https://jna.dev.java.net/svn/jna/tags/%{version}/jnalib/ --username guest jna-%{version}
# tar -cjf jna-%{version}.tar.bz2 jna-%{version}
Source0: %{name}-%{version}.tar.bz2
# https://jna.dev.java.net/issues/show_bug.cgi?id=60
Patch0: jna-3.0.2-dynlink-and-cflags.patch
# This patch is Fedora-specific for now until we get the huge
# JNI library location mess sorted upstream
Patch1: jna-3.0.2-loadlibrary.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: java-devel >= 1.6 ant jpackage-utils ant-nodeps
BuildRequires: libX11-devel libXt-devel libffi-devel
# We manually require libffi because find-requires doesn't work
# inside jars.
Requires: java >= 1:1.6.0 jpackage-utils
%description
JNA provides Java programs easy access to native shared libraries
(DLLs on Windows) without writing anything but Java code. JNA's
design aims to provide native access in a natural way with a
minimum of effort. No boilerplate or generated code is required.
While some attention is paid to performance, correctness and ease
of use take priority.
%package javadoc
Summary: Javadocs for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
%description javadoc
This package contains the javadocs for %{name}.
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
sed -e 's|@JNIPATH@|%{_libdir}/%{name}|' %{PATCH1} | patch -p1
# all java binaries must be removed from the sources
find . -name '*.jar' -exec rm -f '{}' \;
find . -name '*.class' -exec rm -f '{}' \;
# remove internal copy of libffi
rm -rf native/libffi
# remove random unused zips
rm dist/{src,doc}.zip
# clean LICENSE.txt
sed -i 's/\r//' LICENSE.txt
chmod 0644 LICENSE.txt
%build
# We pass -Ddynlink.native which comes from our patch because
# upstream doesn't want to default to dynamic linking.
ant jar -Dcflags_extra.native="%{optflags}" -Ddynlink.native=true -Dnomixedjar.native=true
ant javadoc
%install
rm -rf %{buildroot}
# jars
install -D -m 644 build/%{name}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
(cd %{buildroot}%{_javadir}/; for jar in `ls *-%{version}.jar`; do ln -s $jar `echo $jar | sed -e 's/-%{version}//'`; done)
# NOTE: JNA has highly custom code to look for native jars in this
# directory. Since this roughly matches the jpackage guidelines,
# we'll leave it unchanged.
install -d -m 755 %{buildroot}%{_libdir}/%{name}
install -m 755 build/native/libjnidispatch*.so %{buildroot}%{_libdir}/%{name}/
# javadocs
install -p -d -m 755 %{buildroot}%{_javadocdir}/%{name}-%{version}
cp -a doc/javadoc/* %{buildroot}%{_javadocdir}/%{name}-%{version}
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc LICENSE.txt
%{_libdir}/%{name}
%{_javadir}/*.jar
%files javadoc
%defattr(-,root,root,-)
%{_javadocdir}/%{name}-%{version}
%changelog
* Fri Apr 04 2008 Colin Walters <walters@redhat.com> - 3.0.2-7
- Add patch to use JPackage-compatible JNI library path
- Do build debuginfo package
- Refactor build patch greatly so it's hopefully upstreamable
- Install .so directly to JNI directory, rather than inside jar
- Clean up Requires/BuildRequires (thanks Mamoru Tasaka)
* Sun Mar 30 2008 Conrad Meyer <konrad@tylerc.org> - 3.0.2-6
- -javadocs should be -javadoc.
- %%files section cleaned a bit.
* Mon Mar 17 2008 Conrad Meyer <konrad@tylerc.org> - 3.0.2-5
- -javadocs package should be in group "Documentation".
* Mon Mar 17 2008 Conrad Meyer <konrad@tylerc.org> - 3.0.2-4
- License should be LGPLv2+, not GPLv2+.
- Several minor fixes.
- Fix Requires in javadoc package.
* Sun Mar 16 2008 Conrad Meyer <konrad@tylerc.org> - 3.0.2-3
- Don't use internal libffi.
* Thu Mar 6 2008 Conrad Meyer <konrad@tylerc.org> - 3.0.2-2
- Don't pull in jars from the web.
* Mon Mar 3 2008 Conrad Meyer <konrad@tylerc.org> - 3.0.2-1
- Initial package.

View File

@ -0,0 +1 @@
4f177e179adfdb3c2289c6f36445809f jna-3.0.2.tar.bz2