rpmmacros 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. ##
  2. ## @l_prefix@/etc/openpkg/rpmmacros -- RPM macros for @l_prefix@ hierarchy
  3. ## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2001 Ralf S. Engelschall <rse@engelschall.com>
  5. ##
  6. ## The purpose of this macro set is to override the default
  7. ## macros in the RPM installation for the @l_prefix@ hierarchy.
  8. ##
  9. # the OpenPKG identification
  10. # OpenPKG -CURRENT -> "YYYYMMDD"
  11. # OpenPKG -STABLE -> "X.Y"
  12. %l_branch %(date '+%Y%m%d')
  13. # the platform identification
  14. %l_target %{_target}
  15. %l_location @LOC@
  16. # the user/group name/id pair for installed files
  17. # (because of bootstrapping issues the l_fs[ug]id cannot be cleanly pre-determined)
  18. %l_fsusr @FSUSR@
  19. %l_fsuid %((cat /etc/passwd; ypcat passwd) 2>/dev/null | grep "^%{l_fsusr}:" | head -1 | awk -F: '{ print $3; }')
  20. %l_fsgrp @FSGRP@
  21. %l_fsgid %((cat /etc/group; ypcat group) 2>/dev/null | grep "^%{l_fsgrp}:" | head -1 | awk -F: '{ print $3; }')
  22. # the user/group name/id pair for non-priviledged operations
  23. %l_npusr @NPUSR@
  24. %l_npuid @NPUID@
  25. %l_npgrp @NPGRP@
  26. %l_npgid @NPGID@
  27. # the two root directories
  28. %l_root_install @l_prefix@
  29. %l_root_rpm @l_prefix@/RPM
  30. # define the installation hierarchy
  31. %l_prefix %{l_root_install}
  32. %l_exec_prefix %{l_root_install}
  33. %l_bindir %{l_root_install}/bin
  34. %l_sbindir %{l_root_install}/sbin
  35. %l_libexecdir %{l_root_install}/libexec
  36. %l_datadir %{l_root_install}/share
  37. %l_sysconfdir %{l_root_install}/etc
  38. %l_sharedstatedir %{l_root_install}/com
  39. %l_localstatedir %{l_root_install}/var
  40. %l_libdir %{l_root_install}/lib
  41. %l_includedir %{l_root_install}/include
  42. %l_infodir %{l_root_install}/info
  43. %l_mandir %{l_root_install}/man
  44. %l_docdir %{l_root_install}/doc
  45. # override the internal RPM hierarchy variables
  46. %_usr %{l_root_rpm}
  47. %_var %{l_root_rpm}
  48. %_usrsrc %{l_root_rpm}
  49. %_topdir %{l_root_rpm}
  50. %_dbpath %{l_root_rpm}/DB
  51. %_builddir %{l_root_rpm}/TMP
  52. %_tmppath %{l_root_rpm}/TMP
  53. %_sourcedir %{l_root_rpm}/SRC/%{name}
  54. %_specdir %{l_root_rpm}/SRC/%{name}
  55. %_rpmdir %{l_root_rpm}/PKG
  56. %_srcrpmdir %{l_root_rpm}/PKG
  57. %_defaultdocdir %{l_docdir}
  58. # complement the %{SOURCE<n>} and %{PATCH<n>} with %{SOURCE <file>} and %{PATCH <file>}
  59. %SOURCE() %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
  60. %PATCH() %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
  61. # override RPM's absolute tool paths with relative ones
  62. # (because if you upgrade RPM it would hard-code tools in own hierarchy, too)
  63. %__awk awk
  64. %__bzip2 %{_bzip2bin}
  65. %__cat cat
  66. %__chgrp chgrp
  67. %__chmod chmod
  68. %__chown chown
  69. %__cp cp
  70. %__cpio cpio
  71. %__grep grep
  72. %__gzip %{_gzipbin}
  73. %__id id
  74. %__install install
  75. %__ln_s ln -s
  76. %__make make
  77. %__mkdir mkdir
  78. %__mkdir_p %{l_prefix}/lib/openpkg/shtool mkdir -p
  79. %__mv mv
  80. %__patch %{_patchbin}
  81. %__perl perl
  82. %__pgp %{_pgpbin}
  83. %__rm rm
  84. %__rsh rsh
  85. %__sed sed
  86. %__ssh ssh
  87. %__tar %{_tarbin}
  88. # provide fixed paths to tools (standard)
  89. %_gzipbin %{l_prefix}/lib/openpkg/gzip
  90. %_bzip2bin %{l_prefix}/lib/openpkg/bzip2
  91. %_patchbin %{l_prefix}/lib/openpkg/patch
  92. %_tarbin %{l_prefix}/lib/openpkg/tar
  93. %_buildshell %{l_prefix}/lib/openpkg/bash
  94. # provide fixed paths to tools (additional)
  95. %l_rpmtool %{l_prefix}/sbin/rpmtool
  96. %l_shtool %{l_prefix}/lib/openpkg/shtool
  97. %l_curl %{l_prefix}/lib/openpkg/curl
  98. %l_bash %{l_prefix}/lib/openpkg/bash
  99. # provide smart paths to tools
  100. %l_tool_check test -f %{l_bindir}/$tool && tool="%{l_bindir}/$tool"; echo $tool
  101. %l_gzip %(tool=gzip; %{l_tool_check})
  102. %l_bzip2 %(tool=bzip2; %{l_tool_check})
  103. %l_tar %(tool=tar; %{l_tool_check})
  104. %l_cc %(tool=cc; %{l_tool_check})
  105. %l_cxx %(tool=c++; %{l_tool_check})
  106. %l_make %(tool=make; %{l_tool_check})
  107. %l_patch %(tool=patch; %{l_tool_check})
  108. %l_sed %(tool=sed; %{l_tool_check})
  109. %l_grep %(tool=grep; %{l_tool_check})
  110. %l_awk %(tool=awk; %{l_tool_check})
  111. %l_autoconf %(tool=autoconf; %{l_tool_check})
  112. %l_automake %(tool=automake; %{l_tool_check})
  113. %l_libtool %(tool=libtool; %{l_tool_check})
  114. %l_flex %(tool=flex; %{l_tool_check})
  115. %l_bison %(tool=bison; %{l_tool_check})
  116. %l_perl %(tool=perl; %{l_tool_check})
  117. %l_xmkmf %(tool=xmkmf; %{l_tool_check})
  118. # tool options
  119. %l_mflags(O) %(%{l_rpmtool} flags -m %{-O:-O} %{l_make})
  120. %l_cflags(O) %(%{l_rpmtool} flags -c %{-O:-O} %{l_cc})
  121. # determine the current username
  122. %l_whoami %((id -un) 2>/dev/null || (whoami) 2>/dev/null || (who am i | cut "-d " -f1) 2>/dev/null || echo $LOGNAME)
  123. # macros for dynamically generating a %files list
  124. %l_files_defattr '%defattr(-,%{l_fsusr},%{l_fsgrp})'
  125. %l_files_all '%{l_prefix}'
  126. %l_files_noshared '%not %dir {%{l_prefix},%{l_prefix}/*,%{l_prefix}/etc/rc.d,%{l_prefix}/man/*}'
  127. %l_files_std(o:g:) %l_files_defattr %l_files_all %l_files_noshared
  128. # path to local build root
  129. %l_buildroot %{_tmppath}/%{name}-%{version}-root
  130. # executable path for %post/%pre
  131. %_install_script_path @l_prefix@/bin:@l_prefix@/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
  132. # override the name scheme for RPM files
  133. %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-%%{OS}-@LOC@.rpm
  134. # override the payload compression for the CPIO parts of an RPM
  135. # (we use the equivalent of "bzip2 -9")
  136. %_source_payload w9.bzdio
  137. %_binary_payload w9.bzdio
  138. # package signature type is OpenPGP via GnuPG
  139. %_signature gpg
  140. # the default repository list
  141. %l_repo_cache %{l_root_rpm}/PKG/
  142. %l_repo_0 %{l_root_rpm}/PKG/
  143. %l_repo_1 -
  144. %l_repo_2 -
  145. %l_repo_3 -
  146. %l_repo_4 ftp://ftp.openpkg.org/current/SRC/
  147. %l_repo_5 -
  148. %l_repo_6 -
  149. %l_repo_7 -
  150. %l_repo_8 -
  151. %l_repo_9 -