Accepting request 977561 from Java:packages

maven 3.8.5 / jansi 2.4.0 and fixes for building with them

OBS-URL: https://build.opensuse.org/request/show/977561
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/jansi?expand=0&rev=5
This commit is contained in:
Dominique Leuenberger 2022-05-17 15:24:12 +00:00 committed by Git OBS Bridge
commit 9e652d8399
6 changed files with 146 additions and 231 deletions

3
jansi-2.4.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ba18c50770eebb0b6f472254ada8608138e70045a564efa43626a09691dcf553
size 225579

View File

@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="jansi" default="package" basedir="jansi">
<project name="jansi" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property file="build.properties"/>
<property name="project.version" value="2.4.0"/>
<property name="project.groupId" value="org.fusesource.jansi"/>
<property name="project.artifactId" value="jansi"/>
<property name="project.version" value="1.17.1"/>
<property name="project.name" value="${project.artifactId}"/>
<property name="project.description" value="Jansi is a java library for generating and interpreting ANSI escape sequences."/>
<property name="spec.version" value="2.4"/>
<property name="compiler.source" value="1.8"/>
<property name="compiler.target" value="${compiler.source}"/>
@ -20,26 +18,11 @@
<property name="build.finalName" value="${project.artifactId}-${project.version}"/>
<property name="build.dir" value="target"/>
<property name="build.outputDir" value="${build.dir}/classes"/>
<property name="build.srcDir.0" value="src/main/java"/>
<property name="build.resourceDir.0" value="src/main/resources"/>
<property name="build.testOutputDir" value="${build.dir}/test-classes"/>
<property name="build.testDir.0" value="src/test/java"/>
<property name="build.testResourceDir.0" value="src/test/resources"/>
<property name="test.reports" value="${build.dir}/test-reports"/>
<property name="build.srcDir" value="src/main/java"/>
<property name="build.resourceDir" value="src/main/resources"/>
<property name="reporting.outputDirectory" value="${build.dir}/site"/>
<property name="spec.version" value="1.17"/>
<!-- ====================================================================== -->
<!-- Defining classpaths -->
<!-- ====================================================================== -->
<path id="build.classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ====================================================================== -->
<!-- Cleaning up target -->
<!-- ====================================================================== -->
@ -65,126 +48,29 @@
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.srcDir.0}"/>
<pathelement location="${build.srcDir}"/>
</src>
<classpath refid="build.classpath"/>
</javac>
<copy todir="${build.outputDir}">
<fileset dir="${build.resourceDir.0}"/>
<fileset dir="${build.resourceDir}"/>
</copy>
</target>
<!-- ====================================================================== -->
<!-- Test-compilation target -->
<!-- ====================================================================== -->
<target name="compile-tests"
depends="compile"
description="Compile the test code"
unless="test.skip">
<mkdir dir="${build.testOutputDir}"/>
<javac destdir="${build.testOutputDir}"
encoding="UTF-8"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.testDir.0}"/>
</src>
<classpath>
<path refid="build.classpath"/>
<pathelement location="${build.outputDir}"/>
</classpath>
</javac>
<copy todir="${build.testOutputDir}">
<fileset dir="${build.testResourceDir.0}"/>
</copy>
</target>
<!-- ====================================================================== -->
<!-- Run all tests -->
<!-- ====================================================================== -->
<target name="test"
depends="compile-tests, junit-missing"
unless="junit.skipped"
description="Run the test cases">
<mkdir dir="${test.reports}"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="build.classpath"/>
<pathelement location="${build.outputDir}"/>
<pathelement location="${build.testOutputDir}"/>
</classpath>
<batchtest todir="${test.reports}" unless="test">
<fileset dir="${build.testDir.0}">
<include name="**/*Test.java"/>
<exclude name="**/Abstract*.java"/>
<exclude name="**/Test*.java"/>
</fileset>
</batchtest>
<batchtest todir="${test.reports}" if="test">
<fileset dir="${build.testDir.0}">
<include name="**/${test}.java"/>
<exclude name="**/Abstract*.java"/>
<exclude name="**/Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present" classpathref="build.classpath"/>
</target>
<target name="test-junit-status"
depends="test-junit-present">
<condition property="junit.missing">
<and>
<isfalse value="${junit.present}"/>
<isfalse value="${test.skip}"/>
</and>
</condition>
<condition property="junit.skipped">
<or>
<isfalse value="${junit.present}"/>
<istrue value="${test.skip}"/>
</or>
</condition>
</target>
<target name="junit-missing"
depends="test-junit-status"
if="junit.missing">
<echo>=================================== WARNING ===================================</echo>
<echo> JUnit is not present in the test classpath or your $ANT_HOME/lib directory. Tests not executed.</echo>
<echo>===============================================================================</echo>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${build.srcDir.0}"
<javadoc sourcepath="${build.srcDir}"
packagenames="*"
destdir="${reporting.outputDirectory}/apidocs"
access="protected"
source="${compiler.source}"
verbose="false"
locale="en_US"
version="false"
version="true"
use="true"
author="true"
splitindex="false"
windowtitle="jansi API Reference (${project.version})"
nodeprecated="false"
nodeprecatedlist="false"
notree="false"
@ -194,44 +80,37 @@
serialwarn="false"
encoding="UTF-8"
docencoding="UTF-8"
linksource="true"
breakiterator="false">
<doctitle>&lt;![CDATA[jansi API Reference (${project.version})]]&gt;</doctitle>
<classpath refid="build.classpath"/>
</javadoc>
linksource="false"
breakiterator="false"/>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile,test" description="Package the application">
<target name="package" depends="compile" description="Package the application">
<jar jarfile="${build.dir}/${build.finalName}.jar"
compress="true"
index="false"
basedir="${build.outputDir}"
excludes="**/package.html">
<manifest>
<attribute name="Bundle-Description" value="${project.description}"/>
<attribute name="Automatic-Module-Name" value="${project.groupId}"/>
<attribute name="Bundle-Description" value="Jansi is a java library for generating and interpreting ANSI escape sequences."/>
<attribute name="Bundle-DocURL" value="http://fusesource.com/"/>
<attribute name="Bundle-License" value="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="${project.name}"/>
<attribute name="Bundle-SymbolicName" value="org.fusesource.jansi"/>
<attribute name="Bundle-Name" value="${project.artifactId}"/>
<attribute name="Bundle-SymbolicName" value="${project.groupId}"/>
<attribute name="Bundle-Vendor" value="FuseSource, Corp."/>
<attribute name="Bundle-Version" value="${project.version}"/>
<attribute name="Export-Package" value="org.fusesource.jansi;version=&quot;${project.version}&quot;,org.fusesource.jansi.internal;version=&quot;${project.version}&quot;"/>
<attribute name="Implementation-Title" value="${project.name}"/>
<attribute name="Implementation-URL" value="http://fusesource.github.io/jansi/jansi"/>
<attribute name="Export-Package" value="org.fusesource.jansi.internal;version=&quot;${project.version}&quot;,org.fusesource.jansi.io;version=&quot;${project.version}&quot;;uses:=&quot;org.fusesource.jansi&quot;,org.fusesource.jansi;version=&quot;${project.version}&quot;;uses:=&quot;org.fusesource.jansi.io&quot;"/>
<attribute name="Implementation-Title" value="${project.artifactId}"/>
<attribute name="Implementation-Vendor" value="FuseSource, Corp."/>
<attribute name="Implementation-Vendor-Id" value="${project.groupId}"/>
<attribute name="Implementation-Version" value="${project.version}"/>
<attribute name="JavaPackages-ArtifactId" value="${project.artifactId}"/>
<attribute name="JavaPackages-GroupId" value="${project.groupId}"/>
<attribute name="JavaPackages-Version" value="${project.version}"/>
<attribute name="Main-Class" value="org.fusesource.jansi.AnsiMain"/>
<attribute name="Require-Capability" value="osgi.ee;filter:=&quot;(&amp;(osgi.ee=JavaSE)(version=${compiler.target}))&quot;"/>
<attribute name="Specification-Title" value="${project.name}"/>
<attribute name="Specification-Title" value="${project.artifactId}"/>
<attribute name="Specification-Vendor" value="FuseSource, Corp."/>
<attribute name="Specification-Version" value="${spec.version}"/>
</manifest>

