All pastes #460453 Raw Edit

Unnamed

public text v1 · immutable
#460453 ·published 2007-04-27 01:47 UTC
rendered paste body
#
# ATrpms macros
#
# This is not an official release. It was adapted from:
# http://lists.atrpms.net/pipermail/atrpms-devel/2005-January/000545.html
#
# Paulo Roma.
# 
######################################################################
%distversion %(rpm -qf --qf='%{VERSION}' /etc/redhat-release)
%distinitials rh%(grep -i fedora /etc/redhat-release >/dev/null && echo "fc")
%distname %(grep -i fedora /etc/redhat-release >/dev/null && echo "Fedora Core" || echo "Red Hat Linux")
%disttag %{distinitials}%{distversion}
%disttag2 %(echo %disttag | sed -e's,\\.,_,g')
%disttag3 fc%{distversion}
# For Fedora extras
%dist .%disttag3.lcg
%_dist %disttag3
%atrelease() %1.%{disttag}.at
%lcgrelease() %1.%{disttag}.lcg
%fedora() %distversion

%eversion      %{?epoch:%{epoch}:}%{version}
%evr           %{?epoch:%{epoch}:}%{version}-%{release}

######################################################################
%_initdir      %{_sysconfdir}/rc.d/init.d
%_varlibdir    %{_localstatedir}/lib
%_varcachedir  %{_localstatedir}/cache
%_logdir       %{_localstatedir}/log
%_rundir       %{_localstatedir}/run
%_subsysdir    %{_localstatedir}/lock/subsys
%_sysconfigdir %{_sysconfdir}/sysconfig
%_logrotatedir %{_sysconfdir}logrotate.d
%python_libdir %{_libdir}/python2.4/site-packages
%python_burninversion %(find . -type f | grep -l "^#!.*python" | xargs perl -pi -e's,^(#!.*python)([^0-9.]*|$),${1}%python_version$2,')

######################################################################
# kernel
######################################################################
# Use in specfiles:
# %kernelmodule foo
# %kerneldesc
# %{_kernel} in depmod, %kaddcustomkernel
# %kmdl_name
# %if %{kmain}
# %kernelconfig, %kreqprov
# %kmdlinstall
# %kernelname

# kflavour access only in lirc, deprecated

%_kernel		%(uname -r)
%kmdl_kernelsrcdir	/lib/modules/%{_kernel}/build
%kmdl_userland		%(test "%{_kernel}" = none && echo 1 || echo 0)
%_kflavour		%(echo %{_kernel} | grep -E '(smp|enterprise|bigmem)' | sed -e's/^.*\\(smp\\|enterprise\\|bigmem\\).*$/\\1/')
%_kversion		%(echo %{_kernel} | sed -e's/^\\(.*\\)\\(smp\\|enterprise\\|bigmem\\).*$/\\1/')
%_krelver		%(echo %{_kversion} | sed -e's/-/_/')
%_kname			%(echo kernel-%{_kflavour} | sed -e's/-$//')
%_kname2		%(echo kmodule-%{_kflavour} | sed -e's/-$//')
%_kname3		%(echo kmdl-%{_kflavour} | sed -e's/-$//')
%_modflags		-include /tmp/atrpms-mykernel-%{_kernel}-%{_target_cpu}.h -DMODULE -DMODVERSIONS -include %{_kernelsrcdir}/include/linux/modversions.h

# "kernel": the output of "uname -r" of the kernel to build for
# (default: the running one)
# "_kernelsrcdir": The directory of the sources used to build "kernel"
# (default: /lib/modules/%{_kernel}/build)

## kmdl_name kernel-module-%{_kpkgname}-%{_kernel}
## kmdl_nameof() kernel-module-%1-%{_kernel}
## kmdl_namepure kernel-module-%{_kpkgname}
## kmdl_namepureof() kernel-module-%1
%kmdl_name %{_kpkgname}-kmdl-%{_kernel}
%kmdl_nameof() %1-kmdl-%{_kernel}
#_kmdl_name_old %{_kpkgname}-%{_kname3}-%{_kversion}
#_kmdl_nameof_old() %1-%{_kname3}-%{_kversion}
%kmdl_namepure %{_kpkgname}-kmdl
%kmdl_namepureof() %1-kmdl

%_kernelbuildreq %{nil}

%kmdl() \
%{expand:%%global _kpkgname %1} \
%_kernelbuildreq \
%{nil}

%kmdl_parentdependencies\
Requires: %{kmdl_namepure}-%{evr}

%kmdl_dependencies\
Requires: atrpms-kmdl-helper \
#Requires: strictdep-%{_kname}-%{_target_cpu} = %{_kversion}\
Requires: /boot/vmlinuz-%{_kernel}\
Requires: %{_kname} = %{_kversion}, /sbin/depmod, modutils >= 2.4.14\
BuildRequires: %_kernelcompiler\
Provides: %kmdl_namepure-%{evr}\
Provides: %kmdl_namepure-%_kernel = %{evr}\
#\
# backward compatibility foo-kmdl\
Provides: %{_kpkgname}-%{_kname3}-%{_kversion} = %{evr}
Provides: %{_kpkgname}-kmdl
# backward compatibility with foo-kernel-...\
Provides: %{_kpkgname}-kernel\
%{?_kflavour:Provides: %{_kpkgname}-%{_kname}}\
Provides: %{_kpkgname}-%{_kname}-%{_kversion} = %{evr}\
Provides: %{_kpkgname}-%{_kname}-%{_kversion}-%{_target_cpu} = %{evr}\
# backward compatibility with unversioned kernel-module-foo\
Provides: kernel-module-%{_kpkgname}\
%{?_kflavour:Provides: %{_kname}-module-%{_kpkgname}}\

