LoginSignup
1

More than 5 years have passed since last update.

Travis CIでV8JSをインストール

Last updated at Posted at 2017-05-11

PHPのエクステンションv8jsを使用したコードをTravis CIでテストする場合、既存の環境ではv8もv8jsも含まれていないのでインストールする必要があります。

Travis CIには実行に必要なソフトウエアをインストールするbefore_install及びinstallというセクションがあります。

8jsのインストールをinstallに、v8jsのインストールに必要なv8before_installでインストールします。以下はその手順です。

既存の.travis.ymlに以下のセクションを追加

sudo: required
dist: trusty
env:
  - V8VER=5.2
before_install:
  - make -f Makefile.travis before_install
install:
  - make -f Makefile.travis install

Makefile.travisを設置

# Configure and build scripts for travis CI system
V8VER ?= 5.1

export NO_INTERACTION=1
export REPORT_EXIT_STATUS=1

before_install:
    sudo add-apt-repository ppa:pinepain/libv8-$(V8VER) -y
    sudo apt-get update -q
install:
    sudo apt-get install -y libv8-$(V8VER)-dev
    git clone https://github.com/phpv8/v8js.git
    cd v8js && phpize && ./configure CXXFLAGS="-Wall -Wno-write-strings -Werror" && $(MAKE) -j3 && $(MAKE) install install && cd ..
    echo "extension=v8js.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

以上です。

v8をapt-getした後にv8jsをソースからコンパイルしv8js.soがphp.iniに登録されV8Jsが利用可能になります。

Travis CIログ
https://travis-ci.org/koriym/Koriym.Baracoa/builds/230966608

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1