summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 78f7d308512c9bc8d2bf68b408f593d2692c705a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Maintainer : bartus <arch-user-repoᘓbartus.33mail.com>
# Contributor: David Runge <dave@sleepmap.de>
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: damir <damir@archlinux.org>
# Contributor: Lukas Sabota <punkrockguy318@comcast.net>
# Contributor: Brice Carpentier <brice@dlfp.org>

_pkgbase=scons
pkgname=python2-${_pkgbase}
pkgver=3.1.1
pkgrel=1
pkgdesc="Extensible Python-based build utility. Python2 version"
arch=('any')
url="https://scons.org"
license=('MIT')
depends=('python')
makedepends=('python-setuptools' 'python2-setuptools')
# potential additions include ipkg, rpm
checkdepends=('clang' 'dmd' 'gdc' 'ldc' 'nasm' 'python-lxml' 'python-pytest'
'python-virtualenv' 'python2-lxml' 'python2-pytest' 'python2-virtualenv' 'swig'
'zip')
source=("$_pkgbase-$pkgver.tar.gz::https://github.com/${_pkgbase}/${_pkgbase}/archive/${pkgver}.tar.gz")
sha512sums=('3347a7ec5c6c7b596c0d51bb4a9654b971734736febe3834df0f40e7839e1f0578dafeae838d5ddd9f3319ac3d17b6790666fa1602c30480eba25122355179a5')

prepare() {
   cd "${_pkgbase}-${pkgver}"
   local _copyright='Copyright (c) 2001 - 2019 The SCons Foundation'
   local _date_of_release="$(grep "RELEASE ${pkgver}" src/CHANGES.txt | cut -d ',' -f2)"
   local _date="$(date -d "${_date_of_release}" +'%Y-%m-%d %H:%M:%S')"
   # copy scripts to correct locations and change their globals
   for _script in scons{,ign,-time,-configure-cache}; do
     cp -v "src/script/${_script}.py" "src/script/${_script}"
     sed -e "s|__COPYRIGHT__|${_copyright}|g" \
         -e "s|__FILE__|/src/script/${_script}|g" \
         -e 's/__REVISION__/none/g' \
         -e "s|__DATE__|${_date}|g" \
         -e 's/__BUILDSYS__/none/g' \
         -e 's/__DEVELOPER__/none/g' \
         -e "s/__VERSION__/${pkgver}/g" \
         -i "src/script/${_script}"
   done
   sed -e "s|__COPYRIGHT__|${_copyright}|g" \
       -e 's|__FILE__|/src/setup.py|g' \
       -e 's/__REVISION__/none/g' \
       -e "s|__DATE__|${_date}|g" \
       -e 's/__BUILDSYS__/none/g' \
       -e 's/__DEVELOPER__/none/g' \
       -e "s/__VERSION__/${pkgver}/g" \
       -i "src/setup.py"
    # fix shebang for python2 version
    sed -e 's/env python/env python2/' \
        -i src/script/*
    sed -e 's/python/python2/' \
        -i src/engine/SCons/Tool/docbook/docbook-xsl-*/extensions/xslt.py
}

build() {
    cd "${_pkgbase}-${pkgver}"
    # build man page and move to src directory
    python2 bootstrap.py doc/SConscript
    mv -v build/doc/man/* src/
    cd src
    python2 setup.py build
}

check() {
    cd "${_pkgbase}-${pkgver}"
    python2 runtest.py -a -t -j ${MAKEFLAGS#-j} || msg "Tests passing with 'NO RESULT' count as failed."
}


package() {
  depends=('python2')
  cd "${_pkgbase}-${pkgver}/src"
  python2 setup.py install --prefix=/usr \
                           --skip-build \
                           --optimize=1 \
                           --standard-lib \
                           --install-data=/usr/share \
                           --root="$pkgdir"
  install -vDm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}/"
  install -vDm 644 {CHANGES,README,RELEASE}.txt \
    -t "${pkgdir}/usr/share/doc/${pkgname}/"
  # removing Windows only script
  rm -vf "${pkgdir}/usr/bin/scons"*.bat
  # moving files so scons and python2-scons don't conflict
  for _man_page in scons{,ign,-time}; do
    mv -v "${pkgdir}/usr/share/man/man1/${_man_page}".1 \
      "${pkgdir}/usr/share/man/man1/${_man_page}2".1
  done
  for _bin in scons{,ign,-configure-cache,-time}; do
    mv -v "${pkgdir}/usr/bin/${_bin}"{,2}
    mv -v "${pkgdir}/usr/bin/${_bin}-${pkgver}" "${pkgdir}/usr/bin/${_bin}2-${pkgver}"
  done
}