summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 809a9e066dd77b3a497044c2dfd9f78a46c9b189 (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
# Maintainer: Arnaud Dovi <mr.dovi@gmail.com>

pkgname=detect-it-easy-git
pkgver=3.06
pkgrel=1
pkgdesc='Detect It Easy, or abbreviated "DIE" is a program for determining types of files'
arch=('x86_64')
url='https://horsicq.github.io'
license=(MIT)
provides=(
  'detect-it-easy'
)
conflicts=(
  'detect-it-easy'
)
depends=(
  'freetype2'
  'glib2'
  'glibc'
  'graphite'
  'icu'
  'krb5'
  'qt5-base'
  'qt5-script'
  'qt5-svg'
  'systemd-libs'
)
makedepends=(
  'coreutils'
  'git'
  'imagemagick'
  'qt5-tools'
)
_srcname="DIE-engine"
source=(
  'git+https://github.com/horsicq/DIE-engine.git'
)
sha512sums=(
  'SKIP'
)
_pkgname="${pkgname/-git/}"
_stop='\e[m'
_color="\e[33m"
_bold='\e[1m'
_prefix=" ${_bold}${_color}==>${_stop} "

pkgver() {
  cd "$_srcname" || return
  printf "%s" "$(git describe --long --tags | sed 's/^v//;s/\([^-]*-\)g/r\1/;s/-/./g')"
}

prepare() {
    cd "$srcdir/$_srcname"
    git submodule update --init --recursive
}

build() {
  cd "$_srcname" || return
  echo -e "${_prefix}Building detect-it-easy"

  _subdirs="build_libs gui_source console_source lite_source"

  # [DEPRECATED] FIXME UPSTREAM: -Werror=format-security is causing build errors (merged upstream)
  #export CFLAGS+=" -Wno-format-security"
  #export CXXFLAGS+=" -Wno-format-security"

  for _subdir in $_subdirs; do
    pushd "$_subdir" || return
    echo -e "${_prefix}${_prefix}Building $_subdir"
    qmake-qt5 PREFIX=/usr QMAKE_CFLAGS="${CFLAGS}" QMAKE_CXXFLAGS="${CXXFLAGS}" QMAKE_LFLAGS="${LDFLAGS}" "$_subdir.pro"
    make -f Makefile clean
    make -f Makefile
    popd || return
  done

  echo -e "${_prefix}${_prefix}Running Qt's Linguist tool chain for gui_source"
  cd gui_source || return
  lupdate gui_source_tr.pro
  lrelease gui_source_tr.pro
}

package() {
  cd "$_srcname" || return

  echo -e "${_prefix}Creating the package base"
  install -d "$pkgdir"/{opt/"${_pkgname}",usr/bin,usr/share/pixmaps}
  install -d "$pkgdir/opt/${_pkgname}"/{lang,qss,info,db,signatures,images}

  echo -e "${_prefix}Copying the package binaries"
  install -Dm 755 build/release/die -t "$pkgdir"/opt/"${_pkgname}"
  install -Dm 755 build/release/diec -t "$pkgdir"/opt/"${_pkgname}"
  install -Dm 755 build/release/diel -t "$pkgdir"/opt/"${_pkgname}"

  echo -e "${_prefix}Copying the package files"
  install -Dm 644 gui_source/translation/* -t "$pkgdir"/opt/"${_pkgname}"/lang
  install -Dm 644 XStyles/qss/* -t "$pkgdir"/opt/"${_pkgname}"/qss
  install -Dm 644 Detect-It-Easy/info/* -t "$pkgdir"/opt/"${_pkgname}"/info
  cp -r Detect-It-Easy/db/* -t "$pkgdir"/opt/"${_pkgname}"/db/
  install -Dm 644 signatures/crypto.db -t "$pkgdir"/opt/"${_pkgname}"/signatures
  cp -r images/* -t "$pkgdir"/opt/"${_pkgname}"/images/

  echo -e "${_prefix}Setting up /usr/bin launchers"
  ln -s /opt/"${_pkgname}"/die "$pkgdir"/usr/bin/die
  ln -s /opt/"${_pkgname}"/diec "$pkgdir"/usr/bin/diec
  ln -s /opt/"${_pkgname}"/diel "$pkgdir"/usr/bin/diel

  echo -e "${_prefix}Setting up desktop icon"
  install -Dm 644 LINUX/hicolor/48x48/apps/detect-it-easy.png -t "$pkgdir"/usr/share/pixmaps

  echo -e "${_prefix}Setting up desktop shortcuts"
  install -Dm 644 LINUX/die.desktop -t "$pkgdir"/usr/share/applications
  
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}