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_SYSUSERS}
16 %{MACRO_INSTALL_SYSTEMD_TMPFILES}
17 %{MACRO_INSTALL_PAM_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_PYTHON_COMPILE
41 if [ -x "%{python3}" ]; then
42 %{python3} -m compileall -f \
43 %{BUILDROOT}%{python3_sitearch} %{BUILDROOT}%{python3_sitelib} $@
47 # Compile any Python modules
51 def MACRO_FIX_AUTOTOOLS
52 for i in $(find %{DIR_SRC} -name config.guess -or -name config.sub); do
53 if [ -e "/usr/share/libtool/build-aux/$(basename ${i})" ]; then
54 cp -vf /usr/share/libtool/build-aux/$(basename ${i}) $(dirname ${i})
66 while [ $# -gt 0 ]; do
69 paths+=( "${1#--search-path=}" )
78 # Apply all patches given on command line.
79 for patch in ${patches[@]}; do
84 for path in ${paths[@]}; do
85 if [ -e "${path}/${patch}" ]; then
86 patch="${path}/${patch}"
93 # Check if patch file does exist.
94 if ! [ -e "${patch}" ]; then
95 echo >&2 " ERROR: Patch file does not exist: ${patch}"
99 # Options applied to patch command.
102 # Get right -p1 option.
104 *.patch[0-9]|*.patch[0-9]R)
106 # Get patch level from file name.
107 while [ ${#_patch} -gt 0 ]; do
108 last_pos=$(( ${#_patch} - 1 ))
109 last_char=${_patch:${last_pos}}
110 _patch=${_patch:0:${last_pos}}
112 case "${last_char}" in
114 options="${options} -p${last_char}"
118 options="${options} -R"
125 options="${options} -p1"
128 echo >&2 " WARNING: Ignoring unknown file: ${patch}"
133 echo " Applying ${patch} (${options})..."
134 patch ${options} -i ${patch} || return $?
140 __patch --search-path=%{DIR_PATCHES} "%{patches}"
143 # Pre-defined build scripts.
145 DIR_BUILD = %{DIR_APP}/%{BUILD_DIR}
147 configure = [ -x "%{DIR_APP}/%{CONFIGURE_SCRIPT}" ] && %{DIR_APP}/%{CONFIGURE_SCRIPT} %{configure_options}
152 # Default "make" command
153 make_build = %{__make} %{PARALLELISMFLAGS} %{make_build_targets}
155 # Default "make install" command
156 make_install = %{__make} DESTDIR=%{BUILDROOT} %{make_install_targets}
158 # These variables are used if you have to add some targets directly to the make command
159 # LEGACY: DO NOT USE ANY MORE
161 make_install_targets = install
164 rm -rf %{BUILDROOT}/*
165 mkdir -p %{DIR_SRC} && cd %{DIR_SRC}
169 # Create the build directory
170 mkdir -pv %{DIR_BUILD}
174 # Extract source tarball.
175 %{MACRO_EXTRACT_TARBALL}
180 # Run custom commands.
188 [ -d "%{DIR_BUILD}" ] && cd %{DIR_BUILD}
197 # Remove any RPATH stuff from locally installed libtool
200 # Run custom commands
206 # Run more custom commands.
217 [ -d "%{DIR_BUILD}" ] && cd %{DIR_BUILD}
226 [ -d "%{DIR_BUILD}" ] && cd %{DIR_BUILD}
229 mkdir -pv %{BUILDROOT}
233 %{MACRO_INSTALL_FILES}
234 %{MACRO_PYTHON_COMPILE}
236 # Cleanup perl modules
246 %{MACRO_APPLY_SYSTEMD_SYSUSERS}
248 # Run custom commands