Skip to content

Instantly share code, notes, and snippets.

@briancain
Created September 20, 2017 23:18
Show Gist options
  • Save briancain/b78250c619108f78cf764c54a488051e to your computer and use it in GitHub Desktop.
Save briancain/b78250c619108f78cf764c54a488051e to your computer and use it in GitHub Desktop.
# VERSION=2.0.0 srcdir=/code/vagrant makepkg -s
# libiconv cannot be found
pkgname=hashicorp-vagrant
pkgver=$VERSION
pkgrel=1
pkgdesc="Build and distribute virtualized development environments"
arch=('x86_64')
url="https://www.vagrantup.com"
license=('MIT')
source=('package.tar')
conflicts=('vagrant')
options=('!emptydirs')
md5sums=('SKIP')
depends=('libffi>=3.2.1' 'libiconv>=1.15' 'libxml2>=2.9.4' 'libxslt>=1.1.29'
'libyaml' 'zlib>=1.2.11' 'xz>=5.2.3' 'readline>=6.3'
'openssl>=1.0.2l' 'libssh2>=1.8.0' 'libarchive' 'curl>=7.54.0' 'ruby>=2.3.4'
'rsync' 'chrpath')
build () {
cd $srcdir
gem build vagrant.gemspec
mv vagrant-*.dev.gem vagrant.gem
export NOKOGIRI_USE_SYSTEM_LIBRARIES=1
export EMBEDDED_DIR="/opt/vagrant/embedded"
export GEM_PATH="${EMBEDDED_DIR}/gems"
export GEM_HOME="${GEM_PATH}"
export GEMRC="${EMBEDDED_DIR}/etc/gemrc"
export CPPFLAGS="-I${EMBEDDED_DIR}/include -I${EMBEDDED_DIR}/include/libxml2"
export CFLAGS="${CPPFLAGS}"
export LDFLAGS="-L${EMBEDDED_DIR}/lib"
export PATH="${EMBEDDED_DIR}/bin:${PATH}"
export SSL_CERT_FILE="${EMBEDDED_DIR}/cacert.pem"
gem install pkg-config --no-document -v "~> 1.1.7"
gem install vagrant.gem --no-document
tar -cf ./package.tar "/opt/vagrant"
}
package() {
mv "${srcdir}/opt" "${pkgdir}/opt"
mkdir -p "${pkgdir}/usr/bin"
ln -s /opt/vagrant/bin/vagrant "${pkgdir}/usr/bin/vagrant"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment