summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8018f1cdc0bed5173f31554e732aa99b391dc441 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Maintainer:  Jason Kercher <jkercher 43 at gmail dot com>

pkgname=linuxcnc-git
pkgver=2.9.3.r2407.gb3ef606aa3
pkgrel=1
pkgdesc="Controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more (formerly EMC2)"
arch=($CARCH)
license=('GPL-2.0-only')
url="http://linuxcnc.org"
depends=(
  at-spi2-core
  cairo
  bash
  boost-libs
  freetype2
  fontconfig
  gcc-libs
  gdk-pixbuf2
  glib2
  glibc
  gstreamer
  gtk3
  harfbuzz
  libepoxy
  librsvg
  libtirpc
  libusb
  libx11
  libxext
  libxft
  libxinerama
  libxmu
  libxss
  #   readline
  #   editline
  systemd-libs
  pango
  python
  python-cairo
  python-configobj
  python-dbus
  python-distro
  python-gobject
  python-opencv
  python-opengl
  python-numpy
  python-matplotlib
  python-poppler-qt5
  #   python-psycopg
  python-pyqt5
  python-pyserial
  python-pyzmq
  python-xlib
  #   python-validate-pyproject
  tk
  tcl
  zlib
  # AUR
  #   gtksourceview2
  #   python-pyodbc
  # python-espeak
  libmodbus
)
makedepends=(
  asciidoc
  bc
  boost
  gettext
  glu
  git
  libeatmydata
  libgpiod
  libxaw
  intltool
  openbsd-netcat
  procps-ng
  psmisc
  python-pillow
  python-sphinx
  man-db
  #AUR
  bwidget
  #   tclx
  linkchecker
  python-yapps2
)
checkdepends=()
provides=('linuxcnc')
conflicts=('linuxcnc' 'linuxcnc-bin')
options=(!emptydirs)
source=("${pkgname}::git+https://github.com/LinuxCNC/linuxcnc"
  'libtirpc.patch')
sha256sums=('SKIP'
  'bc95bafd67fad1c1d3722261bc586cdc612ec9e1597fadb95fa825c10550ac2c')

pkgver() {
  cd "${srcdir}/${pkgname}"
  # Generate git tag based version. Count only proper (v)#.#* [#=number] tags.
  local _gitversion=$(git describe --long --tags --match '[v0-9][0-9.][0-9.]*' | sed -e 's|^v||' | tr '[:upper:]' '[:lower:]')

  # Format git-based version for pkgver
  # Expected format: e.g. 1.5.0rc2.r521.g99982a1c
  echo "${_gitversion}" | sed \
    -e 's|^\([0-9][0-9.]*\)-\([a-zA-Z]\+\)|\1\2|' \
    -e 's|\([0-9]\+-g\)|r\1|' \
    -e 's|-|.|g'
}

prepare() {
  git -C "${srcdir}/${pkgname}" clean -dfx

  cd "${srcdir}/${pkgname}/src"
  echo "export TCLLIBPATH=$TCLLIBPATH:/usr/lib/tcltk/linuxcnc" >${pkgname}.sh
  find . -iname fixpaths.py -o -iname checkglade -o \
    -iname update_ini | xargs perl -p -i -e "s/python/python3/"
  patch -Np2 -i "${srcdir}/libtirpc.patch"
  sed -i 's|/usr/local/etc/emc2/configs|/etc/emc2/configs|g' Makefile.inc.in
  #   sed -i 's|libgpiod <|libgpiod >|g' configure.ac
  #   sed -i 's|$(DESTDIR)$(sysconfdir)/linuxcnc|$(DESTDIR)/etc/linuxcnc|g' Makefile.orig
  #   ./autogen.sh
  #   ./configure --prefix=/usr \
  #    --enable-non-distributable=yes \
  #    --with-realtime=uspace \
  #    --without-libmodbus \
  #    --with-python=/usr/bin/python3 \
  #    --disable-gtk2
  #
  sed -i 's|$(DESTDIR)$(sysconfdir)/linuxcnc|$(DESTDIR)/etc/linuxcnc|g' Makefile

  autoreconf -i
  eatmydata ./autogen.sh
  eatmydata ./configure \
    --prefix=/usr \
    --disable-check-runtime-deps \
    --enable-non-distributable=yes \
    --enable-build-documentation \
    --with-realtime=uspace
}

build() {
  cd "${srcdir}/${pkgname}/src"
  #   make
  eatmydata make -O -j$((1 + $(nproc))) default pycheck V=1
  # Note that the package build covers html docs
  eatmydata make -O -j$((1 + $(nproc))) manpages V=1
  #   eatmydata make -O -j$((1+$(nproc))) translateddocs V=1
  eatmydata make -O -j$((1 + $(nproc))) default pycheck V=1

}

# check() {
#   cd "${srcdir}/${pkgname}/src"
#   ../scripts/rip-environment runtests
# }

package() {
  cd "${srcdir}/${pkgname}/src"
  DESTDIR=${pkgdir} make install
  cp -PR "${srcdir}/${pkgname}/share/applications" "${pkgdir}/usr/share"
  mkdir -p "${pkgdir}/etc/xdg"
  cp -PR "${srcdir}/${pkgname}/share/menus" "${pkgdir}/etc/xdg/"
  install -Dm755 "${srcdir}/${pkgname}/src/${pkgname}.sh" \
    "${pkgdir}/etc/profile.d/${pkgname}.sh"
  sed -i "s|${srcdir}||" "${pkgdir}/usr/share/linuxcnc/Makefile.modinc"
  install -Dm644 ${pkgdir}/usr/share/linuxcnc/linuxcncicon.png -t ${pkgdir}/usr/share/pixmaps
}