Package llvm: Specfile

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
%def_disable doxygen
%def_with ocaml

%define gccbootstrap 0

Name: llvm
Version: 3.3
Release: alt2
Summary: The Low Level Virtual Machine
Group: Development/C
License: NCSA
Url: http://llvm.org/

Source0: http://llvm.org/releases/%version/llvm-%version.src.tar.gz
Source1: http://llvm.org/releases/%version/cfe-%version.src.tar.gz
Source2: http://llvm.org/releases/%version/compiler-rt-%version.src.tar.gz
Source3: http://llvm.org/releases/%version/clang-tools-extra-%version.src.tar.gz

Patch1: llvm+clang-3.3-alt-add-alt-triplet.patch

BuildPreReq: /proc

%if %gccbootstrap
BuildRequires: gcc-c++
%else
BuildRequires: clang
%endif

# Automatically added by buildreq on Thu Aug 29 2013 (-ba)
# optimized out: elfutils gnu-config groff-base libstdc++-devel llvm ocaml ocaml-runtime perl-Encode perl-Pod-Escapes perl-Pod-Simple perl-Term-ANSIColor perl-podlators python-base python-modules rpm-build-ocaml tcl
BuildRequires: chrpath dejagnu libstdc++-devel groff-extra groff-ps libffi-devel perl-Pod-Parser perl-devel python-modules-compiler python-modules-unittest zip

%if_with ocaml
BuildRequires: ocamldoc ocaml
%endif

%if_enabled doxygen
BuildRequires: doxygen graphviz fonts-ttf-dejavu
%endif

%description
LLVM is a compiler infrastructure designed for compile-time,
link-time, runtime, and idle-time optimization of programs from
arbitrary programming languages.  The compiler infrastructure includes
mirror sets of programming tools as well as libraries with equivalent
functionality.

%package devel
Summary: Libraries and header files for LLVM
Group: Development/C
Requires: %name = %version-%release

%description devel
This package contains library and header files needed to develop new
native programs that use the LLVM infrastructure.

%package devel-static
Summary: Static libraries for LLVM
Group: Development/C
Requires: %name-devel = %version-%release

%description devel-static
This package contains static libraries needed to develop new
native programs that use the LLVM infrastructure.

%package doc
Summary: Documentation for LLVM
Group: Documentation
BuildArch: noarch
Requires: %name = %version-%release

%description doc
Documentation for the LLVM compiler infrastructure.

%package -n clang
Summary: A C language family frontend for LLVM
License: NCSA
Group: Development/C
Requires: gcc = %__gcc_version

%description -n clang
clang: noun
    1. A loud, resonant, metallic sound.
    2. The strident call of a crane or goose.
    3. C-language family front-end toolkit.

The goal of the Clang project is to create a new C, C++, Objective C
and Objective C++ front-end for the LLVM compiler. Its tools are built
as libraries and designed to be loosely-coupled and extendable.

%package -n clang-devel
Summary: Header files for clang
Group: Development/C
Requires: clang = %version-%release

%description -n clang-devel
This package contains header files for the Clang compiler.

%package -n clang-analyzer
Summary: A source code analysis framework
License: NCSA
Group: Development/C
Requires: clang = %version-%release

%description -n clang-analyzer
The Clang Static Analyzer consists of both a source code analysis
framework and a standalone tool that finds bugs in C and Objective-C
programs. The standalone tool is invoked from the command-line, and is
intended to run in tandem with a build of a project or code base.

%package -n clang-doc
Summary: Documentation for Clang
Group: Documentation
BuildArch: noarch
Requires: %name = %version-%release

%description -n clang-doc
Documentation for the Clang compiler front-end.

%package apidoc
Summary: API documentation for LLVM
Group: Development/C
BuildArch: noarch
Requires: %name-docs = %version-%release

%description apidoc
API documentation for the LLVM compiler infrastructure.

%package -n clang-apidoc
Summary: API documentation for Clang
Group: Development/Languages
BuildArch: noarch
Requires: clang-doc = %version-%release

%description -n clang-apidoc
API documentation for the Clang compiler.

