openpkg/rpmmacros

Sun, 29 May 2011 16:29:06 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sun, 29 May 2011 16:29:06 +0200
changeset 344
e33c1efbd60f
parent 13
cb59d6afeb61
child 427
71503088f51b
permissions
-rw-r--r--

Update, correct, improve build configuration and packaging logic.
Update to new version of vendor software, bump copyright date, remove implicit
gcc dependency, add comments for Trolltech bug tracking, correct enforced
dynamic library linkage, and install mysterious process stub binary.

     1 ##
     2 ##  rpmmacros -- OpenPKG RPM Macros
     3 ##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     5 ##
     6 ##  Permission to use, copy, modify, and distribute this software for
     7 ##  any purpose with or without fee is hereby granted, provided that
     8 ##  the above copyright notice and this permission notice appear in all
     9 ##  copies.
    10 ##
    11 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    12 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    13 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    14 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    15 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    16 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    17 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    18 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    19 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    20 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    21 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    22 ##  SUCH DAMAGE.
    23 ##
    24 ##  The purpose of this macro set is to override the default
    25 ##  macros in the OpenPKG RPM installation for the @l_prefix@ hierarchy.
    26 ##
    28 #   the OpenPKG release identification (for the current package or as a fallback for the bootstrap package)
    29 %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"})
    31 #   the OpenPKG OIDs (root is officially registered at IANA)
    32 %l_openpkg_oid           1.3.6.1.4.1.18749
    33 %l_openpkg_oid_bootstrap %{l_openpkg_oid}.4.1
    34 %l_openpkg_oid_instance  %{l_openpkg_oid_bootstrap}.1
    35 %l_openpkg_oid_platform  %{l_openpkg_oid_bootstrap}.2
    36 %l_openpkg_oid_tagfmtopt %{l_openpkg_oid_bootstrap}.3
    38 #   the OpenPKG package tagging
    39 %l_tag_fmt               @TAG@
    40 %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)
    41 %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;')
    42 %l_tag_fmt_opt           %(uuid_ns="`%{l_uuid} -v3 ns:OID %{l_openpkg_oid_tagfmtopt}`"; %{l_uuid} -v3 $uuid_ns '%{?_options}')
    43 %l_tag_fmt_uuid          %(%{l_uuid} -v1)
    44 %l_tag_fmt_time          %(date '+%%Y%%m%%d%%H%%M%%S')
    45 %l_tag_fmt_user          %(%{l_shtool} echo -e '%%u')
    46 %l_tag_fmt_host          %(%{l_shtool} echo -e '%%h%%d')
    47 %l_tag_gen               %{expand:%(echo '%{l_tag_fmt}' | sed -e 's/<\\([a-zA-Z][_a-zA-Z0-9]*\\)>/%%{l_tag_fmt_\\1}/g')}
    48 %l_tag                   %(echo "%{l_tag_gen}" | sed -e 's;-;;g')
    50 #   the OpenPKG instance location (backward compatibility only)
    51 %l_location              %{l_tag}
    53 #   standard RPM host platform identification
    54 #   (defaults via "shtool platform" and uname(3); used internally)
    55 #%_host_cpu              ...USE INTERNAL DEFAULT...
    56 #%_host_vendor           ...USE INTERNAL DEFAULT...
    57 #%_host_os               ...USE INTERNAL DEFAULT...
    58 %_host_alias             %{nil}
    59 %_host                   %{_host_cpu}-%{_host_os}
    61 #   standard RPM build platform identification
    62 #   (defaults via %{_host*} macros; not used internally AFAIK)
    63 %_build_cpu              %{_host_cpu}
    64 %_build_vendor           %{_host_vendor}
    65 %_build_os               %{_host_os}
    66 %_build_alias            %{_host_alias}
    67 %_build                  %{_host}
    69 #   standard RPM target platform identification
    70 #   (defaults via %{_host*} macros; used internally for %ifarch/%ifnarch)
    71 %_target_cpu             %{_host_cpu}
    72 %_target_vendor          %{_host_vendor}
    73 %_target_os              %{_host_os}
    74 %_target_alias           %{_host_alias}
    75 %_target                 %{_host}
    77 #   legacy RPM platform macros
    78 #   (defaults via config.guess/config.sub under RPM build-time)
    79 %_arch                   %{_host_cpu}
    80 %_vendor                 %{_host_vendor}
    81 %_os                     %{_host_os}
    83 #   legacy RPM platform macros
    84 #   (defaults via various other macros; partly used internally)
    85 %_build_arch             %{_arch}
    86 %_target_platform        %{_target_cpu}-%{_target_vendor}-%{_target_os}
    87 %_gnu                    %{nil}
    89 #   official OpenPKG host platform identification
    90 %l_host_arch             %{_host_cpu}
    91 %l_host_vendor           %{_host_vendor}
    92 %l_host_os               %{_host_os}
    93 %l_host                  %{_host_cpu}-%{_host_os}
    95 #   new OpenPKG platform identification
    96 %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")
    98 #   old OpenPKG platform identification
    99 %l_target                %{l_platform -t}
   101 #   the *S*uper-user user/group name/id pair
   102 %l_susr                  @SUSR@
   103 %l_sgrp                  @SGRP@
   104 %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; }')
   105 %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; }')
   107 #   the *M*anagement user/group name/id pair
   108 %l_musr                  @MUSR@
   109 %l_mgrp                  @MGRP@
   110 %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; }')
   111 %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; }')
   113 #   the *R*restricted user/group name/id pair
   114 %l_rusr                  @RUSR@
   115 %l_rgrp                  @RGRP@
   116 %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; }')
   117 %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; }')
   119 #   the *N*on-privileged user/group name/id pair
   120 %l_nusr                  @NUSR@
   121 %l_ngrp                  @NGRP@
   122 %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; }')
   123 %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; }')
   125 #   backward compatibility (openpkg < 20020204)
   126 %l_fsusr                 %{l_musr}
   127 %l_fsgrp                 %{l_mgrp}
   128 %l_npuid                 %{l_nuid}
   129 %l_npgid                 %{l_ngid}
   131 #   define the installation hierarchy (used parts)
   132 %l_prefix                @l_prefix@
   133 %l_prefix_static         @l_prefix_static@
   135 #   define the installation hierarchy (unused parts)
   136 %l_exec_prefix           %{l_prefix}
   137 %l_bindir                %{l_prefix}/bin
   138 %l_sbindir               %{l_prefix}/sbin
   139 %l_libexecdir            %{l_prefix}/libexec
   140 %l_datadir               %{l_prefix}/share
   141 %l_sysconfdir            %{l_prefix}/etc
   142 %l_sharedstatedir        %{l_prefix}/com
   143 %l_localstatedir         %{l_prefix}/var
   144 %l_libdir                %{l_prefix}/lib
   145 %l_includedir            %{l_prefix}/include
   146 %l_infodir               %{l_prefix}/info
   147 %l_mandir                %{l_prefix}/man
   148 %l_docdir                %{l_prefix}/doc
   150 #   provide killer macro "%{l_value -s|-b|-c (l_xxx ...|-a|-A)}" which
   151 #   expands to the values of previous l_xxx variables in this file. With
   152 #   option "-s" it expands into a chain of "-e 's;<name>;<value>;g'"
   153 #   constructs for used with Stream Editor sed(1), with option "-b" it
   154 #   expands into a chain of "<name>='<value>';" constructs for use with
   155 #   Bourne-Shell sh(1), with option "-c" it expands into a chain of "set
   156 #   <name> = '<value>';" constructs for use with C-Shell csh(1). But
   157 #   be careful, <value> currently (for expansion speed reasons) is not
   158 #   escaped, so make sure the values of the above macros do not contain
   159 #   ";" for "-s" and ";" for "-b" and "-c". You can either specify one
   160 #   or more names of variables to expand or use "-a" for mostly all
   161 #   variables and "-A" for really all variables.
   162 %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")}
   164 #   local version of the empty macro
   165 %l_nil                   %{nil}
   167 #   override the internal RPM hierarchy variables
   168 %_usr                    %{nil}
   169 %_var                    %{nil}
   170 %_usrsrc                 %{nil}
   171 %_topdir                 %{nil}
   172 %_dbpath                 %{l_prefix}/RPM/DB
   173 %_builddir               %{l_prefix}/RPM/TMP
   174 %_tmppath                %{l_prefix}/RPM/TMP
   175 %_sourcedir              %{l_prefix}/RPM/SRC/%{name}
   176 %_specdir                %{l_prefix}/RPM/SRC/%{name}
   177 %_rpmdir                 %{l_prefix}/RPM/PKG
   178 %_srcrpmdir              %{l_prefix}/RPM/PKG
   179 %_repackage_dir          %{l_prefix}/RPM/PKG
   180 %_cache_dbpath           %{l_prefix}/RPM/PKG
   181 %_solve_dbpath           %{l_prefix}/RPM/PKG
   182 %_solve_pkgsdir          %{l_prefix}/RPM/PKG
   183 %_defaultdocdir          %{l_docdir}
   185 #   complement the %{SOURCE<n>} and %{PATCH<n>} with %{SOURCE <file>} and %{PATCH <file>}
   186 %SOURCE()                %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
   187 %PATCH()                 %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
   189 #   override RPM's absolute tool paths with relative ones
   190 #   (because if you upgrade RPM it would hard-code tools in own hierarchy, too)
   191 %__awk                   awk
   192 %__bzip2                 %{_bzip2bin}
   193 %__cat                   cat
   194 %__chgrp                 chgrp
   195 %__chmod                 chmod
   196 %__chown                 chown
   197 %__cp                    cp
   198 %__cpio                  cpio
   199 %__grep                  grep
   200 %__gzip                  %{_gzipbin}
   201 %__id                    id
   202 %__install               install
   203 %__ln_s                  ln -s
   204 %__make                  make
   205 %__mkdir                 mkdir
   206 %__mkdir_p               %{l_shtool} mkdir -p
   207 %__mv                    mv
   208 %__patch                 %{_patchbin}
   209 %__perl                  perl
   210 %__pgp                   %{_pgpbin}
   211 %__rm                    rm
   212 %__rsh                   rsh
   213 %__sed                   sed
   214 %__ssh                   ssh
   215 %__tar                   %{_tarbin}
   216 %__unzip                 %{_unzipbin}
   218 #   override some more RPM macros where the default value is not acceptable
   219 %_dependency_whiteout    %{nil}
   220 %__debug_install_post    %{nil}
   221 %_unpackaged_files_terminate_build 0
   223 #   override automatic dependency generation
   224 %_use_internal_dependency_generator 0
   225 %__find_provides         %{nil}
   226 %__find_requires         %{nil}
   227 %__find_prereq           %{nil}
   228 %__perl_provides         %{nil}
   229 %__perl_requires         %{nil}
   231 #   provide fixed paths to tools (standard)
   232 %_gzipbin                %{l_prefix}/lib/openpkg/gzip
   233 %_bzip2bin               %{l_prefix}/lib/openpkg/bzip2
   234 %_patchbin               %{l_prefix}/lib/openpkg/patch
   235 %_tarbin                 %{l_prefix}/lib/openpkg/tar
   236 %_unzipbin               %{l_prefix}/lib/openpkg/unzip
   238 #   provide path to platform identification file
   239 %__platform              %{l_prefix}/etc/openpkg/platform
   241 #   provide fixed paths to tools (additional)
   242 %l_rc                    %{l_prefix}/etc/rc
   243 %l_rpm                   %{l_prefix}/libexec/openpkg/rpm
   244 %l_rpm2cpio              %{l_prefix}/libexec/openpkg/rpm2cpio
   245 %l_rpm_config            %{l_prefix}/libexec/openpkg/rpm-config
   246 %l_lsync                 %{l_prefix}/libexec/openpkg/lsync
   247 %l_rpmtool               %{l_prefix}/lib/openpkg/rpmtool
   248 %l_shtool                %{l_prefix}/lib/openpkg/shtool
   249 %l_curl                  %{l_prefix}/lib/openpkg/curl
   250 %l_bash                  %{l_prefix}/lib/openpkg/bash
   251 %l_uuid                  %{l_prefix}/lib/openpkg/uuid
   253 #   provide smart paths to tools
   254 %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)
   255 %l_gzip                  %{l_tool_locate gzip     gzip}
   256 %l_bzip2                 %{l_tool_locate bzip2    bzip2}
   257 %l_tar                   %{l_tool_locate tar      tar}
   258 %l_make                  %{l_tool_locate make     make}
   259 %l_cc                    %{l_tool_locate cc       cc}
   260 %l_ar                    %{l_tool_locate ar       ar}
   261 %l_ld                    %{l_tool_locate ld       ld}
   262 %l_as                    %{l_tool_locate as       as}
   263 %l_strip                 %{l_tool_locate strip    strip}
   264 %l_cxx                   %{l_tool_locate cxx      c++}
   265 %l_patch                 %{l_tool_locate patch    patch}
   266 %l_sed                   %{l_tool_locate sed      sed}
   267 %l_grep                  %{l_tool_locate grep     grep}
   268 %l_awk                   %{l_tool_locate awk      awk}
   269 %l_autoconf              %{l_tool_locate autoconf autoconf}
   270 %l_automake              %{l_tool_locate automake automake}
   271 %l_libtool               %{l_tool_locate libtool  libtool}
   272 %l_flex                  %{l_tool_locate flex     flex}
   273 %l_bison                 %{l_tool_locate bison    bison}
   274 %l_perl                  %{l_tool_locate perl     perl}
   275 %l_miniperl              %{l_tool_locate miniperl miniperl}
   276 %l_openssl               %{l_tool_locate openssl  openssl}
   277 %l_xmkmf                 %{l_tool_locate xmkmf    xmkmf}
   278 %l_vcheck                %{l_tool_locate vcheck   vcheck}
   280 #   tool options
   281 %l_mflags(O)             %(%{l_sane_env}; %{l_rpmtool} mflags %{-O:-O} "%{l_make}")
   282 %l_cflags(O)             %(%{l_sane_env}; %{l_rpmtool} cflags %{-O:-O} "%{l_cc}")
   283 %l_cxxflags(O)           %(%{l_sane_env}; %{l_rpmtool} cflags %{-O:-O} "%{l_cxx}")
   284 %l_cppflags(i)           %(%{l_sane_env}; %{l_rpmtool} cppflags -p%{l_prefix} %{-i:-i} -- %*)
   285 %l_ldflags()             %(%{l_sane_env}; %{l_rpmtool} ldflags  -p%{l_prefix}          -- %*)
   287 #   OSSP fake syslog library
   288 %l_fsl_ldflags()         %(if [ ".%{with_fsl}" = ".yes" ]; then flags=`(%{l_prefix}/bin/fsl-config --all --ldflags) 2>/dev/null`; else flags=''; fi; echo $flags)
   289 %l_fsl_libs()            %(if [ ".%{with_fsl}" = ".yes" ]; then flags=`(%{l_prefix}/bin/fsl-config --all --libs   ) 2>/dev/null`; else flags=''; fi; echo $flags)
   291 #   determine the current username
   292 %l_whoami                %((id -un) 2>/dev/null || (whoami) 2>/dev/null || (who am i | cut "-d " -f1) 2>/dev/null || echo $LOGNAME)
   294 #   macros for dynamically generating a %files list
   295 %l_files_defattr         '%%defattr(-,%{l_musr},%{l_mgrp})'
   296 %l_files_all             '%{l_prefix}'
   297 %l_files_noshared        '%%not %%dir {%{l_prefix},%{l_prefix}/*,%{l_prefix}/etc/rc.d,%{l_prefix}/man/*}'
   298 %l_files_std()           %l_files_defattr %l_files_all %l_files_noshared
   300 #   path to local build root
   301 %l_buildroot             %{_tmppath}/%{name}-%{version}-root
   303 #   path to local temporary location
   304 %l_tmpdir()              %{_tmppath}
   305 %l_tmpfile()             %{l_tmpdir}/%{name}-%{version}-%{release}-tmp%{?1:-%1}
   307 #   executable path for %post/%pre
   308 %_install_script_path    %{l_prefix}/bin:%{l_prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin
   310 #   names of RPM files
   311 %l_srcrpmfilename        %%{NAME}-%%{VERSION}-%%{RELEASE}.src.rpm
   312 %l_binrpmfilename        %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-%%{OS}-%{l_tag}.rpm
   314 #   override the name scheme for RPM files
   315 %_rpmfilename            %{l_binrpmfilename}
   316 %_build_name_fmt         %{l_binrpmfilename}
   317 %_repackage_name_fmt     %{l_binrpmfilename}
   318 %_solve_name_fmt         %{_solve_pkgsdir}/%{l_binrpmfilename}
   320 #   override the payload compression for the CPIO parts of an RPM
   321 #   (we use the equivalent of "bzip2 -9")
   322 %_source_payload         w9.bzdio
   323 %_binary_payload         w9.bzdio
   325 #   package signature type is OpenPGP via GnuPG
   326 %__gpg                   %{l_prefix}/bin/gpg
   327 %_signature              gpg
   328 %__vsflags               1
   330 #   two macro-processor add-ons (should be part of forthcoming RPM releases)
   331 %ifdef()                 %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
   332 %ifndef()                %if %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
   334 #   macro for package option configuration
   335 %option()                %{expand:%%{!?%{1}:%%global %*}} %{expand:%%global _options %{?_options:%{_options}:}%{1}=%%%{1}} \
   336 Provides: %{name}::%{1} = %(echo '%{expand:%%{%{1}}}' | sed -e 's;%%;%%%%;g' -e 's; ;%%20;g' -e 's;	;%%09;g')
   338 #   macros for NoSource/NoPatch (distribution restriction) integrity handling
   339 %NoSource()              %(if [ ".%{?restriction}" != ".no" ]; then echo "NoSource: %1"; fi)%{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{SOURCEURL%1}}
   340 %NoPatch()               %(if [ ".%{?restriction}" != ".no" ]; then echo "NoPatch: %1"; fi)%{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{PATCHURL%1}}
   341 %integrity()             %{l_check_nosource}
   343 #   macros for checking build environment
   344 %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)
   345 %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")
   346 %prep %%prep\
   347     %{l_check_nosource} \
   348     %{l_check_class} \
   349     %{nil}
   351 #   macro-processor add-on for testing external conditions
   352 %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)
   354 #   default list of vendor source fetching locations
   355 %l_fetch_mirror_0        -
   356 %l_fetch_mirror_1        -
   357 %l_fetch_mirror_2        -
   358 %l_fetch_mirror_3        -
   359 %l_fetch_mirror_4        -
   360 %l_fetch_mirror_5        -
   361 %l_fetch_mirror_6        -
   362 %l_fetch_mirror_7        -
   363 %l_fetch_mirror_8        -
   364 %l_fetch_mirror_9        -
   365 %l_fetch_backup_0        -
   366 %l_fetch_backup_1        -
   367 %l_fetch_backup_2        -
   368 %l_fetch_backup_3        -
   369 %l_fetch_backup_4        -
   370 %l_fetch_backup_5        -
   371 %l_fetch_backup_6        -
   372 %l_fetch_backup_7        -
   373 %l_fetch_backup_8        -
   374 %l_fetch_backup_9        ftp://ftp.openpkg.org/sources/DST/%{name}/
   376 #   sane build environment setup
   377 %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)
   378 %l_build_ldlp            %{l_prefix}/lib:@l_build_ldlp@
   379 %l_build_ulim            @l_build_ulim@
   380 %l_build_shell_cmd       %{l_prefix}/lib/openpkg/bash
   381 %l_build_shell_opt       --norc --noprofile --posix
   383 #   sane build environment for manual usage in macros (currently just $PATH)
   384 %l_sane_env              PATH="%{l_build_path}"; export PATH; LD_LIBRARY_PATH="%{l_build_ldlp}"; export LD_LIBRARY_PATH
   386 #   sane build environment for %prep/%build/%install
   387 %_buildshell             env -i %{l_build_shell_cmd} %{l_build_shell_opt}
   388 %___build_pre \
   389 HOME="%{l_prefix}"\
   390 SHELL="%{l_build_shell_cmd}"\
   391 TERM="%(echo $TERM)"\
   392 TMPDIR="%{_tmppath}"\
   393 USER="%(echo $USER)"\
   394 LOGNAME="%(echo $LOGNAME)"\
   395 PATH="%{l_build_path}"\
   396 LD_LIBRARY_PATH="%{l_build_ldlp}"\
   397 export HOME SHELL TMPDIR USER LOGNAME PATH LD_LIBRARY_PATH\
   398 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
   399 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
   400 RPM_OPT_FLAGS=\"%{optflags}\"\
   401 RPM_ARCH=\"%{l_host_arch}\"\
   402 RPM_OS=\"%{l_host_os}\"\
   403 RPM_DOC_DIR=\"%{_docdir}\"\
   404 RPM_PACKAGE_NAME=\"%{name}\"\
   405 RPM_PACKAGE_VERSION=\"%{version}\"\
   406 RPM_PACKAGE_RELEASE=\"%{release}\"\
   407 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS RPM_DOC_DIR\
   408 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
   409 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
   410 export RPM_BUILD_ROOT}\
   411 %{l_build_ulim}\
   412 umask 022\
   413 %{verbose:set -x}%{!verbose:exec >/dev/null}\
   414 cd %{u2p:%{_builddir}}
   416 #   special %track section support
   417 %__spec_track_template VCFILE="%{_tmppath}/%{name}-%{version}-%{release}.vc"\
   418 rm -f $VCFILE\
   419 set -o noclobber\
   420 sed -e 's;^ *#.*$;;' -e 's;^    ;;' >$VCFILE <<'EOF'\
   421 %{nil}
   422 %__spec_track_post EOF\
   423 if [ ".%{?___track_dump}" = .yes ]; then\
   424     cat $VCFILE\
   425 else\
   426     if [ ! -f "%{l_vcheck}" ]; then\
   427         echo "rpm:ERROR: Vendor source tracking functionality currently not available because"\
   428         echo "rpm:ERROR: URL tracking tool vcheck(1) not found under \\"%{l_vcheck}\\"."\
   429         echo "rpm:ERROR: You have to install the OpenPKG \\"vcheck\\" package first or set"\
   430         echo "rpm:ERROR: the RPM macro \\"%%{l_vcheck}\\" to the path of your vcheck(1) tool."\
   431         exit 0\
   432     fi\
   433     ( echo "config = {"\
   434       echo "}"\
   435     ) >>$VCFILE\
   436     %{l_vcheck} -v -f $VCFILE || true\
   437 fi\
   438 rm -f $VCFILE\
   439 %{nil}

mercurial