From Gnash Project Wiki
Gnash has it's own infrastructure for building binary packages in a variety of formats. This package building process is completely integrated with Autotools as it's used in Gnash. The Automake code that handles packaging lives in gnash/packaging, and is a series of .am Automake fragments, that become part of the final Makefile.
Automake also has basic support for packaging as well, which Gnash uses. The basic Automake target used is distdir, which creates a subdirectory comprising only of files in the various _DIST variables in Gnash's Makefile.am files. In order for this to work, Gnash must first pass the Automake distcheck target, which does a bunch of distribution related tests, like making sure you can compile Gnash solely from the contents of the source tarball. This is very important, because free software projects official releases are these same source tarballs.
Anyway, once distcheck is happy, then you can proceed to more complex packaging than just making a working source tarball. We primarily only build binary packages so we can get updated snapshots between releases to end users that wish to stay in sync with Gnash development.
To build a source tarball,. there are three targets you can use.
- Makes a gzipped tar file.
- Also makes a gzipped tar file, and is called by dist.
- Makes a bzipped tar file.
The debian format is used by Debian and Ubuntu. You can get more info here: Debian Packaging HOWTO.
For Gnash, the primary target used to build deb packages is make deb. This runs all the other targets to build a source tree, configure the sources, build, and then package. If run correctly all it'll do is ask you for your GPG at the end of the process hours later.
If you have created a source directory already, but changed a Debian packaging file, run make setup-deb, which updates the packaging files in the package source and build directory with the correct version numbers. All snapshot builds are named with the branch nickname and the revision number, as we feel this is more accurate than using the date.
For an official release, we want to override that, so we invoke make like this: make setup-deb SNAPSHOT_VERSION=0.8.7. If you want to overwrite the sources entirely, run make distdir, which will only make the subdirectory populated with the distribution source files.
Once you have a source tree created, you can cd into that directory, and run the standard Debian packaging tools, debuild and dpkg-buildpackage. Standard options to both of those are "-jN", which gets passed to make for parallel builds. You can also set the value use for parallel builds by setting parallel=N in DEB_BUILD_OPTIONS.
If you are testing package building and want to speed things up, set DEB_BUILD_OPTIONS to noopt in your environment, which turns off compiler optimizations. Another speed hack is if your package build is complete, but you just want to repackage it (usually after a packaging change), run dpkg-buildpackage -nc, which doesn't do a clean operation first.
DEB_BUILD_OPTIONS can also be used to change the configuration of the packages. Enabling one of these options changes then configuration of the build and the naming of the packages. For these to take effect, you must set DEB_BUILD_OPTIONS before running make setup-deb, the setup-deb target has to change the version in debian/changelog for this to change anything. This way it's possible to have the different packages in the same repository.
Building Gnash supports these values in DEB_BUILD_OPTIONS:
- Build ffmpeg enabled packages
- Build OpenGL enabled packages
- Build VA API enabled packages (experimental)
Building RPMS starts with the same make distdir process used when building Debian packages, but after that it's very different. make rpm is the top level Makefile target used to build rpm packages, At least in current versions of rpmbuild, all the work goes on in the $HOME/rpmbuild sub-directory tree. The directories we care about are:
The source tarball must be copied to this directory, which in our case is done by the make setup-rpm makefile target.
The source rpm goes here when rpmbuild is complete.
The binary rpm files go here when rpmbuild is complete.
The raw build tree lives here, which you can cd to and run make or configure by hand if you have problems.
The Makefile target setup-rpm makes and copies the source tar file to $HOME/rpmbuild/SOURCES/, and also makes the spec file. The spec file is only edited so the version number is correct. If you have a spec file already in your build tree, and you just want to rebuild or repackage what you already have, then you can just run rpmbuild -ba gnash.spec by hand.
You can read the RPM Manual for more detailed information on how rpm specs files work.