[28d0df2] | 1 | # Vagrantfile to compile OpenGnsys Browser using VirtualBox provider. |
---|
| 2 | |
---|
| 3 | VAGRANTFILE_API_VERSION = "2" |
---|
| 4 | # VM provider: Oracle VM VirtualBox. |
---|
| 5 | ENV['VAGRANT_DEFAULT_PROVIDER'] = "virtualbox" |
---|
| 6 | # Language. |
---|
| 7 | LANGUAGE = "es_ES" |
---|
| 8 | ENV['LC_ALL'] = LANGUAGE + ".UTF-8" |
---|
[b32e00f] | 9 | # Amount of virtual memory and virtual CPUs. |
---|
[28d0df2] | 10 | VMMEM = 2048 |
---|
| 11 | VMCPUS = 2 |
---|
| 12 | # OpenGnsys boot-tools environment provisioning script. |
---|
| 13 | SCRIPT = <<EOT |
---|
| 14 | # Set language. |
---|
| 15 | export LANG="#{LANGUAGE}.UTF-8" |
---|
[5f4cfdc] | 16 | echo "LANG=\\\"$LANG\\\"" > /etc/default/locale |
---|
| 17 | echo "LANG=\\\"$LANG\\\"" >> /etc/environment |
---|
[28d0df2] | 18 | locale-gen --lang #{LANGUAGE} |
---|
[5f4cfdc] | 19 | sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\\\"${LANG%_*}\\\"/" /etc/default/keyboard |
---|
[28d0df2] | 20 | dpkg-reconfigure -fnoninteractive console-setup |
---|
| 21 | # Install main dependencies. |
---|
| 22 | apt-get update |
---|
| 23 | apt-get install -y build-essential gettext libssl-dev libucommon-dev libxtst-dev subversion |
---|
[34994c7] | 24 | # Compile Qt-Embedded 4.8 (accept Open Source license). |
---|
| 25 | wget http://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz |
---|
[28d0df2] | 26 | tar xvzf qt-everywhere-opensource-src-4.8.7.tar.gz |
---|
| 27 | cd qt-everywhere-opensource-src-4.8.7 |
---|
| 28 | echo "yes" | ./configure -opensource -embedded x86 -webkit -openssl -qt-gfx-vnc -qvfb -prefix /usr/local/ -nomake demos -nomake examples |
---|
| 29 | make |
---|
| 30 | make install |
---|
[34994c7] | 31 | # Compile the Browser. |
---|
[08b7e126] | 32 | BRANCH="master" |
---|
[279c269] | 33 | svn export "https://github.com/opengnsys/ogBrowser/branches/$BRANCH/" ../browser |
---|
[34994c7] | 34 | cd ../browser |
---|
[28d0df2] | 35 | qmake browser.pro |
---|
| 36 | make |
---|
| 37 | strip browser |
---|
[bf7643d] | 38 | # Update locale string files. |
---|
| 39 | xgettext -C --qt --from-code=UTF-8 -o browser.pot src/*.cpp |
---|
| 40 | msgmerge -U po/en.po browser.pot |
---|
| 41 | msgmerge -U po/ca.po browser.pot |
---|
| 42 | rm -f browser.pot |
---|
[28d0df2] | 43 | # Instructions. |
---|
| 44 | echo "Browser's code is in /home/vagrant/browser directory." |
---|
| 45 | echo "To compile a new Browser, run as root user:" |
---|
| 46 | echo " cd /home/vagrant/browser && qmake browser.pro && make" |
---|
[bf7643d] | 47 | echo "To compile new locale files (note that \"xx\" is a locale code, like \"en\" or \"ca\"):" |
---|
| 48 | echo " - Translate strings by editing each po/xx.po file." |
---|
| 49 | echo " - Compile each locale file by running as root: msgfmt -o xx.mo po/xx.po" |
---|
| 50 | echo "Do not forget to copy all Browser's files to the OpenGnsys Server:" |
---|
[28d0df2] | 51 | echo " - Browser binary to /opt/opengnsys/client/bin directory on server." |
---|
| 52 | echo " - Qt linked libraries to /opt/opengnsys/client/lib/qtlibs directory." |
---|
[80fd30e] | 53 | echo " - 64-bit-based ogLive only: libssl and libcrypto to /opt/opengnsys/client/lib/qtlibs directory." |
---|
[bf7643d] | 54 | echo " - Compiled Locale files, if needed: xx.mo as /opt/opengnsys/client/lib/locale/xx/LC_MESSAGES/browser.mo (\"xx\" is a locale code)." |
---|
[28d0df2] | 55 | EOT |
---|
| 56 | |
---|
| 57 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
---|
| 58 | |
---|
| 59 | # OpenGnsys boot-tools environment VM definition. |
---|
| 60 | config.vm.define "ogBrowser" do |br| |
---|
| 61 | # Specific VirtualBox configuration. |
---|
| 62 | br.vm.provider "virtualbox" do |vb| |
---|
| 63 | # VM name, memory and CPUs. |
---|
| 64 | vb.name = "ogBrowser" |
---|
| 65 | vb.memory = VMMEM |
---|
| 66 | vb.cpus = VMCPUS |
---|
| 67 | end |
---|
| 68 | # VM base and host name. |
---|
| 69 | br.vm.box = "ubuntu/trusty32" |
---|
| 70 | br.vm.hostname = "ogBrowser" |
---|
[b32e00f] | 71 | # Comment out to disable synced folder. |
---|
[28d0df2] | 72 | #br.vm.synced_folder ".", "/vagrant", disabled: true |
---|
| 73 | # Launch provisioning script. |
---|
| 74 | br.vm.provision "shell", inline: SCRIPT |
---|
| 75 | end |
---|
| 76 | |
---|
| 77 | end |
---|
| 78 | |
---|