[netty-tcnative/f22] Initial commit
jiri vanek
jvanek at fedoraproject.org
Thu Feb 12 10:15:23 UTC 2015
commit 8c0d7efd2ddaf173cbb0cd3fda0c8f1241b07262
Author: Jiri Vanek <jvanek at redhat.com>
Date: Thu Feb 12 11:15:02 2015 +0100
Initial commit
.gitignore | 1 +
CheckLibrary.java | 8 +++++
fixLibNames.patch.in | 40 +++++++++++++++++++++++
i388aprFix.patch | 12 +++++++
netty-tcnative.spec | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++
sources | 1 +
6 files changed, 147 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..f8d06e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/netty-tcnative-1.1.30.Fork2.tar.gz
diff --git a/CheckLibrary.java b/CheckLibrary.java
new file mode 100644
index 0000000..2d2e942
--- /dev/null
+++ b/CheckLibrary.java
@@ -0,0 +1,8 @@
+import org.apache.tomcat.jni.Library;
+
+public class CheckLibrary {
+
+ public static void main(String[] a) throws Exception{
+ Library.initialize(null);
+ }
+}
diff --git a/fixLibNames.patch.in b/fixLibNames.patch.in
new file mode 100644
index 0000000..42627cb
--- /dev/null
+++ b/fixLibNames.patch.in
@@ -0,0 +1,40 @@
+--- netty-tcnative-netty-tcnative-1.1.30.Fork2/src/main/java/org/apache/tomcat/jni/Library (copy).java
++++ netty-tcnative-netty-tcnative-1.1.30.Fork2/src/main/java/org/apache/tomcat/jni/Library.java
+@@ -24,7 +24,7 @@
+ public final class Library {
+
+ /* Default library names */
+- private static final String [] NAMES = {"tcnative-1", "libtcnative-1"};
++ private static final String [] NAMES = {"netty-tcnative", "libnetty-tcnative", "netty-tcnative-1", "libnetty-tcnative-1"};
+ /*
+ * A handle to the unique Library singleton instance.
+ */
+@@ -36,8 +36,9 @@
+ boolean loaded = false;
+ StringBuilder err = new StringBuilder();
+ for (int i = 0; i < NAMES.length; i++) {
++ String name = "@PATH@/" + NAMES[i] + ".so";
+ try {
+- System.loadLibrary(NAMES[i]);
++ System.load(name);
+ loaded = true;
+ }
+ catch (Throwable t) {
+@@ -47,16 +48,10 @@
+ if (t instanceof VirtualMachineError) {
+ throw (VirtualMachineError) t;
+ }
+- String name = System.mapLibraryName(NAMES[i]);
+- String path = System.getProperty("java.library.path");
+- String sep = System.getProperty("path.separator");
+- String [] paths = path.split(sep);
+- for (int j=0; j<paths.length; j++) {
+- java.io.File fd = new java.io.File(paths[j] , name);
++ java.io.File fd = new java.io.File(name);
+ if (fd.exists()) {
+ t.printStackTrace();
+ }
+- }
+ if ( i > 0)
+ err.append(", ");
+ err.append(t.getMessage());
diff --git a/i388aprFix.patch b/i388aprFix.patch
new file mode 100644
index 0000000..a0d17b4
--- /dev/null
+++ b/i388aprFix.patch
@@ -0,0 +1,12 @@
+--- netty-tcnative-netty-tcnative-1.1.30.Fork2/src/main/native-package/m4/custom.m4
++++ netty-tcnative-netty-tcnative-1.1.30.Fork2/src/main/native-package/m4/custom.m4
+@@ -47,7 +47,7 @@
+ fi
+
+ dnl Update the compiler/linker flags to add APR and OpenSSL to the build path.
+- CFLAGS="$CFLAGS $TCN_OPENSSL_INC $APR_INCLUDES"
++ CFLAGS="$CFLAGS $TCN_OPENSSL_INC $APR_INCLUDES -D_LARGEFILE64_SOURCE"
+ CXXFLAGS="$CXXFLAGS $TCN_OPENSSL_INC $APR_INCLUDES"
+ LDFLAGS="$LDFLAGS $TCN_OPENSSL_LIBS $APR_LIBS"
+ AC_SUBST(CFLAGS)
+
diff --git a/netty-tcnative.spec b/netty-tcnative.spec
new file mode 100644
index 0000000..17f194a
--- /dev/null
+++ b/netty-tcnative.spec
@@ -0,0 +1,85 @@
+%global namedreltag .Fork2
+%global namedversion %{version}%{?namedreltag}
+
+Name: netty-tcnative
+Version: 1.1.30
+Release: 0%{?dist}
+Summary: Fork of Tomcat Native with improved OpenSSL and mavenized build
+License: ASL 2.0
+URL: https://github.com/netty/netty/wiki/Forked-Tomcat-Native
+Source0: https://github.com/netty/netty-tcnative/archive/%{name}-%{namedversion}.tar.gz
+Source1: CheckLibrary.java
+Patch1: fixLibNames.patch.in
+Patch2: i388aprFix.patch
+
+#dont know how to configure requires, just guessing
+Requires: java-headless
+Requires: jpackage-utils
+
+
+BuildRequires: maven-local
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: libtool
+BuildRequires: glibc-devel
+BuildRequires: apr-devel
+BuildRequires: openssl-devel
+BuildRequires: maven-hawtjni-plugin
+#parent pom is needed
+BuildRequires: netty
+
+
+%description
+netty-tcnative is a fork of Tomcat Native. It includes a set of changes
+contributed by Twitter, Inc, such as:
+ * Simplified distribution and linkage of native library
+ * Complete mavenization of the project
+ * Improved OpenSSL support
+To minimize the maintenance burden, we create a dedicated branch for each stable
+upstream release and apply our own changes on top of it, while keeping the
+number of maintained branches to minimum
+
+
+%package javadoc
+Summary: API documentation for %{name}
+Group: Documentation
+BuildArch: noarch
+
+%description javadoc
+%{summary}.
+
+%prep
+%setup -q -n %{name}-%{name}-%{namedversion}
+%pom_xpath_remove "pom:extension[pom:artifactId[text()='os-maven-plugin']]"
+patch=`mktemp`
+sed "s;@PATH@;%{_libdir}/%{name};g" < %{PATCH1} > $patch
+patch -p1 < $patch
+%patch2 -p1
+
+
+%build
+%mvn_build -f
+
+%install
+%mvn_install
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{name}/
+cp target/native-build/target/lib/lib%{name}-%{namedversion}.so $RPM_BUILD_ROOT%{_libdir}/%{name}/lib%{name}.so
+
+
+%check
+javac -d . -cp $RPM_BUILD_ROOT%{_jnidir}/%{name}/%{name}.jar %{SOURCE1}
+#don't know how to test load(path) without more and more patching, however the test class can be used for manual testing
+#java -cp .:$RPM_BUILD_ROOT%%{_jnidir}/%%{name}/%%{name}.jar CheckLibrary
+
+
+%files -f .mfiles
+%dir %{_libdir}/%{name}
+%dir %{_jnidir}/%{name}
+%dir %{_mavenpomdir}/%{name}
+%{_libdir}/%{name}/lib%{name}.so
+
+%files javadoc -f .mfiles-javadoc
+
+%changelog
+* Thu Jan 29 2015 Jiri Vanek <jvanek at redhat.com> - 1.1.30-0
+- initial build
diff --git a/sources b/sources
index e69de29..72ec881 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+e9935268b55bbc135a7f6cc1fdb8949c netty-tcnative-1.1.30.Fork2.tar.gz
More information about the scm-commits
mailing list