summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: aee4ef606bd45ae20d5a73648f96909334b02d64 (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
# Maintainer: Andy Weidenbaum <archbaum@gmail.com>
# Contributor: Alexander F Rødseth <xyproto@archlinux.org>
# Contributor: Dominik Picheta <morfeusz8@gmail.com>
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Jesus Alvarez <jeezusjr@gmail.com>
# Contributor: Zion Nimchuk <zionnimchuk@gmail.com>

pkgbase=nim-git
pkgname=('nim-git' 'nimble-git' 'nimsuggest-git')
pkgver=20170710
pkgrel=1
arch=('i686' 'x86_64')
groups=('nim')
makedepends=('git' 'texlive-bin' 'texlive-core' 'texlive-fontsextra')
source=(git+https://github.com/nim-lang/Nim
        git+https://github.com/nim-lang/Nim.wiki
        git+https://github.com/nim-lang/csources
        git+https://github.com/nim-lang/nimble)
sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP')

pkgver() {
  cd "$srcdir/Nim"
  git log -1 --format="%cd" --date=short --no-show-signature | sed "s|-||g"
}

prepare() {
  cd "$srcdir/Nim"

  msg2 'Cloning csources...'
  git clone --local "$srcdir/csources"
}

build() {
  cd "$srcdir/Nim"

  msg2 'Building csources...'
  pushd csources
  sh build.sh
  popd

  msg2 'Building Nim...'
  ./bin/nim c -d:release koch
  ./koch boot -d:release -d:nativeStacktrace -d:useGnuReadline

  msg2 'Building Nim PDF documentation...'
  ./koch pdf

  msg2 'Building Nimble...'
  ./koch nimble

  msg2 'Building nimgrep and nimsuggest...'
  ./koch tools

  msg2 'Building libnimrtl...'
  pushd lib
  ../bin/nim c --app:lib -d:createNimRtl -d:release nimrtl.nim
  popd
}

package_nim-git() {
  pkgdesc="Compiled, garbage-collected systems programming language which has an excellent productivity/performance ratio"
  url="https://github.com/nim-lang/Nim"
  license=('MIT')
  options=('!emptydirs')
  provides=('nim')
  conflicts=('nim')

  cd "$srcdir/Nim"

  msg2 'Installing Nim license...'
  install -Dm 644 "copying.txt" -t "$pkgdir/usr/share/licenses/nim"

  msg2 'Installing Nim documentation...'
  install -dm 755 "$pkgdir/usr/share/doc/nim"
  cp -dpr --no-preserve=ownership examples web doc/* "$pkgdir/usr/share/doc/nim"

  msg2 'Installing Nim wiki...'
  cp -dpr --no-preserve=ownership "$srcdir/Nim.wiki" \
    "$pkgdir/usr/share/doc/nim/wiki"

  msg2 'Installing Nim...'
  ./koch install "$pkgdir"
  install -Dm 755 bin/{nim,nimgrep} -t "$pkgdir/usr/bin"

  cd "$pkgdir/nim"
  install -dm 755 "$pkgdir/etc" "$pkgdir/usr/lib/nim"
  find lib -mindepth 1 -maxdepth 1 -exec \
    cp -dpr --no-preserve=ownership '{}' "$pkgdir/usr/lib/nim" \;
  find config -mindepth 1 -maxdepth 1 -exec \
    cp -dpr --no-preserve=ownership '{}' "$pkgdir/etc/" \;
  cp -dpr --no-preserve=ownership "$srcdir/Nim/lib/packages" \
    "$pkgdir/usr/lib/nim"

  # https://bugs.archlinux.org/task/50252
  msg2 'Fixing unusual placement of header files...'
  install -dm 755 "$pkgdir/usr/include"
  for _header in cycle nimbase; do
    ln -s "/usr/lib/nim/${_header}.h" "$pkgdir/usr/include/${_header}.h"
  done

  msg2 'Fixing unusual placement of shared object files...'
  ln -s "/usr/lib/nim/libnimrtl.so" "$pkgdir/usr/lib/libnimrtl.so"

  msg2 'Cleaning up pkgdir...'
  find "$pkgdir" -type d -name .git -exec rm -r '{}' +
  find "$pkgdir" -type f -name .gitignore -exec rm -r '{}' +
  rm -rf "$pkgdir/nim"
}

package_nimble-git() {
  pkgdesc="Package manager for the Nim programming language"
  url="https://github.com/nim-lang/nimble"
  license=('BSD')
  provides=('nimble')
  conflicts=('nimble')

  cd "$srcdir/nimble"

  msg2 'Installing Nimble license...'
  install -Dm 644 license.txt -t "$pkgdir/usr/share/licenses/nimble"

  msg2 'Installing Nimble documentation...'
  install -Dm 644 *.markdown -t "$pkgdir/usr/share/doc/nimble"

  msg2 'Installing Nimble...'
  install -Dm 755 "$srcdir/Nim/bin/nimble" -t "$pkgdir/usr/bin"

  # Nimble looks for nimscriptapi.nim in /usr/bin/nimblepkg/, of all places.
  install -dm 755 "$pkgdir/usr/share/nimble"
  cp -dpr --no-preserve=ownership src/nimblepkg "$pkgdir/usr/share/nimble"
  ln -s "/usr/share/nimble" "$pkgdir/usr/bin/nimblepkg"

  msg2 'Installing Nimble bash completion...'
  install -Dm 644 nimble.bash-completion \
    "$pkgdir/usr/share/bash-completion/completions/nimble"
}

package_nimsuggest-git() {
  pkgdesc="Tool for providing auto completion data for Nim source code"
  url="https://github.com/nim-lang/nimsuggest"
  license=('MIT')
  provides=('nimsuggest')
  conflicts=('nimsuggest')

  msg2 'Installing Nimsuggest...'
  install -Dm 755 "$srcdir/Nim/bin/nimsuggest" -t "$pkgdir/usr/bin"
}