-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.targets
2045 lines (1669 loc) · 75.7 KB
/
Makefile.targets
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
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# reset makeflags for sub make calls
override MAKEFLAGS:=
# make sure this file is not executed in parallel
.NOTPARALLEL:
# define directories
export BELLE2_EXTERNALS_DIR := $(shell pwd)
export BELLE2_EXTERNALS_SUBDIR := $(BELLE2_ARCH)/$(BELLE2_EXTERNALS_OPTION)
export PATCHDIR := $(BELLE2_EXTERNALS_DIR)/patches
export EXTDIR := $(BELLE2_EXTERNALS_DIR)/$(BELLE2_EXTERNALS_SUBDIR)
export EXTSRCDIR := $(BELLE2_EXTERNALS_DIR)/src
export EXTBUILDDIR := $(BELLE2_EXTERNALS_DIR)/build/$(BELLE2_EXTERNALS_SUBDIR)
export EXTINCDIR := $(EXTDIR)/include
export EXTLIBDIR := $(EXTDIR)/lib
export EXTBINDIR := $(EXTDIR)/bin
export EXTCOMDIR := $(BELLE2_EXTERNALS_DIR)/$(BELLE2_ARCH)/common
export EXTSHRDIR := $(EXTDIR)/share
export ROOTSYS := $(EXTCOMDIR)/root
# download script to get and extract sources
export DOWNLOAD := $(BELLE2_EXTERNALS_DIR)/tools/download.sh
# function to get a relative path in a recipe. This will return a backtick
# string to be expanded by the shell which is needed to get the current shell
# directory. Relpath has been added to python2.6 so we should be fine
# - $(call relpath,$(EXTSRCDIR)) returns a shell expression to evaluate
# $EXTSRCDIR relative to the current directory
# - $(call relpath,$(EXTINCDIR),$(EXTDIR)) returns a shell expression to
# evaluate $EXTINCDIR relative to $EXTDIR
# if needed as make variable wrap it in a shell echo call $(shell echo $(call
# relpath,...))
relpath=`b2anypython -c 'import os,sys; print(os.path.relpath(*sys.argv[1:]))' $(1) $(2)`
# get rid of localization
export LANG:=C
# set number of parallel jobs to the number of processors
ifeq ($(shell uname),Darwin)
NPROCESSES:=$(shell sysctl -n hw.ncpu 2> /dev/null)
else
NPROCESSES:=$(shell grep "physical id" /proc/cpuinfo 2> /dev/null | wc -l)
ifeq ($(NPROCESSES),0)
NPROCESSES:=$(shell grep processor /proc/cpuinfo 2> /dev/null | wc -l)
endif
endif
ifdef BELLE2_MAKE_NPROCESSES
NPROCESSES:=$(BELLE2_MAKE_NPROCESSES)
endif
ifeq ($(NPROCESSES),0)
NPROCESSES:=1
endif
# Default compiler: gcc/g++
export CC:=gcc
export CXX:=g++
# By default, we provide DWARF debug information even for optimized packages, as
# it has uses for dynamic analysis like profiling. You can opt out of it for
# selected packages using the following target file name prefix filter.
#
# The current approach has several caveats that one should keep in mind:
#
# - You must match every make target used during the building and installation
# of a package, including file-based targets like binutils' "$(EXTBINDIR)/ld".
# - To work around the fact that make's filter functions only support a single %
# wildcard, which makes it hard to match the middle of a file name, we trim
# the directory part of the file name before matching. This approach is not
# flexible enough to e.g. match the "xz" part of "$(EXTSRCDIR)/xz/INSTALL".
# - Prefix-based filtering can also overshoot (e.g. "ld" is a prefix of "ldd"
# and "ldap"). Please make sure that your prefixes don't accidentally affect
# other targets in this makefile, extending the filtering logic as necessary.
#
OPTDEB_EXCLUDE_PREFIXES:=astyle bazel binutils clang cmake cppcheck doxygen \
gcc gdb git git-lfs ld llvm pkg-config rclone valgrind
OPTDEB_EXCLUDE_PATTERNS:=$(OPTDEB_EXCLUDE_PREFIXES:%=%%)
OPTDEB_ENABLED=$(filter-out $(OPTDEB_EXCLUDE_PATTERNS),$(notdir $@))
# set debug or optimization options
ifeq ($(BELLE2_EXTERNALS_OPTION),debug)
# suffix for the install target when running "make install". For opt/common
# mode this can be set to "-strip" to install stripped versions of the programs
# to greatly reduce disk size, especially for gcc
export INSTALL_TARGET_SUFFIX:=
export CONFIGURE_CXXFLAGS:=-g
export CONFIGURE_COMMON_FLAGS:=--enable-debug
export CMAKE_COMMON_FLAGS:=-DCMAKE_BUILD_TYPE=RelWithDebInfo
export CMAKE_TARGET_SUFFIX:=
export BOOST_OPTION:=variant=debug
export GEANT4_OPTION:=
else
# make if (option=opt or option=common) using the filter: filter will only
# return common or opt if they are in the EXTERNALS_OPTION so if the option is
# anything else we get an empty string
ifneq (, $(filter $(BELLE2_EXTERNALS_OPTION), common opt))
export INSTALL_TARGET_SUFFIX=$(if $(OPTDEB_ENABLED),,-strip)
export CONFIGURE_CXXFLAGS=$(if $(OPTDEB_ENABLED),-g)
export CONFIGURE_COMMON_FLAGS=$(if $(OPTDEB_ENABLED),--enable-debug)
export CMAKE_COMMON_FLAGS=-DCMAKE_BUILD_TYPE=$(if $(OPTDEB_ENABLED),RelWithDebInfo,Release)
export CMAKE_TARGET_SUFFIX=$(if $(OPTDEB_ENABLED),,/strip)
export BOOST_OPTION:=variant=release
export GEANT4_OPTION:=-DGEANT4_BUILD_STORE_TRAJECTORY=OFF -DGEANT4_BUILD_VERBOSE_CODE=OFF
else
ifeq ($(BELLE2_EXTERNALS_OPTION),intel)
export CC:=icc
export CXX:=icpc
export CXXCPP:=icc -E
export FC:=ifort
export AR:=xiar
export LD:=xild
export BOOST_OPTION:=variant=release toolset=intel
export GEANT4_OPTION:=-DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icc -DGEANT4_BUILD_STORE_TRAJECTORY=OFF -DGEANT4_BUILD_VERBOSE_CODE=OFF
else
$(error Unknown externals build option. Please source the b2setup script.)
endif
endif
endif
export ROOT_OPTION:=
ifdef ORACLE_HOME
ROOT_OPTION += -Doracle=ON -DORACLE_LIBRARY_OCCI=$(ORACLE_HOME) -DORACLE_INCLUDE_DIR=$(ORACLE_HOME)/sdk/include/
endif
# use built externals packages for building other external packages
export CPPFLAGS=-isystem$(EXTINCDIR)
export LDFLAGS=-L$(EXTLIBDIR)
# check for xerces xml library to enable GDML persistency in geant4 which is a
# useful but not necessary tool to track changes in the geometry
ifeq ($(shell pkg-config --exists xerces-c 2> /dev/null; echo $$?),0)
GEANT4_OPTION+= -DGEANT4_USE_GDML=ON
endif
# check for graphics packages needed to built ROOT's OpenGL support
GL_GLU_EXISTS:=$(shell pkg-config --exists gl glu 2> /dev/null; echo $$?)
ifeq ($(GL_GLU_EXISTS),0)
ROOT_OPTION+= -Dopengl=ON -Dbuiltin_glew=ON
endif
# check for graphics packages
GL_XMU_EXISTS:=$(shell pkg-config --exists gl xmu 2> /dev/null; echo $$?)
ifeq ($(GL_XMU_EXISTS),0)
GEANT4_OPTION+= -D g4vis_build_openglx_driver='y' -D g4vis_use_openglx='y'
endif
# cmake executable including common options
CMAKE=cmake -DCMAKE_INSTALL_PREFIX=$(EXTDIR) -GNinja $(CMAKE_COMMON_FLAGS)
# now path for current option and common packages, could be two times the same
export PATH := $(ROOTSYS)/bin:$(EXTBINDIR):$(EXTCOMDIR)/bin:$(PATH)
ifeq ($(shell uname),Darwin)
export DYLD_LIBRARY_PATH := $(ROOTSYS)/lib:$(EXTLIBDIR):$(EXTCOMDIR)/lib:$(DYLD_LIBRARY_PATH)
else
export LD_LIBRARY_PATH := $(ROOTSYS)/lib:$(EXTLIBDIR):$(EXTCOMDIR)/lib:$(LD_LIBRARY_PATH)
endif
# directory we want to create
DIRECTORIES:=$(EXTSRCDIR) $(EXTBUILDDIR) $(EXTLIBDIR) $(EXTBINDIR)
# directories we want to share between all options
SHARED_DIRECTORIES:=$(EXTINCDIR) $(EXTSHRDIR)
# when called without targets, do nothing
donothing: ;
dirs: $(DIRECTORIES) $(SHARED_DIRECTORIES)
# make a lib64 -> lib symlink on 64bit platforms because gcc decides it needs
# to install some libraries in lib64
ifeq ($(shell uname -m),x86_64)
@cd $(EXTDIR) && ln -sfT lib lib64
endif
# make a libexec -> lib symlink too because otherwise git tools will be in "lib"
# on some distros and in "libexec" on others
@cd $(EXTDIR) && ln -sfT lib libexec
# pkg config wrapper using correct paths and being relocatable (if .pc files are fixed)
pkg-config-wrapper: $(EXTBINDIR)/pkg-config
# nothing to do for src
pkg-config-wrapper.src: ;
$(EXTBINDIR)/pkg-config: tools/pkg-config
@echo "Installing pkg-config wrapper"
@install $< $@
relocatable_fixes:
# Fix absolute paths in .pc files for pkg-config and in python scripts
-@sed -i "s:$(BELLE2_EXTERNALS_DIR):\$${BELLE2_EXTERNALS_DIR}:g" $(EXTLIBDIR)/pkgconfig/*.pc 2>/dev/null
# and in CMAKE files
-@sed -i "s:$(BELLE2_EXTERNALS_DIR):\$$ENV{BELLE2_EXTERNALS_DIR}:g" $(EXTLIBDIR)/cmake/**/*.cmake 2>/dev/null
# Fix absolute paths in pip packages and other python scripts id python is installed.
# But only if python3 actually exists
@if [ -n "$$(which python3 | grep -o $(BELLE2_EXTERNALS_DIR))" ]; then $(BELLE2_EXTERNALS_DIR)/tools/python_relocate.py $(EXTDIR) $(EXTBINDIR) `python3-config --configdir`; fi
# If we have root, also fix the root python scripts
@if [ -n "$$(which python3 | grep -o $(BELLE2_EXTERNALS_DIR))" ] && [ -n "$$(which root | grep -o $(BELLE2_EXTERNALS_DIR))" ]; then $(BELLE2_EXTERNALS_DIR)/tools/python_relocate.py $(EXTDIR) $(ROOTSYS)/bin; fi
# Replace hardlinks by symlinks as cvmfs complains about hardlinks
# But only if python3 actually exists
@if [ -n "$$(which python3 | grep -o $(BELLE2_EXTERNALS_DIR))" ]; then $(BELLE2_EXTERNALS_DIR)/tools/convert_hardlinks.py $(EXTDIR) $(BELLE2_EXTERNALS_DIR)/share; fi
# And finally split and strip all binaries except bazel because stripping bazel removes all functionality :?
# Also, exclude libraries in some python packages where stripping breaks them
@if [ -n "$$(which python3 | grep -o $(BELLE2_EXTERNALS_DIR))" ]; then \
$(BELLE2_EXTERNALS_DIR)/tools/strip_the_elves.py \
-j $(NPROCESSES) --exclude-dirs PIL scipy tables torchvision -e bin/bazel \
-e cpython-311 -e libpython3.11.so.1.0 -e bin/python -e libz -e libbz2 -e liblzma $(EXTDIR); \
fi
# create directories
$(DIRECTORIES):
@echo "create $@"
@mkdir -p $@
# create shared directories
$(SHARED_DIRECTORIES):
@echo "create shared $@"
@mkdir -p $(BELLE2_EXTERNALS_DIR)/$(notdir $@)
@cd $(dir $@) && ln -sf $(call relpath,$(BELLE2_EXTERNALS_DIR)/$(notdir $@))
ninja.src: $(EXTSRCDIR)/ninja
ninja: $(EXTBINDIR)/ninja
ninja.touch:
@rm -fr $(EXTBINDIR)/ninja
ninja.clean:
@rm -fr $(EXTBINDIR)/ninja
$(EXTSRCDIR)/ninja:
@echo "downloading Ninja"
$(DOWNLOAD) ninja ninja-linux-v1.10.2.zip https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip
$(EXTBINDIR)/ninja: $(EXTSRCDIR)/ninja
@echo "installing Ninja"
@install $(EXTSRCDIR)/ninja $(EXTBINDIR)/ninja
binutils: $(EXTBINDIR)/ld
binutils.src: $(EXTSRCDIR)/binutils
binutils.touch:
@rm -fr $(EXTBINDIR)/ld
$(EXTSRCDIR)/binutils:
@$(DOWNLOAD) binutils binutils-2.41.tar.bz2 http://ftp.gnu.org/gnu/binutils/binutils-2.41.tar.bz2
@cd $(EXTSRCDIR)/binutils
$(EXTBINDIR)/ld: $(EXTSRCDIR)/binutils
@echo "building binutils"
@mkdir -p $(EXTBUILDDIR)/binutils
#note: avoid propagating CXXFLAGS by explicitly unsetting in sub-shell (works in posix and csh)
@cd $(EXTBUILDDIR)/binutils && unset CXXFLAGS && $(EXTSRCDIR)/binutils/configure $(CONFIGURE_COMMON_FLAGS) \
--disable-werror --disable-multilib --enable-shared --enable-gold --prefix=$(EXTDIR) && \
make tooldir=$(EXTDIR) -j $(NPROCESSES) && \
make tooldir=$(EXTDIR) install$(INSTALL_TARGET_SUFFIX)
binutils.clean:
@echo "cleaning binutils"
@-cd $(EXTSRCDIR)/binutils/build && make distclean
@rm -rf $(EXTSRCDIR)/binutils
gmp: $(EXTLIBDIR)/libgmp.so
gmp.src: $(EXTSRCDIR)/gmp
$(EXTSRCDIR)/gmp:
@$(DOWNLOAD) gmp gmp-6.2.1.tar.xz https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
$(EXTLIBDIR)/libgmp.so: $(EXTSRCDIR)/gmp
@echo "Building gmp..."
@mkdir -p $(EXTBUILDDIR)/gmp
@cd $(EXTBUILDDIR)/gmp && \
$(EXTSRCDIR)/gmp/configure $(CONFIGURE_COMMON_FLAGS) --prefix=$(EXTDIR) && \
make -j $(NPROCESSES) && \
make install$(INSTALL_TARGET_SUFFIX)
gmp.clean:
@rm -rf $(EXTSRCDIR)/gmp
gmp.touch:
@rm $(EXTLIBDIR)/libgmp.so
mpfr: $(EXTLIBDIR)/libmpfr.so
mpfr.src: $(EXTSRCDIR)/mpfr
$(EXTSRCDIR)/mpfr:
@$(DOWNLOAD) mpfr mpfr-4.1.0.tar.xz http://www.mpfr.org/mpfr-4.1.0/mpfr-4.1.0.tar.xz
$(EXTLIBDIR)/libmpfr.so: $(EXTSRCDIR)/mpfr
@echo "Building mpfr..."
@mkdir -p $(EXTBUILDDIR)/mpfr
@cd $(EXTBUILDDIR)/mpfr && \
$(EXTSRCDIR)/mpfr/configure $(CONFIGURE_COMMON_FLAGS) \
--prefix=$(EXTDIR) \
--with-gmp-include=$(EXTINCDIR) --with-gmp-lib=$(EXTLIBDIR) && \
make -j $(NPROCESSES) && \
make install$(INSTALL_TARGET_SUFFIX)
mpfr.clean:
@rm -rf $(EXTSRCDIR)/mpfr
mpfr.touch:
@rm $(EXTLIBDIR)/libmpfr.so
mpc: $(EXTLIBDIR)/libmpc.so
mpc.src: $(EXTSRCDIR)/mpc
$(EXTSRCDIR)/mpc:
@$(DOWNLOAD) mpc mpc-1.2.1.tar.gz http://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz
$(EXTLIBDIR)/libmpc.so: $(EXTSRCDIR)/mpc
@echo "Building mpc..."
@mkdir -p $(EXTBUILDDIR)/mpc
@cd $(EXTBUILDDIR)/mpc && \
$(EXTSRCDIR)/mpc/configure $(CONFIGURE_COMMON_FLAGS) \
--prefix=$(EXTDIR) \
--with-gmp-include=$(EXTINCDIR) --with-gmp-lib=$(EXTLIBDIR) && \
make -j $(NPROCESSES) && \
make install$(INSTALL_TARGET_SUFFIX)
mpc.clean:
@rm -rf $(EXTSRCDIR)/mpc
mpc.touch:
@rm $(EXTLIBDIR)/libmpc.so
isl: $(EXTLIBDIR)/libisl.so
isl.src: $(EXTSRCDIR)/isl
$(EXTSRCDIR)/isl:
@$(DOWNLOAD) isl isl-0.26.tar.xz https://libisl.sourceforge.io/isl-0.26.tar.xz
$(EXTLIBDIR)/libisl.so: $(EXTSRCDIR)/isl
@echo "Building isl..."
@mkdir -p $(EXTBUILDDIR)/isl
@cd $(EXTBUILDDIR)/isl && \
$(EXTSRCDIR)/isl/configure $(CONFIGURE_COMMON_FLAGS) \
--prefix=$(EXTDIR) \
--with-gmp-prefix=$(EXTDIR) && \
make -j $(NPROCESSES) && \
make install$(INSTALL_TARGET_SUFFIX)
isl.clean:
@rm -rf $(EXTSRCDIR)/isl
isl.touch:
@rm $(EXTLIBDIR)/libisl.so
gcc: $(EXTBINDIR)/gcc
gcc.src: $(EXTSRCDIR)/gcc
$(EXTSRCDIR)/gcc:
@$(DOWNLOAD) gcc gcc-14.1.0.tar.xz http://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.xz
GCC_TARGET=$(shell gcc -dumpmachine)
$(EXTBINDIR)/gcc: $(EXTSRCDIR)/gcc
@echo "building gcc"
@mkdir -p $(EXTBUILDDIR)/gcc
# note: avoid propagating CXXFLAGS by explicitly unsetting in sub-shell (works in posix and csh)
# Also, gcc will *always* consider $prefix/include as system include dir and
# put it *after* /usr/local/include which breaks things. So, we choose another
# prefix but adjust the other directories to be like we want them. However,
# these directories need to be inside prefix. Since prefix cannot be EXTDIR or
# BELLE2_EXTERNALS_DIR as both contain an include dir the only option is
# $(BELLE2_EXTERNALS_DIR)/$(BELLE2_ARCH). As nothing gets installed in the
# prefix anymore this should be fine. It's not pretty though but
# alternatives are installing gcc completely separately or patching it.
# Now ROOT needs to see a c++ in the search path, otherwise it thinks there are
# no c++ std includes so we install the c++ includes in $(EXTINCDIR)/c++ but
# skip the version: there's only one gcc version per external version.
@cd $(EXTBUILDDIR)/gcc/ && unset CXXFLAGS && $(EXTSRCDIR)/gcc/configure --disable-multilib --disable-bootstrap \
--prefix=$(BELLE2_EXTERNALS_DIR)/$(BELLE2_ARCH) \
--exec-prefix=$(EXTDIR) --datarootdir=$(EXTSHRDIR) \
--target=$(GCC_TARGET) --host=$(GCC_TARGET) --build=$(GCC_TARGET) \
--with-gmp-include=$(EXTINCDIR) --with-gmp-lib=$(EXTLIBDIR) \
--with-mpfr-include=$(EXTINCDIR) --with-mpfr-lib=$(EXTLIBDIR) \
--with-mpc-include=$(EXTINCDIR) --with-mpc-lib=$(EXTLIBDIR) \
--with-isl-include=$(EXTINCDIR) --with-isl-lib=$(EXTLIBDIR) \
--with-gxx-include-dir=$(EXTINCDIR)/c++ --enable-languages=c,c++,fortran --without-system-libz && \
make -j $(NPROCESSES) && make install$(INSTALL_TARGET_SUFFIX)
# now remove the bloody empty directory gcc creates in prefix. but make sure
# it's actually empty
@[ $$(ls -A $(BELLE2_EXTERNALS_DIR)/$(BELLE2_ARCH)/include 2>/dev/null) ] && \
{ echo "$(BELLE2_EXTERNALS_DIR)/$(BELLE2_ARCH)/include not empty, something is wrong"; exit 1; } || exit 0
@rm -fr $(BELLE2_EXTERNALS_DIR)/$(BELLE2_ARCH)/include
gcc.clean:
@echo "cleaning gcc"
@rm -rf $(EXTBUILDDIR)/gcc
clang: $(EXTBINDIR)/clang++
clang.src: $(EXTSRCDIR)/llvm
clang.touch:
rm -fr $(EXTBINDIR)/clang++
$(EXTSRCDIR)/llvm:
@$(DOWNLOAD) llvm llvm-project-18.1.6.src.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.6/llvm-project-18.1.6.src.tar.xz
$(EXTBINDIR)/clang++: $(EXTSRCDIR)/llvm
@echo "building llvm/clang"
@mkdir -p $(EXTBUILDDIR)/llvm
@cd $(EXTBUILDDIR)/llvm && $(CMAKE) -S $(EXTSRCDIR)/llvm/llvm \
-DPython3_EXECUTABLE=`which python3` \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" && \
ninja -j $(NPROCESSES) install$(CMAKE_TARGET_SUFFIX)
valgrind: $(EXTBINDIR)/valgrind
valgrind.src: $(EXTSRCDIR)/valgrind
valgrind.touch:
@rm -fr $(EXTBINDIR)/valgrind
$(EXTSRCDIR)/valgrind:
@$(DOWNLOAD) valgrind valgrind-3.17.0.tar.bz2 http://sourceware.org/pub/valgrind/valgrind-3.17.0.tar.bz2
$(EXTBINDIR)/valgrind: $(EXTSRCDIR)/valgrind
@echo "building valgrind"
@cp -fa $< $(EXTBUILDDIR)
@cd $(EXTBUILDDIR)/valgrind && ./configure $(CONFIGURE_COMMON_FLAGS) --prefix=$(EXTDIR) --enable-silent-rules && \
make -j $(NPROCESSES) && make install$(INSTALL_TARGET_SUFFIX)
libxml2: $(EXTBINDIR)/xml2-config
libxml2.src: $(EXTSRCDIR)/libxml2
libxml2.clean:
@rm -fr $(EXTSRCDIR)/libxml
libxml2.touch:
@rm $(EXTBINDIR)/xml2-config
$(EXTSRCDIR)/libxml2:
@$(DOWNLOAD) libxml2 libxml2-2.9.13.tar.xz https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.13.tar.xz
$(EXTBINDIR)/xml2-config: $(EXTSRCDIR)/libxml2
@cd $< && ./configure $(CONFIGURE_COMMON_FLAGS) --prefix=$(EXTDIR) --enable-silent-rules --without-python && \
make -j $(NPROCESSES) && make install$(INSTALL_TARGET_SUFFIX)
#Fix absolute path in xml2-config and lib/xml2Conf.sh
@sed -i "s:$(BELLE2_EXTERNALS_DIR):\$${BELLE2_EXTERNALS_DIR}:g" $@
@sed -i "s:$(BELLE2_EXTERNALS_DIR):\$${BELLE2_EXTERNALS_DIR}:g" $(EXTLIBDIR)/xml2Conf.sh
libxslt: $(EXTBINDIR)/xslt-config
libxslt.src: $(EXTSRCDIR)/libxslt
libxslt.clean:
@rm -fr $(EXTSRCDIR)/libxml
libxslt.touch:
@rm $(EXTBINDIR)/xslt-config
$(EXTSRCDIR)/libxslt:
@$(DOWNLOAD) libxslt libxslt-1.1.35.tar.xz https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.35.tar.xz
$(EXTBINDIR)/xslt-config: $(EXTSRCDIR)/libxslt
@cd $< && ./configure $(CONFIGURE_COMMON_FLAGS) --prefix=$(EXTDIR) --enable-silent-rules --without-python && \
make -j $(NPROCESSES) && make install$(INSTALL_TARGET_SUFFIX)
#Fix absolute path in xslt-config and lib/xsltConf.sh
@sed -i "s:$(BELLE2_EXTERNALS_DIR):\$${BELLE2_EXTERNALS_DIR}:g" $@
@sed -i "s:$(BELLE2_EXTERNALS_DIR):\$${BELLE2_EXTERNALS_DIR}:g" $(EXTLIBDIR)/xsltConf.sh
libmd: $(EXTINCDIR)/md5.h
libmd.src: $(EXTSRCDIR)/libmd
libmd.touch:
@rm -f $(EXTINCDIR)/md5.h
$(EXTSRCDIR)/libmd:
@$(DOWNLOAD) libmd libmd-1.1.0.tar.xz https://libbsd.freedesktop.org/releases/libmd-1.1.0.tar.xz
$(EXTINCDIR)/md5.h: $(EXTSRCDIR)/libmd
@cd $< && ./configure $(CONFIGURE_COMMON_FLAGS) --prefix=$(EXTDIR) --enable-silent-rules && \
make -j $(NPROCESSES) && make install$(INSTALL_TARGET_SUFFIX)
libmd.clean:
@rm -fr $(EXTINCDIR)/md5.h
libbsd: $(EXTLIBDIR)/libbsd.so
libbsd.src: $(EXTSRCDIR)/libbsd
libbsd.touch:
@rm -f $(EXTLIBDIR)/libbsd.so
$(EXTSRCDIR)/libbsd:
@$(DOWNLOAD) libbsd libbsd-0.12.2.tar.xz https://libbsd.freedesktop.org/releases/libbsd-0.12.2.tar.xz
$(EXTLIBDIR)/libbsd.so: $(EXTSRCDIR)/libbsd
@echo "building libbsd"
@cp -fa $(EXTSRCDIR)/libbsd $(EXTBUILDDIR)
@cd $(EXTBUILDDIR)/libbsd && ./configure $(CONFIGURE_COMMON_FLAGS) --prefix=$(EXTDIR) --enable-silent-rules && \
make -j $(NPROCESSES) CPPFLAGS=-I$(EXTINCDIR) && make install$(INSTALL_TARGET_SUFFIX)
libbsd.clean:
@rm -fr $(EXTINCDIR)/bsd.h $(EXTLIBDIR)/libbsd*
zlib: $(EXTLIBDIR)/libz.so
zlib.src: $(EXTSRCDIR)/zlib
zlib.touch:
@rm -f $(EXTLIBDIR)/libz.so
$(EXTSRCDIR)/zlib:
@$(DOWNLOAD) zlib zlib-1.2.12.tar.gz http://zlib.net/fossils/zlib-1.2.12.tar.gz
# zlib: so basic that we only want it it common so we just do an in source build
$(EXTLIBDIR)/libz.so: $(EXTSRCDIR)/zlib
# Configuration fails for zlib-1.2.12 with CC=gcc but succeeds if CC is not set.
@cp -fa $(EXTSRCDIR)/zlib $(EXTBUILDDIR)
@cd $(EXTBUILDDIR)/zlib && CC= ./configure --prefix=$(EXTDIR) && \
make -j $(NPROCESSES) install
bzip2: $(EXTBINDIR)/bzip2
bzip2.src: $(EXTSRCDIR)/bzip2
bzip2.clean:
@rm -fr $(EXTSRCDIR)/bzip2
bzip2.touch:
@rm -fr $(EXTBINDIR)/bzip2
$(EXTSRCDIR)/bzip2:
@$(DOWNLOAD) bzip2 bzip2-1.0.8.tar.gz https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
$(EXTBINDIR)/bzip2: $(EXTSRCDIR)/bzip2
@cd $< && make -f Makefile-libbz2_so && mv libbz2.so* $(EXTLIBDIR)
@cd $< && make install PREFIX=$(EXTDIR)
# make links relative
@cd $(EXTBINDIR) && ln -fs bzdiff bzcmp && ln -fs bzgrep bzfgrep && \
ln -fs bzgrep bzegrep && ln -fs bzmore bzless
# add symlink to find library
@cd $(EXTLIBDIR) && ln -fs libbz2.so.1.0.8 libbz2.so
xz: $(EXTBINDIR)/xz
xz.src: $(EXTSRCDIR)/xz/INSTALL
xz.touch:
@rm -fr $(EXTBINDIR)/xz
$(EXTSRCDIR)/xz/INSTALL:
@$(DOWNLOAD) xz xz-5.2.5.tar.gz https://tukaani.org/xz/xz-5.2.5.tar.gz
$(EXTBINDIR)/xz: $(EXTSRCDIR)/xz/INSTALL
@echo "building xz"
@mkdir -p $(EXTBUILDDIR)/xz
@cd $(EXTBUILDDIR)/xz && $(EXTSRCDIR)/xz/configure $(CONFIGURE_COMMON_FLAGS) \
--prefix=$(EXTDIR) --enable-silent-rules && \
make -j $(NPROCESSES) && \
make -j $(NPROCESSES) install$(INSTALL_TARGET_SUFFIX)
xz.clean:
@echo "cleaning xz"
@rm -rf $(EXTSRCDIR)/xz
lz4: $(EXTBINDIR)/lz4
lz4.src: $(EXTSRCDIR)/lz4/INSTALL
lz4.touch:
@rm -fr $(EXTBINDIR)/lz4
$(EXTSRCDIR)/lz4/INSTALL:
@$(DOWNLOAD) lz4 lz4-v1.9.3.tar.gz https://github.com/lz4/lz4/archive/v1.9.3.tar.gz
$(EXTBINDIR)/lz4: $(EXTSRCDIR)/lz4/INSTALL
@echo "building lz4"
@cp -fa $(EXTSRCDIR)/lz4 $(EXTBUILDDIR)
@cd $(EXTBUILDDIR)/lz4 && \
make -j $(NPROCESSES) prefix=$(EXTDIR) && \
make -j $(NPROCESSES) install prefix=$(EXTDIR)
lz4.clean:
@echo "cleaning lz4"
@rm -rf $(EXTSRCDIR)/lz4
openssl: $(EXTBINDIR)/openssl
openssl.src: $(EXTSRCDIR)/openssl
openssl.clean:
@rm -fr $(EXTBUILDDIR)/openssl
openssl.touch:
@rm -fr $(EXTBINDIR)/openssl
$(EXTSRCDIR)/openssl:
$(DOWNLOAD) openssl openssl-3.0.14.tar.gz https://www.openssl.org/source/openssl-3.0.14.tar.gz
$(EXTBINDIR)/openssl: $(EXTSRCDIR)/openssl
@echo "building openssl"
@mkdir -p $(EXTBUILDDIR)/openssl
@cd $(EXTBUILDDIR)/openssl && $(EXTSRCDIR)/openssl/Configure --prefix=$(EXTDIR) --openssldir=$(EXTDIR) && \
make -j $(NPROCESSES) && make install$(INSTALL_TARGET_SUFFIX)
sqlite: $(EXTBINDIR)/sqlite3
sqlite.src: $(EXTSRCDIR)/sqlite
sqlite.clean:
@rm -fr $(EXTBUILDDIR)/sqlite
sqlite.touch:
@rm -fr $(EXTBINDIR)/sqlite3
$(EXTSRCDIR)/sqlite:
$(DOWNLOAD) sqlite sqlite-autoconf-3350100.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350100.tar.gz
$(EXTBINDIR)/sqlite3: $(EXTSRCDIR)/sqlite
@echo "building sqlite"
@mkdir -p $(EXTBUILDDIR)/sqlite
@cd $(EXTBUILDDIR)/sqlite && $(EXTSRCDIR)/sqlite/configure --prefix=$(EXTDIR) \
--enable-json1 --enable-fts5 --enable-session --enable-silent-rules && \
make -j $(NPROCESSES) && make install$(INSTALL_TARGET_SUFFIX)
libffi: $(EXTLIBDIR)/libffi.so
libffi.src: $(EXTSRCDIR)/libffi/README.md
libffi.clean:
@rm -fr $(EXTLIBDIR)/libffi.so
libffi.touch:
@rm -fr $(EXTLIBDIR)/libffi.so
$(EXTSRCDIR)/libffi/README.md:
@$(DOWNLOAD) libffi libffi-3.3.tar.gz https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz
$(EXTLIBDIR)/libffi.so: $(EXTSRCDIR)/libffi/README.md
@echo "building libffi"
@mkdir -p $(EXTBUILDDIR)/libffi
@cd $(EXTBUILDDIR)/libffi && $(EXTSRCDIR)/libffi/configure $(CONFIGURE_COMMON_FLAGS) --enable-shared \
--prefix=$(EXTDIR) --with-gcc-arch=x86-64 && \
make -j $(NPROCESSES) && make install
python: $(EXTBINDIR)/python3
python.src: $(EXTSRCDIR)/python
python.clean:
@rm -fr $(EXTSRCDIR)/python
python.touch:
@rm -fr $(EXTBINDIR)/python3
$(EXTSRCDIR)/python:
@$(DOWNLOAD) python Python-3.11.9.xz https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tar.xz
$(EXTBINDIR)/python3: $(EXTSRCDIR)/python
@echo "building python"
@mkdir -p $(EXTBUILDDIR)/python
@cd $(EXTBUILDDIR)/python && $(EXTSRCDIR)/python/configure $(CONFIGURE_COMMON_FLAGS) \
--enable-shared --prefix=$(EXTDIR) --with-ensurepip=install \
BZIP2_CFLAGS="-I$(EXTINCDIR)" BZIP2_LIBS="-L$(EXTLIBDIR) -lbz2" \
LIBLZMA_CFLAGS="-I$(EXTINCDIR)" LIBLZMA_LIBS="-L$(EXTLIBDIR) -lzma" \
ZLIB_CFLAGS="-I$(EXTINCDIR)" ZLIB_LIBS="-L$(EXTLIBDIR) -lz" && \
make -j $(NPROCESSES) && make install
# add customization to the site directories so that we can also install packages into the other lib directories
@cp sitecustomize.py $(EXTLIBDIR)/python3.11/site-packages
# not very nice but pip only can handle one pem file at a time, so concatenate
# the tools pem file and the official one
CREATE_PIP_CERTCHAIN := "cat $(BELLE2_TOOLS)/certchain.pem `python3 -c 'import site; print(site.getsitepackages()[0])'`/pip/_vendor/*/cacert.pem > .pip-certchain.pem"
PIP3OPTIONS:=--disable-pip-version-check --require-hashes --cert=.pip-certchain.pem \
--find-links=https://software.belle2.org/download/python-packages/
# don't use index if we want to restrict to the belle2 download server
ifneq ($(USE_BELLE2SERVER),)
PIP3OPTIONS+=--no-index
endif
# download the source for the python packages. This is only called directly or
# with make src and it will download src and binary package versions
python-packages.src: $(EXTSRCDIR)/belle2style/README.md
eval $(CREATE_PIP_CERTCHAIN)
# make sure pip is up to date
pip3 install --find-links=src/python-packages $(PIP3OPTIONS) \
-r requirements-base.txt
cat requirements-base.txt requirements-core.txt | (while read line; do \
echo $$line | pip3 download -d src/python-packages $(PIP3OPTIONS) --no-deps --no-build-isolation --no-binary=:all: -r/dev/stdin; \
echo $$line | pip3 download -d src/python-packages $(PIP3OPTIONS) --no-deps --no-build-isolation -r/dev/stdin; \
done)
# we need the matplotlib style files
$(EXTSRCDIR)/belle2style/README.md:
@$(DOWNLOAD) belle2style belle2style-v1.0.zip git:tags/v1.0:$(BELLE2_GIT_SERVER)belle2/software/belle2style.git
# python packages will install ipython so use this as prerequisite and actual
# target. needs to be updated if ipython is removed
python-packages: $(EXTBINDIR)/ipython
python-packages.touch:
@rm -fr $(EXTBINDIR)/ipython
# install all required python packages. setuptools-scm used to be required by
# path.py but for newer versions we can just install the wheel which doesn't
# need that. For now we ignore this dependency and assume easy_install will do
# it correctly.
$(EXTBINDIR)/ipython: $(EXTSRCDIR)/belle2style/README.md
eval $(CREATE_PIP_CERTCHAIN)
pip3 install --find-links=src/python-packages $(PIP3OPTIONS) \
-r requirements-base.txt
pip3 install --find-links=src/python-packages $(PIP3OPTIONS) \
-r requirements-base.txt -r requirements-core.txt
# make pep8 compatibility link
cd $(EXTBINDIR) && ln -sf pycodestyle pep8
# make sure our own python3 kernel has precedence over /usr/share/jupyter/kernels/python3
ipython kernel install --sys-prefix --display-name "Python 3 (Belle2)"
# but make the path relative so it can be found correctly if the externals are installed in a different directory.
sed -i 's#$(EXTBINDIR)/*##g' $(EXTSHRDIR)/jupyter/kernels/python3/kernel.json
# install our own version of sphinx-argparse
pip3 install -U --no-deps src/sphinx-argparse
# install the belle2style files
cp -at `python3 -c 'import matplotlib;print(matplotlib.get_data_path())'`/stylelib $(EXTSRCDIR)/belle2style/matplotlib/*.mplstyle
gdb: $(EXTBINDIR)/gdb
gdb.src: $(EXTSRCDIR)/gdb
gdb.touch:
rm -fr $(EXTBINDIR)/gdb
$(EXTSRCDIR)/gdb:
@$(DOWNLOAD) gdb gdb-14.2.tar.xz http://ftp.gnu.org/gnu/gdb/gdb-14.2.tar.xz
$(EXTBINDIR)/gdb: $(EXTSRCDIR)/gdb
@echo "building gdb"
@mkdir -p $(EXTBUILDDIR)/gdb
# note: avoid propagating CXXFLAGS by explicitly unsetting in sub-shell (works in posix and csh)
# also touch all .info files and their prerequisites to make sure they are up to
# date, otherwise makeinfo might be called on "make install" and we don't want to require that
@cd $(EXTBUILDDIR)/gdb && unset CXXFLAGS && $(EXTSRCDIR)/gdb/configure $(CONFIGURE_COMMON_FLAGS) \
--prefix=$(EXTDIR) --with-python=python3 \
--with-gmp=$(EXTDIR) --with-mpfr=$(EXTDIR) \
--with-mpc=$(EXTDIR) --with-isl=$(EXTDIR) && \
make -j $(NPROCESSES) && \
touch gdb/doc/version.subst gdb/doc/GDBvn.texi gdb/doc/*.info && \
make install
gdb.clean:
@echo "cleaning gdb"
@-cd $(EXTSRCDIR)/gdb && make distclean
@rm -rf $(EXTSRCDIR)/gdb
# dependencies for cmake
cmake: $(EXTBINDIR)/cmake
cmake.src: $(EXTSRCDIR)/cmake/bootstrap
# cmake download
$(EXTSRCDIR)/cmake/bootstrap:
@$(DOWNLOAD) cmake cmake-3.28.3.tar.gz http://www.cmake.org/files/v3.28/cmake-3.28.3.tar.gz
# cmake build
$(EXTBINDIR)/cmake: $(EXTSRCDIR)/cmake/bootstrap
@echo "building cmake"
@cd $(EXTSRCDIR)/cmake && ./bootstrap --prefix=$(EXTDIR) --system-curl \
--system-bzip2 --system-zlib --parallel=$(NPROCESSES) && \
sed -i 's/BUILD_CursesDialog\:BOOL=ON/BUILD_CursesDialog\:BOOL=OFF/g' CMakeCache.txt && \
make -j $(NPROCESSES) && make install
# cmake clean
cmake.clean:
@echo "cleaning cmake"
@cd $(EXTSRCDIR)/cmake && make clean
@rm -f $(EXTBINDIR)/cmake
# cmake touch
cmake.touch:
@rm -f $(EXTBINDIR)/cmake
# dependencies for google test
gtest: $(EXTLIBDIR)/libgtest.so
gtest.src: $(EXTSRCDIR)/gtest/README.md
# google test download
$(EXTSRCDIR)/gtest/README.md:
@$(DOWNLOAD) gtest gtest-1.10.0.tar.gz https://github.com/google/googletest/archive/release-1.10.0.tar.gz
# google test build
$(EXTLIBDIR)/libgtest.so: $(EXTSRCDIR)/gtest/README.md
@echo "building gtest"
@mkdir -p $(EXTBUILDDIR)/gtest
@cd $(EXTBUILDDIR)/gtest && $(CMAKE) $(EXTSRCDIR)/gtest \
-DBUILD_SHARED_LIBS=ON \
-DPython_ADDITIONAL_VERSIONS=3.11 -DPYTHON_EXECUTABLE=`which python3` && \
ninja -j $(NPROCESSES) install$(CMAKE_TARGET_SUFFIX)
# google test clean
gtest.clean:
@echo "cleaning gtest"
@rm -rf $(EXTBUILDDIR)/gtest $(EXTINCDIR)/gtest $(EXTLIBDIR)/libgtest.a
# google test touch
gtest.touch:
@rm -f $(EXTLIBDIR)/libgtest.so
# dependencies for boost
boost: $(EXTLIBDIR)/libboost_system.so
boost.src: $(EXTSRCDIR)/boost/INSTALL
# boost download
$(EXTSRCDIR)/boost/INSTALL:
@$(DOWNLOAD) boost boost_1_85_0.tar.bz2 https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.tar.bz2
# boost build
$(EXTLIBDIR)/libboost_system.so: $(EXTSRCDIR)/boost/INSTALL
@echo "building boost"
cd $(EXTSRCDIR)/boost && ./bootstrap.sh --prefix=$(EXTDIR) \
--includedir=$(EXTINCDIR) --with-python=python3 --without-icu && \
./b2 install -sZLIB_INCLUDE=$(EXTINCDIR) -sZLIB_LIBPATH=$(EXTLIBDIR) \
-sBZIP2_INCLUDE=$(EXTINCDIR) -sBZIP2_LIBPATH=$(EXTLIBDIR) \
-sLZMA_INCLUDE=$(EXTINCDIR) -sLZMA_LIBPATH=$(EXTLIBDIR) \
--disable-icu --build-dir=$(EXTBUILDDIR) -j$(NPROCESSES) $(BOOST_OPTION)
@cd $(EXTLIBDIR) && ln -sfT libboost_python311.so libboost_python.so
# boost clean
boost.clean:
@echo "cleaning boost"
@-cd $(EXTSRCDIR)/boost && ./b2 --clean $(BOOST_OPTION)
@rm -rf $(EXTINCDIR)/boost $(EXTLIBDIR)/libboost_* $(EXTBUILDDIR)/boost
# boost touch
boost.touch:
@rm -f $(EXTLIBDIR)/libboost_system.so
libuuid: $(EXTINCDIR)/uuid/uuid.h
libuuid.src: $(EXTSRCDIR)/util-linux/README
libuuid.clean:
@rm -fr $(EXTINCDIR)/uuid $(EXTLIBDIR)/libuuid* $(EXTLIBDIR)/pkgconfig/uuid.pc
libuuid.touch: libuuid.clean
$(EXTSRCDIR)/util-linux/README:
@$(DOWNLOAD) util-linux util-linux-2.35.1.tar.xz https://www.kernel.org/pub/linux/utils/util-linux/v2.35/util-linux-2.35.1.tar.xz
$(EXTINCDIR)/uuid/uuid.h: $(EXTSRCDIR)/util-linux/README
@echo "building libuuid"
@mkdir -p $(EXTBUILDDIR)/util-linux
@cd $(EXTBUILDDIR)/util-linux && $(EXTSRCDIR)/util-linux/configure $(CONFIGURE_COMMON_FLAGS) \
--prefix=$(EXTDIR) --includedir=$(EXTINCDIR) --libdir=$(EXTLIBDIR) \
--bindir=$(EXTBINDIR) --disable-all-programs --enable-libuuid --enable-libuuid-force-uuidd \
--disable-bash-completion && \
make -j $(NPROCESSES) && make install
# cppcheck
cppcheck: $(EXTBINDIR)/cppcheck
cppcheck.src: $(EXTSRCDIR)/cppcheck
cppcheck.touch:
@rm -fr $(EXTBINDIR)/cppcheck
$(EXTSRCDIR)/cppcheck:
@$(DOWNLOAD) cppcheck cppcheck-2.6.tar.gz https://github.com/danmar/cppcheck/archive/2.6.tar.gz
@cd $(EXTSRCDIR)/cppcheck && patch -p1 < $(PATCHDIR)/cppcheck-Make-CppCheck-relocatable.patch
$(EXTBINDIR)/cppcheck: $(EXTSRCDIR)/cppcheck
@echo "building cppcheck"
@mkdir -p $(EXTBUILDDIR)/cppcheck
@cd $(EXTBUILDDIR)/cppcheck && $(CMAKE) $(EXTSRCDIR)/cppcheck \
-DPython_ADDITIONAL_VERSIONS=3.11 -DPYTHON_EXECUTABLE=`which python3` \
-DMATCH_COMPILER=ON && \
ninja -j $(NPROCESSES) install$(CMAKE_TARGET_SUFFIX)
# doxygen
doxygen: $(EXTBINDIR)/doxygen
doxygen.src: $(EXTSRCDIR)/doxygen
doxygen.touch:
@rm -fr $(EXTBINDIR)/doxygen
$(EXTSRCDIR)/doxygen:
@$(DOWNLOAD) doxygen doxygen-1.12.0.src.tar.gz https://www.doxygen.nl/files/doxygen-1.12.0.src.tar.gz
$(EXTBINDIR)/doxygen: $(EXTSRCDIR)/doxygen
@echo "building doxygen"
@mkdir -p $(EXTBUILDDIR)/doxygen
@cd $(EXTBUILDDIR)/doxygen && $(CMAKE) $(EXTSRCDIR)/doxygen && \
ninja -j $(NPROCESSES) install$(CMAKE_TARGET_SUFFIX)
Vc.src: $(EXTSRCDIR)/Vc/README.md
Vc: $(EXTLIBDIR)/libVc.a
Vc.touch:
rm -fr $(EXTLIBDIR)/libVc.a
$(EXTSRCDIR)/Vc/README.md:
@$(DOWNLOAD) Vc Vc-1.4.5.tar.gz https://github.com/VcDevel/Vc/archive/refs/tags/1.4.5.tar.gz
$(EXTLIBDIR)/libVc.a: $(EXTSRCDIR)/Vc/README.md
@echo "building Vc"
@mkdir -p $(EXTBUILDDIR)/Vc
@cd $(EXTBUILDDIR)/Vc && $(CMAKE) $(EXTSRCDIR)/Vc \
-DBUILD_TESTING=OFF && \
ninja -j $(NPROCESSES) install$(CMAKE_TARGET_SUFFIX)
VecCore.src: $(EXTSRCDIR)/VecCore/README.md
VecCore: $(EXTINCDIR)/VecCore/Version.h
VecCore.touch:
rm -fr $(EXTINCDIR)/VecCore/Version.h
$(EXTSRCDIR)/VecCore/README.md:
$(DOWNLOAD) VecCore VecCore-v0.8.1.tar.gz https://github.com/root-project/veccore/archive/v0.8.1.tar.gz
$(EXTINCDIR)/VecCore/Version.h: $(EXTSRCDIR)/VecCore/README.md
@echo "building VecCore"
@mkdir -p $(EXTBUILDDIR)/VecCore
@cd $(EXTBUILDDIR)/VecCore && $(CMAKE) $(EXTSRCDIR)/VecCore \
-DVC=ON -DUMESIMD=OFF -DCUDA=OFF -DBUILD_TESTING=OFF -DBUILD_BENCHMARKS=OFF -DBUILD_VC=OFF -DBUILD_UMESIMD=OFF && \
ninja -j $(NPROCESSES) install$(CMAKE_TARGET_SUFFIX)
VecGeom.src: $(EXTSRCDIR)/VecGeom/README.md
VecGeom: $(EXTLIBDIR)/libvecgeom.a
VecGeom.touch:
rm -fr $(EXTLIBDIR)/libvecgeom.a
$(EXTSRCDIR)/VecGeom/README.md:
@$(DOWNLOAD) VecGeom VecGeom-v1.2.8.tar.gz https://gitlab.cern.ch/VecGeom/VecGeom/-/archive/v1.2.8/VecGeom-v1.2.8.tar.gz
@cd $(EXTSRCDIR)/VecGeom && patch -p0 < $(PATCHDIR)/vecgeom-doxygen.patch
$(EXTLIBDIR)/libvecgeom.a: $(EXTSRCDIR)/VecGeom/README.md
@echo "building VecGeom"
@mkdir -p $(EXTBUILDDIR)/VecGeom
@cd $(EXTBUILDDIR)/VecGeom && $(CMAKE) $(EXTSRCDIR)/VecGeom \
-DCUDA=OFF -DBACKEND=Vc -DBENCHMARK=OFF -DVECGEOM_VECTOR=sse2 -DBUILTIN_VECCORE=OFF -DCTEST=OFF \
-DINSTALL_INCLUDE_DIR=$(EXTINCDIR)/VecGeom -DCMAKE_CXX_STANDARD=17 -DBUILD_DOC=OFF && \
ninja -j $(NPROCESSES) install$(CMAKE_TARGET_SUFFIX)
VecGeom.clean:
@echo "cleaning VecGeom"
@rm -rf $(EXTBUILDDIR)/VecGeom $(EXTINCDIR)/VecGeom $(EXTLIBDIR)/libvecgeom.a
# dependencies for CLHEP
clhep: $(EXTBINDIR)/clhep-config
clhep.src: $(EXTSRCDIR)/clhep/CLHEP/README.md
# CLHEP download
$(EXTSRCDIR)/clhep/CLHEP/README.md:
@$(DOWNLOAD) clhep clhep-2.4.7.1.tgz https://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-2.4.7.1.tgz
# CLHEP build
$(EXTBINDIR)/clhep-config: $(EXTSRCDIR)/clhep/CLHEP/README.md
@echo "building CLHEP"
@mkdir -p $(EXTBUILDDIR)/clhep
@cd $(EXTBUILDDIR)/clhep && $(CMAKE) $(EXTSRCDIR)/clhep/CLHEP \
-DCLHEP_BUILD_CXXSTD="-std=c++17" -DCLHEP_SINGLE_THREAD=ON && \
ninja -j $(NPROCESSES) install$(CMAKE_TARGET_SUFFIX)
# CLHEP clean
clhep.clean:
@echo "cleaning CLHEP"
@rm -rf $(EXTBUILDDIR)/clhep $(EXTINCDIR)/CLHEP $(EXTLIBDIR)/libCLHEP* $(EXTBINDIR)/clhep-config $(EXTLIBDIR)/CLHEP-2.4.7.1 \
$(EXTLIBDIR)/pkgconfig/clhep*.pc
# CLHEP touch
clhep.touch:
@rm -f $(EXTBINDIR)/clhep-config
# dependencies for GEANT4
geant4: $(EXTBINDIR)/geant4.sh
geant4.src: $(EXTSRCDIR)/geant4
# GEANT4 download
$(EXTSRCDIR)/geant4:
@$(DOWNLOAD) geant4 geant4.11.2.1.tar.gz https://github.com/Geant4/geant4/archive/refs/tags/v11.2.1.tar.gz
# some cosmetic verbosity fixes
@cd $(EXTSRCDIR)/geant4 && patch -l -p1 < $(PATCHDIR)/geant4-verbosity.patch
# disable G4Assembly deletion as basf2 is not ready for this change of ownership logic
@cd $(EXTSRCDIR)/geant4 && patch -l -p1 < $(PATCHDIR)/geant4-disable-assembly-deletion.patch
# GEANT4 build
$(EXTBINDIR)/geant4.sh: $(EXTBINDIR)/clhep-config $(EXTSRCDIR)/geant4
@echo "building geant4"
@mkdir -p $(EXTBUILDDIR)/geant4
@cd $(EXTBUILDDIR)/geant4 && $(CMAKE) $(GEANT4_OPTION) \
-DCLHEP_ROOT_DIR=$(EXTDIR) -DCLHEP_INCLUDE_DIR=$(EXTINCDIR) \
-DGEANT4_USE_G3TOG4=OFF -DGEANT4_USE_SYSTEM_EXPAT=OFF -DGEANT4_USE_SYSTEM_ZLIB=ON -DGEANT4_INSTALL_DATA=ON \
-DGEANT4_USE_USOLIDS=POLYCONE\;TESSELLATEDSOLID\;EXTRUDEDSOLID \
-DCMAKE_CXX_STANDARD=17 -DGEANT4_BUILD_MULTITHREADED=OFF $(EXTSRCDIR)/geant4 && \
ninja -j $(NPROCESSES) install$(CMAKE_TARGET_SUFFIX)
# Fix absolute path in geant4-config, geant4.sh and geant4.csh
@sed -i "s:$(BELLE2_EXTERNALS_DIR):\$${BELLE2_EXTERNALS_DIR}:g" $(EXTBINDIR)/geant4*
# Also fix geant4make just to be safe
@sed -i "s:$(BELLE2_EXTERNALS_DIR):\$${BELLE2_EXTERNALS_DIR}:g" $(EXTSHRDIR)/Geant4/geant4make/geant4make.*
# GEANT4 clean
geant4.clean:
@echo "cleaning geant4"
@-cd $(EXTBUILDDIR)/geant4 && make clean
@rm -rf $(EXTBUILDDIR)/geant4 $(EXTDIR)/geant4 $(EXTSHRDIR)/Geant4 $(EXTINCDIR)/Geant4 $(EXTLIBDIR)/libG4*.so $(EXTBINDIR)/geant4*
# GEANT4 touch command
geant4.touch:
@rm -f $(EXTBINDIR)/geant4.sh
# dependencies for PostgreSql
postgresql: $(EXTLIBDIR)/libpq.so
postgresql.src: $(EXTSRCDIR)/postgresql/configure
# PostgreSql download
$(EXTSRCDIR)/postgresql/configure:
@$(DOWNLOAD) postgresql postgresql-13.2.tar.gz https://ftp.postgresql.org/pub/source/v13.2/postgresql-13.2.tar.gz
# PostgreSql build
$(EXTLIBDIR)/libpq.so: $(EXTSRCDIR)/postgresql/configure
@echo "building PostgreSql"
@mkdir -p $(EXTBUILDDIR)/postgresql
# Compile and install only the library/headers as indicated in INSTALL, no need for the postgres server
@cd $(EXTBUILDDIR)/postgresql && $(EXTSRCDIR)/postgresql/configure $(CONFIGURE_COMMON_FLAGS) --prefix=$(EXTDIR) \
--includedir=$(EXTINCDIR)/pgsql/ --libdir=$(EXTLIBDIR) --bindir=$(EXTBINDIR) && \
make -C src/backend generated-headers && \
make -C src/include install && \
make -C src/interfaces install
# PostgreSql clean
postgresql.clean:
@echo "cleaning PostgreSql"
@rm -fr $(EXTBUILDDIR)/postgresql
@rm -rf $(EXTINCDIR)/pgsql $(EXTLIBDIR)/libpq*
# PostgreSql touch
postgresql.touch:
@rm -f $(EXTLIBDIR)/libpq.so
# dependencies for NeuroBayes
neurobayes: $(EXTLIBDIR)/libNeuroBayesCPPInterface_shared.so