From 3a898d80b1b2302c18c5551da1bcac55fac5af3b Mon Sep 17 00:00:00 2001 From: Jerry James Date: Tue, 15 Dec 2020 11:29:13 -0700 Subject: [PATCH] Version 2.1.1 - Remove package name from Summary - Add patch to change the location of the JNI shared object --- .gitignore | 1 + jansi-jni.patch | 14 ++++++++ jansi.spec | 86 ++++++++++++++++++++++++++++++++----------------- sources | 2 +- 4 files changed, 73 insertions(+), 30 deletions(-) create mode 100644 jansi-jni.patch diff --git a/.gitignore b/.gitignore index 580ec1f..2aebb9a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /jansi-project-1.17.tar.gz /jansi-project-1.17.1.tar.gz /jansi-project-1.18.tar.gz +/jansi-2.1.1.tar.gz diff --git a/jansi-jni.patch b/jansi-jni.patch new file mode 100644 index 0000000..e9e106f --- /dev/null +++ b/jansi-jni.patch @@ -0,0 +1,14 @@ +--- a/src/main/java/org/fusesource/jansi/internal/JansiLoader.java 2020-12-15 03:03:00.000000000 -0700 ++++ b/src/main/java/org/fusesource/jansi/internal/JansiLoader.java 2020-12-15 07:57:30.238720226 -0700 +@@ -295,6 +295,11 @@ public class JansiLoader { + } else { + triedPaths.add(jansiNativeLibraryPath); + } ++ } else { ++ if (loadNativeLibrary(new File("@LIBDIR@/jansi", jansiNativeLibraryName))) { ++ extracted = true; ++ return; ++ } + } + + // Load the os-dependent library from the jar file diff --git a/jansi.spec b/jansi.spec index 8ddd4a2..279d711 100644 --- a/jansi.spec +++ b/jansi.spec @@ -1,20 +1,21 @@ Name: jansi -Version: 1.18 -Release: 5%{?dist} -Summary: Jansi is a java library for generating and interpreting ANSI escape sequences +Version: 2.1.1 +Release: 1%{?dist} +Summary: Generate and interpret ANSI escape sequences in Java + License: ASL 2.0 URL: http://fusesource.github.io/jansi/ +Source0: https://github.com/fusesource/jansi/archive/jansi-%{version}.tar.gz +# Change the location of the native artifact to where Fedora wants it +Patch0: %{name}-jni.patch -Source0: https://github.com/fusesource/jansi/archive/jansi-project-%{version}.tar.gz - -BuildArch: noarch - +BuildRequires: gcc BuildRequires: maven-local -BuildRequires: mvn(junit:junit) BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) +BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin) +BuildRequires: mvn(org.apache.maven.surefire:surefire-junit-platform) BuildRequires: mvn(org.fusesource:fusesource-pom:pom:) -BuildRequires: mvn(org.fusesource.hawtjni:hawtjni-runtime) -BuildRequires: mvn(org.fusesource.jansi:jansi-native) +BuildRequires: mvn(org.junit.jupiter:junit-jupiter-engine) %description Jansi is a small java library that allows you to use ANSI escape sequences @@ -29,45 +30,72 @@ Summary: Javadocs for %{name} This package contains the API documentation for %{name}. %prep -%setup -q -n jansi-jansi-project-%{version} +%autosetup -n jansi-jansi-%{version} -p1 -%pom_disable_module example +# We don't need the Fuse JXR skin %pom_xpath_remove "pom:build/pom:extensions" -%pom_remove_plugin -r :maven-site-plugin +# Plugins not needed for an RPM build +%pom_remove_plugin :maven-gpg-plugin +%pom_remove_plugin :maven-javadoc-plugin +%pom_remove_plugin :nexus-staging-maven-plugin -# No maven-uberize-plugin -%pom_remove_plugin -r :maven-uberize-plugin +# We don't want GraalVM support in Fedora +%pom_remove_plugin :exec-maven-plugin +%pom_remove_dep :picocli-codegen -# Remove unnecessary deps for jansi-native builds -pushd jansi -%pom_remove_dep :jansi-windows32 -%pom_remove_dep :jansi-windows64 -%pom_remove_dep :jansi-osx -%pom_remove_dep :jansi-freebsd32 -%pom_remove_dep :jansi-freebsd64 -# it's there only to be bundled in uberjar and we disable uberjar generation -%pom_remove_dep :jansi-linux32 -%pom_remove_dep :jansi-linux64 -popd +# Build for JDK 1.8 at a minimum +%pom_xpath_set "//pom:plugin[pom:artifactId='maven-compiler-plugin']//pom:source" 1.8 +%pom_xpath_set "//pom:plugin[pom:artifactId='maven-compiler-plugin']//pom:target" 1.8 -# javadoc generation fails due to strict doclint in JDK 8 -%pom_remove_plugin -r :maven-javadoc-plugin +# Remove prebuilt shared objects +rm -fr src/main/resources/org/fusesource/jansi/internal + +# Unbundle the JNI headers +rm src/main/native/inc_linux/*.h +ln -s %{java_home}/include/jni.h src/main/native/inc_linux +ln -s %{java_home}/include/linux/jni_md.h src/main/native/inc_linux + +# Set the JNI path +sed -i 's,@LIBDIR@,%{libdir},' \ + src/main/java/org/fusesource/jansi/internal/JansiLoader.java %build -%mvn_build +# Build the native artifact +CFLAGS="%{build_cflags} -I. -I%{java_home}/include -I%{java_home}/include/linux -fPIC -fvisibility=hidden" +cd src/main/native +gcc $CFLAGS -c jansi.c +gcc $CFLAGS -c jansi_isatty.c +gcc $CFLAGS -c jansi_structs.c +gcc $CFLAGS -c jansi_ttyname.c +gcc $CFLAGS %{build_ldflags} -shared -o libjansi.so *.o -lutil +cd - + +# Build the Java artifacts +%mvn_build -- -Dlibrary.jansi.path=$PWD/src/main/native %install +# Install the native artifact +mkdir -p %{buildroot}%{_libdir}/%{name} +cp -p src/main/native/libjansi.so %{buildroot}%{_libdir}/%{name} + +# Install the Java artifacts %mvn_install %files -f .mfiles %license license.txt %doc readme.md changelog.md +%{_libdir}/%{name}/ %files javadoc -f .mfiles-javadoc %license license.txt %changelog +* Tue Dec 15 2020 Jerry James - 2.1.1-1 +- Version 2.1.1 +- Remove package name from Summary +- Add patch to change the location of the JNI shared object + * Tue Jul 28 2020 Fedora Release Engineering - 1.18-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/sources b/sources index afa3563..8f107e7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (jansi-project-1.18.tar.gz) = d34f271853250d4b23987c0b4d2eeadd9fdb1211b2f5187258bb43e2741d8263312ee04c9a39812550eb658853668a5e941ff3978682cea47c059c6ba85d3e9d +SHA512 (jansi-2.1.1.tar.gz) = ccdb7b13da6715398b0b1d53bb1272ac445774dea7f643882c7df0182e17350b41dd1c782161f5350028209c82ac3588c22ceaaacd4930ec78645230b335bc4a