3 def MACRO_EXTRACT_TARBALL
4 for source in %{sources}; do
5 %{MACRO_EXTRACT} %{DIR_DL}/${source} || exit 1
9 [ -d "%{DIR_APP}" ] && cd %{DIR_APP}
12 def MACRO_INSTALL_FILES
13 %{MACRO_INSTALL_DEFAULT_FILES}
14 %{MACRO_INSTALL_SYSTEMD_FILES}
15 %{MACRO_INSTALL_SYSTEMD_TMPFILES}
16 %{MACRO_INSTALL_PAM_FILES}
17 %{MACRO_INSTALL_LOGROTATE_FILES}
20 # XXX to be removed soon
21 def MACRO_INSTALL_DEFAULT_FILES
22 for file in %{DIR_SOURCE}/default/*; do
23 [ -e "${file}" ] || continue
24 mkdir -p %{BUILDROOT}/etc/default
25 cp -vf ${file} %{BUILDROOT}/etc/default/$(basename ${file})
30 def MACRO_INSTALL_PAM_FILES
31 for file in %{DIR_SOURCE}/{*.pam,pam.d/*}; do
32 [ -e "${file}" ] || continue
33 mkdir -p %{BUILDROOT}/etc/pam.d
34 cp -vf ${file} %{BUILDROOT}/etc/pam.d/$(basename ${file%*.pam})
39 def MACRO_INSTALL_LOGROTATE_FILES
40 for file in %{DIR_SOURCE}/{*.logrotate,logrotate/*}; do
41 [ -e "${file}" ] || continue
42 mkdir -p %{BUILDROOT}/etc/logrotate.d
43 cp -vf ${file} %{BUILDROOT}/etc/logrotate.d/$(basename ${file%*.logrotate})
48 def MACRO_PYTHON_COMPILE
50 if [ -x "%{python3}" ]; then
51 %{python3} -m compileall -f \
52 %{BUILDROOT}%{python3_sitearch} %{BUILDROOT}%{python3_sitelib} $@
56 # Compile any Python modules
60 def MACRO_FIX_AUTOTOOLS
61 if [ "%{DISTRO_ARCH}" = "aarch64" ]; then
62 for i in $(find %{DIR_SRC} -name config.guess -or -name config.sub); do
63 if ! grep -q "aarch64" ${i}; then
64 if [ -e "%{datadir}/pakfire/$(basename ${i})" ]; then
65 cp -vf %{datadir}/pakfire/$(basename ${i}) $(dirname ${i})
79 while [ $# -gt 0 ]; do
82 paths+=( "${1#--search-path=}" )
91 # Apply all patches given on command line.
92 for patch in ${patches[@]}; do
97 for path in ${paths[@]}; do
98 if [ -e "${path}/${patch}" ]; then
99 patch="${path}/${patch}"
106 # Check if patch file does exist.
107 if ! [ -e "${patch}" ]; then
108 echo >&2 " ERROR: Patch file does not exist: ${patch}"
112 # Options applied to patch command.
115 # Get right -p1 option.
117 *.patch[0-9]|*.patch[0-9]R)
119 # Get patch level from file name.
120 while [ ${#_patch} -gt 0 ]; do
121 last_pos=$(( ${#_patch} - 1 ))
122 last_char=${_patch:${last_pos}}
123 _patch=${_patch:0:${last_pos}}
125 case "${last_char}" in
127 options="${options} -p${last_char}"
131 options="${options} -R"
138 options="${options} -p1"
141 echo >&2 " WARNING: Ignoring unknown file: ${patch}"
146 echo " Applying ${patch} (${options})..."
147 patch ${options} -i ${patch} || return $?
153 __patch --search-path=%{DIR_PATCHES} "%{patches}"
156 # Pre-defined build scripts.
158 configure = [ -x "%{CONFIGURE_SCRIPT}" ] && ./%{CONFIGURE_SCRIPT} %{configure_options}
160 # These variables are used if you have to add some targets
161 # directly to the make command.
163 make_install_targets = install
166 rm -rf %{BUILDROOT}/*
167 mkdir -p %{DIR_SRC} && cd %{DIR_SRC}
173 # Extract source tarball.
174 %{MACRO_EXTRACT_TARBALL}
179 # Run custom commands.
182 # Fix outdated autotools on aarch64
183 %{MACRO_FIX_AUTOTOOLS}
190 [ -d "%{DIR_APP}" ] && cd %{DIR_APP}
199 # Remove any RPATH stuff from locally installed libtool
202 # Run custom commands.
205 make %{PARALLELISMFLAGS} %{make_build_targets}
207 # Run more custom commands.
218 [ -d "%{DIR_APP}" ] && cd %{DIR_APP}
227 [ -d "%{DIR_APP}" ] && cd %{DIR_APP}
229 mkdir -pv %{BUILDROOT}
233 %{MACRO_INSTALL_FILES}
234 %{MACRO_PYTHON_COMPILE}
236 # Cleanup perl modules.
243 make DESTDIR=%{BUILDROOT} %{make_install_targets}
245 # Run custom commands.
249 # XXX to be removed soon
253 # Enable strict processing of build-id by default.
254 # The build will fail if a file is missing its build-id.
255 debuginfo_strict_build_id = true