openpkg/rpmmacros

changeset 13
cb59d6afeb61
child 303
2bd9bf3f6f03
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/openpkg/rpmmacros	Tue Jan 06 23:40:39 2009 +0100
     1.3 @@ -0,0 +1,432 @@
     1.4 +##
     1.5 +##  rpmmacros -- OpenPKG RPM Macros
     1.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     1.8 +##
     1.9 +##  Permission to use, copy, modify, and distribute this software for
    1.10 +##  any purpose with or without fee is hereby granted, provided that
    1.11 +##  the above copyright notice and this permission notice appear in all
    1.12 +##  copies.
    1.13 +##
    1.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.25 +##  SUCH DAMAGE.
    1.26 +##
    1.27 +##  The purpose of this macro set is to override the default
    1.28 +##  macros in the OpenPKG RPM installation for the @l_prefix@ hierarchy.
    1.29 +##
    1.30 +
    1.31 +#   the OpenPKG release identification (for the current package or as a fallback for the bootstrap package)
    1.32 +%l_openpkg_release(F:)   %(%{l_prefix}/libexec/openpkg/release --release="%{?release}%{!?release:%(%{l_rpm} -q --qf '%{release}' openpkg)}" %{?-F:-F "%{-F*}"}%{!?-F:-F "OpenPKG-%%t"})
    1.33 +
    1.34 +#   the OpenPKG OIDs (root is officially registered at IANA)
    1.35 +%l_openpkg_oid           1.3.6.1.4.1.18749
    1.36 +%l_openpkg_oid_bootstrap %{l_openpkg_oid}.4.1
    1.37 +%l_openpkg_oid_instance  %{l_openpkg_oid_bootstrap}.1
    1.38 +%l_openpkg_oid_platform  %{l_openpkg_oid_bootstrap}.2
    1.39 +%l_openpkg_oid_tagfmtopt %{l_openpkg_oid_bootstrap}.3
    1.40 +
    1.41 +#   the OpenPKG package tagging
    1.42 +%l_tag_fmt               @TAG@
    1.43 +%l_tag_fmt_compat        %(prefix="%{l_prefix_static}"; if [ ".`expr $prefix : '/[^/][^/]*$'`" != .0 ]; then loc=`echo $prefix | cut -c2-4`; else loc=`echo $prefix | sed -e 's;/\\(.\\)[^/]*;\\1;g' | cut -c1-3`; fi; echo $loc)
    1.44 +%l_tag_fmt_loc           %(echo "%{l_prefix_static}" | sed -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2\\3;' -e 's;^/\\([^/]\\)[^/]*/\\([^/][^/]\\).*;\\1\\2;' -e 's;^/\\([^/][^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' -e 's;^/\\([^/][^/][^/]\\).*;\\1;' -e 's;^/\\([^/][^/]\\).*;\\1;' -e 's;^/\\([^/]\\).*;\\1;')
    1.45 +%l_tag_fmt_opt           %(uuid_ns="`%{l_uuid} -v3 ns:OID %{l_openpkg_oid_tagfmtopt}`"; %{l_uuid} -v3 $uuid_ns '%{?_options}')
    1.46 +%l_tag_fmt_uuid          %(%{l_uuid} -v1)
    1.47 +%l_tag_fmt_time          %(date '+%%Y%%m%%d%%H%%M%%S')
    1.48 +%l_tag_fmt_user          %(%{l_shtool} echo -e '%%u')
    1.49 +%l_tag_fmt_host          %(%{l_shtool} echo -e '%%h%%d')
    1.50 +%l_tag_gen               %{expand:%(echo '%{l_tag_fmt}' | sed -e 's/<\\([a-zA-Z][_a-zA-Z0-9]*\\)>/%%{l_tag_fmt_\\1}/g')}
    1.51 +%l_tag                   %(echo "%{l_tag_gen}" | sed -e 's;-;;g')
    1.52 +
    1.53 +#   the OpenPKG instance location (backward compatibility only)
    1.54 +%l_location              %{l_tag}
    1.55 +
    1.56 +#   standard RPM host platform identification
    1.57 +#   (defaults via "shtool platform" and uname(3); used internally)
    1.58 +#%_host_cpu              ...USE INTERNAL DEFAULT...
    1.59 +#%_host_vendor           ...USE INTERNAL DEFAULT...
    1.60 +#%_host_os               ...USE INTERNAL DEFAULT...
    1.61 +%_host_alias             %{nil}
    1.62 +%_host                   %{_host_cpu}-%{_host_os}
    1.63 +
    1.64 +#   standard RPM build platform identification
    1.65 +#   (defaults via %{_host*} macros; not used internally AFAIK)
    1.66 +%_build_cpu              %{_host_cpu}
    1.67 +%_build_vendor           %{_host_vendor}
    1.68 +%_build_os               %{_host_os}
    1.69 +%_build_alias            %{_host_alias}
    1.70 +%_build                  %{_host}
    1.71 +
    1.72 +#   standard RPM target platform identification
    1.73 +#   (defaults via %{_host*} macros; used internally for %ifarch/%ifnarch)
    1.74 +%_target_cpu             %{_host_cpu}
    1.75 +%_target_vendor          %{_host_vendor}
    1.76 +%_target_os              %{_host_os}
    1.77 +%_target_alias           %{_host_alias}
    1.78 +%_target                 %{_host}
    1.79 +
    1.80 +#   legacy RPM platform macros
    1.81 +#   (defaults via config.guess/config.sub under RPM build-time)
    1.82 +%_arch                   %{_host_cpu}
    1.83 +%_vendor                 %{_host_vendor}
    1.84 +%_os                     %{_host_os}
    1.85 +
    1.86 +#   legacy RPM platform macros
    1.87 +#   (defaults via various other macros; partly used internally)
    1.88 +%_build_arch             %{_arch}
    1.89 +%_target_platform        %{_target_cpu}-%{_target_vendor}-%{_target_os}
    1.90 +%_gnu                    %{nil}
    1.91 +
    1.92 +#   official OpenPKG host platform identification
    1.93 +%l_host_arch             %{_host_cpu}
    1.94 +%l_host_vendor           %{_host_vendor}
    1.95 +%l_host_os               %{_host_os}
    1.96 +%l_host                  %{_host_cpu}-%{_host_os}
    1.97 +
    1.98 +#   new OpenPKG platform identification
    1.99 +%l_platform(cptF:)       %(if [ ".%{?-F}" != . ]; then fmt="%{-F*}"; else T="%{?-c:c}%{?-p:p}%{?-t:t}"; [ ".$T" = . ] && T="p"; fmt="%%<a$T>-%%<s$T>"; fi; %{l_shtool} platform -n -L -S "" -C "+" -F "$fmt")
   1.100 +
   1.101 +#   old OpenPKG platform identification
   1.102 +%l_target                %{l_platform -t}
   1.103 +
   1.104 +#   the *S*uper-user user/group name/id pair
   1.105 +%l_susr                  @SUSR@
   1.106 +%l_sgrp                  @SGRP@
   1.107 +%l_suid                  %((getent passwd "%{l_susr}"; grep "^%{l_susr}:" /etc/passwd; ypmatch "%{l_susr}" passwd; nismatch "%{l_susr}" passwd; nidump passwd . | grep "^%{l_susr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
   1.108 +%l_sgid                  %((getent group  "%{l_sgrp}"; grep "^%{l_sgrp}:" /etc/group;  ypmatch "%{l_sgrp}" group;  nismatch "%{l_sgrp}" group;  nidump group  . | grep "^%{l_susr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
   1.109 +
   1.110 +#   the *M*anagement user/group name/id pair
   1.111 +%l_musr                  @MUSR@
   1.112 +%l_mgrp                  @MGRP@
   1.113 +%l_muid                  %((getent passwd "%{l_musr}"; grep "^%{l_musr}:" /etc/passwd; ypmatch "%{l_musr}" passwd; nismatch "%{l_musr}" passwd; nidump passwd . | grep "^%{l_musr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
   1.114 +%l_mgid                  %((getent group  "%{l_mgrp}"; grep "^%{l_mgrp}:" /etc/group;  ypmatch "%{l_mgrp}" group;  nismatch "%{l_mgrp}" group;  nidump group  . | grep "^%{l_musr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
   1.115 +
   1.116 +#   the *R*restricted user/group name/id pair
   1.117 +%l_rusr                  @RUSR@
   1.118 +%l_rgrp                  @RGRP@
   1.119 +%l_ruid                  %((getent passwd "%{l_rusr}"; grep "^%{l_rusr}:" /etc/passwd; ypmatch "%{l_rusr}" passwd; nismatch "%{l_rusr}" passwd; nidump passwd . | grep "^%{l_rusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
   1.120 +%l_rgid                  %((getent group  "%{l_rgrp}"; grep "^%{l_rgrp}:" /etc/group;  ypmatch "%{l_rgrp}" group;  nismatch "%{l_rgrp}" group;  nidump group  . | grep "^%{l_rusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
   1.121 +
   1.122 +#   the *N*on-privileged user/group name/id pair
   1.123 +%l_nusr                  @NUSR@
   1.124 +%l_ngrp                  @NGRP@
   1.125 +%l_nuid                  %((getent passwd "%{l_nusr}"; grep "^%{l_nusr}:" /etc/passwd; ypmatch "%{l_nusr}" passwd; nismatch "%{l_nusr}" passwd; nidump passwd . | grep "^%{l_nusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
   1.126 +%l_ngid                  %((getent group  "%{l_ngrp}"; grep "^%{l_ngrp}:" /etc/group;  ypmatch "%{l_ngrp}" group;  nismatch "%{l_ngrp}" group;  nidump group  . | grep "^%{l_nusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
   1.127 +
   1.128 +#   backward compatibility (openpkg < 20020204)
   1.129 +%l_fsusr                 %{l_musr}
   1.130 +%l_fsgrp                 %{l_mgrp}
   1.131 +%l_npuid                 %{l_nuid}
   1.132 +%l_npgid                 %{l_ngid}
   1.133 +
   1.134 +#   define the installation hierarchy (used parts)
   1.135 +%l_prefix                @l_prefix@
   1.136 +%l_prefix_static         @l_prefix_static@
   1.137 +
   1.138 +#   define the installation hierarchy (unused parts)
   1.139 +%l_exec_prefix           %{l_prefix}
   1.140 +%l_bindir                %{l_prefix}/bin
   1.141 +%l_sbindir               %{l_prefix}/sbin
   1.142 +%l_libexecdir            %{l_prefix}/libexec
   1.143 +%l_datadir               %{l_prefix}/share
   1.144 +%l_sysconfdir            %{l_prefix}/etc
   1.145 +%l_sharedstatedir        %{l_prefix}/com
   1.146 +%l_localstatedir         %{l_prefix}/var
   1.147 +%l_libdir                %{l_prefix}/lib
   1.148 +%l_includedir            %{l_prefix}/include
   1.149 +%l_infodir               %{l_prefix}/info
   1.150 +%l_mandir                %{l_prefix}/man
   1.151 +%l_docdir                %{l_prefix}/doc
   1.152 +
   1.153 +#   provide killer macro "%{l_value -s|-b|-c (l_xxx ...|-a|-A)}" which
   1.154 +#   expands to the values of previous l_xxx variables in this file. With
   1.155 +#   option "-s" it expands into a chain of "-e 's;<name>;<value>;g'"
   1.156 +#   constructs for used with Stream Editor sed(1), with option "-b" it
   1.157 +#   expands into a chain of "<name>='<value>';" constructs for use with
   1.158 +#   Bourne-Shell sh(1), with option "-c" it expands into a chain of "set
   1.159 +#   <name> = '<value>';" constructs for use with C-Shell csh(1). But
   1.160 +#   be careful, <value> currently (for expansion speed reasons) is not
   1.161 +#   escaped, so make sure the values of the above macros do not contain
   1.162 +#   ";" for "-s" and ";" for "-b" and "-c". You can either specify one
   1.163 +#   or more names of variables to expand or use "-a" for mostly all
   1.164 +#   variables and "-A" for really all variables.
   1.165 +%l_value(sbcaA)          %{expand:%(l=""; for x in `if [ ".%*" != . ]; then echo "%* "; else p=""; if [ ".%{-a:yes}" = .yes ]; then p="^%%l_(prefix|[smrn](usr|grp|uid|gid))"; elif [ ".%{-A:yes}" = .yes ]; then p="^%%l_"; fi; if [ ".$p" != . ]; then egrep "$p" %{l_prefix}/etc/openpkg/rpmmacros | sed -e '/^%%l_value/,$d' -e 's;^%%\\(l_[a-z1-9_]*\\).*;\\1;'; fi; fi`; do e=""; if [ ".%{-s:yes}" = .yes ]; then e="-e 's;@$x@;%%{$x};g'"; elif [ ".%{-b:yes}" = .yes ]; then e="$x='%%{$x}';"; elif [ ".%{-c:yes}" = .yes ]; then e="set $x = '%%{$x}';"; else e="%%{$x}"; fi; if [ ".$l" = . ]; then l="$e"; else l="$l $e"; fi; done; echo "$l")}
   1.166 +
   1.167 +#   local version of the empty macro
   1.168 +%l_nil                   %{nil}
   1.169 +
   1.170 +#   override the internal RPM hierarchy variables
   1.171 +%_usr                    %{nil}
   1.172 +%_var                    %{nil}
   1.173 +%_usrsrc                 %{nil}
   1.174 +%_topdir                 %{nil}
   1.175 +%_dbpath                 %{l_prefix}/RPM/DB
   1.176 +%_builddir               %{l_prefix}/RPM/TMP
   1.177 +%_tmppath                %{l_prefix}/RPM/TMP
   1.178 +%_sourcedir              %{l_prefix}/RPM/SRC/%{name}
   1.179 +%_specdir                %{l_prefix}/RPM/SRC/%{name}
   1.180 +%_rpmdir                 %{l_prefix}/RPM/PKG
   1.181 +%_srcrpmdir              %{l_prefix}/RPM/PKG
   1.182 +%_repackage_dir          %{l_prefix}/RPM/PKG
   1.183 +%_cache_dbpath           %{l_prefix}/RPM/PKG
   1.184 +%_solve_dbpath           %{l_prefix}/RPM/PKG
   1.185 +%_solve_pkgsdir          %{l_prefix}/RPM/PKG
   1.186 +%_defaultdocdir          %{l_docdir}
   1.187 +
   1.188 +#   complement the %{SOURCE<n>} and %{PATCH<n>} with %{SOURCE <file>} and %{PATCH <file>}
   1.189 +%SOURCE()                %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
   1.190 +%PATCH()                 %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
   1.191 +
   1.192 +#   override RPM's absolute tool paths with relative ones
   1.193 +#   (because if you upgrade RPM it would hard-code tools in own hierarchy, too)
   1.194 +%__awk                   awk
   1.195 +%__bzip2                 %{_bzip2bin}
   1.196 +%__cat                   cat
   1.197 +%__chgrp                 chgrp
   1.198 +%__chmod                 chmod
   1.199 +%__chown                 chown
   1.200 +%__cp                    cp
   1.201 +%__cpio                  cpio
   1.202 +%__grep                  grep
   1.203 +%__gzip                  %{_gzipbin}
   1.204 +%__id                    id
   1.205 +%__install               install
   1.206 +%__ln_s                  ln -s
   1.207 +%__make                  make
   1.208 +%__mkdir                 mkdir
   1.209 +%__mkdir_p               %{l_shtool} mkdir -p
   1.210 +%__mv                    mv
   1.211 +%__patch                 %{_patchbin}
   1.212 +%__perl                  perl
   1.213 +%__pgp                   %{_pgpbin}
   1.214 +%__rm                    rm
   1.215 +%__rsh                   rsh
   1.216 +%__sed                   sed
   1.217 +%__ssh                   ssh
   1.218 +%__tar                   %{_tarbin}
   1.219 +%__unzip                 %{_unzipbin}
   1.220 +
   1.221 +#   override some more RPM macros where the default value is not acceptable
   1.222 +%_dependency_whiteout    %{nil}
   1.223 +%__debug_install_post    %{nil}
   1.224 +%_unpackaged_files_terminate_build 0
   1.225 +
   1.226 +#   provide fixed paths to tools (standard)
   1.227 +%_gzipbin                %{l_prefix}/lib/openpkg/gzip
   1.228 +%_bzip2bin               %{l_prefix}/lib/openpkg/bzip2
   1.229 +%_patchbin               %{l_prefix}/lib/openpkg/patch
   1.230 +%_tarbin                 %{l_prefix}/lib/openpkg/tar
   1.231 +%_unzipbin               %{l_prefix}/lib/openpkg/unzip
   1.232 +
   1.233 +#   provide path to platform identification file
   1.234 +%__platform              %{l_prefix}/etc/openpkg/platform
   1.235 +
   1.236 +#   provide fixed paths to tools (additional)
   1.237 +%l_rc                    %{l_prefix}/etc/rc
   1.238 +%l_rpm                   %{l_prefix}/libexec/openpkg/rpm
   1.239 +%l_rpm2cpio              %{l_prefix}/libexec/openpkg/rpm2cpio
   1.240 +%l_rpm_config            %{l_prefix}/libexec/openpkg/rpm-config
   1.241 +%l_lsync                 %{l_prefix}/libexec/openpkg/lsync
   1.242 +%l_rpmtool               %{l_prefix}/lib/openpkg/rpmtool
   1.243 +%l_shtool                %{l_prefix}/lib/openpkg/shtool
   1.244 +%l_curl                  %{l_prefix}/lib/openpkg/curl
   1.245 +%l_bash                  %{l_prefix}/lib/openpkg/bash
   1.246 +%l_uuid                  %{l_prefix}/lib/openpkg/uuid
   1.247 +
   1.248 +#   provide smart paths to tools
   1.249 +%l_tool_locate()         %(if [ ".%{expand:%%{?use_%1}}" != . ]; then tool="%{expand:%%{use_%1}}"; elif [ -f "%{l_prefix}/bin/%2" ]; then tool="%{l_prefix}/bin/%2"; elif [ -f "%{l_prefix}/lib/openpkg/%2" ]; then tool="%{l_prefix}/lib/openpkg/%2"; else tool="%2"; fi; echo $tool)
   1.250 +%l_gzip                  %{l_tool_locate gzip     gzip}
   1.251 +%l_bzip2                 %{l_tool_locate bzip2    bzip2}
   1.252 +%l_tar                   %{l_tool_locate tar      tar}
   1.253 +%l_make                  %{l_tool_locate make     make}
   1.254 +%l_cc                    %{l_tool_locate cc       cc}
   1.255 +%l_ar                    %{l_tool_locate ar       ar}
   1.256 +%l_ld                    %{l_tool_locate ld       ld}
   1.257 +%l_as                    %{l_tool_locate as       as}
   1.258 +%l_strip                 %{l_tool_locate strip    strip}
   1.259 +%l_cxx                   %{l_tool_locate cxx      c++}
   1.260 +%l_patch                 %{l_tool_locate patch    patch}
   1.261 +%l_sed                   %{l_tool_locate sed      sed}
   1.262 +%l_grep                  %{l_tool_locate grep     grep}
   1.263 +%l_awk                   %{l_tool_locate awk      awk}
   1.264 +%l_autoconf              %{l_tool_locate autoconf autoconf}
   1.265 +%l_automake              %{l_tool_locate automake automake}
   1.266 +%l_libtool               %{l_tool_locate libtool  libtool}
   1.267 +%l_flex                  %{l_tool_locate flex     flex}
   1.268 +%l_bison                 %{l_tool_locate bison    bison}
   1.269 +%l_perl                  %{l_tool_locate perl     perl}
   1.270 +%l_miniperl              %{l_tool_locate miniperl miniperl}
   1.271 +%l_openssl               %{l_tool_locate openssl  openssl}
   1.272 +%l_xmkmf                 %{l_tool_locate xmkmf    xmkmf}
   1.273 +%l_vcheck                %{l_tool_locate vcheck   vcheck}
   1.274 +
   1.275 +#   tool options
   1.276 +%l_mflags(O)             %(%{l_sane_env}; %{l_rpmtool} mflags %{-O:-O} "%{l_make}")
   1.277 +%l_cflags(O)             %(%{l_sane_env}; %{l_rpmtool} cflags %{-O:-O} "%{l_cc}")
   1.278 +%l_cxxflags(O)           %(%{l_sane_env}; %{l_rpmtool} cflags %{-O:-O} "%{l_cxx}")
   1.279 +%l_cppflags(i)           %(%{l_sane_env}; %{l_rpmtool} cppflags -p%{l_prefix} %{-i:-i} -- %*)
   1.280 +%l_ldflags()             %(%{l_sane_env}; %{l_rpmtool} ldflags  -p%{l_prefix}          -- %*)
   1.281 +
   1.282 +#   OSSP fake syslog library
   1.283 +%l_fsl_ldflags()         %(if [ ".%{with_fsl}" = ".yes" ]; then flags=`(%{l_prefix}/bin/fsl-config --all --ldflags) 2>/dev/null`; else flags=''; fi; echo $flags)
   1.284 +%l_fsl_libs()            %(if [ ".%{with_fsl}" = ".yes" ]; then flags=`(%{l_prefix}/bin/fsl-config --all --libs   ) 2>/dev/null`; else flags=''; fi; echo $flags)
   1.285 +
   1.286 +#   determine the current username
   1.287 +%l_whoami                %((id -un) 2>/dev/null || (whoami) 2>/dev/null || (who am i | cut "-d " -f1) 2>/dev/null || echo $LOGNAME)
   1.288 +
   1.289 +#   macros for dynamically generating a %files list
   1.290 +%l_files_defattr         '%%defattr(-,%{l_musr},%{l_mgrp})'
   1.291 +%l_files_all             '%{l_prefix}'
   1.292 +%l_files_noshared        '%%not %%dir {%{l_prefix},%{l_prefix}/*,%{l_prefix}/etc/rc.d,%{l_prefix}/man/*}'
   1.293 +%l_files_std()           %l_files_defattr %l_files_all %l_files_noshared
   1.294 +
   1.295 +#   path to local build root
   1.296 +%l_buildroot             %{_tmppath}/%{name}-%{version}-root
   1.297 +
   1.298 +#   path to local temporary location
   1.299 +%l_tmpdir()              %{_tmppath}
   1.300 +%l_tmpfile()             %{l_tmpdir}/%{name}-%{version}-%{release}-tmp%{?1:-%1}
   1.301 +
   1.302 +#   executable path for %post/%pre
   1.303 +%_install_script_path    %{l_prefix}/bin:%{l_prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin
   1.304 +
   1.305 +#   names of RPM files
   1.306 +%l_srcrpmfilename        %%{NAME}-%%{VERSION}-%%{RELEASE}.src.rpm
   1.307 +%l_binrpmfilename        %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-%%{OS}-%{l_tag}.rpm
   1.308 +
   1.309 +#   override the name scheme for RPM files
   1.310 +%_rpmfilename            %{l_binrpmfilename}
   1.311 +%_build_name_fmt         %{l_binrpmfilename}
   1.312 +%_repackage_name_fmt     %{l_binrpmfilename}
   1.313 +%_solve_name_fmt         %{_solve_pkgsdir}/%{l_binrpmfilename}
   1.314 +
   1.315 +#   override the payload compression for the CPIO parts of an RPM
   1.316 +#   (we use the equivalent of "bzip2 -9")
   1.317 +%_source_payload         w9.bzdio
   1.318 +%_binary_payload         w9.bzdio
   1.319 +
   1.320 +#   package signature type is OpenPGP via GnuPG
   1.321 +%__gpg                   %{l_prefix}/bin/gpg
   1.322 +%_signature              gpg
   1.323 +%__vsflags               1
   1.324 +
   1.325 +#   two macro-processor add-ons (should be part of forthcoming RPM releases)
   1.326 +%ifdef()                 %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
   1.327 +%ifndef()                %if %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
   1.328 +
   1.329 +#   macro for package option configuration
   1.330 +%option()                %{expand:%%{!?%{1}:%%global %*}} %{expand:%%global _options %{?_options:%{_options}:}%{1}=%%%{1}} \
   1.331 +Provides: %{name}::%{1} = %(echo '%{expand:%%{%{1}}}' | sed -e 's;%%;%%%%;g' -e 's; ;%%20;g' -e 's;	;%%09;g')
   1.332 +
   1.333 +#   macros for NoSource/NoPatch (distribution restriction) integrity handling
   1.334 +%NoSource()              %(if [ ".%{?restriction}" != ".no" ]; then echo "NoSource: %1"; fi)%{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{SOURCEURL%1}}
   1.335 +%NoPatch()               %(if [ ".%{?restriction}" != ".no" ]; then echo "NoPatch: %1"; fi)%{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{PATCHURL%1}}
   1.336 +%integrity()             %{l_check_nosource}
   1.337 +
   1.338 +#   macros for checking build environment
   1.339 +%l_check_nosource()      %(%{l_sane_env}; checkok=1; checkinfo=`echo "Sorry, this OpenPKG package contains a DISTRIBUTION RESTRICTED source file."; echo "Before you can proceed building this package, fetch missing files MANUALLY:"`; for url in . %{?_restricted}; do [ ".$url" = .. ] && continue; eval `echo "$url" | sed -e 's!^\\(.*\\)::/\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' -e 's!^\\([^:;][^:]*://.*/\\)\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' -e 's:^\\([^;].*\\)$:;url="(unknown location) "; file="\\1":' -e 's:^;::'`; if [ ! -f "%{_specdir}/$file" ] && [ ! -f "%{_sourcedir}/$file" ]; then checkok=0; checkinfo=`echo "${checkinfo}"; echo ""; echo "from ${url}"; echo "file ${file}"; echo "here %{_sourcedir}/$file"`; fi; done; if [ $checkok -ne 1 ]; then echo "set +x"; echo "$checkinfo" | %{l_rpmtool} msg -b -t error | sed -e 's;^;echo ";' -e 's;$;";'; echo "exit 1"; fi)
   1.340 +%l_check_class()         %(%{l_sane_env}; class=`echo "@:%{?class}:%{?distribution}" | sed -e 's;^@:\\([^:][^:]*\\):.*$;\\1;' -e 's;^@:.*\\[\\(.*\\)\\].*$;\\1;' -e 's;^@:.*$;JUNK;'`; %{l_rpmtool} check-class "$class")
   1.341 +%prep %%prep\
   1.342 +    %{l_check_nosource} \
   1.343 +    %{l_check_class} \
   1.344 +    %{nil}
   1.345 +
   1.346 +#   macro-processor add-on for testing external conditions
   1.347 +%l_test(pfd)             %(if [ ".%{?-p:yes}" = .yes ]; then %{l_rpm} -q %1 >/dev/null 2>&1; rc=$?; elif [ ".%{?-f:yes}" = .yes ]; then test -f %1; rc=$?; elif [ ".%{?-d:yes}" = .yes ]; then test -d %1; rc=$?; fi; if [ ".$rc" = .0 ]; then echo "yes"; else echo "no"; fi)
   1.348 +
   1.349 +#   default list of vendor source fetching locations
   1.350 +%l_fetch_mirror_0        -
   1.351 +%l_fetch_mirror_1        -
   1.352 +%l_fetch_mirror_2        -
   1.353 +%l_fetch_mirror_3        -
   1.354 +%l_fetch_mirror_4        -
   1.355 +%l_fetch_mirror_5        -
   1.356 +%l_fetch_mirror_6        -
   1.357 +%l_fetch_mirror_7        -
   1.358 +%l_fetch_mirror_8        -
   1.359 +%l_fetch_mirror_9        -
   1.360 +%l_fetch_backup_0        -
   1.361 +%l_fetch_backup_1        -
   1.362 +%l_fetch_backup_2        -
   1.363 +%l_fetch_backup_3        -
   1.364 +%l_fetch_backup_4        -
   1.365 +%l_fetch_backup_5        -
   1.366 +%l_fetch_backup_6        -
   1.367 +%l_fetch_backup_7        -
   1.368 +%l_fetch_backup_8        -
   1.369 +%l_fetch_backup_9        ftp://ftp.openpkg.org/sources/DST/%{name}/
   1.370 +
   1.371 +#   sane build environment setup
   1.372 +%l_build_path            %(if [ -d %{l_prefix}/lib/openpkg/override ]; then echo "%{l_prefix}/lib/openpkg/override:"; fi)%{l_prefix}/bin:%{l_prefix}/sbin:@l_build_path@%(if [ -d %{l_prefix}/lib/openpkg/fallback ]; then echo ":%{l_prefix}/lib/openpkg/fallback"; fi)
   1.373 +%l_build_ldlp            %{l_prefix}/lib:@l_build_ldlp@
   1.374 +%l_build_ulim            @l_build_ulim@
   1.375 +%l_build_shell_cmd       %{l_prefix}/lib/openpkg/bash
   1.376 +%l_build_shell_opt       --norc --noprofile --posix
   1.377 +
   1.378 +#   sane build environment for manual usage in macros (currently just $PATH)
   1.379 +%l_sane_env              PATH="%{l_build_path}"; export PATH; LD_LIBRARY_PATH="%{l_build_ldlp}"; export LD_LIBRARY_PATH
   1.380 +
   1.381 +#   sane build environment for %prep/%build/%install
   1.382 +%_buildshell             env -i %{l_build_shell_cmd} %{l_build_shell_opt}
   1.383 +%___build_pre \
   1.384 +HOME="%{l_prefix}"\
   1.385 +SHELL="%{l_build_shell_cmd}"\
   1.386 +TERM="%(echo $TERM)"\
   1.387 +TMPDIR="%{_tmppath}"\
   1.388 +USER="%(echo $USER)"\
   1.389 +LOGNAME="%(echo $LOGNAME)"\
   1.390 +PATH="%{l_build_path}"\
   1.391 +LD_LIBRARY_PATH="%{l_build_ldlp}"\
   1.392 +export HOME SHELL TMPDIR USER LOGNAME PATH LD_LIBRARY_PATH\
   1.393 +RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
   1.394 +RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
   1.395 +RPM_OPT_FLAGS=\"%{optflags}\"\
   1.396 +RPM_ARCH=\"%{l_host_arch}\"\
   1.397 +RPM_OS=\"%{l_host_os}\"\
   1.398 +RPM_DOC_DIR=\"%{_docdir}\"\
   1.399 +RPM_PACKAGE_NAME=\"%{name}\"\
   1.400 +RPM_PACKAGE_VERSION=\"%{version}\"\
   1.401 +RPM_PACKAGE_RELEASE=\"%{release}\"\
   1.402 +export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS RPM_DOC_DIR\
   1.403 +export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
   1.404 +%{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
   1.405 +export RPM_BUILD_ROOT}\
   1.406 +%{l_build_ulim}\
   1.407 +umask 022\
   1.408 +%{verbose:set -x}%{!verbose:exec >/dev/null}\
   1.409 +cd %{u2p:%{_builddir}}
   1.410 +
   1.411 +#   special %track section support
   1.412 +%__spec_track_template VCFILE="%{_tmppath}/%{name}-%{version}-%{release}.vc"\
   1.413 +rm -f $VCFILE\
   1.414 +set -o noclobber\
   1.415 +sed -e 's;^ *#.*$;;' -e 's;^    ;;' >$VCFILE <<'EOF'\
   1.416 +%{nil}
   1.417 +%__spec_track_post EOF\
   1.418 +if [ ".%{?___track_dump}" = .yes ]; then\
   1.419 +    cat $VCFILE\
   1.420 +else\
   1.421 +    if [ ! -f "%{l_vcheck}" ]; then\
   1.422 +        echo "rpm:ERROR: Vendor source tracking functionality currently not available because"\
   1.423 +        echo "rpm:ERROR: URL tracking tool vcheck(1) not found under \\"%{l_vcheck}\\"."\
   1.424 +        echo "rpm:ERROR: You have to install the OpenPKG \\"vcheck\\" package first or set"\
   1.425 +        echo "rpm:ERROR: the RPM macro \\"%%{l_vcheck}\\" to the path of your vcheck(1) tool."\
   1.426 +        exit 0\
   1.427 +    fi\
   1.428 +    ( echo "config = {"\
   1.429 +      echo "}"\
   1.430 +    ) >>$VCFILE\
   1.431 +    %{l_vcheck} -v -f $VCFILE || true\
   1.432 +fi\
   1.433 +rm -f $VCFILE\
   1.434 +%{nil}
   1.435 +

mercurial