Trying to create package


i am trying to create the fpc and fpc-src package. below is the fpc pkgbuild file:

# Maintainer: L <alaviss 0 at gmail dot com>
# Contributor: Sergej Pupykin <>
# Contributor: Valeriy Lyasotskiy <>
# Contributor: Jan Willemson <>
# Contributor: Hugo Ideler <>
# Contributor: BlackIkeEagle <ike DOT devolder AT gmail DOT com>
# Original PKGBUILD: Andre Naumann <>
# See

# Build docs

pkgname=('fpc-svn' 'fpc-src-svn')
[[ $_build_docs -ne 0 ]] && pkgname+=('fpc-docs-svn')
arch=('i686' 'x86_64')
license=('GPL' 'LGPL' 'custom')
depends=('ncurses' 'zlib' 'expat')
# Trunk can only be built with stable version of FPC
makedepends=('fpc<9999' 'subversion')
[[ $_build_docs -ne 0 ]] && makedepends+=('texlive-core' 'texlive-htmlxml'
                                          'texlive-latexextra' 'ghostscript')

pkgver() {
  cd "${srcdir}"/src/
  printf '%s.r%s' \
    $(grep -m 1 'version' Makefile.fpc | cut -d '=' -f 2) \
    $(svnversion | tr -d [A-z])

build() {
  cd "${srcdir}"/src
  pushd fpcsrc/compiler
  fpcmake -Tall
  make NOGDB=1 OPT=' -dRelease' build

  if [[ $_build_docs -ne 0 ]]; then
    cd fpcdocs
    make -j1 FPCSRCDIR="${srcdir}"/fpcbuild/fpcsrc html

package_fpc-svn() {
  pkgdesc="The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible \
    Pascal Compiler. It comes with fully TP 7.0 compatible run-time library."

  cd "${srcdir}"/fpcbuild

  export HOME="${srcdir}"

  make -j1 PREFIX="${pkgdir}"/usr NOGDB=1 OPT=' -dRelease' install
  export PATH="${pkgdir}/usr/bin:${PATH}"

  install -Dm644 fpcsrc/rtl/COPYING.FPC \

  local _fpcarch=''
  case "$CARCH" in
      error 'Unsupported $CARCH'
      return 1
  ln -s /usr/lib/fpc/${_pkgver}/ppc${_fpcarch} "${pkgdir}"/usr/bin/
  unset _fpcarch

  install -dm755 "${pkgdir}"/etc
  "${pkgdir}"/usr/lib/fpc/${_pkgver}/samplecfg \
    "${pkgdir}"/usr/lib/fpc/${_pkgver} "${pkgdir}"/etc

  # use -fPIC by default
  echo -e '#ifdef cpux86_64\n# for x86_64 use -fPIC by default\n-Cg\n#endif' \
    >> "${pkgdir}"/etc/fpc.cfg

  mv "${pkgdir}"/usr/man "${pkgdir}"/usr/share/

  find "${pkgdir}"/etc -type f -exec sed -i "s|${pkgdir}||g" {} \;

package_fpc-src-svn() {
  pkgdesc='Sources for the Free Pascal Compiler (required by the Lazarus IDE)'

  install -dm755 "${pkgdir}"/usr/lib/fpc

  svn export -r HEAD "${srcdir}"/fpcbuild/fpcsrc "${pkgdir}"/usr/lib/fpc/src

package_fpc-docs-svn() {
  pkgdesc='Documentation for the Free Pascal Compiler'

  cd "${srcdir}"/fpcbuild/fpcdocs
  make PREFIX="${pkgdir}"/usr htmlinstall

i get this error:

jshand@jshand-pc fpc]$ makepkg
==&gt; Making package: fpc-svn 3.2.0-1 (Sat 12 Jan 2019 20:38:00 NZDT)
==&gt; Checking runtime dependencies...
==&gt; Checking buildtime dependencies...
==&gt; Retrieving sources...
&#160;-&gt; Updating fpcbuild svn repo...
Updating '.':
At revision 40847.
==&gt; Validating source files with sha1sums...
&#160;&#160;&#160;fpcbuild ... Skipped
==&gt; Extracting sources...
&#160;-&gt; Creating working copy of &#160;svn repo...
==&gt; Starting pkgver()...
/home/jshand/fpc/PKGBUILD: line 31: cd: /home/jshand/fpc/src/fpc/src/: No such file or directory
==&gt; ERROR: pkgver is not allowed to be empty.
==&gt; ERROR: pkgver() generated an invalid version: &#160;
[jshand@jshand-pc fpc]$

i need help to understand what i’m doing here


I don’t know about creating packages … Make sure you use ``` above and bellow the text code you share here so it is properly formatted and readable for others.

Both of those packages are in the community repo. Why not installing them from there, or use the pkgbuild that already exists :slight_smile:


i’m trying that already and i seem to be failing at it.


To install it from repos or to make it custom ?


This line should be:
I think.
One might even say it’s redundant.


I thinked that too at first, then see

So it might have sense

You have changing to a not existing directory so it can’t calculate pkgver()

Have you used Gentoo before? :grin:

Failing to install from repo?