]> git.pld-linux.org Git - packages/rpm-build-macros.git/blame - macros.java
Add rename notice
[packages/rpm-build-macros.git] / macros.java
CommitLineData
2e434209
JR
1# vim:ts=4 sw=4 noet ft=spec
2#
3# Java macros. based on jpackage macros.java
4#
5# Import packaging conventions from jpackage.org (prefixed with _
6# to avoid name collisions).
7#
8%_javadir %{_datadir}/java
9%_javadocdir %{_datadir}/javadoc
10
11# Root directory where all Java VMs/SDK/JREs are installed.
12%_jvmdir %{_libdir}/jvm
13
14# Root directory where all Java VMs/SDK/JREs expose their jars
15%_jvmjardir %{_libdir}/jvm-exports
16
17# Root directory for all Java VM/SDK/JRE's private things.
18%_jvmprivdir %{_libdir}/jvm-private
19
20# Root directory for all architecture dependent parts of Java VM/SDK/JRE's
21%_jvmlibdir %{_libdir}/jvm
22
23# Root directory for all architecture independent parts of Java VM/SDK/JRE's
24%_jvmdatadir %{_datadir}/jvm
25
26# Root directory for all configurations parts of Java VM/SDK/JRE's
27%_jvmsysconfdir %{_sysconfdir}/jvm
28
29# Root directory for all common architecture dependent parts of Java VM/SDK/JRE's
30%_jvmcommonlibdir %{_libdir}/jvm-common
31
32# Root directory for all common architecture independent parts of Java VM/SDK/JRE's
33%_jvmcommondatadir %{_datadir}/jvm-common
34
35# Root directory for all common configurations parts of Java VM/SDK/JRE's
36%_jvmcommonsysconfdir %{_sysconfdir}/jvm-common
37
38# Directory where arch-specific (JNI) version-independent jars are installed.
39%_jnidir %{_libdir}/java
40
41
42# JDK selection. Set this to name of the JDK implementation to use
43# insead of the system default
44#%use_jdk icedtea6
45
46# expands to the value with right jdk for BuildRequires header
47# 'jdk' if %%use_jdk is not defined, jdk(%%use_jdk) otherwise
48# The requirement will not replace current 'default' JDK
49%required_jdk jdk%{?use_jdk:(%{use_jdk})}
50
51%buildrequires_jdk BuildRequires: %required_jdk
52
53%java_home %{expand:%%global java_home %([ -f %{_javadir}-utils/java-functions ] || { echo ERROR; exit 0; }; %{!?use_jdk:unset JAVA_HOME; . %{_javadir}-utils/java-functions; set_jvm}%{?use_jdk:JAVA_HOME=%{_jvmdir}/%{use_jdk}}; echo ${JAVA_HOME:-ERROR})}%java_home
54
55%_javasrcdir %{_usrsrc}/java
56
57%ant JAVA_HOME=%{java_home} CLASSPATH=$CLASSPATH ant
58%jar %{java_home}/bin/jar
59%java %{expand:%%global java %([ -f %{_javadir}-utils/java-functions ] || { echo ERROR; exit 0; }; %{!?use_jdk:unset JAVACMD; . %{_javadir}-utils/java-functions; set_javacmd}%{?use_jdk:JAVACMD=%{java_home}/bin/java}; echo $JAVACMD)}%java
60%javac %{java_home}/bin/javac
61%javadoc %{java_home}/bin/javadoc
62
63%add_jvm_extension JAVA_LIBDIR=%{buildroot}/%{_javadir} %{_bindir}/jvmjar -l
64
65%jpackage_script() \
66install -d $RPM_BUILD_ROOT%{_bindir}\
67cat > $RPM_BUILD_ROOT%{_bindir}/%5 << 'EOF' \
68#!/bin/sh\
69#\
70# %{name} script\
71# JPackage Project <http://www.jpackage.org/>\
72\
73# Source functions library\
74. %{_javadir}-utils/java-functions\
75\
76# Source system prefs\
77if [ -f %{_sysconfdir}/java/%{name}.conf ]; then\
78 . %{_sysconfdir}/java/%{name}.conf\
79fi\
80\
81# Source user prefs\
82if [ -f $HOME/.%{name}rc ]; then\
83 . $HOME/.%{name}rc\
84fi\
85\
86# Configuration\
87MAIN_CLASS=%1\
88BASE_FLAGS=%2\
89BASE_OPTIONS=%3\
90BASE_JARS="%(echo %4 | tr ':' ' ')"\
91\
92# Set parameters\
93set_jvm\
94set_classpath $BASE_JARS\
95set_flags $BASE_FLAGS\
96set_options $BASE_OPTIONS\
97\
98# Let's start\
99run "$@"\
100EOF
101
102# jpackage 1.7
103# Directory for maven depmaps
104#
105%_mavendepmapdir /etc/maven
106%_mavendepmapfragdir /etc/maven/fragments
107
108#
109# add_to_depmap adds an entry to the depmap. The arguments are:
110#
111# %1 the original groupid
112# %2 the original artifact id
113# %3 the version
114# %4 the new groupid
115# %5 the new artifactid
116#
117
118%add_to_maven_depmap() \
119install -dm 755 $RPM_BUILD_ROOT/%{_mavendepmapfragdir}\
120cat >>$RPM_BUILD_ROOT/%{_mavendepmapfragdir}/%{name}<< EOF\
121<dependency>\
122 <maven>\
123 <groupId>%1</groupId>\
124 <artifactId>%2</artifactId>\
125 <version>%3</version>\
126 </maven>\
127 <jpp>\
128 <groupId>%4</groupId>\
129 <artifactId>%5</artifactId>\
130 <version>%3</version>\
131 </jpp>\
132</dependency>\
133\
134EOF\
135%{nil}
136
137#==============================================================================
138#
139# update_maven_depmap updates the main maven depmap
140#
141%update_maven_depmap() \
142echo -e "<dependencies>\\n" > %{_mavendepmapdir}/maven2-depmap.xml\
143if [ -d %{_mavendepmapfragdir} ] && [ -n "`find %{_mavendepmapfragdir} -type f`" ]; then\
144cat %{_mavendepmapfragdir}/* >> %{_mavendepmapdir}/maven2-depmap.xml\
145fi\
146echo -e "</dependencies>\\n" >> %{_mavendepmapdir}/maven2-depmap.xml
147
148# JAVA macros specific for PLD
149
150# Directory for tomcat context configuration files
151%_tomcatconfdir /etc/tomcat/Catalina/localhost
152
153# Tomcat cache path
154%_tomcatcachedir %{_sharedstatedir}/tomcat/work/Catalina/localhost
155
156# Clear tomcat cache
157# Author: Paweł Zuzelski <pawelz@pld-linux.org>
158#
159# Usage:
160# %%tomcat_clear_cache appname
161#
162# Call this script in %postun scriptlet. It will remove compiled jsps related to
163# given app.
164#
165%tomcat_clear_cache() %{!?1:ERROR}%{?2:ERROR} %{__rm} -rf %{_tomcatcachedir}/%1
This page took 0.07394 seconds and 4 git commands to generate.