build_windows.sh 3.98 KB
Newer Older
1
2
3
4
#!/bin/bash

app_name="netpd"
package_version=$(date +%Y-%m-%d)
5
src_url="https://github.com/reduzent/netpd"
6
7

# Pd
8
pd_archive_file=~/Downloads/pd-0.51-4.msw.zip
9
10
11
12

# Libraries
ext_urls=()
ext_urls+=("http://puredata.info/Members/rdz/software/binfile/0.1~git20181006/binfile%5Bv0.1~git20181006%5D(Windows-amd64-32).dek")
Roman Haefeli's avatar
Roman Haefeli committed
13
ext_urls+=("http://puredata.info/Members/porres/software/else/1.0-0_beta37_with_live_electronics_tutorial/else%5Bv1.0-0_beta37_with_live_electronics_tutorial%5D(Windows-amd64-32).dek")
14
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")
Roman Haefeli's avatar
Roman Haefeli committed
15
ext_urls+=("http://puredata.info/Members/zmoelnigbot/software/iemnet/0.3.0/iemnet%5Bv0.3.0%5D(Darwin-amd64-32)(Linux-amd64-32)(Linux-arm64-32)(Linux-armv7-32)(Linux-i386-32)(Windows-amd64-32)(Windows-i386-32).dek")
16
17
18
ext_urls+=("http://puredata.info/Members/rdz/software/osc/0.2~git20181006/osc%5Bv0.2~git20181006%5D(Windows-amd64-32).dek")
ext_urls+=("http://puredata.info/Members/rdz/software/slip/0.1~git20181006/slip%5Bv0.1~git20181006%5D(Windows-amd64-32).dek")
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")
19
ext_urls+=("https://puredata.info/downloads/kiosk-plugin/releases/1.0/kiosk-plugin.zip")
20
21

# workdir
22
work_dir="${app_name}"
23
24
25
26
27
28

function fail {
  echo "abort due some error"
  exit 1
}

29
30
31
32
33
34
35
36
37
38
# get netpd and extract version
(
  cd "$(dirname "$0")"
  mkdir -p "${work_dir}"
  cd "${work_dir}"
  git clone --recursive ${src_url} || fail
) || fail

app_version=$(sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' "$(dirname $0)/${work_dir}/netpd/includes/netpd-meta.pd") || fail

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# do stuff
(
  cd "$(dirname "$0")"
  (
    mkdir -p "${work_dir}"
    cd "${work_dir}"

    # install pd
    unzip -q "${pd_archive_file}" || fail
    mv pd-0.*-* pd-netpd || fail

    # install externals
    (
      cd pd-netpd/extra
      for url in ${ext_urls[@]}
      do
Roman Haefeli's avatar
Roman Haefeli committed
55
        curl --fail -s -o file "${url}" || fail
56
57
58
59
60
61
62
63
64
65
        if file file | grep ' Zip archive data' > /dev/null
        then
          unzip -q file || fail
        fi
        if file file | grep 'gzip compressed data' > /dev/null
        then
          tar xf file || fail
        fi
        rm file || fail
      done
66
      rm -rf else/*.wav else/*.aif else/Live-Electronics-Tutorial || fail
67
68
69
    ) || fail

    # install netpd
70
71
72
    rm -rf netpd/.git netpd/.gitignore netpd/.gitmodules netpd/instruments/.git
    mv netpd/instruments . || fail
    mv netpd pd-netpd
73
74
75
76
77
78
  ) || fail

  # apply patch to load netpd at start
  patch -s ${work_dir}/pd-netpd/tcl/pd-gui.tcl < files/pd-gui.tcl.patch || fail
  # fix instruments path in preferences
  patch -s ${work_dir}/pd-netpd/netpd/includes/netpd-preferences.cnf < files/netpd-preferences.cnf.patch || fail
79
80
  # configure kiosk-plugin
  cp files/kiosk.cfg "${work_dir}/pd-netpd/extra/kiosk-plugin/" || fail
81
82
83
84
85
  # copy launcher exe
  cp files/netpd.exe "${work_dir}" || fail
  # copy README
  cp files/README.txt.win "${work_dir}/README.txt" || fail
  # create version file
86
87
88
89
  #echo "${app_version} (${package_version})" > "${work_dir}/VERSION.txt"

  # rename work_dir
  mv ${work_dir} "${app_name}-${app_version}"
90
91

  # create archive
92
  zip -q -r "${app_name}-${app_version}-windows-${package_version}.zip" "${app_name}-${app_version}"
93
94

  # upload bundle
95
  scp -q "${app_name}-${app_version}-windows-${package_version}.zip" all@netpd.org:public_html/software/
96
97

  # clean up
98
  rm -rf "${app_name}-${app_version}" "${app_name}-${app_version}-windows-${package_version}.zip"
99
100

  # create shortcut to latest
101
102
103
104
  ssh all@netpd.org ln -f -s "${app_name}-${app_version}-windows-${package_version}.zip" "public_html/software/${app_name}-${app_version}-windows.zip" || fail

  # update redirect target in .htaccess
  ssh all@netpd.org sed -i "1s/[0-9]\.[0-9]\.[0-9]/${app_version}/" public_html/software/.htaccess || fail
105
)