Skip to content

Instantly share code, notes, and snippets.

@goldmann
Created November 21, 2011 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldmann/1383245 to your computer and use it in GitHub Desktop.
Save goldmann/1383245 to your computer and use it in GitHub Desktop.
%global namedreltag .Final
%global namedversion %{version}%{?namedreltag}
Name: package
Version: 1.0.0
# TODO
# If the package doesn't have a final release, but CR1, Beta, Alpha, etc, use this as the release tag:
# Release: 0.1%{namedreltag}%{?dist}
Release: 1%{?dist}
Summary: TODO
Group: Development/Libraries
License: TODO (LGPLv2+)
URL: TODO
# SVN
#
# svn export http://anonsvn.jboss.org/repos/jbossas/projects/security/security-xacml/tags/2.0.6.Final/ picketbox-xacml-2.0.6.Final
# tar cafJ picketbox-xacml-2.0.6.Final.tar.xz picketbox-xacml-2.0.6.Final
#
# GIT
#
# git clone git://github.com/jboss-remoting/jboss-marshalling.git
# cd jboss-marshalling/ && git archive --format=tar --prefix=jboss-marshalling-1.3.0.GA/ 1.3.0.GA | xz > jboss-marshalling-1.3.0.GA.tar.xz
#
# TODO Save here above instructions how to get the source code, remove unnecessary part
Source0: %{name}-%{namedversion}.tar.xz
BuildArch: noarch
BuildRequires: jpackage-utils
BuildRequires: java-devel
BuildRequires: maven
BuildRequires: maven-compiler-plugin
BuildRequires: maven-install-plugin
BuildRequires: maven-jar-plugin
BuildRequires: maven-javadoc-plugin
Requires: jpackage-utils
Requires: java
%description
TODO
%package javadoc
Summary: Javadocs for %{name}
Group: Documentation
Requires: jpackage-utils
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n %{name}-%{namedversion}
%build
mvn-rpmbuild install javadoc:aggregate
%install
# JAR
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -pm 644 target/%{name}-%{namedversion}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
# TODO if the package will contain multiple jars, for example resteasy - put them into a directory:
# install -d -m 755 $RPM_BUILD_ROOT%{_javadir}/%{name}
# POM
install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}
install -pm 644 pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
# TODO
# If the package landed in a subdirectory (%{name} in above example), then you need to install the pom into:
# install -pm 644 pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}.pom
# DEPMAP
%add_maven_depmap JPP-%{name}.pom %{name}.jar
# TODO
# If the package landed in a subdirectory (%{name} in above example), then you need to generate depmap like this:
# %add_maven_depmap JPP.%{name}-%{name}.pom %{name}/%{name}.jar
# APIDOCS
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -rp target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%files
%{_mavenpomdir}/*
%{_mavendepmapfragdir}/*
%{_javadir}/*
%doc
%files javadoc
%{_javadocdir}/%{name}
%changelog
* Mon Nov 21 2011 FirstName LastName <email@host> 1.0.0-1
- Initial packaging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment