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
# Contributor: Gustavo A. Gomez Farhat <gustavo_dot_gomez_dot_farhat at gmail_dot_com>
# Contributer: Matt Beisser <beissemj(at)gmail(dot)com>
# Contributor: Stewart Mackenzie <[email protected]>
# Contributor: Alain Kalker <[email protected]>
pkgname=mozart-git
pkgver=20130228
pkgrel=1
pkgdesc="The Mozart Programming System"
arch=('i686' 'x86_64')
url="http://www.mozart-oz.org"
license=('custom:X11style')
depends=('tk' 'emacs')

if test "$CARCH" == i686; then
  depends=("${depends[@]}" 'gmp' 'gdbm')
fi

if test "$CARCH" == x86_64; then
  depends=("${depends[@]}" 'gcc-multilib' 'gcc-libs-multilib' 'binutils-multilib' 'libtool-multilib' 'lib32-glibc' 'lib32-gmp' 'lib32-gdbm' 'lib32-zlib')
fi

options=('!makeflags')
source=(mozart.profile)
md5sums=('cc4567bb8fad4a81da1903ee092a4886')

_gitroot=https://github.com/mozart/mozart.git
_gitstdroot=https://github.com/mozart/mozart-stdlib.git
_gitname=mozart
_gitstdname=mozart-stdlib


build() {
  cd "$srcdir"
  msg "Connecting to github.com/mozart/mozart..."

  if [[ -d "$_gitname" ]]; then
    cd "$_gitname" && git pull origin
    msg "The local files are updated."
  else
    git clone "$_gitroot" "$_gitname" --depth=1
  fi

  cd "$srcdir"
  msg "Connecting to github.com/mozart/mozart-stdlib..."
  if [[ -d "$_gitstdname" ]]; then
     cd "$_gitstdname" && git pull origin
     msg "The local files are updated"
  else
     git clone "$_gitstdroot" "$_gitstdname" --depth=1
  fi

  msg "GIT checkout done or server timeout"

  rm -rf "$srcdir/$_gitname-build"
  mkdir "$srcdir/$_gitname-build"
  cd "$srcdir/$_gitname-build"
  export BUILDTOP=$srcdir/$_gitname-build  

  msg "Starting to configure Mozart Oz"
  ../$_gitname/configure --prefix=$pkgdir/opt/$_gitname
  # Fix for Tcl >= 8.6
  echo "#define USE_INTERP_RESULT 1" >> platform/wish/conf.h
  msg "starting to build Mozart Oz"
  make 
  make DESTDIR="$pkgdir/opt/$_gitname" install

  rm -rf "$srcdir/$_gitstdname-build"
  mkdir "$srcdir/$_gitstdname-build"
  cd "$srcdir/$_gitstdname-build"

  #some systems break on the stdlib configure due to missing dep binaries  
  #this seems to fix it
  PATH=$pkgdir/opt/mozart/bin:$PATH

  msg "Starting to configure Mozart Oz Stdlib"
  ../$_gitstdname/configure --prefix=$pkgdir/opt/$_gitname
  msg "Starting to build Mozart Oz Stdlib"
  make
 
  mkdir -p $pkgdir/usr/share/licenses/mozart
  install -m 755 -D $srcdir/mozart.profile $pkgdir/etc/profile.d/mozart.sh
  cp $pkgdir/opt/mozart/LICENSE* $pkgdir/usr/share/licenses/mozart
}

package() {
  msg "Packaging Mozart Oz"
  cd "$srcdir/$_gitstdname-build"
  make DESTDIR="$pkgdir/opt/$_gitname" install
}