14
jansi-jni.patch Normal file
View File

@ -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))) {
+ loaded = true;
+ return;
+ }
}
// Load the os-dependent library from the jar file

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3d7280eb14edc82e480d66b225470ed6a1da5c5afa4faeab7804a1f15e53b2cd
size 270221

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon May 16 11:00:15 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Upgrade the latest upstream release 2.4.0
* Integrates jansi-native libraries
* Does not depend on jansi-native and hawtjni-runtime
- Make the jansi package archful since it installs a native
library and jni jar
- Added patch:
* jansi-jni.patch
+ Give a possibility to load the native libjansi.so from
system
-------------------------------------------------------------------
Wed Mar 23 23:34:23 UTC 2022 - Fridrich Strba <fstrba@suse.com>

View File

@ -16,27 +16,20 @@
#
%bcond_with tests
Name: jansi
Version: 1.17.1
Version: 2.4.0
Release: 0
Summary: Java library for generating and interpreting ANSI escape sequences
License: Apache-2.0
Group: Development/Libraries/Java
URL: http://fusesource.github.io/jansi/
Source0: https://github.com/fusesource/jansi/archive/jansi-project-%{version}.tar.gz
URL: https://fusesource.github.io/jansi/
Source0: https://github.com/fusesource/jansi/archive/jansi-%{version}.tar.gz
Source1: %{name}-build.xml
Patch0: %{name}-jni.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: hawtjni-runtime
BuildRequires: jansi-native
BuildRequires: gcc
BuildRequires: javapackages-local
%if %{with tests}
BuildRequires: ant-junit
%endif
Requires: mvn(org.fusesource.hawtjni:hawtjni-runtime)
Requires: mvn(org.fusesource.jansi:jansi-native)
BuildArch: noarch
%description
Jansi is a java library that allows you to use ANSI escape sequences
@ -47,68 +40,84 @@ when output is being sent to output devices which cannot support ANSI sequences.
%package javadoc
Summary: Javadocs for %{name}
Group: Documentation/HTML
BuildArch: noarch
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n jansi-jansi-project-%{version}
cp %{SOURCE1} .
%setup -q -n jansi-jansi-%{version}
cp %{SOURCE1} build.xml
%pom_disable_module example
%pom_remove_parent
# 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:properties/pom:jdkTarget" 1.8
%pom_remove_parent jansi
%pom_xpath_inject pom:project "
<groupId>org.fusesource.jansi</groupId>
<version>%{version}</version>" jansi
%pom_change_dep ::\${jansi-native-version} ::1.8 jansi
# 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
# Filtering complicated with ant
sed -i 's,\${project.version},%{version},' \
src/main/resources/org/fusesource/jansi/jansi.properties
%build
mkdir -p jansi/lib
build-jar-repository -s jansi/lib \
hawtjni/hawtjni-runtime jansi-native/jansi-native
%{ant} -f %{name}-build.xml \
%if %{without tests}
-Dtest.skip=true \
%endif
jar javadoc
# Build the native artifact
CFLAGS="$CFLAGS -I. -I%{java_home}/include -I%{java_home}/include/linux -fPIC -fvisibility=hidden"
pushd src/main/native
%__cc $CFLAGS -c jansi.c
%__cc $CFLAGS -c jansi_isatty.c
%__cc $CFLAGS -c jansi_structs.c
%__cc $CFLAGS -c jansi_ttyname.c
%__cc $CFLAGS $LDFLAGS -shared -o libjansi.so *.o -lutil
popd
# Build the Java artifacts
%{ant} jar javadoc
%install
# Install the native artifact
install -dm 0755 %{buildroot}%{_libdir}/%{name}
install -pm 0755 src/main/native/libjansi.so %{buildroot}%{_libdir}/%{name}
# jar
install -dm 0755 %{buildroot}%{_javadir}/%{name}
install -pm 0644 jansi/target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}/%{name}.jar
install -dm 0755 %{buildroot}%{_jnidir}/%{name}
install -pm 0644 target/%{name}-%{version}.jar %{buildroot}%{_jnidir}/%{name}/%{name}.jar
# pom
install -dm 0755 %{buildroot}%{_mavenpomdir}/%{name}
install -pm 0644 jansi/pom.xml %{buildroot}%{_mavenpomdir}/%{name}/%{name}.pom
install -pm 0644 pom.xml %{buildroot}%{_mavenpomdir}/%{name}/%{name}.pom
%add_maven_depmap %{name}/%{name}.pom %{name}/%{name}.jar
# javadoc
%fdupes -s %{buildroot}%{_javadocdir}
# javadoc
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr jansi/target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}
%files -f .mfiles
%license license.txt
%doc readme.md changelog.md
%{_libdir}/%{name}
%files javadoc
%{_javadocdir}/%{name}