%package ocaml
Summary: OCaml binding for LLVM
Group: Development/Functional
Requires: %name = %version-%release
Requires: ocaml-runtime

%description ocaml
OCaml binding for LLVM.

%package ocaml-devel
Summary: Development files for %name-ocaml
Group: Development/Functional
Requires: %name-devel = %version-%release
Requires: %name-ocaml = %version-%release
Requires: ocaml

%description ocaml-devel
The %name-ocaml-devel package contains libraries and signature files
for developing applications that use %name-ocaml.

%package ocaml-doc
Summary: Documentation for LLVM's OCaml binding
Group: Documentation
BuildArch: noarch
Requires: %name-ocaml = %version-%release

%description ocaml-doc
HTML documentation for LLVM's OCaml binding.

%add_python_req_skip AppKit

%prep
%setup -n llvm-%version.src -a1 -a2 -a3
mv cfe-%version.src tools/clang
mv clang-tools-extra-%version.src tools/clang/tools/extra
mv compiler-rt-%version.src projects/compiler-rt

%patch1 -p1
sed -i "s|%{version}svn|%version|g" configure
sed -i 's|/lib /usr/lib $lt_ld_extra|%_libdir $lt_ld_extra|' configure

# build sets DOT_PATH = /usr/bin/dot, but _PATH_ is /usr/bin
find -name doxygen.cfg.in | xargs sed -i 's,\(^DOT_PATH[[:blank:]]*=\).*,\1,'
#sed -i 's/\(OmitFramePointer := \).*/\1/' Makefile.rules

# some strange failing tests
rm tools/clang/test/Driver/{android-standalone,linux-header-search,mips-cs-header-search}.cpp

%build
mkdir build
cd build

%if %gccbootstrap == 0
CC=clang
CXX=clang++
export CC CXX
%endif

%define  _configure_script ../configure
%configure \
        --enable-cxx11 \
        --enable-optimized \
        --disable-assertions \
        --enable-targets=x86,x86_64,arm,aarch64,cpp,nvptx \
        --enable-experimental-targets=R600 \
        --enable-jit \
        --enable-shared \
        --enable-libffi \
	%{subst_enable doxygen} \
        --with-c-include-dirs=%_includedir:%_libdir/gcc/%_arch-%_vendor-%_os/%__gcc_version/include

# FIXME file this
# configure does not properly specify libdir
sed -i 's|(PROJ_prefix)/lib|(PROJ_prefix)/%_lib|g' Makefile.config
# llvm-config.cpp hardcodes lib in it
sed -i 's|ActiveLibDir = ActivePrefix + "/lib"|ActiveLibDir = ActivePrefix + "/%_lib"|g' ../tools/llvm-config/llvm-config.cpp

%make_build REQUIRES_RTTI=1 KEEP_SYMBOLS=1 OPTIMIZE_OPTION="%optflags" VERBOSE=1

%if_enabled doxygen
# hack to build docs during %%build, not %%install
for docdir in docs/ tools/clang/docs/; do
	sed -i "\,^doxygen: ,s,regendoc ,," $docdir/Makefile
	make VERBOSE=1 regendoc -C $docdir
	make VERBOSE=1 doxygen -C $docdir
done
%endif

%check
cd build
make check 2>&1 | tee llvm-testlog.txt

pushd tools/clang
make test 2>&1 | tee clang-testlog.txt
popd

%install
cd build

%makeinstall_std KEEP_SYMBOLS=1 VERBOSE=1 PROJ_docsdir=/moredocs

# Static analyzer not installed by default:
# http://clang-analyzer.llvm.org/installation#OtherPlatforms
mkdir -p %buildroot%_libdir/clang-analyzer
# create launchers
for f in scan-{build,view}; do
  ln -s %_libdir/clang-analyzer/$f/$f %buildroot%_bindir/$f
done

pushd ../tools/clang/tools
cp -pr scan-{build,view} %buildroot%_libdir/clang-analyzer/
popd

