summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: de5d3ad4b6cf28f35d99ad78f04db75f93aa3922 (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
# Maintainer: Alfredo Palhares <alfredo at palhares dot me>
# Contributor: Mark Wagie <mark dot wagie at tutanota dot com>

# Please contribute to:
# https://github.com/alfredopalhares/arch-pkgbuilds

pkgbase="joplin"
pkgname=('joplin' 'joplin-desktop-electron')
pkgver=1.4.19
pkgrel=1
pkgdesc="A note taking and to-do application with synchronization capabilities - Split Package"
arch=('x86_64' 'i686')
conflicts=('joplin-cli' 'joplin-desktop')
makedepends=('git' 'npm' 'python' 'rsync')
url="https://joplinapp.org/"
license=('MIT')
source=("joplin.desktop" "joplin-desktop.sh" "joplin.sh"
        "joplin-${pkgver}.tar.gz::https://github.com/laurent22/joplin/archive/v${pkgver}.tar.gz")
sha256sums=('c7c5d8b0ff9edb810ed901ea21352c9830bfa286f3c18b1292deca5b2f8febd2'
            'a450284fe66d89aa463d129ce8fff3a0a1a783a64209e4227ee47449d5737be8'
            '5b6f8847ec0c3848375755213c3009c273f478b4b80ed2c5f0af8f67ee0e94fb'
            '55aad4fe50e2da980983a69bc7c0870626064db971550d522e266feb17d38916')


build() {
  cd "${srcdir}/joplin-${pkgver}"
  msg "Disabling husky (git hooks)"
  sed -i '/"husky": ".*"/d' package.json

  # Force Lang
  # INFO: https://github.com/alfredopalhares/joplin-pkgbuild/issues/25
  export LANG=en_US.utf8

  msg2 "Installing dependencies..."
  npm install
  npm install compare-version # Joplin Cli needs this
  ./node_modules/.bin/lerna bootstrap

}

#TODO: A slimdown is needed
package_joplin() {
  pkgdesc="A note taking and to-do application with synchronization capabilities - CLI App"
  depends=('nodejs' 'rsync')

  msg2 "Building CLI..."
  mkdir -p "${pkgdir}/usr/share/joplin-cli/app-cli"
  cd "${srcdir}/joplin-${pkgver}/packages/app-cli"
  npm run build
  cd build
  cp -R "." "${pkgdir}/usr/share/joplin-cli/app-cli/"

  msg2 "Copying Base Node Modules packages..."
  cd "${srcdir}/joplin-${pkgver}/packages/app-cli"
  cp -R "node_modules/" \
    "${pkgdir}/usr/share/joplin-cli/app-cli"

  msg2 "Copy CLI Joplin Dependencies..."
  cd "${srcdir}/joplin-${pkgver}/packages/"
  cp -R "fork-htmlparser2" "${pkgdir}/usr/share/joplin-cli/"
  cp -R "fork-sax" "${pkgdir}/usr/share/joplin-cli/"
  cp -R "lib/" "${pkgdir}/usr/share/joplin-cli/"
  cp -R "renderer/" "${pkgdir}/usr/share/joplin-cli/"
  cp -R "tools/" "${pkgdir}/usr/share/joplin-cli/"

  #TODO: Check if existing symblinks are valid
  msg2 "Fixing @Joplin Symlinks..."
  cd "${pkgdir}/usr/share/joplin-cli/"
  for dir in $(find . -type d -name "@joplin"); do
    cd "${pkgdir}/usr/share/joplin-cli/${dir}"
    rm -r *
    ln -s "../../../fork-htmlparser2" "fork-htmlparser2"
    ln -s "../../../fork-sax" "fork-sax"
    ln -s "../../../lib" "lib"
    ln -s "../../../renderer" "renderer"
    ln -s "../../../tools" "tools"

  done

  msg2 "Installing LICENSE..."
  cd "${srcdir}/joplin-${pkgver}/"
  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"

  msg2 "Installing Startup Script"
  cd "${srcdir}"
  install -Dm755 joplin.sh "${pkgdir}/usr/bin/joplin-cli"
}

#TODO: Check for slimdown
package_joplin-desktop-electron() {
  pkgdesc="A note taking and to-do application with synchronization capabilities - Desktop"
  depends=('gtk3' 'libexif' 'libgsf' 'libjpeg-turbo' 'libwebp' 'libxss' 'nodejs'
         'nss' 'orc')
  optdepends=('libappindicator-gtk3: for tray icon')

  msg2 "Building Desktop..."
  mkdir -p "${pkgdir}/usr/share/joplin-desktop"
  cd "${srcdir}/joplin-${pkgver}/packages/app-desktop"
  USE_HARD_LINKS=false npm run dist -- --publish=never
  cd dist/linux-unpacked/
  cp -R "." "${pkgdir}/usr/share/joplin-desktop"

  msg2 "Installing LICENSE..."
  cd "${srcdir}/joplin-${pkgver}/"
  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"

  msg2 "Installing startup script and desktop file..." 
  cd "${srcdir}"
  install -Dm755 ${srcdir}/joplin-desktop.sh "${pkgdir}/usr/bin/joplin-desktop"
  install -Dm644 ${srcdir}/joplin.desktop -t "${pkgdir}/usr/share/applications"

}