| 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" |
|---|
| 9 | # Amount of virtual memory and virtual CPUs. |
|---|
| 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" |
|---|
| 16 | echo "LANG=\\\"$LANG\\\"" > /etc/default/locale |
|---|
| 17 | echo "LANG=\\\"$LANG\\\"" >> /etc/environment |
|---|
| 18 | locale-gen --lang #{LANGUAGE} |
|---|
| 19 | sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\\\"${LANG%_*}\\\"/" /etc/default/keyboard |
|---|
| 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 |
|---|
| 24 | # Compile Qt-Embedded 4.8 (aceptar la licencia Open Source). |
|---|
| 25 | wget http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz |
|---|
| 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 |
|---|
| 31 | # Compile Browser. |
|---|
| 32 | BRANCH="devel" |
|---|
| 33 | svn export "https://github.com/opengnsys/OpenGnsys/branches/$BRANCH/client/browser" ../browser |
|---|
| 34 | cd browser |
|---|
| 35 | qmake browser.pro |
|---|
| 36 | make |
|---|
| 37 | strip browser |
|---|
| 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 |
|---|
| 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" |
|---|
| 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:" |
|---|
| 51 | echo " - Browser binary to /opt/opengnsys/client/bin directory on server." |
|---|
| 52 | echo " - Qt linked libraries to /opt/opengnsys/client/lib/qtlibs directory." |
|---|
| 53 | echo " - 64-bit-based ogLive only: libssl and libcrypto to /opt/opengnsys/client/lib/qtlibs directory." |
|---|
| 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)." |
|---|
| 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 | vb.gui = true |
|---|
| 68 | end |
|---|
| 69 | # VM base and host name. |
|---|
| 70 | br.vm.box = "ubuntu/trusty32" |
|---|
| 71 | br.vm.hostname = "ogBrowser" |
|---|
| 72 | # Comment out to disable synced folder. |
|---|
| 73 | #br.vm.synced_folder ".", "/vagrant", disabled: true |
|---|
| 74 | # Launch provisioning script. |
|---|
| 75 | br.vm.provision "shell", inline: SCRIPT |
|---|
| 76 | end |
|---|
| 77 | |
|---|
| 78 | end |
|---|
| 79 | |
|---|