diff --git a/.travis.yml b/.travis.yml index dd678af..772cdfd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,22 @@ -language: objective-c -before_install: | - brew unlink `brew list`; \ - brew install xz coreutils gnu-tar; \ - brew link --force xz coreutils gnu-tar; \ - true; \ - rvm get stable; \ - true - -script: "./mac.sh --perl_version `cat BUILD_VERSION`" - +language: generic +matrix: + include: + - os: osx + env: _PERL_ARCHNAME=darwin-2level + - os: linux + env: _PERL_ARCHNAME=x86_64-linux + services: docker +before_install: + - bash .travis/before_install_$TRAVIS_OS_NAME.sh +script: + - bash .travis/script_$TRAVIS_OS_NAME.sh deploy: provider: releases api_key: secure: LHxcdsW2E+3Dm1FXnIbeKf2yQtEHPP9l4d6j+uK47DmFVDe+u6IpphdiTdrJipiOUrU6eC+lyY3izzh0ej1yklMue99YBbT4KbdtQzHqyeb6KBYs4M/LrB8AU4n8i7O7ZcUCQVtbx5q/be7OtJnwEIJTFSfPnuaJpL3/9mYQ2wU= file: - - perl-darwin-2level.tar.gz - - perl-darwin-2level.tar.xz + - perl-$_PERL_ARCHNAME.tar.gz + - perl-$_PERL_ARCHNAME.tar.xz skip_cleanup: true on: repo: skaji/relocatable-perl diff --git a/Dockerfile b/.travis/Dockerfile similarity index 97% rename from Dockerfile rename to .travis/Dockerfile index 213dddd..0bc2e5e 100644 --- a/Dockerfile +++ b/.travis/Dockerfile @@ -29,7 +29,7 @@ RUN set -eux; \ xz -9 --stdout perl-x86_64-linux.tar > /perl-x86_64-linux.tar.xz; \ true -FROM alpine +FROM gcr.io/google_containers/pause COPY --from=builder /perl-x86_64-linux.tar.gz /perl-x86_64-linux.tar.gz COPY --from=builder /perl-x86_64-linux.tar.xz /perl-x86_64-linux.tar.xz # ID=$(docker create skaji/relocatable-perl) diff --git a/.travis/before_install_linux.sh b/.travis/before_install_linux.sh new file mode 100644 index 0000000..b85f5af --- /dev/null +++ b/.travis/before_install_linux.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo noop diff --git a/.travis/before_install_osx.sh b/.travis/before_install_osx.sh new file mode 100644 index 0000000..77fb00d --- /dev/null +++ b/.travis/before_install_osx.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -eux + +brew unlink $(brew list) +brew install xz coreutils gnu-tar +brew link --force xz coreutils gnu-tar diff --git a/.travis/script_linux.sh b/.travis/script_linux.sh new file mode 100644 index 0000000..35aa27e --- /dev/null +++ b/.travis/script_linux.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -eux + +docker build -t skaji/relocatable-perl -f .travis/Dockerfile . +ID=$(docker create skaji/relocatable-perl) +docker cp $ID:/perl-x86_64-linux.tar.gz . +docker cp $ID:/perl-x86_64-linux.tar.xz . +docker rm $ID diff --git a/.travis/script_osx.sh b/.travis/script_osx.sh new file mode 100644 index 0000000..41776cf --- /dev/null +++ b/.travis/script_osx.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin + +set -ex +sudo install -m 755 -o $USER -g staff -d /opt/perl +perl ./relocatable-perl-build --prefix /opt/perl --perl_version $(cat BUILD_VERSION) +curl --compressed -sSL https://git.io/cpm | /opt/perl/bin/perl - install -g App::cpanminus App::ChangeShebang +/opt/perl/bin/change-shebang -f /opt/perl/bin/* + +NAME=perl-$(/opt/perl/bin/perl -MConfig -e 'print $Config{archname}') +gcp -r /opt/perl ./$NAME +gtar cf $NAME.tar $NAME +gzip -9 --stdout $NAME.tar > $NAME.tar.gz +xz -9 --stdout $NAME.tar > $NAME.tar.xz +rm -rf $NAME $NAME.tar diff --git a/README.md b/README.md index 440f18f..19d1744 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ then we have self-contained and portable perl. ## Install +There are 3 ways: + ### One liner curl -fsSL https://git.io/perl-install | bash -s ~/perl @@ -26,25 +28,18 @@ then [plenv-download](https://github.com/skaji/plenv-download) may be useful: ### Manually -Let's say you use OS X. Then: - - wget https://github.com/skaji/relocatable-perl/releases/download/5.26.2.0/perl-darwin-2level.tar.gz - tar xzf perl-darwin-2level.tar.gz - mv perl-darwin-2level ~/my-favorite-name - -That's all. Check out your perl works: +You can download appropriate tarballs from [release pages](https://github.com/skaji/relocatable-perl/releases). - $ ~/my-favorite-name/bin/perl -v - This is perl 5, version 26, subversion 2 (v5.26.2) built for darwin-2level +For example, if you use x86-64 Linux, then: - # cpanm is already installed. Install your favorite cpan modules. - $ ~/my-favorite-name/bin/cpanm LWP::UserAgent + curl -fsSL -o perl-x86_64-linux.tar.xz https://github.com/skaji/relocatable-perl/releases/latest/download/perl-x86_64-linux.tar.xz + tar xJf perl-x86_64-linux.tar.xz + mv perl-x86_64-linux ~/wherever-you-want + ~/wherever-you-want/bin/perl --version ## How to build relocatable perls by yourself -See [mac.sh](https://github.com/skaji/relocatable-perl/blob/master/mac.sh), -[Dockerfile](https://github.com/skaji/relocatable-perl/blob/master/Dockerfile) and -[Docker Hub](https://hub.docker.com/r/skaji/relocatable-perl/). +See [.travis](.travis) directory. ## License diff --git a/mac.sh b/mac.sh deleted file mode 100755 index 848743d..0000000 --- a/mac.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# Usage: -# ./mac.sh --perl_version 5.20.1 -# ./mac.sh --tarball ~/perl-5.20.1.tar.gz - -HAVE_GDBM=NO -PERL_PREFIX=/opt/perl -export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin - -for cmd in gcp gtar xz curl; do - if ! type $cmd >/dev/null 2>&1; then echo missing $cmd; exit 1; fi -done - -set -ex -if [ -e $PERL_PREFIX ]; then echo already exists $PERL_PREFIX; exit 1; fi -sudo mkdir $PERL_PREFIX -sudo chown $USER:staff $PERL_PREFIX - -if [ -f /usr/local/lib/libgdbm.dylib ]; then brew unlink gdbm; HAVE_GDBM=YES; fi -perl ./relocatable-perl-build --prefix $PERL_PREFIX "$@" -if [ $HAVE_GDBM = "YES" ]; then brew link gdbm; fi - -curl --compressed -sSL https://git.io/cpm | $PERL_PREFIX/bin/perl - install -g App::cpanminus App::ChangeShebang -$PERL_PREFIX/bin/change-shebang -f $PERL_PREFIX/bin/* - -NAME=perl-`$PERL_PREFIX/bin/perl -MConfig -e 'print $Config{archname}'` -gcp -r /opt/perl ./$NAME -gtar czf $NAME.tar.gz $NAME -gtar cJf $NAME.tar.xz $NAME -rm -rf $NAME