1 |
# (kamil) Different packages have different releases.. currently antlr_release = python_runtime_release |
2 |
|
3 |
%global with_bootstrap 0 |
4 |
|
5 |
%global antlr_version 3.4 |
6 |
#%global python_runtime_version 3.1.3 |
7 |
%global javascript_runtime_version 3.1 |
8 |
|
9 |
Summary: ANother Tool for Language Recognition |
10 |
Name: antlr3 |
11 |
Version: %{antlr_version} |
12 |
Release: %mkrel 3 |
13 |
URL: http://www.antlr.org/ |
14 |
Source0: http://www.antlr.org/download/antlr-%{antlr_version}.tar.gz |
15 |
Source1: http://www.antlr.org/download/C/libantlr3c-%{antlr_version}.tar.gz |
16 |
Source2: http://www.antlr.org/download/Python/antlr_python_runtime-%{python_runtime_version}.tar.gz |
17 |
Source3: http://www.antlr.org/download/antlr-javascript-runtime-%{javascript_runtime_version}.zip |
18 |
Source5: antlr3 |
19 |
%if %{with_bootstrap} |
20 |
Source6: settings.xml |
21 |
Source7: http://www.antlr.org/download/antlr-%{antlr_version}.jar |
22 |
Source8: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/antlr/antlr3-maven-plugin/%{antlr_version}/antlr3-maven-plugin-%{antlr_version}.jar |
23 |
%endif |
24 |
Source9: antlr-runtime-MANIFEST.MF |
25 |
License: BSD |
26 |
Group: Development/Libraries |
27 |
BuildRequires: java-devel >= 1:1.6.0 |
28 |
BuildRequires: jpackage-utils |
29 |
BuildRequires: maven |
30 |
BuildRequires: maven-enforcer-plugin |
31 |
BuildRequires: maven-plugin-bundle |
32 |
BuildRequires: maven-assembly-plugin |
33 |
BuildRequires: maven-shared-reporting-impl |
34 |
BuildRequires: maven-surefire-provider-junit4 |
35 |
BuildRequires: buildnumber-maven-plugin |
36 |
BuildRequires: junit |
37 |
BuildRequires: tomcat-servlet-3.0-api |
38 |
BuildRequires: stringtemplate4 |
39 |
BuildRequires: stringtemplate |
40 |
BuildRequires: felix-parent |
41 |
BuildRequires: zip |
42 |
%if ! %{with_bootstrap} |
43 |
BuildRequires: antlr3-tool >= 3.2 |
44 |
%endif |
45 |
|
46 |
# we don't build it now |
47 |
Obsoletes: antlr3-gunit < 3.2-15 |
48 |
|
49 |
%description |
50 |
ANother Tool for Language Recognition, is a language tool |
51 |
that provides a framework for constructing recognizers, |
52 |
interpreters, compilers, and translators from grammatical |
53 |
descriptions containing actions in a variety of target languages. |
54 |
|
55 |
%package tool |
56 |
Group: Development/Libraries |
57 |
Summary: ANother Tool for Language Recognition |
58 |
BuildArch: noarch |
59 |
Requires: jpackage-utils |
60 |
Requires: java >= 1:1.6.0 |
61 |
Provides: %{name} = %{antlr_version}-%{release} |
62 |
Obsoletes: %{name} < %{antlr_version}-%{release} |
63 |
Requires: %{name}-java = %{antlr_version}-%{release} |
64 |
Requires: stringtemplate4 |
65 |
|
66 |
%description tool |
67 |
ANother Tool for Language Recognition, is a language tool |
68 |
that provides a framework for constructing recognizers, |
69 |
interpreters, compilers, and translators from grammatical |
70 |
descriptions containing actions in a variety of target languages. |
71 |
|
72 |
%package java |
73 |
Group: Development/Libraries |
74 |
Summary: Java run-time support for ANTLR-generated parsers |
75 |
BuildArch: noarch |
76 |
Requires: stringtemplate4 |
77 |
Requires: stringtemplate |
78 |
Requires: jpackage-utils |
79 |
Requires: java >= 1:1.6.0 |
80 |
|
81 |
%description java |
82 |
Java run-time support for ANTLR-generated parsers |
83 |
|
84 |
%package javascript |
85 |
Group: Development/Libraries |
86 |
Summary: Javascript run-time support for ANTLR-generated parsers |
87 |
Version: %{javascript_runtime_version} |
88 |
BuildArch: noarch |
89 |
|
90 |
%description javascript |
91 |
Javascript run-time support for ANTLR-generated parsers |
92 |
|
93 |
%package C |
94 |
Group: Development/Libraries |
95 |
Summary: C run-time support for ANTLR-generated parsers |
96 |
|
97 |
%description C |
98 |
C run-time support for ANTLR-generated parsers |
99 |
|
100 |
%package C-devel |
101 |
Group: Development/Libraries |
102 |
Summary: Header files for the C bindings for ANTLR-generated parsers |
103 |
Requires: %{name}-C = %{antlr_version}-%{release} |
104 |
|
105 |
%description C-devel |
106 |
Header files for the C bindings for ANTLR-generated parsers |
107 |
|
108 |
%package C-docs |
109 |
Group: Documentation |
110 |
Summary: API documentation for the C run-time support for ANTLR-generated parsers |
111 |
BuildArch: noarch |
112 |
BuildRequires: graphviz |
113 |
BuildRequires: doxygen |
114 |
Requires: %{name}-C = %{antlr_version}-%{release} |
115 |
|
116 |
%description C-docs |
117 |
This package contains doxygen documentation with instruction |
118 |
on how to use the C target in ANTLR and complete API description of the |
119 |
C run-time support for ANTLR-generated parsers. |
120 |
|
121 |
#%package python |
122 |
#Group: Development/Libraries |
123 |
#Summary: Python run-time support for ANTLR-generated parsers |
124 |
#BuildRequires: python-devel |
125 |
#BuildRequires: python-setuptools-devel |
126 |
#BuildArch: noarch |
127 |
#Version: %{python_runtime_version} |
128 |
# |
129 |
#%description python |
130 |
#Python run-time support for ANTLR-generated parsers |
131 |
|
132 |
%prep |
133 |
%setup -q -n antlr-%{antlr_version} -a 1 -a 2 -a 3 |
134 |
%if %{with_bootstrap} |
135 |
cp %{SOURCE6} settings.xml |
136 |
%endif |
137 |
sed -i "s,\${buildNumber},`cat %{_sysconfdir}/fedora-release` `date`," tool/src/main/resources/org/antlr/antlr.properties |
138 |
|
139 |
sed -i 's:<module>antlr3-maven-archetype</module>::' pom.xml |
140 |
sed -i 's:<module>gunit</module>::' pom.xml |
141 |
sed -i 's:<module>gunit-maven-plugin</module>::' pom.xml |
142 |
|
143 |
# compile for target 1.6, see BZ#842572 |
144 |
sed -i 's/jsr14/1.6/' antlr3-maven-archetype/src/main/resources/archetype-resources/pom.xml \ |
145 |
antlr3-maven-plugin/pom.xml \ |
146 |
gunit/pom.xml \ |
147 |
gunit-maven-plugin/pom.xml \ |
148 |
pom.xml \ |
149 |
runtime/Java/pom.xml \ |
150 |
tool/pom.xml |
151 |
|
152 |
# remove corrupted files: |
153 |
rm antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/._* |
154 |
rm gunit-maven-plugin/src/main/java/org/antlr/mojo/antlr3/._GUnitExecuteMojo.java |
155 |
|
156 |
|
157 |
%build |
158 |
|
159 |
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository |
160 |
mkdir -p $MAVEN_REPO_LOCAL |
161 |
|
162 |
%if %{with_bootstrap} |
163 |
# we need antlr3-maven-plugin in place |
164 |
sed -i -e \ |
165 |
"s|<url>__JPP_URL_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" \ |
166 |
settings.xml |
167 |
sed -i -e \ |
168 |
"s|<url>__JAVADIR_PLACEHOLDER__</url>|<url>file://`pwd`/external_repo</url>|g" \ |
169 |
settings.xml |
170 |
sed -i -e \ |
171 |
"s|<url>__MAVENREPO_DIR_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" \ |
172 |
settings.xml |
173 |
sed -i -e \ |
174 |
"s|<url>__MAVENDIR_PLUGIN_PLACEHOLDER__</url>|<url>file:///usr/share/maven2/plugins</url>|g" \ |
175 |
settings.xml |
176 |
|
177 |
mkdir -p $MAVEN_REPO_LOCAL/JPP/maven2/default_poms/ |
178 |
mkdir -p $MAVEN_REPO_LOCAL/org.antlr/ |
179 |
cp antlr3-maven-plugin/pom.xml $MAVEN_REPO_LOCAL/JPP/maven2/default_poms/JPP-antlr3-maven-plugin.pom |
180 |
# install prebuilt antlr and antlr3-maven-plugin into repository |
181 |
# Man, this is hackish. Hold your nose. |
182 |
cp %{SOURCE7} $MAVEN_REPO_LOCAL/org.antlr/antlr.jar |
183 |
cp %{SOURCE8} $MAVEN_REPO_LOCAL/org.antlr/antlr3-maven-plugin.jar |
184 |
%endif |
185 |
|
186 |
# Build antlr |
187 |
%if %{with_bootstrap} |
188 |
mvn-rpmbuild -s $(pwd)/settings.xml -Dmaven.repo.local=$MAVEN_REPO_LOCAL -Dmaven.test.skip=true -Dmaven.compile.target=1.6 install |
189 |
%else |
190 |
mvn-rpmbuild -Dmaven.repo.local=$MAVEN_REPO_LOCAL -Dmaven.test.skip=true -Dmaven.compile.target=1.6 install |
191 |
%endif |
192 |
|
193 |
# Build the plugin |
194 |
pushd antlr3-maven-plugin |
195 |
mvn-rpmbuild -Dmaven.repo.local=$MAVEN_REPO_LOCAL -Dmaven.compile.target=1.6 install javadoc:javadoc |
196 |
popd |
197 |
|
198 |
## Build the python runtime |
199 |
#pushd antlr_python_runtime-%{python_runtime_version} |
200 |
#%{__python} setup.py build |
201 |
#popd |
202 |
|
203 |
# Build the C runtime |
204 |
pushd libantlr3c-%{antlr_version}-beta4 |
205 |
autoreconf -fi |
206 |
%configure --disable-abiflags --enable-debuginfo \ |
207 |
%ifarch x86_64 ppc64 s390x sparc64 |
208 |
--enable-64bit |
209 |
%else |
210 |
%{nil} |
211 |
%endif |
212 |
|
213 |
sed -i "s/CFLAGS = .*/CFLAGS = $RPM_OPT_FLAGS/" Makefile |
214 |
make %{?_smp_mflags} |
215 |
doxygen -u # update doxygen configuration file |
216 |
doxygen # build doxygen documentation |
217 |
popd |
218 |
|
219 |
# inject OSGi manifests |
220 |
mkdir -p META-INF |
221 |
cp -p %{SOURCE9} META-INF/MANIFEST.MF |
222 |
touch META-INF/MANIFEST.MF |
223 |
zip -u runtime/Java/target/antlr-runtime-%{antlr_version}.jar META-INF/MANIFEST.MF |
224 |
|
225 |
%install |
226 |
mkdir -p $RPM_BUILD_ROOT{%{_javadir},%{_mavenpomdir},%{_bindir},%{_datadir}/antlr,%{_mandir}} |
227 |
|
228 |
# install maven POMs |
229 |
install -pm 644 pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-antlr3-master.pom |
230 |
%add_maven_depmap JPP-antlr3-master.pom |
231 |
|
232 |
install -pm 644 runtime/Java/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-antlr3-runtime.pom |
233 |
install -pm 644 tool/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-antlr3.pom |
234 |
install -pm 644 antlr3-maven-plugin/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-antlr3-maven-plugin.pom |
235 |
install -pm 644 gunit-maven-plugin/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-maven-gunit-plugin.pom |
236 |
|
237 |
# install jars |
238 |
install -m 644 runtime/Java/target/antlr-runtime-*.jar \ |
239 |
$RPM_BUILD_ROOT%{_datadir}/java/antlr3-runtime.jar |
240 |
%add_maven_depmap JPP-antlr3-runtime.pom antlr3-runtime.jar |
241 |
|
242 |
install -m 644 tool/target/antlr-*.jar \ |
243 |
$RPM_BUILD_ROOT%{_datadir}/java/antlr3.jar |
244 |
%add_maven_depmap JPP-antlr3.pom antlr3.jar |
245 |
|
246 |
install -m 644 antlr3-maven-plugin/target/%{name}-maven-plugin-%{antlr_version}.jar \ |
247 |
$RPM_BUILD_ROOT%{_datadir}/java/%{name}-maven-plugin.jar |
248 |
%add_maven_depmap JPP-%{name}-maven-plugin.pom %{name}-maven-plugin.jar |
249 |
|
250 |
# We disable gunit because it currently fails to build, maybe after upgrade? |
251 |
#install gunit/target/gunit-%{antlr_version}.jar \ |
252 |
# $RPM_BUILD_ROOT%{_datadir}/java/gunit.jar |
253 |
|
254 |
#install -m 644 gunit-maven-plugin/target/maven-gunit-plugin-%{antlr_version}.jar \ |
255 |
# $RPM_BUILD_ROOT%{_datadir}/java/maven-gunit-plugin.jar |
256 |
#%%add_maven_depmap JPP-maven-gunit-plugin.pom maven-gunit.plugin.jar |
257 |
|
258 |
|
259 |
# install wrapper script |
260 |
install -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{_bindir}/antlr3 |
261 |
|
262 |
## install python runtime |
263 |
#pushd antlr_python_runtime-%{python_runtime_version} |
264 |
#%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT |
265 |
#chmod a+x $RPM_BUILD_ROOT%{python_sitelib}/antlr_python_runtime-* |
266 |
#popd |
267 |
|
268 |
# install C runtime |
269 |
pushd libantlr3c-%{antlr_version}-beta4 |
270 |
make DESTDIR=$RPM_BUILD_ROOT install |
271 |
rm $RPM_BUILD_ROOT%{_libdir}/libantlr3c.{a,la} |
272 |
pushd api/man/man3 |
273 |
for file in `ls -1 * | grep -vi "^antlr3"`; do |
274 |
mv $file antlr3-$file |
275 |
done |
276 |
sed -i -e 's,^\.so man3/pANTLR3,.so man3/antlr3-pANTLR3,' `grep -rl 'man3/pANTLR3' .` |
277 |
gzip * |
278 |
popd |
279 |
mv api/man/man3 $RPM_BUILD_ROOT%{_mandir}/ |
280 |
rmdir api/man |
281 |
popd |
282 |
|
283 |
# install javascript runtime |
284 |
pushd antlr-javascript-runtime-%{javascript_runtime_version} |
285 |
install -pm 644 *.js $RPM_BUILD_ROOT%{_datadir}/antlr/ |
286 |
popd |
287 |
|
288 |
%post C -p /sbin/ldconfig |
289 |
|
290 |
%postun C -p /sbin/ldconfig |
291 |
|
292 |
%files tool |
293 |
%doc tool/{README.txt,LICENSE.txt,CHANGES.txt} |
294 |
%{_javadir}/antlr3.jar |
295 |
%{_javadir}/antlr3-maven*.jar |
296 |
%{_bindir}/antlr3 |
297 |
|
298 |
#%files python |
299 |
#%doc tool/LICENSE.txt |
300 |
#%{python_sitelib}/antlr3/* |
301 |
#%{python_sitelib}/antlr_python_runtime-* |
302 |
|
303 |
%files C |
304 |
%doc tool/LICENSE.txt |
305 |
%{_libdir}/libantlr3c.so |
306 |
|
307 |
%files C-devel |
308 |
%{_includedir}/antlr3* |
309 |
%{_mandir}/man3/* |
310 |
|
311 |
%files C-docs |
312 |
%doc libantlr3c-%{antlr_version}-beta4/api/ |
313 |
|
314 |
%files java |
315 |
%doc tool/LICENSE.txt |
316 |
%{_javadir}/*runtime*.jar |
317 |
%{_mavenpomdir}/*.pom |
318 |
%config %{_mavendepmapfragdir}/antlr3 |
319 |
|
320 |
%files javascript |
321 |
%doc tool/LICENSE.txt |
322 |
%{_datadir}/antlr/ |
323 |
|