summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2cc8cfd851e1cba8512dd45cb9c5e3ba17df6c83 (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
# Contributor: Luis Sarmiento < Luis.Sarmiento-ala-nuclear.lu.se >
#
#
pkgname=go4-git
_pkgname=go4
pkgver=r2054.111adfd6
pkgrel=1
pkgdesc='Object-oriented system (GSI Object Oriented On-line Off-line system) based on ROOT'
arch=('x86_64')
depends=('root' 'qt5-base')
url="https://www.gsi.de/en/work/research/experiment_electronics/data_processing/data_analysis/the_go4_home_page.htm"
license=('GPL')
source=($_pkgname::git+https://github.com/linev/go4.git)
sha256sums=('SKIP')
provides=(go4)
conflicts=(go4)

pkgver() {
  cd ${srcdir}/$_pkgname
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {

  rm -rf ${srcdir}/build
  [[ -d  ${srcdir}/build ]] || mkdir ${srcdir}/build
  cd     ${srcdir}/build

  sed -i 's#$ENV{ROOTSYS}#/usr/lib/cmake/ROOT#g' ${srcdir}/${_pkgname}/cmake/modules/Go4Configuration.cmake

  # with Qt5 there is a change in path for some components
  find ${srcdir}/${_pkgname}/qt4/Go4GUI -type f -exec sed -e 's#QtGui/QAction#QtWidgets/QApplication#g' -i {} \;
  find ${srcdir}/${_pkgname}/qt4/Go4GUI -type f -exec sed -e 's#QtGui/QApplication#QtWidgets/QApplication#g' -i {} \;

  cmake -DCMAKE_INSTALL_PREFIX=${pkgdir}/usr \
        -DGO4PREFIX=/usr \
        -DROOTSYS=/usr \
        -DGO4_OS=Linux \
        -DWITHQT=5 \
        -Dwithdabc=yes \
        ${srcdir}/go4

  # -Ddesigner=ON

}

build() {
  cd ${srcdir}/build

  make all || return 1

}

package() {

  #install the package
  cd ${srcdir}/build
  make install

  #install the license
  install -Dm644 "Go4License.txt" "$pkgdir/usr/share/licenses/go4/Go4License.txt"

  # cp /etc and /usr/bin and /usr/lib
  install -d ${pkgdir}/etc
  install -d ${pkgdir}/usr/bin
  install -d ${pkgdir}/usr/lib
  for file in ${srcdir}/build/etc/*; do install -m755 ${file} ${pkgdir}/etc/; done
  for file in ${srcdir}/build/bin/*; do install -m755 ${file} ${pkgdir}/usr/bin/; done
  for file in ${srcdir}/build/lib/*; do install -m755 ${file} ${pkgdir}/usr/lib/; done

  #install the desktop file
  echo "
	[Desktop Entry]
	Name=${_PKGNAME}
	Comment=${pkgdesc}
	Exec=go4
	Icon=xchm-32
	Terminal=false
	Type=Application
	Categories=Utility;Science;
	StartupNotify=false
	" > $srcdir/$pkgname.desktop
  install -Dm644 $srcdir/$pkgname.desktop $pkgdir/usr/share/applications/$pkgname.desktop

  install -d ${pkgdir}/etc/profile.d

  cat <<- EOF > ${srcdir}/go4.sh
  # source go4login script
  source /usr/bin/go4login

  # If ROOT_INCLUDE_PATH already exists, then add Go4 to it, otherwise do nothing
  export ROOT_INCLUDE_PATH=\${ROOT_INCLUDE_PATH:+\$ROOT_INCLUDE_PATH:/usr/include/go4}

  # if ROOT_INCLUDE_PATH does not exist, define it as the one from Go4, otherwise do nothing
  export ROOT_INCLUDE_PATH=\${ROOT_INCLUDE_PATH:-/usr/include/go4}

EOF

  install -m755 ${srcdir}/go4.sh  ${pkgdir}/etc/profile.d/go4.sh
}