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}
19 # XXX to be removed soon
20 def MACRO_INSTALL_DEFAULT_FILES
21 for file in %{DIR_SOURCE}/default/*; do
22 [ -e "${file}" ] || continue
23 mkdir -p %{BUILDROOT}/etc/default
24 cp -vf ${file} %{BUILDROOT}/etc/default/$(basename ${file})
29 def MACRO_INSTALL_PAM_FILES
30 for file in %{DIR_SOURCE}/{*.pam,pam.d/*}; do
31 [ -e "${file}" ] || continue
32 mkdir -p %{BUILDROOT}/etc/pam.d
33 cp -vf ${file} %{BUILDROOT}/etc/pam.d/$(basename ${file%*.pam})
38 def MACRO_PYTHON_COMPILE
40 if [ -x "%{python3}" ]; then
41 %{python3} -m compileall -f \
42 %{BUILDROOT}%{python3_sitearch} %{BUILDROOT}%{python3_sitelib} $@
46 # Compile any Python modules
50 def MACRO_FIX_AUTOTOOLS
51 for i in $(find %{DIR_SRC} -name config.guess -or -name config.sub); do
52 if [ -e "/usr/share/libtool/build-aux/$(basename ${i})" ]; then
53 cp -vf /usr/share/libtool/build-aux/$(basename ${i}) $(dirname ${i})
65 while [ $# -gt 0 ]; do
68 paths+=( "${1#--search-path=}" )
77 # Apply all patches given on command line.
78 for patch in ${patches[@]}; do
83 for path in ${paths[@]}; do
84 if [ -e "${path}/${patch}" ]; then
85 patch="${path}/${patch}"
92 # Check if patch file does exist.
93 if ! [ -e "${patch}" ]; then
94 echo >&2 " ERROR: Patch file does not exist: ${patch}"
98 # Options applied to patch command.
101 # Get right -p1 option.
103 *.patch[0-9]|*.patch[0-9]R)
105 # Get patch level from file name.
106 while [ ${#_patch} -gt 0 ]; do
107 last_pos=$(( ${#_patch} - 1 ))
108 last_char=${_patch:${last_pos}}
109 _patch=${_patch:0:${last_pos}}
111 case "${last_char}" in
113 options="${options} -p${last_char}"
117 options="${options} -R"
124 options="${options} -p1"
127 echo >&2 " WARNING: Ignoring unknown file: ${patch}"
132 echo " Applying ${patch} (${options})..."
133 patch ${options} -i ${patch} || return $?
139 __patch --search-path=%{DIR_PATCHES} "%{patches}"
142 # Pre-defined build scripts.
144 DIR_BUILD = %{DIR_APP}/%{BUILD_DIR}
146 configure = [ -x "%{DIR_APP}/%{CONFIGURE_SCRIPT}" ] && %{DIR_APP}/%{CONFIGURE_SCRIPT} %{configure_options}
151 # Default "make" command
152 make_build = %{__make} %{PARALLELISMFLAGS} %{make_build_targets}
154 # Default "make install" command
155 make_install = %{__make} DESTDIR=%{BUILDROOT} %{make_install_targets}
157 # These variables are used if you have to add some targets directly to the make command
158 # LEGACY: DO NOT USE ANY MORE
160 make_install_targets = install
163 rm -rf %{BUILDROOT}/*
164 mkdir -p %{DIR_SRC} && cd %{DIR_SRC}
168 # Create the build directory
169 mkdir -pv %{DIR_BUILD}
173 # Extract source tarball.
174 %{MACRO_EXTRACT_TARBALL}
179 # Run custom commands.
187 [ -d "%{DIR_BUILD}" ] && cd %{DIR_BUILD}
196 # Remove any RPATH stuff from locally installed libtool
199 # Run custom commands
205 # Run more custom commands.
216 [ -d "%{DIR_BUILD}" ] && cd %{DIR_BUILD}
225 [ -d "%{DIR_BUILD}" ] && cd %{DIR_BUILD}
228 mkdir -pv %{BUILDROOT}
232 %{MACRO_INSTALL_FILES}
233 %{MACRO_PYTHON_COMPILE}
235 # Cleanup perl modules
245 # Run custom commands