%_kernelcompiler_rhfc6 /usr/bin/gcc
%_kernelcompiler_rhfc5 /usr/bin/gcc
%_kernelcompiler_rhfc4 /usr/bin/gcc
%_kernelcompiler_rhfc3 /usr/bin/gcc
%_kernelcompiler_rhfc2 /usr/bin/gcc
%_kernelcompiler_rhfc1 /usr/bin/gcc32
%_kernelcompiler_rh9   /usr/bin/gcc
%_kernelcompiler_rh8_0 /usr/bin/gcc
%_kernelcompiler_rh7_3 /usr/bin/gcc

%_kernelcompiler %{expand:%%_kernelcompiler_%{disttag2}}

%kmdl_moduledir /lib/modules/%{_kernel}/updates

%kmdl_config\
export CC=%_kernelcompiler\
#/sbin/mkkerneldoth.atrpms %{_kernel} %{_target_cpu} > /tmp/atrpms-mykernel-%{_kernel}-%{_target_cpu}.h\
#mkdir -p %{buildroot}%{kmdl_moduledir}

%kmdl_desc\
This package contains the %kmdl_name kernel modules for the Linux kernel package:\
%{_kname}-%{_kversion}.%{_target_cpu}.rpm.

%_kernelname %{_kname}-%{_kversion}.%{_target_cpu}.rpm

%kmdl_install\
%{_datadir}/atrpms/addcustomkmdl '/lib/modules/`uname -r`/updates'\
depmod -ae -F /boot/System.map-%{_kernel} %{_kernel}

%kmdl_remove\
depmod -ae -F /boot/System.map-%{_kernel} %{_kernel}

##################################################################################
# These are new macros I'm experimenting with that ease up packaging of libs.
# Axel Thimm - 01/08/2005

%__lib_name() lib%(echo %1 | grep '[0-9]$' > /dev/null && echo %{1}_%2 || echo %1%2)

%lib_package() \
%global __lib_dependencies %{?__lib_dependencies:%(echo -n %__lib_dependencies | sed -e's,%%,%%%%,g'),}%%%%{__lib_name %1 %2} = %{evr}\
%global __lib_packages %{?__lib_packages:%(echo %__lib_packages | sed -e's,%%,%%%%,g')}%%%%{__lib_package %1 %2}


%__lib_package() \
%global _enable_devel_packages 1\
%global __the_lib_name lib%(echo %1 | grep '[0-9]$' > /dev/null && echo %{1}_%2 || echo %1%2)\
%package -n %__the_lib_name\
Summary: Shared libraries for package %{name}.\
Group: System Environment/Libraries\
Provides: shared-library-package\
%(echo %__the_lib_name | grep -- - > /dev/null && echo "Obsoletes: %__the_lib_name" | sed -e's,-,,g')\
%description -n %__the_lib_name\
This package provides the shared libraries lib%1.so.%{2}* for the package %{name}.\
Shared libraries are required at runtime for software built against %{name}.\
Keeping shared libraries in a separate package enables their use as\
forward/backward compatibility packages.\
%post -n %__the_lib_name -p /sbin/ldconfig\
%postun -n %__the_lib_name -p /sbin/ldconfig\
%files -n %__the_lib_name\
%defattr(-,root,root,-)\
%{_libdir}/lib%1.so.%{2}*\
%{nil}

%lib_dependencies %{?__lib_dependencies:Requires: %{expand:%__lib_dependencies}}

#
%devel_package \
%global __devel_package 1\
%package devel\
Summary: Development files for building against the %{name} package.\
Group: Development/Libraries\
%lib_dependencies\
%{?__devel_extra_Requires:Requires: %{__devel_extra_Requires}}\
%{?__devel_extra_Obsoletes:Obsoletes: %{__devel_extra_Obsoletes}}\
%{?__devel_extra_Provides:Provides: %{__devel_extra_Provides}}\
%{?__devel_extra_Conflicts:Conflicts: %{__devel_extra_Conflicts}}\
%description devel\
This package provides the files neccessary for development against\
%{name}. Use this package if you need to build a package depending on\
%{name} at build time, or if you want to do your own development\
against %{name}.\
%files devel -f develfiles.list\
%defattr(-,root,root,-)\
%{nil}

%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
%{?__lib_packages:%{expand:%__lib_packages}}\
%{?_enable_devel_packages:%{devel_package}}\
%%install\
LANG=C\
export LANG\
unset DISPLAY || :\
%{nil}

#roma 14/07/2006
%bcond_with()       %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%bcond_without()    %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}

# roma 25/09/2006
%_x_prefix_rhfc6 /usr
%_x_prefix_rhfc5 /usr
%_x_prefix_rhfc4 /usr/X11R6
%_x_prefix_rhfc3 /usr/X11R6
%_x_prefix_rhfc2 /usr/X11R6
%_x_prefix_rhfc1 /usr/X11R6
%_x_prefix %{expand:%%_x_prefix_%{disttag2}}

%_x_bindir 	 %{_x_prefix}/bin
%_x_includes     %{_x_prefix}/include
%_x_libraries    %{_x_prefix}/lib

%_x_module_rhfc6 xorg/modules
%_x_module_rhfc5 xorg/modules
%_x_module_rhfc4 modules
%_x_module_rhfc3 modules 
%_x_module_rhfc2 modules
%_x_module_rhfc1 modules
%_x_module_path  %{_x_libraries}/%{expand:%%_x_module_%{disttag2}}