aboutsummaryrefslogtreecommitdiff
path: root/reproduce/src/make/dependencies-build-rules.mk
blob: 7b3a419e669d9a918dfc22a570e9950ccde1a12d (plain)
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
# Generic configurable recipes to build packages with GNU Build system or
# CMake. This is Makefile is not intended to be run directly, it will be
# imported into `dependencies-basic.mk' and `dependencies.mk'. They should
# be activated with Make's `Call' function.
#
# Original author:
#     Mohammad Akhlaghi <mohammad@akhlaghi.org>
# Contributing author(s):
#     Your name <your@email.address>
# Copyright (C) 2018, Your Name.
#
# This Makefile is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This Makefile is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.
#
# A copy of the GNU General Public License is available at
# <http://www.gnu.org/licenses/>.





# IMPORTANT note
# --------------
#
# Without using `&&', if a step fails, the process will continue. However,
# in the `if' statements, we need `;' (particularly between `]' and
# `then'). So we need to put any necessary checks at the start, then when
# we start the process, every command will be separated by an `&&'.





# GNU Build system
# ----------------
#
# Arguments:
#  1: Tarball full address.
#  2: Directory name after unpacking.
#  3: Set to `static' for a static build.
#  4: Extra configuration options.
#  5: Extra options/arguments to pass to Make.
#  6: Step to run between `make' and `make install': usually `make check'.
gbuild = if [ x$(static_build) = xyes ] && [ $(3)x = staticx ]; then          \
	   export LDFLAGS="$$LDFLAGS -static";                                \
	 fi;                                                                  \
	 check="$(6)";                                                        \
	 if [ x"$$check" = x ]; then check="echo Skipping-check"; fi;         \
	 export SHELL=$(ibdir)/bash;                                          \
	 cd $(ddir) && rm -rf $(2) && tar xf $(1) && cd $(2) &&               \
	 ./configure $(4) --prefix=$(idir) &&                                 \
	 make $(5) &&                                                         \
	 $$check &&                                                           \
	 make install&&                                                       \
	 cd .. && rm -rf $(2)





# CMake
# -----
cbuild = if [ x$(static_build) = xyes ] && [ $(3)x = staticx ]; then          \
	   export LDFLAGS="$$LDFLAGS -static";                                \
	   opts="-DBUILD_SHARED_LIBS=OFF";                                    \
	 fi;                                                                  \
	 export SHELL=$(ibdir)/bash;                                          \
	 cd $(ddir) && rm -rf $(2) && tar xf $(1) && cd $(2) &&               \
	 rm -rf pipeline-build && mkdir pipeline-build &&                     \
	 cd pipeline-build &&                                                 \
	 cmake .. $$opts $(4) &&                                              \
	 cmake --build . &&                                                   \
	 cmake .. -DCMAKE_INSTALL_PREFIX=$(idir) &&                           \
	 cmake --build . --target install &&                                  \
	 cd ../.. &&                                                          \
	 rm -rf $(2)