[flexdock] Use packaging guidelines Move jni to %{_jnidir} and jar to %{_javadir}

Clément David davidcl at fedoraproject.org
Tue Dec 13 13:44:47 UTC 2011


commit 4f222327e8d8ae611f8d22ad3b2a89dfd0ec0298
Author: Clément DAVID <c.david86 at gmail.com>
Date:   Tue Dec 13 14:44:21 2011 +0100

    Use packaging guidelines
    Move jni to %{_jnidir} and jar to %{_javadir}

 flexdock-jni.patch |    2 +-
 flexdock.spec      |   74 ++++++++++++++--------------------------------------
 2 files changed, 21 insertions(+), 55 deletions(-)
---
diff --git a/flexdock-jni.patch b/flexdock-jni.patch
index 8f51325..d67fafe 100644
--- a/flexdock-jni.patch
+++ b/flexdock-jni.patch
@@ -6,7 +6,7 @@
          // determine a file from which we can load our library.
 -        File file = new File(System.getProperty("user.home") + "/flexdock");
 +        // FEDORA PATCH -- Override java search location
-+        File file = new File("%{_libdir}/%{name}");
++        File file = new File("%{_jnidir}");
          file.mkdirs();
          file = new File(file.getAbsolutePath() + "/" + library
                          + LIBRARY_EXTENSION);
diff --git a/flexdock.spec b/flexdock.spec
index 21b12a7..d9cec38 100644
--- a/flexdock.spec
+++ b/flexdock.spec
@@ -1,6 +1,6 @@
 Name:		    flexdock
 Version:	    1.0
-Release:	    2%{?dist}
+Release:	    3%{?dist}
 Summary:	    Docking framework for Java Swing GUI apps
 
 Group:		    Development/Libraries
@@ -27,10 +27,6 @@ Patch3:		    flexdock-skinlfTitlebarui-path.patch
 #Fixes the skinlf search paths in the skinlf.jar (2 of 2)
 Patch4:		    flexdock-skinlfPainter-path.patch
 
-
-BuildRoot:	    %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-
 BuildRequires:	ant
 BuildRequires:	ant-apache-regexp
 BuildRequires:	ant-commons-logging
@@ -55,7 +51,7 @@ Swing applications.
 
 #Modify the jni dir that is hardcoded in the patch
 cp %{PATCH0} ./tmpJniPatch
-sed -i 's!%%{_libdir}/%%{name}!%{_libdir}/%{name}!' tmpJniPatch
+sed -i 's!%%{_jnidir}!%{_jnidir}!' tmpJniPatch
 
 #Apply patches
 #Apply patch0
@@ -66,43 +62,23 @@ patch -p0 --fuzz=0 < tmpJniPatch
 %patch4
 
 #Override the build file's default hard-coded paths
-echo "sdk.home=%{_jvmdir}/java" > workingcopy.properties
+echo "sdk.home=%{java_home}" > workingcopy.properties
+
+#JAR "dependency" handling
+find ./ -name \*.jar -exec rm {} \;
+build-jar-repository -s -p lib commons-logging skinlf jgoodies-looks
+
+## Cleanup
 
 #remove *dll
 find ./ -name \*.dll -exec rm  {} \;
 #remove .so files
 find ./ -name \*.so -exec rm {} \;
 
-
 #Remove the jmf-using demo files
 rm src/java/demo/org/flexdock/demos/raw/jmf/MediaPanel.java
 rm src/java/demo/org/flexdock/demos/raw/jmf/JMFDemo.java
 
-
-#JAR "dependency" handling
-#==========
-
-build-jar-repository -s -p lib commons-logging skinlf jgoodies-looks.jar
-
-pushd lib
-ln -s jgoodies-looks.jar looks-2.2.1.jar
-ln -s commons-logging.jar commons-logging-1.1.jar
-popd
-
-
-JAR_files=""
-for j in $(find -name \*.jar); do
-if [ ! -L $j ] ; then
-	JAR_files="$JAR_files $j"
-	fi
-done
-
-if [ ! -z "$JAR_files" ] ; then
-	echo "These JAR files should be deleted and symlinked to system JAR files: $JAR_files"
-	exit 1
-fi
-#=========
-
 #Endline convert Doc files
 for i in "README-RELEASE LICENSE.txt README release-notes.txt" ;
 do
@@ -111,38 +87,28 @@ done
 
 %build
 export CLASSPATH=$(build-classpath jgoodies-looks skinlf commons-logging)
-ant -v -Dbuild.sysclasspath=first build.with.native jar
-ant -v -Dbuild.sysclasspath=first compile.native
+ant -v -Dbuild.sysclasspath=first compile.unix.lib jar
 
 %install
-rm -rf %{buildroot}
-
-#Create dirs needed.
-mkdir -p %{buildroot}/%{_libdir}/%{name}
-
 #flexdock has funny arch flags, such as "libRubberBand-linux-x86.so" on i386
 SOFILE=`find ./ -name libRubberBand*so`
 
+mkdir -p %{buildroot}%{_jnidir}
+install -pm755 $SOFILE %{buildroot}%{_jnidir}/libRubberBand-0.so
 
-install -pm755 $SOFILE %{buildroot}/%{_libdir}/%{name}/libRubberBand-0.so
-#install jar file into lib dir as it is a JNI requiring jar
-install -pm644 build/%{name}-%{version}.jar %{buildroot}/%{_libdir}/%{name}/%{name}-%{version}.jar
-
-pushd .
-cd %{buildroot}/%{_libdir}/%{name}
-ln -s %{name}-%{version}.jar %{name}.jar
-popd
-
-%clean
-rm -rf %{buildroot}
+mkdir -p %{buildroot}%{_javadir}
+install -pm644 build/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
 
 %files
-%defattr(-,root,root,-)
 %doc LICENSE.txt README README-RELEASE release-notes.txt
-%{_libdir}/%{name}
-
+%{_jnidir}/*
+%{_javadir}/*
 
 %changelog
+* Mon Dec 13 2011 Clément <davidcl> David  <c.david86 at gmail.com> 1.0-3
+- Use packaging guidelines
+- Move jni to %{_jnidir} and jar to %{_javadir}
+
 * Mon Dec 12 2011 Clément <davidcl> David  <c.david86 at gmail.com> 1.0-2
 - Bump version to force build (NFS server outage)
 


More information about the scm-commits mailing list