何をするのか
以下の記事で書いた、Vagrant の仮想環境を作る方法の、
ソースからコンパイルする版を作った。対象バージョンは 2.2.0
http://qiita.com/mzmttks/items/b6f45c97e662bd32eeb0
方法は上記記事と全く同じで、playbook のみが異なる。
結構時間がかかるので注意。
準備
- vagrant をインストールする
- 次のコマンドを実行
mkdir hark
cd hark
Vagrantfile # 下記のファイルを作成
playbook.yml # 下記のファイルを作成
vagrant up
- ブラウザで http://192.168.33.10:3000 にアクセス
Vagrantfile
IP アドレスが重複している時は、 192.168.33.10 を別の何かに変える。
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config|
config.vm.hostname = "hark"
config.vm.provider "virtualbox" do |provider, override|
override.vm.box = "ubuntu/trusty64"
override.vm.network "private_network", ip: "192.168.33.10"
override.vm.network :forwarded_port, host: 3000, guest: 3000
# Display the VirtualBox GUI when booting the machine
provider.gui = false
# Customize the amount of memory on the VM:
provider.memory = "1024"
end
config.vm.provision :ansible do |ansible|
ansible.playbook = "playbook.yml" # playbookファイル名
ansible.host_key_checking = false
end
end
Playbook
- hosts: all
sudo: yes
tasks:
- name: upgrade system
apt: upgrade=dist update_cache=yes
- name: install dependent packages
apt: name={{ item }} state=latest
with_items:
# flowdesigner
- g++
- libxml2-dev
- libasound2-dev
- pkg-config
- libgnomeui-dev
# libharkio3
- cmake
- libzip-dev
# hark-fd
- libgtk2.0-dev
- libboost-thread-dev
# libharkio
- libboost-filesystem-dev
- libboost-regex-dev
# hark-music
- libfftw3-dev
# hark-opencv
- libopencv-dev
# hark-python
- python-dev
- autoconf
- libboost-python-dev
# hark-designer
- npm
- nodejs-legacy
- name: get HARK sources
get_url: url=http://www.hark.jp/src/2.2.0/{{ item }} dest=/usr/local/src/
with_items:
- flowdesigner-0.9.1-hark_2.2.0.tar.gz
- libharkio3_2.2.0.tar.gz
- libharknetapi_2.2.0.tar.gz
- hark-fd_2.2.0.tar.gz
- hark-designer_2.2.0.tar.gz
- libharkio_2.2.0.tar.gz
- hark-music_2.2.0.tar.gz
- hark-opencv_2.2.0.tar.gz
- hark-python_2.2.0.tar.gz
- hark-sss_2.2.0.tar.gz
- hark-ene_2.2.0.tar.gz
- name: unarchive HARK sources
unarchive: src=/usr/local/src/{{ item }} dest=/usr/local/src/ copy=no
with_items:
- flowdesigner-0.9.1-hark_2.2.0.tar.gz
- hark-designer_2.2.0.tar.gz
- hark-fd_2.2.0.tar.gz
- libharknetapi_2.2.0.tar.gz
- libharkio3_2.2.0.tar.gz
- libharkio_2.2.0.tar.gz
- hark-music_2.2.0.tar.gz
- hark-opencv_2.2.0.tar.gz
- hark-python_2.2.0.tar.gz
- hark-sss_2.2.0.tar.gz
- hark-ene_2.2.0.tar.gz
- name: Compile & install flowdesigner
shell: ./configure && make && make install
args:
chdir: /usr/local/src/flowdesigner-0.9.1-hark
- name: Compile & install libharknetapi
shell: make && make install
args:
chdir: /usr/local/src/libharknetapi
- name: Compile & install libharkio3
shell: mkdir build && cd build && cmake .. && make && make install
args:
chdir: /usr/local/src/libharkio3
- name: Compile & install hark-fd
shell: ./configure && make && make install
args:
chdir: /usr/local/src/hark-fd
- name: Compile & install libharkio
shell: ./configure && make && make install
args:
chdir: /usr/local/src/libharkio
- name: Compile & install hark-music
shell: ./configure --with-hark-inc=/usr/local/include/hark && make && make install
args:
chdir: /usr/local/src/hark-music
- name: Compile & install hark-opencv
shell: ./configure --with-hark-inc=/usr/local/include/hark && make && make install
args:
chdir: /usr/local/src/hark-opencv
- name: Compile & install hark-python
shell: ./configure && make && make install
args:
chdir: /usr/local/src/hark-python
- name: Compile & install hark-sss
shell: ./configure --with-hark-inc=/usr/local/include/hark && make && make install
args:
chdir: /usr/local/src/hark-sss
- name: Compile & install hark-ene
shell: ./configure && make && make install
args:
chdir: /usr/local/src/hark-ene
- name: Install dependent packages for HARK Designer
shell: npm install
args:
chdir: /usr/local/src/hark-designer
- name: install pm2
npm: name={{ item }} global=yes
with_items:
- pm2
- name: Run hark designer
shell: pm2 start app.js --node-args "app.js allowremote"
args:
chdir: /usr/local/src/hark-designer