diff options
Diffstat (limited to 'macros.in')
-rw-r--r-- | macros.in | 466 |
1 files changed, 466 insertions, 0 deletions
diff --git a/macros.in b/macros.in new file mode 100644 index 0000000..aa48dd2 --- /dev/null +++ b/macros.in @@ -0,0 +1,466 @@ +# @RPMVENDORDIR@/macros: +# Main Mandrivalinux rpm configuration +# Only modified macros goes here +# +# $Id$ +# +# This is a global RPM configuration file. All changes made here will +# be lost when the rpm package is upgraded. Any per-system configuration +# should be added to /etc/rpm/macros, while per-user configuration should +# be added to ~/.rpmmacros. + +%_host_vendor Mandriva +%_real_vendor Mandriva + +%_vendor Mandriva + +%_target_platform %{_target_cpu}-%{_real_vendor}-%{_target_os}%{?_gnu} + +%_host %{_host_cpu}-%{_real_vendor}-%{_host_os} + +#============================================================================== +# Macro naming conventions (preliminary): +# +# Macros that begin with an underscore are "local" in the sense that +# they (if used) will not be exported in rpm headers. Some macros +# that don't start with an underscore (but look like they should) +# are compatible with macros generated by rpm-2.5.x and will be made +# more consistent in a future release. +# + +%__gzip /usr/bin/gzip + +#============================================================================== +# ---- Build system path macros. +# + +%__cputoolize cputoolize + +# Where install-info is located +%__install_info /sbin/install-info + +# Update Menu +%_update_menus_bin %{_bindir}/update-menus + +#============================================================================== +# ---- Required rpmrc macros. +# Macros that used to be initialized as a side effect of rpmrc parsing. +# These are the default values that can be overridden by other +# (e.g. per-platform, per-system, per-packager, per-package) macros. +# + +%_enable_debug_packages 0 + +%debugcflags %{?_enable_debug_packages:-g} + +%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\ +%%install\ +%{nil} + +#============================================================================== +# ---- Optional rpmrc macros. +# Macros that are initialized as a side effect of rpmrc and/or spec +# file parsing. +# + +# Multilibs +%_multilibno 1 +%_multilibpatt (/%{_lib}|/usr/%{_lib}(|/gconv)|/usr/local/%{_lib}|/usr/X11R6/%{_lib}|/opt/%{_lib})/[^/]*\\.([oa]|la|so[0-9.]*)$ + +%_sysconfdir /etc +%_infodir /usr/share/info +%_mandir /usr/share/man +%_initrddir %{_sysconfdir}/rc.d/init.d + +%_defaultdocdir %{_usr}/share/doc + +# Games macros +%_gamesdir games +%_gamesbindir %{_prefix}/%{_gamesdir} +%_gamesdatadir %{_datadir}/%{_gamesdir} + +# Default extension to use. +%_extension .bz2 + +# Menu directories +%_menudir %{_prefix}/lib/menu +%_iconsdir %{_datadir}/icons +%_miconsdir %{_datadir}/icons/mini +%_liconsdir %{_datadir}/icons/large + +%_mandir %_datadir/man + +#============================================================================== +# ---- Build configuration macros. +# +# Package version macro. +# The type of package to produce, for compatibility with legacy +# versions of rpm. +# +# Script gets packaged file list on input. +# Returns list of multiarch files that are not marked as such, +# i.e. files in $RPM_BUILD_ROOT that have arch-dependent values +# +# Note: Disable (by commenting out) for legacy compatibility. +%__check_multiarch_files @RPMVENDORDIR@/check-multiarch-files + +# Use internal dependency generator rather than external helpers? +%_use_internal_dependency_generator 0 + +%__find_provides @RPMVENDORDIR@/filter.sh '%{?_provides_exceptions:%{_provides_exceptions}}%{!?_provides_exceptions: }' @RPMVENDORDIR@/find-provides +%__find_requires @RPMVENDORDIR@/filter.sh '%{?_requires_exceptions:%{_requires_exceptions}}%{!?_requires_exceptions: }' @RPMVENDORDIR@/find-requires %{?buildroot:%{buildroot}} %{?_target_cpu:%{_target_cpu}} + +%find_lang @RPMVENDORDIR@/find-lang.sh %{buildroot} + +# Macro: %{mklibname <name> [<major> [<minor>]] [-s] [-d]} +# - %{mklibname test} => lib64test, on a lib64 platform +# - %{mklibname test 1 -d} => libtest1-devel +# - %{mklibname test 1 -d 0 -s} => libtest1_0-static-devel +%mklibname(ds) %{_lib}%{1}%{?2:%{2}}%{?3:_%{3}}%{-s:-static}%{-d:-devel} + +# Update Menu +%_update_menus_bin %{_bindir}/update-menus +%update_menus if [ -x %{_update_menus_bin} ]; then %{_update_menus_bin} || true ; fi \ +%{nil} + +# Clean Menu +%clean_menus if [ "$1" = "0" -a -x %{_update_menus_bin} ]; then %{_update_menus_bin} || true ; fi \ +%{nil} + +# Update Window Managers session. +%_fndsession_bin %{_sbindir}/fndSession +%make_session if [ -x %{_fndsession_bin} ]; then %{_fndsession_bin} || true ; fi \ +%{nil} + +# Macros to install info-files. +%_install_info() if [[ -f %{_infodir}/%{1}%{_extension} ]];then %{__install_info} %{_infodir}/%{1}%{_extension} --dir=%{_infodir}/dir;fi \ +%{nil} + +# Macros to remove info-files. (keep the "alone on its line ';'") +%_remove_install_info() if [ "$1" = "0" ]; then if [[ -f %{_infodir}/%{1}%{_extension} ]];then %{__install_info} %{_infodir}/%{1}%{_extension} --dir=%{_infodir}/dir --remove ;fi; fi \ +%{nil} + + +# From rpm-helper + +%_create_ghostfile_helper /usr/share/rpm-helper/create-file +%create_ghostfile() %_create_ghostfile_helper %{name} $1 %{1} %{2} %{3} %{4} \ +%{nil} + +# initscripts macros +%_add_service_helper /usr/share/rpm-helper/add-service +%_post_service() %_add_service_helper %{name} $1 %{1} \ +%{nil} + +%_del_service_helper /usr/share/rpm-helper/del-service +%_preun_service() %_del_service_helper %{name} $1 %{1} \ +%{nil} + +%_add_user_helper /usr/share/rpm-helper/add-user +%_pre_useradd() %_add_user_helper %{name} $1 %{1} %{2} %{3} \ +%{nil} + +%_del_user_helper /usr/share/rpm-helper/del-user +%_postun_userdel() %_del_user_helper %{name} $1 %{1} \ +%{nil} + +%_add_group_helper /usr/share/rpm-helper/add-group +%_pre_groupadd() %_add_group_helper %{name} $1 %{1} %{?2:%2} \ +%{nil} + +%_del_group_helper /usr/share/rpm-helper/del-group +%_postun_groupdel() %_del_group_helper %{name} $1 %{1} \ +%{nil} + +%_add_shell_helper /usr/share/rpm-helper/add-shell +%_post_shelladd() %_add_shell_helper %{name} $1 %{1} \ +%{nil} + +%_del_shell_helper /usr/share/rpm-helper/del-shell +%_preun_shelldel() %_del_shell_helper %{name} $1 \ +%{nil} + +# Mandrakelinux version +# - "9.1" => 910 +# - "10.2.2" => 1022 +# (user may copy the following line in specfile) +%mdkversion %(perl -pe '/(\\d+)\\.(\\d)\\.?(\\d)?/; $_="$1$2".($3||0)' /etc/mandrake-release) + +%mkrel(c:) %{-c:0.%{-c*}.}%{!?_with_unstable:%(perl -e '$_="%{1}";m/(.*)(\\d+)$/;$rel=$2-1;re;print "$1$rel";').%{?subrel:%subrel}%{!?subrel:1}.%{?distversion:%distversion}%{?!distversion:%(echo $[%{mdkversion}/10])}}%{?_with_unstable:%{1}}%{?distsuffix:%distsuffix}%{?!distsuffix:mdk} + +%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\ + && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ + [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS") + +# make +%_make_bin make +%make %{_make_bin} %_smp_mflags + +#============================================================================== +# ---- Build policy macros. +# +#--------------------------------------------------------------------- +# Expanded at end of %install scriptlet. +# + +%__os_install_post \ + @RPMVENDORDIR@/brp-compress \\\ + @RPMVENDORDIR@/brp-strip \\\ + @RPMVENDORDIR@/brp-strip-comment-note \\\ +%{nil} + +%__debug_install_post \ + @RPMVENDORDIR@/find-debuginfo.sh %{_builddir}/%{?buildsubdir}\ +%{nil} + + +#============================================================================== +# ---- Database configuration macros. +# Macros used to configure Berkley db parameters. +# +# rpmdb macro configuration values are a colon (or white space) separated +# list of tokens, with an optional '!' negation to explicitly disable bit +# values, or a "=value" if a parameter. A per-tag value is used (e.g. +# %_dbi_config_Packages) if defined, otherwise a per-rpmdb default +# (e.g. %_dbi_config). The configuration is also conditioned on the +# existence of an internal %{_rpmdb_rebuild} switch to permit changing +# the configuration while rebuilding an rpmdb database. +# +# The rpmdb configuration tokens are in a popt table in rpmdb/dbconfig.c, +# see that for the latest gory details. Note carefully that, unless you +# are writing an rpm installer, you shouldn't have to touch *any* of these +# parameters. +# +# Here's a short list of the tokens, with a guess of whether the option is +# useful: +# (nothing) currently used in rpm, known to work. +# "+++" under development, will be supported in rpm eventually. +# "???" I have no clue, you're mostly on your own. +# +# If you do find yourself inclined to fiddle, here's what I see (shrug): +# 1) Only the value of mp_size has any serious impact on overall performance, +# and you will need ~256Kb to handle a typical machine install. +# 2) Only the Packages hash, because of the size of the values (i.e. headers), +# will ever need tuning. Diddle the pagesize if you're interested, although +# I believe that you will find pagesize=512 "best". +# 3) Adding nofsync increases speed, but risks total data loss. Fiddle shared +# and/or mp_size instead. +# 4) btree is faster than hash, but would require some painful rpm release +# engineering to convert everbody's databases to btree, not gonna happen +# soon. +# +# See the db3-devel package, or http://www.sleepycat.com for Berkeley db-3.x +# documentation. +# +# token works? Berkeley db flag or value +#================================================== +#---------------------- DBENV->open parameters and tunable values: +# mmapsize=16Mb DBENV->set_mp_mmapsize +# cachesize=1Mb DBENV->set_cachesize, DB->set_cachesize +#---------------------- DBENV->open and DB->open common bits: +# create DB_CREATE +# thread ??? DB_THREAD (useless w/o posix mutexes on linux) +#---------------------- DBENV->open bits: +# joinenv DB_JOIN_ENV +# mpool DB_INIT_MPOOL +# cdb +++ DB_INIT_CDB +# txn ??? DB_INIT_TXN +# log ??? DB_INIT_LOG +# lock ??? DB_INIT_LOCK +# recover ??? DB_RECOVER +# recover_fatal ??? DB_RECOVER_FATAL +# use_environ ??? DB_USE_ENVIRON +# use_environ_root ??? DB_USE_ENVIRON_ROOT +# private +++ DB_PRIVATE +# lockdown ??? DB_LOCKDOWN +# shared +++ DB_SYSTEM_MEM +#---------------------- DB->open parameters and tunable values: +# pagesize=512 +++ DB->set_pagesize +#---------------------- DB->open bits: +# excl ??? DB_EXCL +# nommap ??? DB_NOMMAP +# rdonly DB_RDONLY +#---------------------- DB->open types: +# btree DB_BTREE +# hash DB_HASH +# recno ??? DB_RECNO +# queue ??? DB_QUEUE +# unknown +++ DB_UNKNOWN +#---------------------- DB->set_flags bits: +# bt_dup +++ (btree only) DB_DUP +# bt_dupsort +++ (btree only) DB_DUPSORT +# ht_dup +++ (hash only) DB_DUP +# ht_dupsort +++ (hash only) DB_DUPSORT +#----------------------- rpmdb specific configuration: +# usedbenv (always on) Use db3 environment? +# verify (db3 only) Verify Packages db after RW close? +# lockdbfd (always on for Packages) Use fcntl(2) locking ? +# nofsync Disable fsync(2) call performed after db3 writes? +# temporary Unlink file when closing. +# + +#============================================================================== +# ---- GPG/PGP/PGP5 signature macros. +# Macro(s) to hold the arguments passed to GPG/PGP for package +# signing and verification. +# + +#============================================================================== +# ---- Transaction macros. +# Macro(s) used to parameterize transactions. +# +# The output binary package file name template used when building +# binary packages. +# + +#============================================================================== +# ---- Cache configuration macros. +# Macro(s) used to configure the universe of headers used to +# solve dependencies using rpmcache(8). +# +# Note: These values are specific to my machine, and most certainly +# are incorrect for any non-redhat.com machine. The macros are +# included here only to document the macro names and usage. + +#============================================================================== +# ---- per-platform macros. +# Macros that are specific to an individual platform. The values here +# will be used if the per-platform macro file does not exist.. +# + +#============================================================================== +# ---- Scriptlet template templates. +# Global defaults used for building scriptlet templates. +# + +#============================================================================== +# ---- Scriptlet templates. +# Macro(s) that expand to a command and script that is executed. +# CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer. +# + +#============================================================================== +# ---- configure macros. +# Macro(s) slavishly copied from autoconf's config.status. +# + +#============================================================================== +# ---- config.guess platform macros. +# Macro(s) similar to the tokens used by configure. +# + +#============================================================================== +# ---- specfile macros. +# Macro(s) here can be used reliably for reproducible builds. +# (Note: Above is the goal, below are the macros under development) +# + +# Servers opt flags +%serverbuild export CFLAGS="%optflags -fno-omit-frame-pointer"; export CXXFLAGS="%optflags -fno-omit-frame-pointer"; export RPM_OPT_FLAGS="%optflags -fno-omit-frame-pointer" \ +%{nil} + +# This is an improved version of %configure (from PLD team). +%configure \ + CONFIGURE_TOP="${CONFIGURE_TOP:-.}"; \ + CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ + CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ + FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \ + %{?__cputoolize:%{__cputoolize} -c $CONFIGURE_TOP} ; \ + %{?__libtoolize:(cd $CONFIGURE_TOP; [ -f configure.in -o -f configure.ac ] && %{__libtoolize} --copy --force)} ; \ + [ -f $CONFIGURE_TOP/configure.in -o -f $CONFIGURE_TOP/configure.ac ] && \ + CONFIGURE_XPATH="--x-includes=%{_prefix}/X11R6/include --x-libraries=%{_prefix}/X11R6/%{_lib}" \ + $CONFIGURE_TOP/configure %{_target_platform} \\\ + --program-prefix=%{?_program_prefix} \\\ + --prefix=%{_prefix} \\\ + --exec-prefix=%{_exec_prefix} \\\ + --bindir=%{_bindir} \\\ + --sbindir=%{_sbindir} \\\ + --sysconfdir=%{_sysconfdir} \\\ + --datadir=%{_datadir} \\\ + --includedir=%{_includedir} \\\ + --libdir=%{_libdir} \\\ + --libexecdir=%{_libexecdir} \\\ + --localstatedir=%{_localstatedir} \\\ + --sharedstatedir=%{_sharedstatedir} \\\ + --mandir=%{_mandir} \\\ + --infodir=%{_infodir} \\\ + $CONFIGURE_XPATH + +%configure2_5x \ + CONFIGURE_TOP="${CONFIGURE_TOP:-.}"; \ + CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ + CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ + FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \ + %{?__cputoolize:%{__cputoolize} -c $CONFIGURE_TOP} ; \ + %{?__libtoolize:(cd $CONFIGURE_TOP; [ -f configure.in -o -f configure.ac ] && %{__libtoolize} --copy --force)} ; \ + [ -f $CONFIGURE_TOP/configure.in -o -f $CONFIGURE_TOP/configure.ac ] && \ + CONFIGURE_XPATH="--x-includes=%{_prefix}/X11R6/include --x-libraries=%{_prefix}/X11R6/%{_lib}" \ + $CONFIGURE_TOP/configure --build=%{_target_platform} \\\ + --prefix=%{_prefix} \\\ + --exec-prefix=%{_exec_prefix} \\\ + --bindir=%{_bindir} \\\ + --sbindir=%{_sbindir} \\\ + --sysconfdir=%{_sysconfdir} \\\ + --datadir=%{_datadir} \\\ + --includedir=%{_includedir} \\\ + --libdir=%{_libdir} \\\ + --libexecdir=%{_libexecdir} \\\ + --localstatedir=%{_localstatedir} \\\ + --sharedstatedir=%{_sharedstatedir} \\\ + --mandir=%{_mandir} \\\ + --infodir=%{_infodir} \\\ + $CONFIGURE_XPATH + +%makeinstall_std make DESTDIR=%{?buildroot:%{buildroot}} install + +%old_makeinstall \ + make \\\ + prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\ + exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\ + bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\ + sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\ + sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\ + datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\ + includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\ + libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\ + libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\ + localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\ + sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\ + mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\ + infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\ + install + + +#------------------------------------------------------------------------------ +# Useful python macros +%pyver %(python -V 2>&1 | cut -f2 -d" " | cut -f1,2 -d".") + +#------------------------------------------------------------------------------ +# Useful perl macros +# (initially from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>) +# (modified by Pixel <pixel@mandrakesoft.com>) +# +# [...] +# Group: Development/Perl +# [...] +# %build +# perl Makefile.PL INSTALLDIRS=vendor +# %make +# [...] +# %install +# rm -rf $RPM_BUILD_ROOT +# make install PREFIX="$RPM_BUILD_ROOT/%{prefix}" +# [...] +# %files +# %defattr(644,root,root,755) +# %{perl_vendorlib}/CGI +# or +# %{perl_vendorarch}/DBI +# %{perl_vendorarch}/auto/DBI +# %{_mandir}/*/* +# + +# kept for compatibility, but should not be used, especially the ugly perl_archlib! +%perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch) +%perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib) + |