Name:           slf4j
Version:        1.7.25
Release:        7
Epoch:          0
Summary:        Simple Logging Facade for Java(SLF4J)
License:        MIT and ASL 2.0
URL:            http://www.slf4j.org/
Source0:        https://github.com/qos-ch/%{name}/archive/v_%{version}.tar.gz
Source1:        http://www.apache.org/licenses/LICENSE-2.0.txt

BuildArch:      noarch
BuildRequires:  maven-local mvn(ch.qos.cal10n:cal10n-api) mvn(commons-lang:commons-lang)
BuildRequires:  mvn(commons-logging:commons-logging) mvn(javassist:javassist) mvn(log4j:log4j:1.2.17)
BuildRequires:  mvn(org.apache.maven.plugins:maven-antrun-plugin) mvn(org.apache.maven.plugins:maven-source-plugin)
BuildRequires:  mvn(org.codehaus.mojo:build-helper-maven-plugin)

%description
The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various
logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the
desired logging framework at deployment time.Before you start using SLF4J, we highly recommend
that you read the two-page SLF4J user manual.
Note that SLF4J-enabling your library implies the addition of only a single mandatory dependency,
namely slf4j-api.jar. If no binding is found on the class path, then SLF4J will default to a
no-operation implementation.
In case you wish to migrate your Java source files to SLF4J, consider our migrator tool which
can migrate your project to use the SLF4J API in just a few minutes.
In case an externally-maintained component you depend on uses a logging API other than SLF4J,
such as commons logging, log4j or java.util.logging, have a look at SLF4J's binary-support for legacy APIs.

%package jdk14
Summary:        JDK14 Binding of SLF4J

%description jdk14
JDK14 Binding of SLF4J.

%package log4j12
Summary:        LOG4J-12 Binding of SLF4J

%description log4j12
LOG4J-12 Binding of SLF4J.

%package jcl
Summary:        JCL Binding of SLF4J

%description jcl
JCL Binding of SLF4J.

%package -n jcl-over-slf4j
Summary:        JCL 1.1.1 implemented over SLF4J

%description -n jcl-over-slf4j
JCL 1.1.1 implemented over SLF4J.

%package -n jul-to-slf4j
Summary:        JUL to SLF4J bridge

%description -n jul-to-slf4j
JUL to SLF4J bridge.

%package -n log4j-over-slf4j
Summary:        Log4j implemented over SLF4J

%description -n log4j-over-slf4j
Log4j implemented over SLF4J.

%package ext
Summary:        Extensions Module of SLF4J

%description ext
Extensions Module of SLF4J.

%package sources
Summary:        Source JARs of SLF4J

%description sources
SLF4J Source JARs,which is required by Maven 3.4.0.

%package help
Summary:        API documentation for slf4j package
Provides:       %{name}-javadoc = %{epoch}:%{version}-%{release} %{name}-manual = %{epoch}:%{version}-%{release}
Obsoletes:      %{name}-javadoc < %{epoch}:%{version}-%{release} %{name}-manual < %{epoch}:%{version}-%{release}

%description help
API documentation for slf4j package.

%prep
%autosetup -n %{name}-v_%{version} -p1

find . -name "*.jar" -delete
cp -p %{SOURCE1} APACHE-LICENSE

%pom_disable_module integration
%pom_disable_module osgi-over-slf4j
%pom_disable_module slf4j-android
%pom_disable_module slf4j-migrator

%pom_xpath_inject "pom:project/pom:properties" "
    <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>"

%pom_xpath_remove "pom:links"
%pom_xpath_inject "pom:plugin[pom:artifactId[text()='maven-javadoc-plugin']]/pom:configuration" "
    <detectJavaApiLink>false</detectJavaApiLink>
    <isOffline>false</isOffline>
    <links><link>/usr/share/javadoc/java</link></links>"

find -name "*.css" -o -name "*.js" -o -name "*.txt" | xargs -t sed -i 's/\r$//'

%pom_xpath_remove pom:extensions

%pom_xpath_inject "pom:plugin[pom:artifactId='maven-jar-plugin']/pom:executions" "
    <execution>
      <id>default-jar</id>
      <phase>skip</phase>
    </execution>" slf4j-api

sed -i "/Import-Package/s/.$/;resolution:=optional&/" slf4j-api/src/main/resources/META-INF/MANIFEST.MF

# source of slf4j is required by maven 3.4.0
%mvn_package :::sources: sources

%mvn_package :slf4j-parent __noinstall
%mvn_package :slf4j-site __noinstall
%mvn_package :slf4j-api
%mvn_package :slf4j-simple
%mvn_package :slf4j-nop

%build
%mvn_build -f -s

%install
%mvn_file ':%{name}-{*}' %{name}/%{name}-@1 %{name}/@1
%mvn_install
sed -i 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/f2f42549-cfab-4d71-be48-5e9f9a41e5f5/g' $(find %{_buildrootdir} -name slf4j-slf4j-jdk14.xml)
sed -i 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/f2f42549-cfab-4d71-be48-5e9f9a41e5f5/g' $(find %{_buildrootdir} -name slf4j.xml)

install -d -m 0755 $RPM_BUILD_ROOT%{_defaultdocdir}/slf4j-manual
cp -rp target/site/* $RPM_BUILD_ROOT%{_defaultdocdir}/slf4j-manual

%files -f .mfiles
%license LICENSE.txt APACHE-LICENSE

%files jdk14 -f .mfiles-slf4j-jdk14

%files log4j12 -f .mfiles-slf4j-log4j12

%files jcl -f .mfiles-slf4j-jcl

%files -n jcl-over-slf4j -f .mfiles-jcl-over-slf4j

%files -n jul-to-slf4j -f .mfiles-jul-to-slf4j

%files -n log4j-over-slf4j -f .mfiles-log4j-over-slf4j

%files ext -f .mfiles-slf4j-ext

%files sources -f .mfiles-sources
%license LICENSE.txt APACHE-LICENSE

%files help -f .mfiles-javadoc
%{_defaultdocdir}/slf4j-manual
%exclude %{_defaultdocdir}/slf4j-manual/{.htaccess,apidocs}

%changelog
* Wed Dec 04 2019 daiqianwen <daiqianwen@huawei.com> - 0:1.7.25-7
- Package init