# Move documentation back to build directory
rm -rf moredocs
mv %buildroot/moredocs .
rm -f moredocs/*.tar.gz
rm -f moredocs/ocamldoc/html/*.tar.gz

# and separate the apidoc
%if_enabled doxygen
cp -al moredocs/html/doxygen apidoc
cp -al tools/clang/docs/doxygen/html clang-apidoc
%endif

# And prepare Clang documentation
rm -rf clang-docs
mkdir clang-docs
for f in LICENSE.TXT NOTES.txt README.txt; do
  ln ../tools/clang/$f clang-docs/
done
rm -rf ../tools/clang/docs/{doxygen*,Makefile*,*.graffle,tools}
subst 's|^\(DIRS.*\) docs\(.*\)|\1\2|' ../tools/clang/Makefile

# Get rid of erroneously installed example files.
rm -f %buildroot%_libdir/*LLVMHello.*
rm -f %buildroot%_libdir/*BugpointPasses.*

file %buildroot%_bindir/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
file %buildroot%_libdir/*.so | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d

# remove documentation makefiles:
# they require the build directory to work
find examples -name 'Makefile' -delete

# need for build cmake projects
mkdir -p %buildroot%_datadir/CMake/Modules
install -p -m644 ../cmake/modules/*.cmake %buildroot%_datadir/CMake/Modules
ln -s LLVM-Config.cmake %buildroot%_datadir/CMake/Modules/LLVMConfig.cmake

%files
%doc CREDITS.TXT LICENSE.TXT README.txt build/llvm-testlog.txt
%_bindir/bugpoint
%_bindir/llc
%_bindir/lli
%exclude %_bindir/llvm-config
%_bindir/llvm*
%_bindir/opt
%_bindir/macho-dump
%_libdir/*.so
%exclude %_libdir/libclang.so
%_mandir/man1/*.1.*
%exclude %_mandir/man1/clang.1.*

%files devel
%_bindir/llvm-config
%_includedir/llvm
%_includedir/llvm-c
%_datadir/CMake/Modules

%files devel-static
%_libdir/*.a

%files -n clang
%doc build/clang-docs/* build/tools/clang/clang-testlog.txt
%_bindir/clang*
%_bindir/cpp11-migrate
%_bindir/c-index-test
%prefix/lib/clang
%_libdir/libclang.so
%_mandir/man1/clang.1.*

%files -n clang-devel
%_includedir/clang
%_includedir/clang-c

%files -n clang-analyzer
%_bindir/scan-build
%_bindir/scan-view
%_libdir/clang-analyzer

%if_with ocaml
%files ocaml
%_libdir/ocaml/*.cma
%_libdir/ocaml/*.cmi

%files ocaml-devel
%_libdir/ocaml/META.llvm
%_libdir/ocaml/*.a
%_libdir/ocaml/*.cmx*
%_libdir/ocaml/*.mli

%files ocaml-doc
%doc build/moredocs/ocamldoc/html/*
%endif

%if_enabled doxygen
%files -n clang-doc
%doc tools/clang/docs

%files doc
%doc examples build/moredocs/html

%files apidoc
%doc build/apidoc

%files -n clang-apidoc
%doc build/clang-apidoc
%endif

%changelog
* Fri Aug 30 2013 Gleb F-Malinovskiy <glebfm@altlinux.org> 3.3-alt2
- build with clang
- clang: add versioned R: gcc
- llvm:
 + drop ld.so.conf file
 + package static libraries in devel-static subpackage

* Mon Aug 19 2013 Gleb F-Malinovskiy <glebfm@altlinux.org> 3.3-alt1
- New version

* Tue Apr 23 2013 Dmitry V. Levin <ldv@altlinux.org> 3.2-alt3
- Fixed build to enable proper debuginfo information.

* Sat Mar 09 2013 Valery Inozemtsev <shrek@altlinux.ru> 3.2-alt2
- update R600 target to mesa-9.1

* Sat Feb 23 2013 Valery Inozemtsev <shrek@altlinux.ru> 3.2-alt1
- 3.2

* Sun May 20 2012 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 2.9-alt1
- Version up (by george@) (ALT #27328)

* Tue Dec 27 2011 Alexey Shabalin <shaba@altlinux.ru> 2.8-alt2
- Rebuild with ocaml-3.12.1

* Fri Nov 05 2010 Vladimir Lettiev <crux@altlinux.ru> 2.8-alt1.1
- rebuilt with perl 5.12

* Thu Nov 04 2010 Fr. Br. George <george@altlinux.ru> 2.8-alt1
- Merge new version from Rawhide

* Fri Apr 30 2010 Fr. Br. George <george@altlinux.ru> 2.7-alt1
- Merge new varsion from RawHide

* Sun Mar 28 2010 Michel Salim <salimma@fedoraproject.org> - 2.7-0.1.pre1
- Update to first 2.7 pre-release

* Tue Oct 27 2009 Fr. Br. George <george@altlinux.ru> 2.6-alt1
- Version up

* Fri Sep 18 2009 Michel Salim <salimma@fedoraproject.org> - 2.6-0.6.pre2
- Update to 2.6 pre-release2
- -devel subpackage now virtually provides -static

* Wed Sep  9 2009 Michel Salim <salimma@fedoraproject.org> - 2.6-0.5.pre1
- Disable var tracking assignments on PPC

* Wed Sep  9 2009 Michel Salim <salimma@fedoraproject.org> - 2.6-0.4.pre1
- Don't adjust clang include dir; files there are noarch (bz#521893)
- Enable clang unit tests
- clang and clang-analyzer renamed; no longer depend on llvm at runtime

* Mon Sep  7 2009 Michel Salim <salimma@fedoraproject.org> - 2.6-0.3.pre1
- Package Clang's static analyzer tools

* Mon Sep  7 2009 Michel Salim <salimma@fedoraproject.org> - 2.6-0.2.pre1
- PIC is now enabled by default; explicitly disable on %%{ix86}

* Mon Sep  7 2009 Michel Salim <salimma@fedoraproject.org> - 2.6-0.1.pre1
- First 2.6 prerelease
- Enable Clang front-end
- Enable debuginfo generation

* Sat Sep  5 2009 Michel Salim <salimma@fedoraproject.org> - 2.5-6
- Disable assertions (needed by OpenGTL, bz#521261)
- Align spec file with upstream build instructions
- Enable unit tests

* Sat Aug 22 2009 Michel Salim <salimma@fedoraproject.org> - 2.5-5
- Only disable PIC on %%ix86; ppc actually needs it

* Sat Aug 22 2009 Michel Salim <salimma@fedoraproject.org> - 2.5-4
- Disable use of position-independent code on 32-bit platforms
  (buggy in LLVM <= 2.5)

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sat Mar 21 2009 Fr. Br. George <george@altlinux.ru> 2.5-alt1
- Import from FC, old package spec merged

* Wed Mar  4 2009 Michel Salim <salimma@fedoraproject.org> - 2.5-2
- Remove build scripts; they require the build directory to work

* Wed Mar  4 2009 Michel Salim <salimma@fedoraproject.org> - 2.5-1
- Update to 2.5
- Package build scripts (bug #457881)

* Tue Dec  2 2008 Michel Salim <salimma@fedoraproject.org> - 2.4-2
- Patched build process for the OCaml binding

* Tue Dec  2 2008 Michel Salim <salimma@fedoraproject.org> - 2.4-1
- Update to 2.4
- Package Ocaml binding

* Wed Jun 18 2008 Bryan O'Sullivan <bos@serpentine.com> - 2.3-2
- Add dependency on groff

* Wed Jun 18 2008 Bryan O'Sullivan <bos@serpentine.com> - 2.3-1
- LLVM 2.3

* Thu May 29 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 2.2-4
- fix license tags

* Wed Mar  5 2008 Bryan O'Sullivan <bos@serpentine.com> - 2.2-3
- Fix compilation problems with gcc 4.3

* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.2-2
- Autorebuild for GCC 4.3

* Sun Jan 20 2008 Bryan O'Sullivan <bos@serpentine.com> - 2.1-2
- Fix review comments

* Sun Jan 20 2008 Bryan O'Sullivan <bos@serpentine.com> - 2.1-1
- Initial version