File: build-windows.sh

package info (click to toggle)
ruby-gnome2 3.1.0-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 16,072 kB
  • ctags: 17,433
  • sloc: ansic: 93,621; ruby: 62,273; xml: 335; sh: 246; makefile: 25
file content (172 lines) | stat: -rwxr-xr-x 4,258 bytes parent folder | download
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/sh

export LANG=C
export DEBIAN_FRONTEND=noninteractive

ruby_versions="2.1.10 2.2.4 2.3.1"
export RUBY_CC_VERSION="2.1.10:2.2.4:2.3.1"

N_CPUS=$(grep '^processor' /proc/cpuinfo | wc -l)
export MAKE_N_JOBS=${N_CPUS}

export RUBYLIB="$(pwd)/pkg-config/lib"

run()
{
  "$@"
  if [ $? -ne 0 ]; then
    echo "Failed $@"
    exit 1
  fi
}

if [ ! -f ~/setup.timestamp ]; then
  run sudo rm -rf /etc/udev/rules.d/70-persistent-net.rules/
  run sudo sed -i'' -e 's,http://us,http://jp,g' /etc/apt/sources.list
  run sudo apt-get update

  echo ttf-mscorefonts-installer \
       msttcorefonts/accepted-mscorefonts-eula \
       select true | \
    run sudo debconf-set-selections

  run \
    sudo apt-get install -y -V \
    git \
    ruby \
    ruby-dev \
    build-essential \
    pkg-config \
    autoconf \
    libtool \
    gettext \
    intltool \
    gtk-doc-tools \
    libffi-dev \
    libglib2.0-dev \
    libgdk-pixbuf2.0-dev \
    gobject-introspection \
    libgtk2.0-bin \
    gtk-3-examples \
    libgtk-3-dev \
    flex \
    bison \
    gperf \
    libxml2-utils \
    python-dev \
    python-pip \
    wine1.6 \
    mingw-w64 \
    cmake \
    valac \
    libmount-dev

  # Enable me when WebKitGTK+ supports Windows.
  # run sudo update-alternatives --set \
  #     ${BUILD_HOST}-gcc /usr/bin/${BUILD_HOST}-gcc-posix
  # run sudo update-alternatives --set \
  #     ${BUILD_HOST}-g++ /usr/bin/${BUILD_HOST}-g++-posix

  run sudo pip install jsmin

  run git clone file:///pkg-config/.git
  run git clone file:///rcairo/.git rcairo.${DIRECTORY_SUFFIX}
  run git clone file:///ruby-gnome2/.git ruby-gnome2.${DIRECTORY_SUFFIX}

  run sudo gem install --no-document \
      rake \
      bundler \
      pkg-config \
      rake-compiler \
      mechanize \
      packnga

  if [ ! -d ~/.wine/ ]; then
    run wineboot
    until [ -f ~/.wine/system.reg ]; do
      sleep 1
    done
    sleep 10
    wine_home="z:/home/vagrant"
    wine_rcairo="${wine_home}/rcairo.${DIRECTORY_SUFFIX}"
    wine_ruby_gnome2="${wine_home}/ruby-gnome2.${DIRECTORY_SUFFIX}"
    bin_dir="vendor/local/bin"
    path=$(
      (
        echo -n "${wine_rcairo}/${bin_dir};";
        echo -n "${wine_ruby_gnome2}/glib2/${bin_dir};";
        echo -n "${wine_ruby_gnome2}/gdk_pixbuf2/${bin_dir};"
        echo -n "${wine_ruby_gnome2}/pango/${bin_dir};";
        echo -n "${wine_ruby_gnome2}/atk/${bin_dir};";
        echo -n "${wine_ruby_gnome2}/gtk2/${bin_dir};";
        echo -n "${wine_ruby_gnome2}/gdk3/${bin_dir};";
      ) | \
        sed -e 's,/,\\\\\\\\,g')
    run sed -i'' -r \
        -e "s,^(\"PATH\"=str\\(2\\):\"),\\1${path},g" \
        ~/.wine/system.reg
  fi

  run wget https://www.opengl.org/registry/api/GL/glext.h
  run sudo install glext.h /usr/share/mingw-w64/include/GL/
  run rm -f glext.h

  if ! grep -q GL/glext /usr/share/mingw-w64/include/GL/gl.h; then
    cat <<EOF > /tmp/insert.txt

typedef ptrdiff_t GLintptr;
typedef ptrdiff_t GLsizeiptr;
typedef char GLchar;
#include <GL/glext.h>

EOF
    run sudo sed -i'' -e '/typedef void GLvoid;/ r /tmp/insert.txt' \
        /usr/share/mingw-w64/include/GL/gl.h
    run rm -f /tmp/insert.txt
  fi

  run touch ~/setup.timestamp
fi

if [ ! -f ~/rake-compiler.timestamp ]; then
  sudo chown -R "${USER}:${USER}" /var/lib/gems

  for ruby_version in ${ruby_versions}; do
    run rake-compiler cross-ruby HOST="${BUILD_HOST}" VERSION="${ruby_version}"
  done

  run touch ~/rake-compiler.timestamp
fi

if [ ! -f ~/native.timestamp ]; then
  run cd ~/rcairo.${DIRECTORY_SUFFIX}
  run git pull --rebase
  run rake windows:gcc:dll:bundle windows:zlib:build

  run cd ~/ruby-gnome2.${DIRECTORY_SUFFIX}
  run git pull --rebase

  run cd ~/ruby-gnome2.${DIRECTORY_SUFFIX}/glib2
  run rake native:build windows:build

  run cd ~/ruby-gnome2.${DIRECTORY_SUFFIX}/gobject-introspection
  run rake native:build

  run touch ~/native.timestamp
fi

if [ ! -f ~/rcairo.timestamp ]; then
  run cd ~/rcairo.${DIRECTORY_SUFFIX}
  run git pull --rebase
  run rake windows:build
  run rake cross compile native

  run touch ~/rcairo.timestamp
fi

run cd ~/ruby-gnome2.${DIRECTORY_SUFFIX}
run git pull --rebase
run rake gem:windows:clean:gem gem:windows:build

run mkdir -p /vagrant/pkg
run cp */pkg/*.gem /vagrant/pkg/