diff --git a/0001-Adapt-build.patch b/0001-Adapt-build.patch new file mode 100644 index 0000000..003d5db --- /dev/null +++ b/0001-Adapt-build.patch @@ -0,0 +1,33 @@ +From 52ef407584801916d6e60c4f4c5411023b5ac369 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Mon, 16 Jan 2017 11:29:06 +0100 +Subject: [PATCH 1/6] Adapt build + +--- + native/Makefile | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/native/Makefile b/native/Makefile +index 6f9ad25..3712a9e 100644 +--- a/native/Makefile ++++ b/native/Makefile +@@ -97,7 +97,7 @@ CDEFINES=-D_REENTRANT + PCFLAGS=-W -Wall -Wno-unused -Wno-parentheses + CFLAGS=$(PCFLAGS) $(CFLAGS_EXTRA) $(COPT) $(CDEBUG) $(CDEFINES) $(CINCLUDES) \ + -DJNA_JNI_VERSION='"$(JNA_JNI_VERSION)"' -DCHECKSUM='"$(CHECKSUM)"' +-LDFLAGS=-o $@ -shared ++LDFLAGS=$(RPM_LD_FLAGS) -o $@ -shared + ifeq ($(DYNAMIC_LIBFFI),true) + CFLAGS += $(shell pkg-config --cflags libffi 2>/dev/null || echo) + LIBS += $(shell pkg-config --libs libffi 2>/dev/null || echo -lffi) +@@ -455,7 +455,6 @@ $(BUILD)/$(JNA_JNI_VERSION).stamp: + + $(LIBRARY): $(JNIDISPATCH_OBJS) $(FFI_LIB) + $(LD) $(LDFLAGS) $(JNIDISPATCH_OBJS) $(FFI_LIB) $(LIBS) +- $(STRIP) $@ + + $(TESTLIB): $(BUILD)/testlib.o + $(LD) $(LDFLAGS) $< $(LIBS) +-- +2.14.3 + diff --git a/0002-Load-system-library.patch b/0002-Load-system-library.patch new file mode 100644 index 0000000..717300c --- /dev/null +++ b/0002-Load-system-library.patch @@ -0,0 +1,122 @@ +From 3d08314de0494ff8bdc1a7bccc0ecc1730dbdd60 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Mon, 16 Jan 2017 11:31:32 +0100 +Subject: [PATCH 2/6] Load system library + +--- + src/com/sun/jna/Native.java | 97 ++------------------------------------------- + 1 file changed, 4 insertions(+), 93 deletions(-) + +diff --git a/src/com/sun/jna/Native.java b/src/com/sun/jna/Native.java +index 91b195f..9ac3815 100644 +--- a/src/com/sun/jna/Native.java ++++ b/src/com/sun/jna/Native.java +@@ -829,101 +829,12 @@ public final class Native implements Version { + + /** + * Loads the JNA stub library. +- * First tries jna.boot.library.path, then the system path, then from the +- * jar file. ++ * MODIFIED FROM UPSTREAM - we rip out all sorts of gunk here that is ++ * unnecessary when JNA is properly installed with the OS. + */ + private static void loadNativeDispatchLibrary() { +- if (!Boolean.getBoolean("jna.nounpack")) { +- try { +- removeTemporaryFiles(); +- } +- catch(IOException e) { +- System.err.println("JNA Warning: IOException removing temporary files: " + e.getMessage()); +- } +- } +- +- String libName = System.getProperty("jna.boot.library.name", "jnidispatch"); +- String bootPath = System.getProperty("jna.boot.library.path"); +- if (bootPath != null) { +- // String.split not available in 1.4 +- StringTokenizer dirs = new StringTokenizer(bootPath, File.pathSeparator); +- while (dirs.hasMoreTokens()) { +- String dir = dirs.nextToken(); +- File file = new File(new File(dir), System.mapLibraryName(libName).replace(".dylib", ".jnilib")); +- String path = file.getAbsolutePath(); +- if (DEBUG_JNA_LOAD) { +- System.out.println("Looking in " + path); +- } +- if (file.exists()) { +- try { +- if (DEBUG_JNA_LOAD) { +- System.out.println("Trying " + path); +- } +- System.setProperty("jnidispatch.path", path); +- System.load(path); +- jnidispatchPath = path; +- if (DEBUG_JNA_LOAD) { +- System.out.println("Found jnidispatch at " + path); +- } +- return; +- } catch (UnsatisfiedLinkError ex) { +- // Not a problem if already loaded in anoteher class loader +- // Unfortunately we can't distinguish the difference... +- //System.out.println("File found at " + file + " but not loadable: " + ex.getMessage()); +- } +- } +- if (Platform.isMac()) { +- String orig, ext; +- if (path.endsWith("dylib")) { +- orig = "dylib"; +- ext = "jnilib"; +- } else { +- orig = "jnilib"; +- ext = "dylib"; +- } +- path = path.substring(0, path.lastIndexOf(orig)) + ext; +- if (DEBUG_JNA_LOAD) { +- System.out.println("Looking in " + path); +- } +- if (new File(path).exists()) { +- try { +- if (DEBUG_JNA_LOAD) { +- System.out.println("Trying " + path); +- } +- System.setProperty("jnidispatch.path", path); +- System.load(path); +- jnidispatchPath = path; +- if (DEBUG_JNA_LOAD) { +- System.out.println("Found jnidispatch at " + path); +- } +- return; +- } catch (UnsatisfiedLinkError ex) { +- System.err.println("File found at " + path + " but not loadable: " + ex.getMessage()); +- } +- } +- } +- } +- } +- if (!Boolean.getBoolean("jna.nosys")) { +- try { +- if (DEBUG_JNA_LOAD) { +- System.out.println("Trying (via loadLibrary) " + libName); +- } +- System.loadLibrary(libName); +- if (DEBUG_JNA_LOAD) { +- System.out.println("Found jnidispatch on system path"); +- } +- return; +- } +- catch(UnsatisfiedLinkError e) { +- } +- } +- if (!Boolean.getBoolean("jna.noclasspath")) { +- loadNativeDispatchLibraryFromClasspath(); +- } +- else { +- throw new UnsatisfiedLinkError("Unable to locate JNA native support library"); +- } ++ jnidispatchPath = "@LIBDIR@/" + System.mapLibraryName("jnidispatch"); ++ System.load(jnidispatchPath); + } + + static final String JNA_TMPLIB_PREFIX = "jna"; +-- +2.14.3 + diff --git a/0003-Tests-headless.patch b/0003-Tests-headless.patch new file mode 100644 index 0000000..f879f9d --- /dev/null +++ b/0003-Tests-headless.patch @@ -0,0 +1,24 @@ +From c0f33e9ed0a5cfd79b58487c2a36c9b880b49947 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Mon, 16 Jan 2017 11:32:32 +0100 +Subject: [PATCH 3/6] Tests headless + +--- + build.xml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/build.xml b/build.xml +index 63a9cc7..ab9cf52 100644 +--- a/build.xml ++++ b/build.xml +@@ -1128,6 +1128,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc + + + ++ + + + +-- +2.14.3 + diff --git a/0004-Fix-javadoc-build.patch b/0004-Fix-javadoc-build.patch new file mode 100644 index 0000000..f68b0be --- /dev/null +++ b/0004-Fix-javadoc-build.patch @@ -0,0 +1,24 @@ +From ced8baacd3bccba7ebaba80785b891bf579af215 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Tue, 31 Jan 2017 14:21:19 +0100 +Subject: [PATCH 4/6] Fix javadoc build + +--- + build.xml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/build.xml b/build.xml +index ab9cf52..d1fe4aa 100644 +--- a/build.xml ++++ b/build.xml +@@ -1233,6 +1233,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc + + + ++ + + + +-- +2.14.3 + diff --git a/0005-Fix-duplicate-manifest-entry.patch b/0005-Fix-duplicate-manifest-entry.patch new file mode 100644 index 0000000..fce0d78 --- /dev/null +++ b/0005-Fix-duplicate-manifest-entry.patch @@ -0,0 +1,29 @@ +From de939d7c9266f89542cea5ebef5980a95f1244a9 Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +Date: Mon, 10 Jul 2017 11:48:43 +0200 +Subject: [PATCH 5/6] Fix duplicate manifest entry + +Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1469022 +--- + build.xml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/build.xml b/build.xml +index d1fe4aa..c0a0b78 100644 +--- a/build.xml ++++ b/build.xml +@@ -571,9 +571,9 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc + includes="*jnidispatch*" + prefix="com/sun/jna/w32ce-arm"/> + +- ++ + +- ++ + + + +-- +2.14.3 + diff --git a/0006-Remove-Werror.patch b/0006-Remove-Werror.patch new file mode 100644 index 0000000..60f7f02 --- /dev/null +++ b/0006-Remove-Werror.patch @@ -0,0 +1,29 @@ +From 6e8784db2fa3b3b2efedaae75d15d5d5cf3ed50c Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Thu, 22 Feb 2018 16:17:15 +0100 +Subject: [PATCH 6/6] Remove -Werror + +--- + native/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/native/Makefile b/native/Makefile +index 3712a9e..73a906f 100644 +--- a/native/Makefile ++++ b/native/Makefile +@@ -336,10 +336,10 @@ endif + ifeq ($(CC),gcc) + GCC_MAJOR_VERSION = $(shell gcc -dumpversion | cut -f 1 -d '.') + ifneq ($(GCC_MAJOR_VERSION),4) +- LOC_CC_OPTS=-Wno-unknown-warning-option -Werror -Wno-clobbered -Wno-unused-variable ++ LOC_CC_OPTS=-Wno-unknown-warning-option -Wno-clobbered -Wno-unused-variable + endif + else +- LOC_CC_OPTS=-Wno-unknown-warning-option -Werror -Wno-clobbered -Wno-unused-variable ++ LOC_CC_OPTS=-Wno-unknown-warning-option -Wno-clobbered -Wno-unused-variable + endif + + # Enable 64-bit builds if the arch demands it +-- +2.14.3 + diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 21f0633..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# jna - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index 4a5462a..0000000 --- a/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# jna - -#### 介绍 -{**以下是码云平台说明,您可以替换此简介** -码云是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用码云实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 码云特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/generate-tarball.sh b/generate-tarball.sh new file mode 100755 index 0000000..511bc4d --- /dev/null +++ b/generate-tarball.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +version=`grep Version: *spec | sed -e 's/Version:\s*\(.*\)/\1/'` + + +wget https://github.com/java-native-access/jna/archive/${version}.tar.gz -O jna-${version}.tar.gz +rm -rf jna-${version} +tar xf jna-${version}.tar.gz +#mv twall-jna-* jna-${version} +# remove bundled things with unknown licensing +rm -rvf jna-${version}/{dist/*,www,native/libffi} +# jars in lib/native subdir need to be present in tarball so +# that final jar can be built. They can be empty and then have no +# effect on resulting jar. One jar (depending on architecture) will +# be replaced with full content (containing libjnidispatch.so) +for njar in jna-${version}/lib/native/*.jar; do + rm -v $njar + touch empty + jar cf $njar empty + rm -f empty +done + +find jna-${version} -iname '*jar' -size +1b -delete +find jna-${version} -name '*.class' -delete + +tar cf jna-${version}-clean.tar jna-${version} +xz -9 jna-${version}-clean.tar diff --git a/jna-4.5.1-clean.tar.xz b/jna-4.5.1-clean.tar.xz new file mode 100644 index 0000000..2330963 Binary files /dev/null and b/jna-4.5.1-clean.tar.xz differ diff --git a/jna.spec b/jna.spec new file mode 100644 index 0000000..0453acc --- /dev/null +++ b/jna.spec @@ -0,0 +1,72 @@ +Name: jna +Version: 4.5.1 +Release: 5 +Summary: Pure Java access to native libraries +License: (LGPLv2 or ASL 2.0) and ASL 2.0 +URL: https://github.com/java-native-access/jna/ +Source0: jna-%{version}-clean.tar.xz +Source1: package-list +Source2: generate-tarball.sh + +Patch0000: 0001-Adapt-build.patch +Patch0001: 0002-Load-system-library.patch +Patch0002: 0003-Tests-headless.patch +Patch0003: 0004-Fix-javadoc-build.patch +Patch0004: 0005-Fix-duplicate-manifest-entry.patch +Patch0005: 0006-Remove-Werror.patch + +BuildRequires: make javapackages-local libffi-devel ant ant-junit +BuildRequires: junit libX11-devel libXt-devel reflections +Requires: libffi + +Provides: jna-contrib = %{version}-%{release} +Obsoletes: jna-contrib < %{version}-%{release} + +%description +JNA provides Java programs easy access to native shared libraries without +writing anything but Java code - no JNI or native code is required. + +%package help +Summary: Help docs for jna +BuildArch: noarch +Provides: jna-javadoc = %{version}-%{release} +Obsoletes: jna-javadoc < %{version}-%{release} + +%description help +This package contains the help docs for jna. + +%prep +%autosetup -n jna-%{version} -p1 + +cp %{SOURCE1} . +chmod -Rf a+rX,u+w,g-w,o-w . +sed -i 's|@LIBDIR@|%{_libdir}/jna|' src/com/sun/jna/Native.java +sed s,',&,' -i build.xml +build-jar-repository -s -p lib junit reflections ant +cp lib/native/aix-ppc64.jar lib/clover.jar + +%build +ant -Dcompatibility=1.6 -Dplatform.compatibility=1.6 -Dcflags_extra.native="%{optflags}" -Ddynlink.native=true native dist +find contrib -name build | xargs rm -rf + +%install +install -D -m 755 build/native*/libjnidispatch.so %{buildroot}%{_libdir}/jna/libjnidispatch.so + +%mvn_file :jna jna jna/jna %{_javadir}/jna +%mvn_package :jna-platform contrib +%mvn_alias :jna-platform :platform +%mvn_artifact pom-jna.xml build/jna-min.jar +%mvn_artifact pom-jna-platform.xml contrib/platform/dist/jna-platform.jar +%mvn_install -J doc/javadoc + +%files -f .mfiles -f .mfiles-contrib +%doc OTHERS TODO +%license LICENSE LGPL2.1 AL2.0 +%{_libdir}/jna + +%files help -f .mfiles-javadoc +%doc README.md CHANGES.md + +%changelog +* Fri Nov 22 2019 sunguoshuai - 4.5.1-5 +- Package init. diff --git a/package-list b/package-list new file mode 100644 index 0000000..fecd4d4 --- /dev/null +++ b/package-list @@ -0,0 +1,135 @@ +java.applet +java.awt +java.awt.color +java.awt.datatransfer +java.awt.dnd +java.awt.event +java.awt.font +java.awt.geom +java.awt.im +java.awt.im.spi +java.awt.image +java.awt.image.renderable +java.awt.print +java.beans +java.beans.beancontext +java.io +java.lang +java.lang.ref +java.lang.reflect +java.math +java.net +java.nio +java.nio.channels +java.nio.channels.spi +java.nio.charset +java.nio.charset.spi +java.rmi +java.rmi.activation +java.rmi.dgc +java.rmi.registry +java.rmi.server +java.security +java.security.acl +java.security.cert +java.security.interfaces +java.security.spec +java.sql +java.text +java.util +java.util.jar +java.util.logging +java.util.prefs +java.util.regex +java.util.zip +javax.accessibility +javax.crypto +javax.crypto.interfaces +javax.crypto.spec +javax.imageio +javax.imageio.event +javax.imageio.metadata +javax.imageio.plugins.jpeg +javax.imageio.spi +javax.imageio.stream +javax.naming +javax.naming.directory +javax.naming.event +javax.naming.ldap +javax.naming.spi +javax.net +javax.net.ssl +javax.print +javax.print.attribute +javax.print.attribute.standard +javax.print.event +javax.rmi +javax.rmi.CORBA +javax.security.auth +javax.security.auth.callback +javax.security.auth.kerberos +javax.security.auth.login +javax.security.auth.spi +javax.security.auth.x500 +javax.security.cert +javax.sound.midi +javax.sound.midi.spi +javax.sound.sampled +javax.sound.sampled.spi +javax.sql +javax.swing +javax.swing.border +javax.swing.colorchooser +javax.swing.event +javax.swing.filechooser +javax.swing.plaf +javax.swing.plaf.basic +javax.swing.plaf.metal +javax.swing.plaf.multi +javax.swing.table +javax.swing.text +javax.swing.text.html +javax.swing.text.html.parser +javax.swing.text.rtf +javax.swing.tree +javax.swing.undo +javax.transaction +javax.transaction.xa +javax.xml.parsers +javax.xml.transform +javax.xml.transform.dom +javax.xml.transform.sax +javax.xml.transform.stream +org.ietf.jgss +org.omg.CORBA +org.omg.CORBA.DynAnyPackage +org.omg.CORBA.ORBPackage +org.omg.CORBA.TypeCodePackage +org.omg.CORBA.portable +org.omg.CORBA_2_3 +org.omg.CORBA_2_3.portable +org.omg.CosNaming +org.omg.CosNaming.NamingContextExtPackage +org.omg.CosNaming.NamingContextPackage +org.omg.Dynamic +org.omg.DynamicAny +org.omg.DynamicAny.DynAnyFactoryPackage +org.omg.DynamicAny.DynAnyPackage +org.omg.IOP +org.omg.IOP.CodecFactoryPackage +org.omg.IOP.CodecPackage +org.omg.Messaging +org.omg.PortableInterceptor +org.omg.PortableInterceptor.ORBInitInfoPackage +org.omg.PortableServer +org.omg.PortableServer.CurrentPackage +org.omg.PortableServer.POAManagerPackage +org.omg.PortableServer.POAPackage +org.omg.PortableServer.ServantLocatorPackage +org.omg.PortableServer.portable +org.omg.SendingContext +org.omg.stub.java.rmi +org.w3c.dom +org.xml.sax +org.xml.sax.ext +org.xml.sax.helpers