summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9b1f80ebd0d5d36e822f3b8b268ee2806af0a443 (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
# Maintainer: Nick Østergaard <oe.nick at gmail dot com>
pkgname=kicad-pretty-git
pkgver=1
pkgrel=3
pkgdesc="KiCad .pretty repos. Theese are the new footprint library."
arch=('any')
url="https://github.com/KiCad"
license=('GPL')
makedepends=('git' 'curl')
options=('!strip')
install='kicad.install'
source=('https://raw.githubusercontent.com/KiCad/kicad-library/master/template/fp-lib-table.for-pretty')
md5sums=('SKIP')


package() {
  cd "$srcdir"
  msg "Fetching list of available pretty repos..."
  PRETTY_REPOS=`curl https://api.github.com/orgs/KiCad/repos?per_page=2000 2> /dev/null \
    | grep full_name | grep pretty \
    | sed -r  's:.+ "KiCad/(.+)",:\1:'`

  echo $PRETTY_REPOS
  
  # Fetching the pretty repos. This should possibly be a bit more
  # intelligent, such that it will remove orphaned repos.
  for repo in $PRETTY_REPOS; do
    if [ ! -e "$srcdir/$repo" ]; then
      msg "Cloning $repo"
      git clone "https://github.com/KiCad/$repo" "$srcdir/$repo"
    else
      msg "Updating $repo"
      cd "$srcdir/$repo"
      git pull
    fi
  done
  
  mkdir -p "$pkgdir/usr/share/kicad/footprints"
  
  for repo in $PRETTY_REPOS; do
    cp -r "$srcdir/$repo" "$pkgdir/usr/share/kicad/footprints"
  done
  
  mv $srcdir/fp-lib-table.for-pretty "$pkgdir/usr/share/kicad/footprints/fp-lib-table"

  mkdir -p "$pkgdir/etc/profile.d"
  echo "export KISYSMOD=/usr/share/kicad/footprints" > "$pkgdir/etc/profile.d/kicad-pretty-git.sh"
}

# vim:set ts=2 sw=2 et: