From ParabolaWiki
Jump to: navigation, search
Note: The use of SRCBUILD should be considered to be deprecated. The newer mksource() mechanism, should be preferred instead; although it too, may be obsoleted soon, in favor of a fully integrated mechanism, which simply creates the source-ball after prepare() runs, rather than before.

SRCBUILDs are similar to PKGBUILDs, and you may want to use your PKGBUILD to start. This is where we build the package, but we will end up tarballing the source as well. First, we will cover the header, but see PKGBUILD for details about the following parts of the header.

1 Header

  • # Maintainer: Your Name <name@domain.tld>
    • Optionally, other maintainers, e.g., AUR. If you need this option, please put Parabola in parentheses for your name and AUR (or whatever the case may be) for subsequent lines. For example, # Maintainer (AUR): So and So <email@domain.tld>
    • Another option may be contributors and the basis for this derivative, if any. For example, pandoc was based on haskell-pandoc.
  • pkgname
  • pkgver
  • pkgrel
  • pkgdesc
  • arch
  • url
  • license
  • depends (Note on PKGBUILD that it's okay to leave blank. Most SRCBUILDS don't even have this line)
  • makedepends (also optional)
Note: Skipping a lot of PKGBUILD options, now.
  • source (optional URLs with $variables as noted in PKGBUILD and patches if any) and
  • md5sums
    • even better, include sha256 (don't forget /etc/makepkg.conf)
    • can leave off these and run the following when you're finished (including the path to SRCBUILD if not in the same directory):
$ makepkg -g >> SRCBUILD

2 Functions

2.1 Build

  1. Declare the build() function.
  2. Put all the steps needed to download the original source and create a free one, including wget'ing, unpacking, patching, removing files and/or dirs and repacking again.
  3. Change the source array in the PKGBUILD to point to it, instead of the original.
  4. When in doubt, check another SRCBUILD by cloning our repos (or download from the commit page).

2.2 Package

You may need to tweak some of these steps:

  1. Declare the package() function.
  2. Optionally change to the ${srcdir}.
  3. Declare the variables PKGEXT and PKGDEST.
    • with or without the export comand
    • PKGEXT=${SRCEXT} or .src.tar.xz
    • and PKGDEST=${SRCDEST} or ${startdir}
  4. Move or copy the package to its directory:
cp -a ${srcdir}/${pkgname}-${pkgver} ${pkgdir}/

3 Making the Source

Finally, before using libremakepkg on PKGBUILD as explained in the Package maintainer guide#Building packages, make sure that you're in the directory with your SRCBUILD and run the following to make the source for building the package later:

$ makepkg -src -p SRCBUILD

Put this free tarball on a public Web server. Ours is this one. Make the package and see if it works. PKGBUILD will use this source.

4 See also

Creating -libre packages for more information on creating packages