Skip to content

Commit

Permalink
Add Vagrant configuration & modify build system
Browse files Browse the repository at this point in the history
Due to the limitations of VirtualBox shared folders, symlinks need to be
replaced with either file copies or elided entirely.
  • Loading branch information
pao committed Jun 2, 2013
1 parent 5af0445 commit 1cf9747
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@

/usr
/COMMIT
/contrib/vagrant/.vagrant
27 changes: 17 additions & 10 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -379,30 +379,37 @@ ifeq ($(BUILD_OS), WINNT)
define mingw_to_dos
$(subst /,\\,$(subst $(shell $(2) pwd),$(shell $(2) cmd //C cd),$(abspath $(1))))
endef
endif

define symlink_target
CLEAN_TARGETS += clean-$(2)/$(1)
clean-$$(abspath $(2)/$(1)):
ifeq ($(BUILD_OS), WINNT)
@-cmd //C rmdir $$(call mingw_to_dos,$(2)/$(1),cd $(2) &&)
$$(subst $$(abspath $(JULIAHOME))/,,$$(abspath $(2)/$(1))): $$(abspath $(2)/$(1))
$$(abspath $(2)/$(1)): | $$(abspath $(2))
@cmd //C mklink //J $$(call mingw_to_dos,$(2)/$(1),cd $(2) &&) $$(call mingw_to_dos,$(1),)
endef
spawn = $(1)
else
define symlink_target
CLEAN_TARGETS += clean-$(2)/$(1)
clean-$$(abspath $(2)/$(1)):
@-rm $$(abspath $(2)/$(1))
endif
$$(subst $$(abspath $(JULIAHOME))/,,$$(abspath $(2)/$(1))): $$(abspath $(2)/$(1))
$$(abspath $(2)/$(1)): | $$(abspath $(2))
@ln -sf $$(abspath $(1)) $$@
ifeq ($(BUILD_OS), WINNT)
@cmd //C mklink //J $$(call mingw_to_dos,$(2)/$(1),cd $(2) &&) $$(call mingw_to_dos,$(1),)
else ifdef JULIA_VAGRANT_BUILD
@cp -R $$(abspath $(1)) $$@
else
@ln -sf $$(abspath $(1)) $$@
endif
endef
ifeq ($(OS),WINNT)

ifeq ($(BUILD_OS), WINNT)
spawn = $(1)
else
ifeq ($(OS), WINNT)
spawn = wine cmd /c "set PATH=$(WINE_PATH) && $$(exec winepath -w '$(1)')"
else
spawn = $(1)
endif
endif

exec = $(shell $(call spawn,$(1)))

wine_pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(shell printf %s\n '$(2)' | xargs -d";" winepath -u | tr '\n' ' '))))
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ julia-debug julia-release:
@$(MAKE) $(QUIET_MAKE) -C base
@$(MAKE) $(QUIET_MAKE) -C ui $@
ifneq ($(OS),WINNT)
ifndef JULIA_VAGRANT_BUILD
@ln -sf $(BUILD)/bin/$@-$(DEFAULT_REPL) julia
endif
endif

$(BUILD)/share/julia/helpdb.jl: doc/helpdb.jl | $(BUILD)/share/julia
@cp $< $@
Expand Down
58 changes: 58 additions & 0 deletions contrib/vagrant/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

$script = <<SCRIPT
rm /home/vagrant/postinstall.sh
cat - > /home/vagrant/.bash_aliases <<"EOF"
export JULIA_VAGRANT_BUILD=1
BUILDOPTS="LLVM_CONFIG=llvm-config-3.2"
for lib in LLVM ZLIB SUITESPARSE ARPACK BLAS FFTW LAPACK GMP MPFR PCRE LIBUNWIND READLINE GRISU OPENLIBM RMATH LIBUV; do
export BUILDOPTS="$BUILDOPTS USE_SYSTEM_$lib=1"
done
alias jlmake="make $BUILDOPTS"
EOF
apt-get update -qq -y
apt-get install python-software-properties -y
add-apt-repository ppa:staticfloat/julia-deps -y
apt-get update -qq -y
apt-get install g++ git make patchelf gfortran llvm-3.2-dev libsuitesparse-dev libncurses5-dev libopenblas-dev liblapack-dev libarpack2-dev libfftw3-dev libgmp-dev libpcre3-dev libunwind7-dev libreadline-dev libdouble-conversion-dev libopenlibm-dev librmath-dev libuv-julia-dev libmpfr-dev -y
SCRIPT

Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.

# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"

# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http:https://files.vagrantup.com/precise64.box"

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "../..", "/home/vagrant/julia"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider :virtualbox do |vb|
# # Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
# end
#
# View the documentation for the provider you're using for more
# information on available options.

config.vm.provision :shell, :inline => $script
end

0 comments on commit 1cf9747

Please sign in to comment.