build.sh 3.03 KB
Newer Older
Roman Haefeli's avatar
Roman Haefeli committed
1
2
#!/bin/bash

3
4
5
6
app_name="netpd"
app_version="2.2"
app_bundle_name="${app_name}-${app_version}.app"
package_version=$(date +%Y-%m-%d)
Roman Haefeli's avatar
Roman Haefeli committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

# Pd
pd_archive_file=~/Downloads/pd-0.51-0test3.mac.tar.gz

# Libraries
ext_urls=()
ext_urls+=("http://puredata.info/Members/rdz/software/binfile-v0.1~git20151118-(Darwin-i386-32)(Darwin-x86_64-32)-externals.tar.gz")
ext_urls+=("http://puredata.info/Members/porres/software/else/1.0beta27/else%5Bv1.0beta27%5D(Darwin-amd64-32).dek")
ext_urls+=("http://puredata.info/Members/musil/software/iemlib/1.22/iemlib%5Bv1.22%5D(Darwin-amd64-32)(Darwin-i386-32)(Linux-amd64-32)(Windows-amd64-32)(Windows-i386-32)(Sources).dek")
ext_urls+=("http://puredata.info/Members/zmoelnigbot/software/iemnet/0.2.3/iemnet%5Bv0.2.3%5D(Darwin-amd64-32).dek")
ext_urls+=("http://puredata.info/Members/zmoelnig/software/iem/20150529.2247/osc-v0.2-20150529iem-(Darwin-i386-32)(Darwin-x86_64-32)-externals.tar.gz")
ext_urls+=("http://puredata.info/Members/rdz/software/slip/0.1~git20151118/slip-v0.1~git20151118-(Darwin-i386-32)(Darwin-x86_64-32)-externals.tar.gz")
ext_urls+=("http://puredata.info/Members/zmoelnigbot/software/zexy/2.3.1/zexy%5Bv2.3.1%5D(Darwin-amd64-32)(Linux-amd64-32)(Linux-arm64-32)(Linux-armv7-32)(Linux-i386-32)(Windows-amd64-32)(Windows-i386-32).dek")

# netpd bundle
netpd_bundle_url="https://www.netpd.org/~roman/netpd-plus-instruments.zip"

# workdir
work_dir=workdir

27
28
info_plist_replacements="
s/{DISPLAY_NAME}/${app_name}/
29
s/{EXECUTBALE}/Pd/
30
31
s/{ICON_FILES}/netpd.icns/
s/{BUNDLE_NAME}/${app_name}/
32
s/{BUNDLE_SHORT_VERSION}/${app_version}_${package_version}/
33
34
35
36
s/{SPOKEN_NAME}/${app_name}/
s/{BUNDLE_VERSION}/${netpd_version}/
"

Roman Haefeli's avatar
Roman Haefeli committed
37
38
39
40
41
42
43
function fail {
  echo "abort due some error"
  exit 1
}

# do stuff
(
44
45
46
47
  cd "$(dirname "$0")"
  (
    mkdir -p "${work_dir}"
    cd "${work_dir}"
Roman Haefeli's avatar
Roman Haefeli committed
48

49
50
51
    # install pd
    tar xvf "${pd_archive_file}" || fail
    mv Pd-*.app "${app_bundle_name}" || fail
Roman Haefeli's avatar
Roman Haefeli committed
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    # install externals
    (
      cd ${app_bundle_name}/Contents/Resources/extra
      for url in ${ext_urls[@]}
      do
        echo "downloading $url"
        curl -q -o file "${url}" || fail
        if file file | grep ' Zip archive data' > /dev/null
        then
          unzip file || fail
        fi
        if file file | grep 'gzip compressed data' > /dev/null
        then
          tar xf file || fail
        fi
        rm file || fail
      done
    ) || fail
Roman Haefeli's avatar
Roman Haefeli committed
71

72
73
74
75
76
77
    # install netpd
    (
      cd ${app_bundle_name}/Contents/Resources
      curl -q -o file "${netpd_bundle_url}" || fail
      unzip file && rm file || fail
    ) || fail
Roman Haefeli's avatar
Roman Haefeli committed
78

79
  ) || fail
Roman Haefeli's avatar
Roman Haefeli committed
80

81
82
83
84
  # apply patch to load netpd at start
  patch ${work_dir}/${app_bundle_name}/Contents/Resources/tcl/pd-gui.tcl < files/pd-gui.tcl.patch || fail
  cp files/netpd.icns ${work_dir}/${app_bundle_name}/Contents/Resources/ || fail
  sed -f <(echo "${info_plist_replacements}") files/Info.plist > ${work_dir}/${app_bundle_name}/Contents/Info.plist || fail
Roman Haefeli's avatar
Roman Haefeli committed
85

86
87
88
89
90
  # create archive
  (
    cd "${work_dir}"
    tar cf "../${app_name}-${app_version}.tar.gz" "${app_bundle_name}"  || fail
  ) || fail
Roman Haefeli's avatar
Roman Haefeli committed
91

92
93
94
  rm -r "${work_dir}"
  echo "Done!"
)