From 178a720873b1d859ef8a2a6ff319b9aa94b97ec2 Mon Sep 17 00:00:00 2001 From: ivarne Date: Fri, 10 Jan 2014 21:51:29 +0100 Subject: [PATCH] Added source-dist make target source-dist is a make target for creating a standalone tarball that can be compilled on a system with the requisit external dependencies without internet access to download the internal dependencies. --- .gitignore | 2 ++ DISTRIBUTING.md | 13 ++++++++----- Makefile | 39 +++++++++++++++++++++++++++++++-------- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 3d171ffd6fe59..f323f35ec6b43 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ /usr /Make.user /julia-* +/source-dist.tmp +/source-dist.tmp1 *.exe *.dll diff --git a/DISTRIBUTING.md b/DISTRIBUTING.md index 795698b1b9348..8030b95b05881 100644 --- a/DISTRIBUTING.md +++ b/DISTRIBUTING.md @@ -21,17 +21,20 @@ Versioning and Git The Makefile uses both the `VERSION` file and commit hashes and tags from the git repository to generate the `base/version_git.jl` with information we use to fill the splash screen and the `versioninfo()` output. If you for some reason -don't want to have the git repository availible when building you should +don't want to have the git repository available when building you should pregenerate the `base/version_git.jl` file with: make -C base version_git.jl.phony -For some dependencies we use patched versions that will be fetched via -`git submodules`. Those might be prefetched by: +Juila has lots of build dependencies where we use patched versions that has not +yet been included by the popular package managers. These dependencies will usually +be automatically downloaded when you build, but if you want to be able to build +Julia on a computer without internet access you should create a source-dist archive +with the special make targed - git submodule update --init + make source-dist -See example for how this is done for building nigtlies at [the debian build servers](https://github.com/staticfloat/julia-nightly-packaging/blob/master/build_ubuntu.sh) +that creates a julia-version-commit.tar.gz archive with all required dependencies. When compiling a tagged release in the git repository, we don't display the branch/commit hash info in the splash screen. You can use this line to show diff --git a/Makefile b/Makefile index 7ac9afc9cd964..532e432ec6ffa 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,13 @@ endif $(foreach dir,$(DIRS),$(eval $(call dir_target,$(dir)))) $(foreach link,base test doc examples,$(eval $(call symlink_target,$(link),$(BUILD)/share/julia))) +git-submodules: +ifneq ($(NO_GIT), 1) + @-git submodule update --init +else + $(warn "Submodules could not be updated because git is unavailible") +endif + debug release: | $(DIRS) $(BUILD)/share/julia/base $(BUILD)/share/julia/test $(BUILD)/share/julia/doc $(BUILD)/share/julia/examples $(BUILD)/etc/julia/juliarc.jl @$(MAKE) $(QUIET_MAKE) julia-$@ @export JL_PRIVATE_LIBDIR=$(JL_PRIVATE_LIBDIR) && \ @@ -43,13 +50,7 @@ julia-debug-symlink: julia-release-symlink: @ln -sf $(BUILD)/bin/julia-$(DEFAULT_REPL) julia -julia-debug julia-release: -ifneq ($(NO_GIT), 1) - @-git submodule init --quiet - @-git submodule update -else - $(warn "Submodules could not be updated because git is unavailible") -endif +julia-debug julia-release: git-submodules @$(MAKE) $(QUIET_MAKE) -C deps @$(MAKE) $(QUIET_MAKE) -C src lib$@ @$(MAKE) $(QUIET_MAKE) -C base @@ -264,6 +265,27 @@ else endif rm -fr julia-$(JULIA_COMMIT) + +source-dist: git-submodules + # Save git information + -@$(MAKE) -C base version_git.jl.phony + # Get all the dependencies downloaded + @$(MAKE) -C deps getall + + # Create file source-dist.tmp to hold all the filenames that goes into the tarball + echo "base/version_git.jl" > source-dist.tmp + git ls-files >> source-dist.tmp + ls deps/*.tar.gz deps/*.tar.bz2 deps/*.tgz deps/random/*.tar.gz >> source-dist.tmp + git submodule --quiet foreach 'git ls-files | sed "s&^&$$path/&"' >> source-dist.tmp + + # Remove unwanted files + sed '/\.git/d' source-dist.tmp > source-dist.tmp1 + sed '/\.travis/d' source-dist.tmp1 > source-dist.tmp + + # Create tarball + tar -cz -T source-dist.tmp --no-recursion -f julia-$(JULIA_VERSION)_$(JULIA_COMMIT).tar.gz + rm -f source-dist.tmp source-dist.tmp1 + clean: | $(CLEAN_TARGETS) @$(MAKE) -C base clean @$(MAKE) -C src clean @@ -275,6 +297,7 @@ clean: | $(CLEAN_TARGETS) @rm -f julia @rm -f *~ *# *.tar.gz @rm -fr $(BUILD)/$(JL_PRIVATE_LIBDIR) + @rm -f source-dist.tmp source-dist.tmp1 # Temporarily add this line to the Makefile to remove extras @rm -fr $(BUILD)/share/julia/extras @@ -294,7 +317,7 @@ distclean: cleanall .PHONY: default debug release julia-debug julia-release \ test testall testall1 test-* clean distclean cleanall \ run-julia run-julia-debug run-julia-release run \ - install dist + install dist source-dist git-submodules ifeq ($(VERBOSE),1) .SILENT: