diff --git a/Make.inc b/Make.inc index 24108b1115045..75311f1c55a71 100644 --- a/Make.inc +++ b/Make.inc @@ -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' ' ')))) diff --git a/Makefile b/Makefile index fd50539ce1717..b2a2f2040a912 100644 --- a/Makefile +++ b/Makefile @@ -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 $< $@ diff --git a/README.md b/README.md index 19a6dba48f3a0..3363fc974e775 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,10 @@ You must use the `gmake` command on FreeBSD instead of `make`. In order to build Julia on Windows, see [README.windows](https://github.com/JuliaLang/julia/blob/master/README.windows.md). +### Vagrant + +Julia can be developed in an isolated Vagrant environment. See [the Vagrant README](https://github.com/JuliaLang/julia/blob/master/contrib/vagrant/README.md) for details. + ## Required Build Tools and External Libraries diff --git a/contrib/vagrant/.gitignore b/contrib/vagrant/.gitignore new file mode 100644 index 0000000000000..0ae91c4f2b023 --- /dev/null +++ b/contrib/vagrant/.gitignore @@ -0,0 +1 @@ +/.vagrant diff --git a/contrib/vagrant/README.md b/contrib/vagrant/README.md new file mode 100644 index 0000000000000..699b6e0557d71 --- /dev/null +++ b/contrib/vagrant/README.md @@ -0,0 +1,43 @@ +## Developing Julia with Vagrant + +Vagrant is a system that creates lightweight, self-contained development +environments as virtual machines. This directory contains a Vagrantfile which +will provision a headless 64-bit Ubuntu 12.04 Precise Pangolin virtual machine +on VirtualBox for building Julia. + +### Requirements + +To develop under Vagrant, you will first need to install [Oracle +VirtualBox](https://www.virtualbox.org/wiki/Downloads) and +[Vagrant](http://downloads.vagrantup.com/). Then, from a command line, enter +the `contrib/vagrant` directory, and enter: + +``` +$ vagrant up +``` + +A virtual machine will be downloaded if needed, created, and provisioned with +the dependencies to build Julia. By default, it exposes an SSH server to your +local machine on port 2222. See the [Vagrant +documentation](http://docs.vagrantup.com/v2/) for complete details on using +Vagrant. + +### Building Julia + +Before attempting to build Julia from the Vagrant machine, you must ensure that +submodules have been initialized and are up to date. On the host system, from +the top level Julia repository directory, run: + +``` +$ git submodule init +$ git submodule update +``` + +The Julia repository is exposed to the VM using a VirtualBox shared folder as +`~/julia`. To speed up the build process and handle some limitations of +VirtualBox shared folders, the contents of the julia-dependencies PPA are +downloaded during provisioning. To take advantage of these dependencies, use +the `jlmake` alias in place of `make`. + +When the build is complete, you can run +`~/julia/usr/bin/julia-release-readline` to start Julia. diff --git a/contrib/vagrant/Vagrantfile b/contrib/vagrant/Vagrantfile new file mode 100644 index 0000000000000..fdffb0a1fcb63 --- /dev/null +++ b/contrib/vagrant/Vagrantfile @@ -0,0 +1,58 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +$script = <