%global phpname gettext Name: php-gettext Version: 1.0.9 # In release, the %{?dist} means: if the variable "dist" exists substitute it here, # other wise nothing Release: 2%{?dist} License: GPLv2+ # Many people copy the Summary straight from the upstream website. Summary: Gettext emulation in PHP Group: Development/Libraries URL: https://launchpad.net/%{name} Source: http://launchpad.net/%{name}/trunk/%{version}/+download/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # BuildRequires are the things needed to compile (%%build) the package, even if # you don't need them to actually *run* the installed package #BuildRequires: dos2unix, foobar #BuildRequires: yoyoyo2 blahblah #BuildRequires: foobar3 # Requires: The things that must be installed to run this package. Many of them # are auto-detected when you build the package. Some aren't. # Or might be: Requires: php-common >= 5.1 Requires: php-common # You won't use BuildArch for a lot of compiled stuff. But it's often used for PHP # and Python apps that are not compiled. BuildArch: noarch # Many people will copy the description straight from the upstream website. %description This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system. # %%prep is a section -- this marks the beginning of some stuff that will be run # during the "prep" phase of building a package. %prep # The %%setup macro intelligently unpacks the source archive(s). The sources must # exist in your %%{_sourcedir} directory -- usually $HOME/rpmbuild/SOURCES # If the source doesn't unpack into a %{name}-%{version}/ folder automatically, # use the -n option to tell it where it *does* unpack to, such as: # %%setup -q -n mypackage # If you need to create a directory to unpack to (rare), use -c. # %%setup -q -c %{name}-%{version} %setup -q # After the %%setup runs, the commands you run are in the working directory where # the archive was unpacked. chmod -x *.php # The next section is %%build, which is used to do any compiling or other crunching # of code before it's put into the right file locations. # Keep in mind sometimes a section won't really do # anything. PHP apps, for example, are just straight code, so they're simply copied # somewhere useful, and voila you're done. %build # The next section is %%install, which is used to (surprise) install the resulting # stuff you compiled and crunched (or not) into a chroot that looks like the root # filesystem. %install # this next bit makes sure no cruft remains from a previous build rm -rf %{buildroot} # %%{_datadir} is a special macro that represents /usr/share. How would you know # this? You basically learn them over time, but a good way to see a list is # to run 'rpm --showrc | grep ': +_[a-z]*dir' mkdir -p %{buildroot}%{_datadir}/php/%{name} cp -a *.php gettext.inc %{buildroot}%{_datadir}/php/%{name} # The %clean section is used to sanitize the work area. In most cases, this is # the same for every package. %clean rm -rf %{buildroot} # The %%files section is where you tell rpm what files you installed belong in the # package. That sounds a little odd because if you leave something out, rpm will # complain. Why have it? Because is some cases you can have subpackages, where # some of the built & installed stuff goes in different subpackages (e.g. libfoo # and libfoo-devel). %files %defattr(-,root,root,-) # These are documents existing in the source archive's folder that you want to # automatically put in /usr/share/doc/%%{name}-%%{version} %doc README AUTHORS COPYING # Now a list of files that have been installed in the %%install section that need # to be in the binary package # This one points to /usr/share/php/php-gettext %{_datadir}/php/%{name} # Notice that %%changelog is always in reverse chrono order. %changelog * Sun Dec 06 2009 David Nalley 1.0.9-2 - corrected license field * Sun Dec 06 2009 David Nalley 1.0.9-1 - Initial packaging