From ce42457c60b8c35d8f7ef638ea3f64b95bb9f714 Mon Sep 17 00:00:00 2001 From: Taqtiqa Administrator <1335713+taqtiqa-admin@users.noreply.github.com> Date: Sun, 11 Nov 2018 11:52:03 +1100 Subject: [PATCH 01/19] Fix Org references in README.md (#8) Shell script examples should work when cut-n-paste. Closes #8. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7fea36c..8657834 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ provides the `jlenv install` command, or as a standalone program. ```sh # As an jlenv plugin $ mkdir -p "$(jlenv root)"/plugins -$ git clone https://github.com/jlenv/julia-build.git "$(jlenv root)"/plugins/julia-build +$ git clone https://github.com/HiroakiMikami/julia-build.git "$(jlenv root)"/plugins/julia-build # As a standalone program -$ git clone https://github.com/jlenv/julia-build.git +$ git clone https://github.com/HiroakiMikami/julia-build.git $ PREFIX=/usr/local ./julia-build/install.sh ``` From 7771933e007cf623b9548f711eeb19f27b196259 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Sun, 11 Nov 2018 13:19:12 +1100 Subject: [PATCH 02/19] Convert Ruby references to Julia --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7fea36c..e52dd4a 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,11 @@ $ cd "$(jlenv root)"/plugins/julia-build && git pull ```sh # As an jlenv plugin -$ jlenv install --list # lists all available versions of Ruby +$ jlenv install --list # lists all available versions of Julia $ jlenv install v0.6.0 # installs Julia v0.6.0 to ~/.jlenv/versions # As a standalone program -$ julia-build --definitions # lists all available versions of Ruby +$ julia-build --definitions # lists all available versions of Julia $ julia-build 0.6.0 ~/local/julia-v0.6.0 # installs Julia v0.6.0 to ~/local/julia-0.6.0 ``` @@ -53,9 +53,9 @@ libraries](https://github.com/JuliaLang/julia#required-build-tools-and-external- #### Custom Build Definitions -If you wish to develop and install a version of Ruby that is not yet supported +If you wish to develop and install a version of Julia that is not yet supported by julia-build, you may specify the path to a custom “build definition file” in -place of a Ruby version number. +place of a Julia version number. Use the [default build definitions][definitions] as a template for your custom definitions. @@ -79,14 +79,14 @@ The build process may be configured through the following environment variables: | `MAKE` | Custom `make` command (_e.g.,_ `gmake`). | | `MAKE_OPTS` / `MAKEOPTS` | Additional `make` options. | | `MAKE_INSTALL_OPTS` | Additional `make install` options. | -| `JULIA_CONFIGURE_OPTS` | Additional `./configure` options (applies only to Ruby source). | -| `JULIA_MAKE_OPTS` | Additional `make` options (applies only to Ruby source). | -| `JULIA_MAKE_INSTALL_OPTS` | Additional `make install` options (applies only to Ruby source). | +| `JULIA_CONFIGURE_OPTS` | Additional `./configure` options (applies only to Julia source). | +| `JULIA_MAKE_OPTS` | Additional `make` options (applies only to Julia source). | +| `JULIA_MAKE_INSTALL_OPTS` | Additional `make install` options (applies only to Julia source). | #### Applying Patches Both `jlenv install` and `julia-build` support the `--patch` (`-p`) flag to apply -a patch to the Ruby (/JRuby/Rubinius) source code before building. Patches are +a patch to the Julia source code before building. Patches are read from `STDIN`: ```sh @@ -113,7 +113,7 @@ definition. (All bundled definitions include checksums.) Both `julia-build` and `jlenv install` accept the `-k` or `--keep` flag, which tells julia-build to keep the downloaded source after installation. This can be -useful if you need to use `gdb` and `memprof` with Ruby. +useful if you need to use `gdb` and `memprof` with Julia. Source code will be kept in a parallel directory tree `~/.jlenv/sources` when using `--keep` with the `jlenv install` command. You should specify the @@ -122,8 +122,8 @@ variable when using `--keep` with `julia-build`. ## Getting Help -Please see ruby-build wiki for solutions to common problems. +Please see Julia-Build wiki for solutions to common problems. [jlenv]: https://github.com/HiroakiMikami/jlenv [definitions]: https://github.com/HiroakiMikami/julia-build/tree/master/share/julia-build - [wiki]: https://github.com/rbenv/ruby-build/wiki + [wiki]: https://github.com/HiroakiMikami/julia-build/wiki From 096ad1121d78b5fdf1f90bf61236a9d16229f8b5 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:31:01 +1100 Subject: [PATCH 03/19] Add versions 1.1.0 and 1.0.3 --- share/julia-build/v1.0.3 | 1 + share/julia-build/v1.1.0 | 1 + 2 files changed, 2 insertions(+) create mode 100644 share/julia-build/v1.0.3 create mode 100644 share/julia-build/v1.1.0 diff --git a/share/julia-build/v1.0.3 b/share/julia-build/v1.0.3 new file mode 100644 index 0000000..296f392 --- /dev/null +++ b/share/julia-build/v1.0.3 @@ -0,0 +1 @@ +install_git "julia-v1.0.3" "https://github.com/JuliaLang/julia.git" "v1.0.3" "julia" diff --git a/share/julia-build/v1.1.0 b/share/julia-build/v1.1.0 new file mode 100644 index 0000000..f799ddf --- /dev/null +++ b/share/julia-build/v1.1.0 @@ -0,0 +1 @@ +install_git "julia-v1.1.0" "https://github.com/JuliaLang/julia.git" "v1.1.0" "julia" From 849df73babafc7371464d1de1d2bafc2eb14dd11 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:48:04 +1100 Subject: [PATCH 04/19] Remove Ruby references --- bin/jlenv-install | 8 ++++---- bin/jlenv-uninstall | 2 +- bin/julia-build | 13 +++++-------- test/definitions.bats | 4 ++-- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/bin/jlenv-install b/bin/jlenv-install index 39880ae..b4dcd5f 100755 --- a/bin/jlenv-install +++ b/bin/jlenv-install @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Summary: Install a Ruby version using julia-build +# Summary: Install a Julia version using julia-build # # Usage: jlenv install [-f|-s] [-kpv] # jlenv install [-f|-s] [-kpv] @@ -19,7 +19,7 @@ # -v/--verbose Verbose mode: print compilation status to stdout # --version Show version of julia-build # -# For detailed information on installing Ruby versions with +# For detailed information on installing Julia versions with # julia-build, including a list of environment variables for adjusting # compilation, see: https://github.com/jlenv/julia-build#usage # @@ -176,8 +176,8 @@ if [ -z "${JULIA_BUILD_CACHE_PATH}" ] && [ -d "${JLENV_ROOT}/cache" ]; then export JULIA_BUILD_CACHE_PATH="${JLENV_ROOT}/cache" fi -# Default JLENV_VERSION to the globally-specified Ruby version. (The -# REE installer requires an existing Ruby installation to run. An +# Default JLENV_VERSION to the globally-specified Julia version. (The +# REE installer requires an existing Julia installation to run. An # unsatisfied local .julia-version file can cause the installer to # fail.) export JLENV_VERSION="$(jlenv-global 2>/dev/null || true)" diff --git a/bin/jlenv-uninstall b/bin/jlenv-uninstall index ebb9cfe..3e423a7 100755 --- a/bin/jlenv-uninstall +++ b/bin/jlenv-uninstall @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Summary: Uninstall a specific Ruby version +# Summary: Uninstall a specific Julia version # # Usage: jlenv uninstall [-f|--force] # diff --git a/bin/julia-build b/bin/julia-build index 9a33b62..dfeefca 100755 --- a/bin/julia-build +++ b/bin/julia-build @@ -670,10 +670,7 @@ require_gcc() { echo "as of version 4.2. Instead, the \`gcc\` executable is a symlink to" echo "\`llvm-gcc\`, a modified version of GCC which outputs LLVM bytecode." echo - echo "For most programs the \`llvm-gcc\` compiler works fine. However," - echo "versions of Ruby older than 1.9.3-p125 are incompatible with" - echo "\`llvm-gcc\`. To build older versions of Ruby you must have the official" - echo "GCC compiler installed on your system." + echo "For most programs the \`llvm-gcc\` compiler works fine." echo colorize 1 "TO FIX THE PROBLEM" @@ -690,7 +687,7 @@ require_gcc() { echo echo echo "You will need to install the official GCC compiler to build older" - echo "versions of Ruby even if you have installed Apple's Command Line Tools" + echo "versions of Julia even if you have installed Apple's Command Line Tools" echo "for Xcode package. The Command Line Tools for Xcode package only" echo "includes \`llvm-gcc\`." fi @@ -877,7 +874,7 @@ build_package_mac_openssl() { # Put openssl.conf, certs, etc in ~/.jlenv/versions/*/openssl/ssl OPENSSLDIR="${OPENSSLDIR:-$OPENSSL_PREFIX_PATH/ssl}" - # Tell Ruby to use this openssl for its extension. + # Tell Julia to use this openssl for its extension. package_option julia configure --with-openssl-dir="$OPENSSL_PREFIX_PATH" # Hint OpenSSL that we prefer a 64-bit build. @@ -920,12 +917,12 @@ build_package_verify_openssl() { begin require lib rescue LoadError - $stderr.puts "The Ruby #{lib} extension was not compiled." + $stderr.puts "The Julia #{lib} extension was not compiled." end end if failed.size > 0 - $stderr.puts "ERROR: Ruby install aborted due to missing extensions" + $stderr.puts "ERROR: Julia install aborted due to missing extensions" $stderr.print "Try running `%s install -y %s` to fetch missing dependencies.\n\n" % [ manager, failed.map { |lib| packages.fetch(manager)[lib] }.join(" ") diff --git a/test/definitions.bats b/test/definitions.bats index 4e05e5f..a575b85 100644 --- a/test/definitions.bats +++ b/test/definitions.bats @@ -65,7 +65,7 @@ NUM_DEFINITIONS="$(ls "$BATS_TEST_DIRNAME"/../share/julia-build | wc -l)" assert_output "julia-build: definition not found: nonexistent" } -@test "sorting Ruby versions" { +@test "sorting Julia versions" { export JULIA_BUILD_ROOT="$TMP" mkdir -p "${JULIA_BUILD_ROOT}/share/julia-build" expected="1.8.7 @@ -98,7 +98,7 @@ jjulia-9000" assert_success "$expected" } -@test "removing duplicate Ruby versions" { +@test "removing duplicate Julia versions" { export JULIA_BUILD_ROOT="$TMP" export JULIA_BUILD_DEFINITIONS="${JULIA_BUILD_ROOT}/share/julia-build" mkdir -p "$JULIA_BUILD_DEFINITIONS" From 577c8be6f8d5aeaa7b9f21f568bebfc03f27b864 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 22 Aug 2019 18:12:40 +1000 Subject: [PATCH 05/19] V1.2.0 (#2) * Add v1.2.0, v1.0.4, v1.3.0-rc1 * Add update-alternatives to manage GCC/G++ Julia's travis-ci build currently uses gcc-5, with a manual link to gcc. * Add alternatives to manage GCC/G++Julia's build current uses gcc-5, with a manual link to gcc. * Readme.md refers to jlenv organization. * Fix typo in if statement. * Fix if mac update-alternatives logic. * Fix if else fi statements. * Add tests for update-alternatives managed gcc. * Fix (minor) readme.md. * Update tests. --- .gitignore | 1 + README.md | 29 +++--- bin/julia-build | 37 +++++++- share/julia-build/v1.0.4 | 1 + share/julia-build/v1.2.0 | 1 + share/julia-build/v1.3.0-rc1 | 1 + test/build.bats | 115 +++++++----------------- test/compiler.bats | 14 ++- test/definitions.bats | 46 +++++----- test/fixtures/definitions/needs-yaml | 2 +- test/fixtures/definitions/vanilla-julia | 2 +- test/jlenv.bats | 38 ++++---- 12 files changed, 147 insertions(+), 140 deletions(-) create mode 100644 share/julia-build/v1.0.4 create mode 100644 share/julia-build/v1.2.0 create mode 100644 share/julia-build/v1.3.0-rc1 diff --git a/.gitignore b/.gitignore index 21f271e..214d196 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /bats +/.vscode \ No newline at end of file diff --git a/README.md b/README.md index b476995..bbd5d1a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![](https://travis-ci.org/HiroakiMikami/julia-build.svg?branch=master) +![](https://travis-ci.org/jlenv/julia-build.svg?branch=master) # julia-build @@ -9,18 +9,27 @@ This project was forked from [ruby-build](https://github.com/rbenv/ruby-build), julia-build is a command-line utility that makes it easy to install virtually any version of Julia, from source. -It is available as a plugin for [jlenv](https://github.com/HiroakiMikami/julia-build) that +It is available as a plugin for [jlenv](https://github.com/jlenv/julia-build) that provides the `jlenv install` command, or as a standalone program. + - [jlenv]: https://github.com/jlenv/jlenv + - [definitions]: https://github.com/jlenv/julia-build/tree/master/share/julia-build + - [wiki]: https://github.com/jlenv/julia-build/wiki + ## Installation +Manages gcc versions using `update-alternatives`/`alternatives`: + +1. Debian/Ubuntu package: `dpkg` +1. RHEL/CentOS/Fedora package: `chkconfig` + ```sh # As an jlenv plugin $ mkdir -p "$(jlenv root)"/plugins -$ git clone https://github.com/HiroakiMikami/julia-build.git "$(jlenv root)"/plugins/julia-build +$ git clone https://github.com/jlenv/julia-build.git "$(jlenv root)"/plugins/julia-build # As a standalone program -$ git clone https://github.com/HiroakiMikami/julia-build.git +$ git clone https://github.com/jlenv/julia-build.git $ PREFIX=/usr/local ./julia-build/install.sh ``` @@ -91,13 +100,13 @@ read from `STDIN`: ```sh # applying a single patch -$ jlenv install --patch 1.9.3-p429 < /path/to/julia.patch +$ jlenv install --patch 1.0.3-p429 < /path/to/julia.patch # applying a patch from HTTP -$ jlenv install --patch 1.9.3-p429 < <(curl -sSL http://git.io/julia.patch) +$ jlenv install --patch 1.0.3-p429 < <(curl -sSL http://git.io/julia.patch) # applying multiple patches -$ cat fix1.patch fix2.patch | jlenv install --patch 1.9.3-p429 +$ cat fix1.patch fix2.patch | jlenv install --patch 1.0.3-p429 ``` #### Checksum Verification @@ -124,6 +133,6 @@ variable when using `--keep` with `julia-build`. Please see Julia-Build wiki for solutions to common problems. - [jlenv]: https://github.com/HiroakiMikami/jlenv - [definitions]: https://github.com/HiroakiMikami/julia-build/tree/master/share/julia-build - [wiki]: https://github.com/HiroakiMikami/julia-build/wiki + [jlenv]: https://github.com/jlenv/jlenv + [definitions]: https://github.com/jlenv/julia-build/tree/master/share/julia-build + [wiki]: https://github.com/jlenv/julia-build/wiki diff --git a/bin/julia-build b/bin/julia-build index 9b930c9..03de1e9 100755 --- a/bin/julia-build +++ b/bin/julia-build @@ -12,8 +12,11 @@ # --definitions List all built-in definitions # --version Show version of julia-build # +# Linux Helper Packages +# - hostnamectl (Disambiguates Centos, Ubuntu etc.) +# - alternatives (Redhat family) update-alternatives (Debian family) -JULIA_BUILD_VERSION="20190425" +JULIA_BUILD_VERSION="20190821" OLDIFS="$IFS" @@ -100,6 +103,14 @@ os_information() { fi } +is_rhel() { + local os="$(cat /etc/{centos,redhat,fedora,system}-release 2>/dev/null | head -1)" + if [ "$os" = "" ]; then + local os="$(hostnamectl|grep -i -E 'Fedora|CentOS|redhat|"Red Hat Enterprise"' 2>/dev/null | head -1)" + fi + [ "$os" != "" ] || return 1 +} + is_mac() { [ "$(uname -s)" = "Darwin" ] || return 1 [ $# -eq 0 ] || [ "$(osx_version)" "$@" ] @@ -758,9 +769,33 @@ gccs_in_path() { done shopt -u nullglob + if is_mac; then + echo "Macintosh equivalent of update-alternatives?" + else + update_gcc 5 + fi + printf :%s "${gccs[@]}" } +update_gcc() { + if [ ! -f "/usr/bin/gcc-$1" ] || [ ! -f "/usr/bin/g++-$1" ]; then + echo "no such version gcc/g++ installed" 1>&2 + exit 1 + fi + if is_rhel; then + alternatives --install /usr/bin/gcc gcc "/usr/bin/gcc-$1" 10 + alternatives --install /usr/bin/g++ g++ "/usr/bin/g++-$1" 10 + alternatives --set gcc "/usr/bin/gcc-$1" + alternatives --set g++ "/usr/bin/g++-$1" + else + update-alternatives --install /usr/bin/gcc gcc "/usr/bin/gcc-$1" 10 + update-alternatives --install /usr/bin/g++ g++ "/usr/bin/g++-$1" 10 + update-alternatives --set gcc "/usr/bin/gcc-$1" + update-alternatives --set g++ "/usr/bin/g++-$1" + fi +} + verify_gcc() { local gcc="$1" if [ -z "$gcc" ]; then diff --git a/share/julia-build/v1.0.4 b/share/julia-build/v1.0.4 new file mode 100644 index 0000000..e2158c8 --- /dev/null +++ b/share/julia-build/v1.0.4 @@ -0,0 +1 @@ +install_git "julia-v1.0.4" "https://github.com/JuliaLang/julia.git" "v1.0.4" "julia" diff --git a/share/julia-build/v1.2.0 b/share/julia-build/v1.2.0 new file mode 100644 index 0000000..335ef07 --- /dev/null +++ b/share/julia-build/v1.2.0 @@ -0,0 +1 @@ +install_git "julia-v1.2.0" "https://github.com/JuliaLang/julia.git" "v1.2.0" "julia" diff --git a/share/julia-build/v1.3.0-rc1 b/share/julia-build/v1.3.0-rc1 new file mode 100644 index 0000000..ad826da --- /dev/null +++ b/share/julia-build/v1.3.0-rc1 @@ -0,0 +1 @@ +install_git "julia-v1.3.0-rc1" "https://github.com/JuliaLang/julia.git" "v1.3.0-rc1" "julia" diff --git a/test/build.bats b/test/build.bats index 6b52244..47a30ee 100755 --- a/test/build.bats +++ b/test/build.bats @@ -58,34 +58,9 @@ assert_build_log() { assert_output } -@test "yaml is installed for julia" { - cached_tarball "yaml-0.1.6" - cached_tarball "julia-2.0.0" - - stub uname '-s : echo Linux' - stub brew false - stub_make_install - stub_make_install - - install_fixture definitions/needs-yaml - assert_success - - unstub uname - unstub make - - assert_build_log <&2; echo 4.2.1' '--version : echo warning >&2; echo 4.2.1' run_inline_definition < "${TMP}/definitions/1.9.3-test" + echo true > "${TMP}/definitions/1.0.3-test" mkdir -p "${TMP}/other" - echo false > "${TMP}/other/1.9.3-test" - run bin/julia-build "1.9.3-test" "${TMP}/install" + echo false > "${TMP}/other/1.0.3-test" + run bin/julia-build "1.0.3-test" "${TMP}/install" assert_success "" } @@ -68,18 +68,18 @@ NUM_DEFINITIONS="$(ls "$BATS_TEST_DIRNAME"/../share/julia-build | wc -l)" @test "sorting Julia versions" { export JULIA_BUILD_ROOT="$TMP" mkdir -p "${JULIA_BUILD_ROOT}/share/julia-build" - expected="1.8.7 -1.8.7-p72 -1.8.7-p375 -1.9.3-dev -1.9.3-preview1 -1.9.3-rc1 -1.9.3-p0 -1.9.3-p125 + expected="0.7.0-rc1 +0.7.0-rc2 +0.7.0 +1.0.3-dev +1.0.3-preview1 +1.0.3-rc1 +1.0.3 +1.0.3-p0 +1.0.3-p125 2.1.0-dev 2.1.0-rc1 2.1.0 -2.1.1 2.2.0-dev jjulia-1.6.5 jjulia-1.6.5.1 @@ -92,7 +92,7 @@ jjulia-1.7.10 jjulia-9000-dev jjulia-9000" for ver in $expected; do - touch "${JULIA_BUILD_ROOT}/share/julia-build/$ver" + touch "${JULIA_BUILD_ROOT}/share/julia-build/${ver}" done run julia-build --definitions assert_success "$expected" @@ -102,13 +102,13 @@ jjulia-9000" export JULIA_BUILD_ROOT="$TMP" export JULIA_BUILD_DEFINITIONS="${JULIA_BUILD_ROOT}/share/julia-build" mkdir -p "$JULIA_BUILD_DEFINITIONS" - touch "${JULIA_BUILD_DEFINITIONS}/1.9.3" + touch "${JULIA_BUILD_DEFINITIONS}/1.0.3" touch "${JULIA_BUILD_DEFINITIONS}/2.2.0" run julia-build --definitions assert_success assert_output <&2 && exit 2' \ - "--definitions : echo 1.8.7 1.9.3-p0 1.9.3-p194 2.1.2 | tr ' ' $'\\n'" + "--definitions : echo 0.7.0 1.0.3-rc1 1.0.3-rc2 1.0.4 | tr ' ' $'\\n'" - run jlenv-install 1.9.3 + run jlenv-install 1.0.3 assert_failure assert_output <&2 && exit 2' \ "--definitions : true" - run jlenv-install 1.9.3 + run jlenv-install 1.0.3 assert_failure assert_output < Date: Thu, 22 Aug 2019 21:20:45 +1000 Subject: [PATCH 06/19] Add docs folder. --- docs/other.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/other.md diff --git a/docs/other.md b/docs/other.md new file mode 100644 index 0000000..802992c --- /dev/null +++ b/docs/other.md @@ -0,0 +1 @@ +Hello world From 4bdb81fc687c81f00ec9e0e34cadbf823ffffbe9 Mon Sep 17 00:00:00 2001 From: Taqtiqa Administrator <1335713+taqtiqa-admin@users.noreply.github.com> Date: Thu, 22 Aug 2019 21:24:21 +1000 Subject: [PATCH 07/19] Set theme jekyll-theme-minimal --- docs/_config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/_config.yml diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 0000000..2f7efbe --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-minimal \ No newline at end of file From f3f63f05456d461d3e21743367cae1e7f7051d8e Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Fri, 13 Sep 2019 14:00:50 +1000 Subject: [PATCH 08/19] Add buil;ds and docs. --- .gitignore | 1 + .vscode/settings.json | 7 + LICENSE | 2 + LICENSE-ruby-build => LICENSE-julia-build | 3 + README.md | 127 ++----- bin/julia-build | 2 +- docs/CONDUCT.md | 4 + docs/LICENSE.md | 22 ++ docs/README.md | 419 ++++++++++++++++++++++ docs/_config.yml | 19 + gh-md-toc | 281 +++++++++++++++ share/julia-build/v1.0.4 | 1 + share/julia-build/v1.0.5 | 1 + share/julia-build/v1.1.1 | 1 + share/julia-build/v1.2.0 | 1 + 15 files changed, 799 insertions(+), 92 deletions(-) create mode 100644 .vscode/settings.json rename LICENSE-ruby-build => LICENSE-julia-build (91%) create mode 100644 docs/CONDUCT.md create mode 100644 docs/LICENSE.md create mode 100644 docs/README.md create mode 100644 docs/_config.yml create mode 100755 gh-md-toc create mode 100644 share/julia-build/v1.0.4 create mode 100644 share/julia-build/v1.0.5 create mode 100644 share/julia-build/v1.1.1 create mode 100644 share/julia-build/v1.2.0 diff --git a/.gitignore b/.gitignore index 21f271e..d145970 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /bats +.vscode \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c5992c0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "workbench.colorCustomizations": { + "activityBar.background": "#213211", + "titleBar.activeBackground": "#2E4718", + "titleBar.activeForeground": "#F7FBF4" + } +} \ No newline at end of file diff --git a/LICENSE b/LICENSE index c6feaa9..244bb07 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,5 @@ +Copyright (c) 2019 Mark Van de Vyver +Copyright (c) 2019 Taqtiqa LLC Copyright (c) 2017 Hiroaki Mikami Copyright (c) 2012-2013 Sam Stephenson diff --git a/LICENSE-ruby-build b/LICENSE-julia-build similarity index 91% rename from LICENSE-ruby-build rename to LICENSE-julia-build index f272008..244bb07 100644 --- a/LICENSE-ruby-build +++ b/LICENSE-julia-build @@ -1,3 +1,6 @@ +Copyright (c) 2019 Mark Van de Vyver +Copyright (c) 2019 Taqtiqa LLC +Copyright (c) 2017 Hiroaki Mikami Copyright (c) 2012-2013 Sam Stephenson Permission is hereby granted, free of charge, to any person obtaining a copy of diff --git a/README.md b/README.md index b476995..db53cf1 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,34 @@ -![](https://travis-ci.org/HiroakiMikami/julia-build.svg?branch=master) +![](https://travis-ci.org/jlenv/julia-build.svg?branch=master) # julia-build -This project was forked from [ruby-build](https://github.com/rbenv/ruby-build), and modified for [julia](https://github.com/JuliaLang/julia). +Julia-build is a command-line utility tool that makes it easy to compile, +install and remove virtually any version of [Julia](https://www.julialang.org), +using downloaded source files. + +Julia-build is exposed as a plugin for [jlenv](https://github.com/jlenv/julia-build) +that provides the `jlenv install` command. +Or simply as `julia-build` when used as a standalone program. + +# Table of Contents + + + + * [Installation](#installation) + * [Upgrading](#upgrading) + * [Usage](#usage) + * [Documentation](#documentation) + + + + --- julia-build is a command-line utility that makes it easy to install virtually any version of Julia, from source. -It is available as a plugin for [jlenv](https://github.com/HiroakiMikami/julia-build) that +It is available as a plugin for [jlenv](https://github.com/jlenv/julia-build) that provides the `jlenv install` command, or as a standalone program. ## Installation @@ -17,14 +36,14 @@ provides the `jlenv install` command, or as a standalone program. ```sh # As an jlenv plugin $ mkdir -p "$(jlenv root)"/plugins -$ git clone https://github.com/HiroakiMikami/julia-build.git "$(jlenv root)"/plugins/julia-build +$ git clone https://github.com/jlenv/julia-build.git "$(jlenv root)"/plugins/julia-build # As a standalone program -$ git clone https://github.com/HiroakiMikami/julia-build.git +$ git clone https://github.com/jlenv/julia-build.git $ PREFIX=/usr/local ./julia-build/install.sh ``` -### Upgrading +## Upgrading ```sh # As an jlenv plugin @@ -33,97 +52,23 @@ $ cd "$(jlenv root)"/plugins/julia-build && git pull ## Usage -### Basic Usage - ```sh # As an jlenv plugin -$ jlenv install --list # lists all available versions of Julia -$ jlenv install v0.6.0 # installs Julia v0.6.0 to ~/.jlenv/versions +$ jlenv install --list # lists all available versions of Julia +$ jlenv install v1.0.1 # installs Julia v1.0.1 to ~/.jlenv/versions # As a standalone program -$ julia-build --definitions # lists all available versions of Julia -$ julia-build 0.6.0 ~/local/julia-v0.6.0 # installs Julia v0.6.0 to ~/local/julia-0.6.0 +$ julia-build --definitions # lists all available versions of Julia +$ julia-build 1.0.1 ~/local/julia-v1.0.1 # installs Julia v1.0.1 to ~/local/julia-1.0.1 ``` julia-build does not check for system dependencies before downloading and -attempting to compile the Julia source. Please ensure that [all required -libraries](https://github.com/JuliaLang/julia#required-build-tools-and-external-libraries) are available on your system. - -### Advanced Usage - -#### Custom Build Definitions - -If you wish to develop and install a version of Julia that is not yet supported -by julia-build, you may specify the path to a custom “build definition file” in -place of a Julia version number. - -Use the [default build definitions][definitions] as a template for your custom -definitions. - -#### Custom Build Configuration - -The build process may be configured through the following environment variables: - -| Variable | Function | -| ------------------------ | ------------------------------------------------------------------------------------------------ | -| `TMPDIR` | Where temporary files are stored. | -| `JULIA_BUILD_BUILD_PATH` | Where sources are downloaded and built. (Default: a timestamped subdirectory of `TMPDIR`) | -| `JULIA_BUILD_CACHE_PATH` | Where to cache downloaded package files. (Default: `~/.jlenv/cache` if invoked as jlenv plugin) | -| `JULIA_BUILD_MIRROR_URL` | Custom mirror URL root. | -| `JULIA_BUILD_SKIP_MIRROR` | Always download from official sources, not mirrors. (Default: unset) | -| `JULIA_BUILD_ROOT` | Custom build definition directory. (Default: `share/julia-build`) | -| `JULIA_BUILD_DEFINITIONS` | Additional paths to search for build definitions. (Colon-separated list) | -| `CC` | Path to the C compiler. | -| `JULIA_CFLAGS` | Additional `CFLAGS` options (_e.g.,_ to override `-O3`). | -| `CONFIGURE_OPTS` | Additional `./configure` options. | -| `MAKE` | Custom `make` command (_e.g.,_ `gmake`). | -| `MAKE_OPTS` / `MAKEOPTS` | Additional `make` options. | -| `MAKE_INSTALL_OPTS` | Additional `make install` options. | -| `JULIA_CONFIGURE_OPTS` | Additional `./configure` options (applies only to Julia source). | -| `JULIA_MAKE_OPTS` | Additional `make` options (applies only to Julia source). | -| `JULIA_MAKE_INSTALL_OPTS` | Additional `make install` options (applies only to Julia source). | - -#### Applying Patches - -Both `jlenv install` and `julia-build` support the `--patch` (`-p`) flag to apply -a patch to the Julia source code before building. Patches are -read from `STDIN`: - -```sh -# applying a single patch -$ jlenv install --patch 1.9.3-p429 < /path/to/julia.patch - -# applying a patch from HTTP -$ jlenv install --patch 1.9.3-p429 < <(curl -sSL http://git.io/julia.patch) - -# applying multiple patches -$ cat fix1.patch fix2.patch | jlenv install --patch 1.9.3-p429 -``` - -#### Checksum Verification - -If you have the `shasum`, `openssl`, or `sha256sum` tool installed, julia-build will -automatically verify the SHA2 checksum of each downloaded package before -installing it. - -Checksums are optional and specified as anchors on the package URL in each -definition. (All bundled definitions include checksums.) - -#### Keeping the build directory after installation - -Both `julia-build` and `jlenv install` accept the `-k` or `--keep` flag, which -tells julia-build to keep the downloaded source after installation. This can be -useful if you need to use `gdb` and `memprof` with Julia. - -Source code will be kept in a parallel directory tree `~/.jlenv/sources` when -using `--keep` with the `jlenv install` command. You should specify the -location of the source code with the `JULIA_BUILD_BUILD_PATH` environment -variable when using `--keep` with `julia-build`. - -## Getting Help +attempting to compile the Julia source. Please ensure that [all requiredlibraries](https://github.com/JuliaLang/julia#required-build-tools-and-external-libraries) +are available on your system. +The Chef [jlenv](https://github.com/jlenv/jlenv-cookbook) cookbook automatically +ensures system dependencies are in place. -Please see Julia-Build wiki for solutions to common problems. +## Documentation - [jlenv]: https://github.com/HiroakiMikami/jlenv - [definitions]: https://github.com/HiroakiMikami/julia-build/tree/master/share/julia-build - [wiki]: https://github.com/HiroakiMikami/julia-build/wiki +Please see `julia-build` [documentation page](https://julia-build.github.io/docs/README.md) +for more detail and solutions to common problems. diff --git a/bin/julia-build b/bin/julia-build index 9b930c9..00607a0 100755 --- a/bin/julia-build +++ b/bin/julia-build @@ -795,7 +795,7 @@ require_llvm() { local homebrew_package="llvm@$llvm_version" { echo colorize 1 "ERROR" - echo ": Rubinius will not be able to compile using Apple's LLVM-based " + echo ": Julia will not be able to compile using Apple's LLVM-based " echo "build tools on OS X. You will need to install LLVM $llvm_version first." echo colorize 1 "TO FIX THE PROBLEM" diff --git a/docs/CONDUCT.md b/docs/CONDUCT.md new file mode 100644 index 0000000..7cca28f --- /dev/null +++ b/docs/CONDUCT.md @@ -0,0 +1,4 @@ +# Requested Contributor Conduct + +In the interest of fostering an excellent code base, we try to encourage anyone +to participate in our project. Please do likewise. diff --git a/docs/LICENSE.md b/docs/LICENSE.md new file mode 100644 index 0000000..244bb07 --- /dev/null +++ b/docs/LICENSE.md @@ -0,0 +1,22 @@ +Copyright (c) 2019 Mark Van de Vyver +Copyright (c) 2019 Taqtiqa LLC +Copyright (c) 2017 Hiroaki Mikami +Copyright (c) 2012-2013 Sam Stephenson + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..9dafe12 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,419 @@ +![](https://travis-ci.org/jlenv/julia-build.svg?branch=master) + +# julia-build + +Julia-build is a command-line utility tool that makes it easy to compile, +install and remove virtually any version of [Julia](https://www.julialang.org), +using downloaded source files. + +Julia-build is exposed as a plugin for [jlenv](https://github.com/jlenv/julia-build) +that provides the `jlenv install` command. +Or simply as `julia-build` when used as a standalone program. + +# Table of Contents + + + +* [Requirements](#requirements) +* [Installing](#installing) +* [Upgrading](#upgrading) +* [Contributing](#contributing) + * [Running BATS test suite](#running-bats-test-suite) +* [Notes](#notes) + * [GCC compatibility](#gcc-compatibility) + * [Suggested build environment](#suggested-build-environment) +* [Troubleshooting](#troubleshooting) + * ["mkdir: /Volumes/Macintosh: Not a directory"](#mkdir-volumesmacintosh-not-a-directory) + * [No space left on device](#no-space-left-on-device) + * [Lower the number of parallel jobs](#lower-the-number-of-parallel-jobs) +* [Usage](#usage) + * [Basic Usage](#basic-usage) + * [Advanced Usage](#advanced-usage) + * [Custom Build Definitions](#custom-build-definitions) + * [Custom Build Configuration](#custom-build-configuration) + * [Applying Patches](#applying-patches) + * [Checksum Verification](#checksum-verification) + * [Keeping the build directory after installation](#keeping-the-build-directory-after-installation) +* [Definitions](#definitions) + * [Build steps](#build-steps) + * [Constraints](#constraints) + * [Hooks](#hooks) + + + + + +--- + +## Requirements + +The Julia build requirements should be inplace, these are elaborated below, +[Suggested build environment](#suggested-build-environment). +Please note, the [jlenv](https://github.com/jlenv/jlenv-cookbook) cookbook +provides the [resources](https://docs.chef.io/resource.html) to setup the +correct build environment and write Julia installation management recipes. + +## Installing + +```sh +# As an jlenv plugin +$ mkdir -p "$(jlenv root)"/plugins +$ git clone https://github.com/jlenv/julia-build.git "$(jlenv root)"/plugins/julia-build + +# As a standalone program +$ git clone https://github.com/jlenv/julia-build.git +$ PREFIX=/usr/local ./julia-build/install.sh +``` + +## Upgrading + +If you have trouble installing a Julia version, first try to update julia-build to +get the latest bug fixes and Julia definitions. + +First locate it on your system: + +```sh +which julia-build +ls "$(jlenv root)"/plugins +``` + + +Or, if you have it installed via git as an jlenv plugin: + +```sh +cd "$(jlenv root)"/plugins/julia-build && git pull +``` +## Contributing + +Adding a Julia release is as simple as: + +1. Identify the Julia [tag]() string. Example: `v1.3.0-alpha`. +1. Copy one of the files in this rep's folder `share\julia-build`. Give it + the tag string as a name: `cp .\share\juila-build\v1.0.0 .\share\juila-build\v1.3.0-alpha` +1. Open the newly created file and replace occurances of `v1.0.0` with `v1.3.0-alpha` + +### Running BATS test suite + +It is only neccessary to run the [BATS](https://github.com/sstephenson/bats) +test suite if functionality is added or a bug is fixed. + +Please add tests that exercise the functionality added, or guard against the +bug regressions. To run tests: + +```bash +script\test +``` + +## Notes + +### GCC compatibility + +Julia is currently built using `gcc-5`. The Julia build script points this to +`gcc`. + +### Suggested build environment + +Julia-build will try its best to download and compile the wanted Julia version, +but sometimes compilation fails because of unmet system dependencies, or +compilation succeeds but the new Julia version exhibits weird failures at +runtime. The following instructions are our recommendations for a sane build +environment. + +* **Chef (zero), etc.:** + + If you don't already, we suggest you manage software installation + prerequisites, environment and configuration using one of + [Chef](https://www.chef.io/) ([Zero](https://github.com/chef/chef-zero)), + [Ansible](https://www.ansible.com), [Salt](https://www.saltstack.com), + [Puppet](https://puppet.com/), etc. + In the case of [Chef](https://www.chef.io/) ([Zero](https://github.com/chef/chef-zero)) + the [jlenv](https://github.com/jlenv/jlenv-cookbook) cookbook provides the + [resources](https://docs.chef.io/resource.html) to write Julia installation + management recipes. + +* **macOS:** + + If you haven't done so, install Xcode Command Line Tools + (`xcode-select --install`) and [Homebrew][https://brew.sh]. Then: + + ```sh + brew install + ``` + Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv) + package [dependencies file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) + +* **Ubuntu/Debian/Mint:** + + ```sh + apt-get install -y + ``` + Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv) + package [dependencies file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) + +* **CentOS/Fedora:** + + ```sh + yum install -y + ``` + Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv) + package [dependencies file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) + +* **openSUSE:** + + ```sh + zypper install -y + ``` + Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv) + package [dependencies file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) + +* **Arch Linux:** + +T.B.A. + +## Troubleshooting + +### "mkdir: /Volumes/Macintosh: Not a directory" + +This can occur if you have [more than one disk drive](https://github.com/sstephenson/ruby-build/issues/748#issuecomment-95143238) +and your home directory is physically mounted on a volume that might have a +space in its name, such as "Macintosh HD": + +``` +$ df +/dev/disk2 ... / +/dev/disk1s2 ... /Volumes/Macintosh HD +``` + +The easiest solution is to avoid building a Julia version to any path that has space characters in it. So instead of building into `~/.jlenv/versions/`, which is the default for `jlenv install `, instead you could install into `/opt/julias/` and symlink `/opt/julias` as `~/.jlenv/versions` so jlenv continues to work as before: + +```sh +sudo mkdir -p /opt/julias +sudo chown "${USER}:staff" /opt/julias +rm -rf ~/.jlenv/versions # This will DELETE your existing Julia versions! +ln -s /opt/julias ~/.jlenv/versions +``` + +Now proceed as following: + +``` +julia-build /opt/julias/ +``` + +### No space left on device + +Some distributions will mount a tmpfs partition with low disk space to `/tmp`, such as 250 MB. You can check this with: + + mount | grep tmp + df -h | grep tmp + +Compiling Julia can require up to 4 or 5GiB, so you should temporarily resize `/tmp` to allow more usage: + + rm -rf /tmp/julia-build* + mount -o remount,size=5G,noatime /tmp + +### Lower the number of parallel jobs + +On hosts that report a large amount of CPU cores, but don't have plenty of RAM, you might get: + +``` +gcc: internal compiler error: Killed (program cc1) +``` + +The solution is to use `MAKE_OPTS=-j2` to limit `make` to maximum of 2 parallel processes: + +```bash +export MAKE_OPTS=-j2 +``` + +or also with writable temp directory: + +```bash +TMPDIR=~/tmp MAKE_OPTS=-j2 jlenv install 1.0.3 +``` + +## Usage + +### Basic Usage + +```sh +# As an jlenv plugin +$ jlenv install --list # lists all available versions of Julia +$ jlenv install v1.0.1 # installs Julia v1.0.1 to ~/.jlenv/versions + +# As a standalone program +$ julia-build --definitions # lists all available versions of Julia +$ julia-build 1.0.1 ~/local/julia-v1.0.1 # installs Julia v1.0.1 to ~/local/julia-1.0.1 +``` + +julia-build does not check for system dependencies before downloading and +attempting to compile the Julia source. Please ensure that [all required +libraries](https://github.com/JuliaLang/julia#required-build-tools-and-external-libraries) are available on your system. + +### Advanced Usage + +#### Custom Build Definitions + +If you wish to develop and install a version of Julia that is not yet supported +by julia-build, you may specify the path to a custom “build definition file” in +place of a Julia version number. + +Use the [default build definitions][definitions] as a template for your custom +definitions. + +#### Custom Build Configuration + +The build process may be configured through the following environment variables: + +| Variable | Function | +| ------------------------ | ------------------------------------------------------------------------------------------------ | +| `TMPDIR` | Where temporary files are stored. | +| `JULIA_BUILD_BUILD_PATH` | Where sources are downloaded and built. (Default: a timestamped subdirectory of `TMPDIR`) | +| `JULIA_BUILD_CACHE_PATH` | Where to cache downloaded package files. (Default: `~/.jlenv/cache` if invoked as jlenv plugin) | +| `JULIA_BUILD_MIRROR_URL` | Custom mirror URL root. | +| `JULIA_BUILD_SKIP_MIRROR` | Always download from official sources, not mirrors. (Default: unset) | +| `JULIA_BUILD_ROOT` | Custom build definition directory. (Default: `share/julia-build`) | +| `JULIA_BUILD_DEFINITIONS` | Additional paths to search for build definitions. (Colon-separated list) | +| `CC` | Path to the C compiler. | +| `JULIA_CFLAGS` | Additional `CFLAGS` options (_e.g.,_ to override `-O3`). | +| `CONFIGURE_OPTS` | Additional `./configure` options. | +| `MAKE` | Custom `make` command (_e.g.,_ `gmake`). | +| `MAKE_OPTS` / `MAKEOPTS` | Additional `make` options. | +| `MAKE_INSTALL_OPTS` | Additional `make install` options. | +| `JULIA_CONFIGURE_OPTS` | Additional `./configure` options (applies only to Julia source). | +| `JULIA_MAKE_OPTS` | Additional `make` options (applies only to Julia source). | +| `JULIA_MAKE_INSTALL_OPTS` | Additional `make install` options (applies only to Julia source). | + +#### Applying Patches + +Both `jlenv install` and `julia-build` support the `--patch` (`-p`) flag to apply +a patch to the Julia source code before building. Patches are +read from `STDIN`: + +```sh +# applying a single patch +$ jlenv install --patch 1.0.3-p4 < /path/to/julia.patch + +# applying a patch from HTTP +$ jlenv install --patch 1.0.3-p4 < <(curl -sSL http://git.io/julia.patch) + +# applying multiple patches +$ cat fix1.patch fix2.patch | jlenv install --patch 1.0.3-p4 +``` + +#### Checksum Verification + +If you have the `shasum`, `openssl`, or `sha256sum` tool installed, julia-build will +automatically verify the SHA2 checksum of each downloaded package before +installing it. + +Checksums are optional and specified as anchors on the package URL in each +definition. + +#### Keeping the build directory after installation + +Both `julia-build` and `jlenv install` accept the `-k` or `--keep` flag, which +tells julia-build to keep the downloaded source after installation. This can be +useful if you need to use `gdb` and `memprof` with Julia. + +Source code will be kept in a parallel directory tree `~/.jlenv/sources` when +using `--keep` with the `jlenv install` command. You should specify the +location of the source code with the `JULIA_BUILD_BUILD_PATH` environment +variable when using `--keep` with `julia-build`. + +## Definitions + +Build definitions are simple shell scripts that get sourced in the julia-build +environment so they can invoke functions that fetch necessary packages and +compile them into the destination directory. The complete list of is here +[Julia definitions](https://github.com/jlenv/julia-build/tree/master/share/julia-build) + +The basic invocation from a build definition is the function to download and +install a package from a tarball: + +```sh +install_package PACKAGE_NAME PACKAGE_URL#SHA2 [BUILD_STEPS...] [--if CONDITION] +``` + +`PACKAGE_URL` specifies the location of the tarball where the package is +published. After download, its signature verified against the optional SHA2 +checksum. + +`PACKAGE_NAME` is the name of the directory to `cd` into after extracting the +tarball. The subsequent `BUILD_STEPS` will be executed within that directory. + +Alternatively, a package may be retrieved via git or SVN: + +```sh +install_git PACKAGE_NAME GIT_URL BRANCH [...] +install_svn PACKAGE_NAME SVN_URL REVISION [...] +``` + +`BUILD_STEPS` is a list of operations to run in order to complete the installation +of a Julia version. If empty, the list defaults to "standard". + +`CONDITION` is a way to specify that this package is optional and will only be +installed if the function of the name `CONDITION` returns a success status. Some +condition functions available to built-in definitions are: + +* **needs_yaml**: true if there isn't an adequate libyaml found on the system +* **has_broken_mac_openssl**: true for Apple-patched openssl v0.9.8 + + +### Build steps + +Pre-build steps: + +* **ldflags_dirs**: Ensures that directories listed in `LDFLAGS` exist. +* **auto_tcltk**: Detects XQuartz on OS X or disables TK. +* **autoconf**: Runs `autoconf`. Prerequisite for "standard" step when fetching + Julia versions from git/SVN. + +Build steps: + +* **standard**: `./configure` + `make`. This is the default. +* **topaz**: copies over pre-built Topaz. +* **julia**: `julia setup.jl`. Used when installing Julia Packages. +* **mac_openssl**: builds OpenSSL on OS X. + +Post-build steps: + +* **verify_openssl**: Checks that openssl extension can be loaded. + +### Constraints + +These constraints should appear in the beginning of the build definition to +check whether the system is compatible with the Julia version: + +* **require_gcc**: ensures that gcc is gcc-5. Required check for all Julia. + +### Hooks + +Before and after installing each package, julia-build invokes these functions: + +```sh +before_install_package PACKAGE_NAME +after_install_package PACKAGE_NAME +``` + +You can take advantage of this by defining these functions in the definition +itself and filtering by package name as necessary. Example: + +```sh +before_install_package() { + local package_name="$1" + case "$package_name" in + julia-* ) + # do something for all Julia packages + ;; + esac +} + +install_package ... +``` diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 0000000..6ee0d2e --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,19 @@ +--- +title: Your awesome title +email: mark@taqtiqa.com +description: > # this means to ignore newlines until "baseurl:" + Jlenv. Compile and install multiple versions of Julia. [Julia](https://www.julialang.org/). +github_username: jlenv +include_related_posts: true +plugins: + - jekyll-relative-links +relative_links: + enabled: true + collections: true +include: + - README.md + - LICENSE.md + - ISSUE_TEMPLATE.md + - PULL_REQUEST_TEMPLATE.md + - CONTRIBUTING.md + - CONDUCT.md diff --git a/gh-md-toc b/gh-md-toc new file mode 100755 index 0000000..792d6ff --- /dev/null +++ b/gh-md-toc @@ -0,0 +1,281 @@ +#!/usr/bin/env bash + +# +# Steps: +# +# 1. Download corresponding html file for some README.md: +# curl -s $1 +# +# 2. Discard rows where no substring 'user-content-' (github's markup): +# awk '/user-content-/ { ... +# +# 3.1 Get last number in each row like ' ... sitemap.js.*<\/h/)+2, RLENGTH-5) +# +# 5. Find anchor and insert it inside "(...)": +# substr($0, match($0, "href=\"[^\"]+?\" ")+6, RLENGTH-8) +# + +gh_toc_version="0.6.1" + +gh_user_agent="gh-md-toc v$gh_toc_version" + +# +# Download rendered into html README.md by its url. +# +# +gh_toc_load() { + local gh_url=$1 + + if type curl &>/dev/null; then + curl --user-agent "$gh_user_agent" -s "$gh_url" + elif type wget &>/dev/null; then + wget --user-agent="$gh_user_agent" -qO- "$gh_url" + else + echo "Please, install 'curl' or 'wget' and try again." + exit 1 + fi +} + +# +# Converts local md file into html by GitHub +# +# ➥ curl -X POST --data '{"text": "Hello world github/linguist#1 **cool**, and #1!"}' https://api.github.com/markdown +#

Hello world github/linguist#1 cool, and #1!

'" +gh_toc_md2html() { + local gh_file_md=$1 + URL=https://api.github.com/markdown/raw + if [ ! -z "$GH_TOC_TOKEN" ]; then + TOKEN=$GH_TOC_TOKEN + else + TOKEN="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" + fi + if [ -f "$TOKEN" ]; then + URL="$URL?access_token=$(cat $TOKEN)" + fi + # echo $URL 1>&2 + OUTPUT="$(curl -s --user-agent "$gh_user_agent" \ + --data-binary @"$gh_file_md" -H "Content-Type:text/plain" \ + $URL)" + + if [ "$?" != "0" ]; then + echo "XXNetworkErrorXX" + fi + if [ "$(echo "${OUTPUT}" | awk '/API rate limit exceeded/')" != "" ]; then + echo "XXRateLimitXX" + else + echo "${OUTPUT}" + fi +} + + +# +# Is passed string url +# +gh_is_url() { + case $1 in + https* | http*) + echo "yes";; + *) + echo "no";; + esac +} + +# +# TOC generator +# +gh_toc(){ + local gh_src=$1 + local gh_src_copy=$1 + local gh_ttl_docs=$2 + local need_replace=$3 + + if [ "$gh_src" = "" ]; then + echo "Please, enter URL or local path for a README.md" + exit 1 + fi + + + # Show "TOC" string only if working with one document + if [ "$gh_ttl_docs" = "1" ]; then + + echo "Table of Contents" + echo "=================" + echo "" + gh_src_copy="" + + fi + + if [ "$(gh_is_url "$gh_src")" == "yes" ]; then + gh_toc_load "$gh_src" | gh_toc_grab "$gh_src_copy" + if [ "${PIPESTATUS[0]}" != "0" ]; then + echo "Could not load remote document." + echo "Please check your url or network connectivity" + exit 1 + fi + if [ "$need_replace" = "yes" ]; then + echo + echo "!! '$gh_src' is not a local file" + echo "!! Can't insert the TOC into it." + echo + fi + else + local rawhtml=$(gh_toc_md2html "$gh_src") + if [ "$rawhtml" == "XXNetworkErrorXX" ]; then + echo "Parsing local markdown file requires access to github API" + echo "Please make sure curl is installed and check your network connectivity" + exit 1 + fi + if [ "$rawhtml" == "XXRateLimitXX" ]; then + echo "Parsing local markdown file requires access to github API" + echo "Error: You exceeded the hourly limit. See: https://developer.github.com/v3/#rate-limiting" + TOKEN="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" + echo "or place github auth token here: $TOKEN" + exit 1 + fi + local toc=`echo "$rawhtml" | gh_toc_grab "$gh_src_copy"` + echo "$toc" + if [ "$need_replace" = "yes" ]; then + if grep -Fxq "" $gh_src && grep -Fxq "" $gh_src; then + echo "Found markers" + else + echo "You don't have or in your file...exiting" + exit 1 + fi + local ts="<\!--ts-->" + local te="<\!--te-->" + local dt=`date +'%F_%H%M%S'` + local ext=".orig.${dt}" + local toc_path="${gh_src}.toc.${dt}" + local toc_footer="" + # http://fahdshariff.blogspot.ru/2012/12/sed-mutli-line-replacement-between-two.html + # clear old TOC + sed -i${ext} "/${ts}/,/${te}/{//!d;}" "$gh_src" + # create toc file + echo "${toc}" > "${toc_path}" + echo -e "\n${toc_footer}\n" >> "$toc_path" + # insert toc file + if [[ "`uname`" == "Darwin" ]]; then + sed -i "" "/${ts}/r ${toc_path}" "$gh_src" + else + sed -i "/${ts}/r ${toc_path}" "$gh_src" + fi + echo + echo "!! TOC was added into: '$gh_src'" + echo "!! Origin version of the file: '${gh_src}${ext}'" + echo "!! TOC added into a separate file: '${toc_path}'" + echo + fi + fi +} + +# +# Grabber of the TOC from rendered html +# +# $1 — a source url of document. +# It's need if TOC is generated for multiple documents. +# +gh_toc_grab() { + # if closed is on the new line, then move it on the prev line + # for example: + # was: The command foo1 + # + # became: The command foo1 + sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<\/h/<\/h/g' | + # find strings that corresponds to template + grep -E -o '//g' | sed 's/<\/code>//g' | + # now all rows are like: + # ... .*<\/h/)+2, RLENGTH-5) + href = substr($0, match($0, "href=\"[^\"]+?\"")+6, RLENGTH-7) + print sprintf("%*s", level*3, " ") "* [" text "](" gh_url href ")" }' | + sed 'y/+/ /; s/%/\\x/g')" +} + +# +# Returns filename only from full path or url +# +gh_toc_get_filename() { + echo "${1##*/}" +} + +# +# Options hendlers +# +gh_toc_app() { + local need_replace="no" + + if [ "$1" = '--help' ] || [ $# -eq 0 ] ; then + local app_name=$(basename "$0") + echo "GitHub TOC generator ($app_name): $gh_toc_version" + echo "" + echo "Usage:" + echo " $app_name [--insert] src [src] Create TOC for a README file (url or local path)" + echo " $app_name - Create TOC for markdown from STDIN" + echo " $app_name --help Show help" + echo " $app_name --version Show version" + return + fi + + if [ "$1" = '--version' ]; then + echo "$gh_toc_version" + echo + echo "os: `lsb_release -d | cut -f 2`" + echo "kernel: `cat /proc/version`" + echo "shell: `$SHELL --version`" + echo + for tool in curl wget grep awk sed; do + printf "%-5s: " $tool + echo `$tool --version | head -n 1` + done + return + fi + + if [ "$1" = "-" ]; then + if [ -z "$TMPDIR" ]; then + TMPDIR="/tmp" + elif [ -n "$TMPDIR" -a ! -d "$TMPDIR" ]; then + mkdir -p "$TMPDIR" + fi + local gh_tmp_md + gh_tmp_md=$(mktemp $TMPDIR/tmp.XXXXXX) + while read input; do + echo "$input" >> "$gh_tmp_md" + done + gh_toc_md2html "$gh_tmp_md" | gh_toc_grab "" + return + fi + + if [ "$1" = '--insert' ]; then + need_replace="yes" + shift + fi + + for md in "$@" + do + echo "" + gh_toc "$md" "$#" "$need_replace" + done + + echo "" + echo "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)" +} + +# +# Entry point +# +gh_toc_app "$@" diff --git a/share/julia-build/v1.0.4 b/share/julia-build/v1.0.4 new file mode 100644 index 0000000..e2158c8 --- /dev/null +++ b/share/julia-build/v1.0.4 @@ -0,0 +1 @@ +install_git "julia-v1.0.4" "https://github.com/JuliaLang/julia.git" "v1.0.4" "julia" diff --git a/share/julia-build/v1.0.5 b/share/julia-build/v1.0.5 new file mode 100644 index 0000000..cc842e8 --- /dev/null +++ b/share/julia-build/v1.0.5 @@ -0,0 +1 @@ +install_git "julia-v1.0.5" "https://github.com/JuliaLang/julia.git" "v1.0.5" "julia" diff --git a/share/julia-build/v1.1.1 b/share/julia-build/v1.1.1 new file mode 100644 index 0000000..e51c724 --- /dev/null +++ b/share/julia-build/v1.1.1 @@ -0,0 +1 @@ +install_git "julia-v1.1.1" "https://github.com/JuliaLang/julia.git" "v1.1.1" "julia" diff --git a/share/julia-build/v1.2.0 b/share/julia-build/v1.2.0 new file mode 100644 index 0000000..335ef07 --- /dev/null +++ b/share/julia-build/v1.2.0 @@ -0,0 +1 @@ +install_git "julia-v1.2.0" "https://github.com/JuliaLang/julia.git" "v1.2.0" "julia" From a96e5c706b7223effae7004d130bc35dce714897 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Fri, 13 Sep 2019 16:27:56 +1000 Subject: [PATCH 09/19] Update docs on build steps. --- docs/README.md | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/README.md b/docs/README.md index 9dafe12..23c9c21 100644 --- a/docs/README.md +++ b/docs/README.md @@ -36,10 +36,13 @@ Or simply as `julia-build` when used as a standalone program. * [Keeping the build directory after installation](#keeping-the-build-directory-after-installation) * [Definitions](#definitions) * [Build steps](#build-steps) + * [Pre-build steps:](#pre-build-steps) + * [Build steps:](#build-steps-1) + * [Post-build steps:](#post-build-steps) * [Constraints](#constraints) * [Hooks](#hooks) - + @@ -329,10 +332,11 @@ variable when using `--keep` with `julia-build`. ## Definitions -Build definitions are simple shell scripts that get sourced in the julia-build +Build definitions are simple shell scripts that get sourced in the `julia-build` environment so they can invoke functions that fetch necessary packages and -compile them into the destination directory. The complete list of is here +compile them into the destination directory. The complete list of [Julia definitions](https://github.com/jlenv/julia-build/tree/master/share/julia-build) +is here. The basic invocation from a build definition is the function to download and install a package from a tarball: @@ -348,13 +352,6 @@ checksum. `PACKAGE_NAME` is the name of the directory to `cd` into after extracting the tarball. The subsequent `BUILD_STEPS` will be executed within that directory. -Alternatively, a package may be retrieved via git or SVN: - -```sh -install_git PACKAGE_NAME GIT_URL BRANCH [...] -install_svn PACKAGE_NAME SVN_URL REVISION [...] -``` - `BUILD_STEPS` is a list of operations to run in order to complete the installation of a Julia version. If empty, the list defaults to "standard". @@ -365,24 +362,30 @@ condition functions available to built-in definitions are: * **needs_yaml**: true if there isn't an adequate libyaml found on the system * **has_broken_mac_openssl**: true for Apple-patched openssl v0.9.8 +Alternatively, a package may be retrieved via git or SVN: + +```sh +install_git PACKAGE_NAME GIT_URL BRANCH [...] +install_svn PACKAGE_NAME SVN_URL REVISION [...] +``` ### Build steps -Pre-build steps: +#### Pre-build steps: * **ldflags_dirs**: Ensures that directories listed in `LDFLAGS` exist. * **auto_tcltk**: Detects XQuartz on OS X or disables TK. * **autoconf**: Runs `autoconf`. Prerequisite for "standard" step when fetching Julia versions from git/SVN. -Build steps: +#### Build steps: * **standard**: `./configure` + `make`. This is the default. * **topaz**: copies over pre-built Topaz. * **julia**: `julia setup.jl`. Used when installing Julia Packages. * **mac_openssl**: builds OpenSSL on OS X. -Post-build steps: +#### Post-build steps: * **verify_openssl**: Checks that openssl extension can be loaded. From 78e3d912bbc5517849e222c80ba1e0aad29b87dc Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 17 Oct 2019 14:46:45 +1100 Subject: [PATCH 10/19] Markdown lint changes. Git ignore refinements. --- .gitignore | 14 ++++++++++++-- .markdownlint.yml | 4 ++++ README.md | 40 ++++++++++++++++++---------------------- test/tmp/.gitignore | 1 - 4 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 .markdownlint.yml delete mode 100644 test/tmp/.gitignore diff --git a/.gitignore b/.gitignore index 5e7d4db..a2fb30e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,12 @@ -/bats -/.vscode +# Don't track test scaffolding: +test/libs/ +test/libexec/bin +test/libexec/libexec +test/libexec/share +test/tmp/ + +# Editor settings +.vscode/ + +# merge conflict artifacts +*.orig \ No newline at end of file diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 0000000..f9a89e1 --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,4 @@ +{ + "default": true, + "MD003": { "style": "atx" } +} \ No newline at end of file diff --git a/README.md b/README.md index f4b1ca5..ca8c502 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,22 @@ -![](https://travis-ci.org/jlenv/julia-build.svg?branch=master) - # julia-build -Julia-build is a command-line utility tool that makes it easy to compile, -install and remove virtually any version of [Julia](https://www.julialang.org), +Julia-build is a command-line utility tool that makes it easy to compile, +install and remove virtually any version of [Julia](https://www.julialang.org), using downloaded source files. Julia-build is exposed as a plugin for [jlenv](https://github.com/jlenv/julia-build) that provides the `jlenv install` command. Or simply as `julia-build` when used as a standalone program. -# Table of Contents +## Table of Contents - - * [Installation](#installation) - * [Upgrading](#upgrading) - * [Usage](#usage) - * [Documentation](#documentation) +* [Installation](#installation) +* [Upgrading](#upgrading) +* [Usage](#usage) +* [Documentation](#documentation) - --- @@ -35,19 +31,19 @@ provides the `jlenv install` command, or as a standalone program. ```sh # As an jlenv plugin -$ mkdir -p "$(jlenv root)"/plugins -$ git clone https://github.com/jlenv/julia-build.git "$(jlenv root)"/plugins/julia-build +mkdir -p "$(jlenv root)"/plugins +git clone https://github.com/jlenv/julia-build.git "$(jlenv root)"/plugins/julia-build # As a standalone program -$ git clone https://github.com/jlenv/julia-build.git -$ PREFIX=/usr/local ./julia-build/install.sh +git clone https://github.com/jlenv/julia-build.git +PREFIX=/usr/local ./julia-build/install.sh ``` ## Upgrading ```sh # As an jlenv plugin -$ cd "$(jlenv root)"/plugins/julia-build && git pull +cd "$(jlenv root)"/plugins/julia-build && git pull ``` ## Usage @@ -56,21 +52,21 @@ $ cd "$(jlenv root)"/plugins/julia-build && git pull ```sh # As an jlenv plugin -$ jlenv install --list # lists all available versions of Julia -$ jlenv install v1.0.1 # installs Julia v1.0.1 to ~/.jlenv/versions +jlenv install --list # lists all available versions of Julia +jlenv install v1.0.1 # installs Julia v1.0.1 to ~/.jlenv/versions # As a standalone program -$ julia-build --definitions # lists all available versions of Julia -$ julia-build 1.0.1 ~/local/julia-v1.0.1 # installs Julia v1.0.1 to ~/local/julia-1.0.1 +julia-build --definitions # lists all available versions of Julia +julia-build 1.0.1 ~/local/julia-v1.0.1 # installs Julia v1.0.1 to ~/local/julia-1.0.1 ``` julia-build does not check for system dependencies before downloading and -attempting to compile the Julia source. Please ensure that [all requiredlibraries](https://github.com/JuliaLang/julia#required-build-tools-and-external-libraries) +attempting to compile the Julia source. Please ensure that [all requiredlibraries](https://github.com/JuliaLang/julia#required-build-tools-and-external-libraries) are available on your system. The Chef [jlenv](https://github.com/jlenv/jlenv-cookbook) cookbook automatically ensures system dependencies are in place. ## Documentation -Please see `julia-build` [documentation page](https://julia-build.github.io/docs/README.md) +Please see `julia-build` [documentation page](https://julia-build.github.io/docs/README.md) for more detail and solutions to common problems. diff --git a/test/tmp/.gitignore b/test/tmp/.gitignore deleted file mode 100644 index 72e8ffc..0000000 --- a/test/tmp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* From d01f8a316be71c0ad510382655070a8e8b9be01f Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 17 Oct 2019 17:00:30 +1100 Subject: [PATCH 11/19] Add badges. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dc92a23..10d840b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -![](https://travis-ci.org/jlenv/julia-build.svg?branch=master) - # julia-build +[![Build Status](https://travis-ci.com/jlenv/julia-build.svg?branch=master)](https://travis-ci.com/jlenv/julia-build)[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d33f741a507b4cee99ab9d4931ae1163)](https://www.codacy.com/manual/taqtiqa-mark/jlenv-julia-build?utm_source=github.com&utm_medium=referral&utm_content=jlenv/julia-build&utm_campaign=Badge_Grade)[![CodeFactor](https://www.codefactor.io/repository/github/jlenv/julia-build/badge)](https://www.codefactor.io/repository/github/jlenv/julia-build) + Julia-build is a command-line utility tool that makes it easy to compile, install and remove virtually any version of [Julia](https://www.julialang.org), using downloaded source files. From aeb904fc4bced5edc5059f6dc4e00b5f50851ed1 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 31 Oct 2019 07:57:27 +1100 Subject: [PATCH 12/19] Add docs changes. --- LICENSE-julia-build | 22 ----- README.md | 22 ++--- docs/CONDUCT.md | 4 - docs/README.md | 192 +++++++++++++++++++++++++------------------- docs/_config.yml | 13 +-- 5 files changed, 120 insertions(+), 133 deletions(-) delete mode 100644 LICENSE-julia-build delete mode 100644 docs/CONDUCT.md diff --git a/LICENSE-julia-build b/LICENSE-julia-build deleted file mode 100644 index 244bb07..0000000 --- a/LICENSE-julia-build +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2019 Mark Van de Vyver -Copyright (c) 2019 Taqtiqa LLC -Copyright (c) 2017 Hiroaki Mikami -Copyright (c) 2012-2013 Sam Stephenson - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index 10d840b..43e15ea 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.com/jlenv/julia-build.svg?branch=master)](https://travis-ci.com/jlenv/julia-build)[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d33f741a507b4cee99ab9d4931ae1163)](https://www.codacy.com/manual/taqtiqa-mark/jlenv-julia-build?utm_source=github.com&utm_medium=referral&utm_content=jlenv/julia-build&utm_campaign=Badge_Grade)[![CodeFactor](https://www.codefactor.io/repository/github/jlenv/julia-build/badge)](https://www.codefactor.io/repository/github/jlenv/julia-build) -Julia-build is a command-line utility tool that makes it easy to compile, +`julia-build` is a command-line utility tool that makes it easy to compile, install and remove virtually any version of [Julia](https://www.julialang.org), using downloaded source files. @@ -17,22 +17,9 @@ Or simply as `julia-build` when used as a standalone program. * [Upgrading](#upgrading) * [Usage](#usage) * [Documentation](#documentation) - ---- - -julia-build is a command-line utility that makes it easy to install virtually any -version of Julia, from source. - -It is available as a plugin for [jlenv](https://github.com/jlenv/julia-build) that -provides the `jlenv install` command, or as a standalone program. - - - [jlenv]: https://github.com/jlenv/jlenv - - [definitions]: https://github.com/jlenv/julia-build/tree/master/share/julia-build - - [wiki]: https://github.com/jlenv/julia-build/wiki - ## Installation Manages gcc versions using `update-alternatives`/`alternatives`: @@ -79,5 +66,10 @@ ensures system dependencies are in place. ## Documentation -Please see `julia-build` [documentation page](https://julia-build.github.io/docs/README.md) +Please see `julia-build` [documentation page](https://jlenv.github.io/julia-build) for more detail and solutions to common problems. + +## Requested Contributor Conduct + +In the interest of fostering an excellent code base, we try to encourage anyone +to participate in our project. Please do likewise. \ No newline at end of file diff --git a/docs/CONDUCT.md b/docs/CONDUCT.md deleted file mode 100644 index 7cca28f..0000000 --- a/docs/CONDUCT.md +++ /dev/null @@ -1,4 +0,0 @@ -# Requested Contributor Conduct - -In the interest of fostering an excellent code base, we try to encourage anyone -to participate in our project. Please do likewise. diff --git a/docs/README.md b/docs/README.md index 5fcb671..ec046f6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,45 +1,45 @@ -![](https://travis-ci.org/jlenv/julia-build.svg?branch=master) - # julia-build -Julia-build is a command-line utility tool that makes it easy to compile, -install and remove virtually any version of [Julia](https://www.julialang.org), +[![Build Status](https://travis-ci.com/jlenv/julia-build.svg?branch=master)](https://travis-ci.com/jlenv/julia-build)[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d33f741a507b4cee99ab9d4931ae1163)](https://www.codacy.com/manual/taqtiqa-mark/jlenv-julia-build?utm_source=github.com&utm_medium=referral&utm_content=jlenv/julia-build&utm_campaign=Badge_Grade)[![CodeFactor](https://www.codefactor.io/repository/github/jlenv/julia-build/badge)](https://www.codefactor.io/repository/github/jlenv/julia-build) + +Julia-build is a command-line utility tool that makes it easy to compile, +install and remove virtually any version of [Julia](https://www.julialang.org), using downloaded source files. Julia-build is exposed as a plugin for [jlenv](https://github.com/jlenv/julia-build) that provides the `jlenv install` command. Or simply as `julia-build` when used as a standalone program. -# Table of Contents +## Table of Contents * [Requirements](#requirements) * [Installing](#installing) * [Upgrading](#upgrading) * [Contributing](#contributing) - * [Running BATS test suite](#running-bats-test-suite) + * [Running BATS test suite](#running-bats-test-suite) * [Notes](#notes) - * [GCC compatibility](#gcc-compatibility) - * [Suggested build environment](#suggested-build-environment) + * [GCC compatibility](#gcc-compatibility) + * [Suggested build environment](#suggested-build-environment) * [Troubleshooting](#troubleshooting) - * ["mkdir: /Volumes/Macintosh: Not a directory"](#mkdir-volumesmacintosh-not-a-directory) + * ["mkdir: /Volumes/Macintosh: Not a directory"](#mkdir-volumesmacintosh-not-a-directory) * [No space left on device](#no-space-left-on-device) * [Lower the number of parallel jobs](#lower-the-number-of-parallel-jobs) * [Usage](#usage) - * [Basic Usage](#basic-usage) - * [Advanced Usage](#advanced-usage) - * [Custom Build Definitions](#custom-build-definitions) - * [Custom Build Configuration](#custom-build-configuration) - * [Applying Patches](#applying-patches) - * [Checksum Verification](#checksum-verification) - * [Keeping the build directory after installation](#keeping-the-build-directory-after-installation) + * [Basic Usage](#basic-usage) + * [Advanced Usage](#advanced-usage) + * [Custom Build Definitions](#custom-build-definitions) + * [Custom Build Configuration](#custom-build-configuration) + * [Applying Patches](#applying-patches) + * [Checksum Verification](#checksum-verification) + * [Keeping the build directory after installation](#keeping-the-build-directory-after-installation) * [Definitions](#definitions) - * [Build steps](#build-steps) - * [Pre-build steps:](#pre-build-steps) - * [Build steps:](#build-steps-1) - * [Post-build steps:](#post-build-steps) - * [Constraints](#constraints) - * [Hooks](#hooks) + * [Build steps](#build-steps) + * [Pre-build steps:](#pre-build-steps) + * [Build steps:](#build-steps-1) + * [Post-build steps:](#post-build-steps) + * [Constraints](#constraints) + * [Hooks](#hooks) @@ -48,22 +48,22 @@ Or simply as `julia-build` when used as a standalone program. ## Requirements -The Julia build requirements should be inplace, these are elaborated below, -[Suggested build environment](#suggested-build-environment). -Please note, the [jlenv](https://github.com/jlenv/jlenv-cookbook) cookbook -provides the [resources](https://docs.chef.io/resource.html) to setup the +The Julia build requirements should be inplace, these are elaborated below, +[Suggested build environment](#suggested-build-environment). +Please note, the [jlenv](https://github.com/jlenv/jlenv-cookbook) cookbook +provides the [resources](https://docs.chef.io/resource.html) to setup the correct build environment and write Julia installation management recipes. ## Installing ```sh # As an jlenv plugin -$ mkdir -p "$(jlenv root)"/plugins -$ git clone https://github.com/jlenv/julia-build.git "$(jlenv root)"/plugins/julia-build +mkdir -p "$(jlenv root)"/plugins +git clone https://github.com/jlenv/julia-build.git "$(jlenv root)"/plugins/julia-build # As a standalone program -$ git clone https://github.com/jlenv/julia-build.git -$ PREFIX=/usr/local ./julia-build/install.sh +git clone https://github.com/jlenv/julia-build.git +PREFIX=/usr/local ./julia-build/install.sh ``` ## Upgrading @@ -77,6 +77,7 @@ First locate it on your system: which julia-build ls "$(jlenv root)"/plugins ``` + - Or, if you have it installed via git as an jlenv plugin: ```sh cd "$(jlenv root)"/plugins/julia-build && git pull ``` + ## Contributing Adding a Julia release is as simple as: -1. Identify the Julia [tag]() string. Example: `v1.3.0-alpha`. -1. Copy one of the files in this rep's folder `share\julia-build`. Give it - the tag string as a name: `cp .\share\juila-build\v1.0.0 .\share\juila-build\v1.3.0-alpha` -1. Open the newly created file and replace occurances of `v1.0.0` with `v1.3.0-alpha` +1. Identify the Julia [tag](https://github.com/JuliaLang/julia/release) string. +Example: `v1.1.0-rc2`. +1. Copy one of the files in this rep's folder `share\julia-build`. Give it + the tag string as a name: `cp .\share\juila-build\v1.0.0 .\share\juila-build\v1.1.0-rc2` +1. Open the newly created file and replace occurances of `v1.0.0` with `v1.1.0-rc2` ### Running BATS test suite -It is only neccessary to run the [BATS](https://github.com/sstephenson/bats) +It is only neccessary to run the [BATS](https://github.com/sstephenson/bats) test suite if functionality is added or a bug is fixed. -Please add tests that exercise the functionality added, or guard against the +Please add tests that exercise the functionality added, or guard against the bug regressions. To run tests: ```bash @@ -116,8 +118,8 @@ script\test ### GCC compatibility -Julia is currently built using `gcc-5`. The Julia build script points this to -`gcc`. +Julia is currently built using `gcc-5`. +The Julia build script points this to `gcc`. ### Suggested build environment @@ -130,13 +132,13 @@ environment. * **Chef (zero), etc.:** If you don't already, we suggest you manage software installation - prerequisites, environment and configuration using one of - [Chef](https://www.chef.io/) ([Zero](https://github.com/chef/chef-zero)), - [Ansible](https://www.ansible.com), [Salt](https://www.saltstack.com), + prerequisites, environment and configuration using one of + [Chef](https://www.chef.io/) ([Zero](https://github.com/chef/chef-zero)), + [Ansible](https://www.ansible.com), [Salt](https://www.saltstack.com), [Puppet](https://puppet.com/), etc. - In the case of [Chef](https://www.chef.io/) ([Zero](https://github.com/chef/chef-zero)) - the [jlenv](https://github.com/jlenv/jlenv-cookbook) cookbook provides the - [resources](https://docs.chef.io/resource.html) to write Julia installation + In the case of [Chef](https://www.chef.io/) ([Zero](https://github.com/chef/chef-zero)) + the [jlenv](https://github.com/jlenv/jlenv-cookbook) cookbook provides the + [resources](https://docs.chef.io/resource.html) to write Julia installation management recipes. * **macOS:** @@ -147,23 +149,26 @@ environment. ```sh brew install ``` - Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv) - package [dependencies file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) + + Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv-cookbook) + package dependencies [file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) * **Ubuntu/Debian/Mint:** ```sh apt-get install -y ``` - Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv) - package [dependencies file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) + + Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv-cookbook) + package dependencies [file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) * **CentOS/Fedora:** ```sh yum install -y ``` - Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv) + + Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv-cookbook) package [dependencies file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) * **openSUSE:** @@ -171,8 +176,9 @@ environment. ```sh zypper install -y ``` - Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv) - package [dependencies file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) + + Where the package-dependencies are defined in the [jlenv-cookbook](https://github.com/jlenv/jlenv-cookbook) + package dependencies [file](https://github.com/jlenv/jlenv-cookbook/blob/master/libraries/package_deps.rb#L38) * **Arch Linux:** @@ -180,50 +186,68 @@ T.B.A. ## Troubleshooting +***NOTE:*** + +Julia [README](https://github.com/JuliaLang/julia) states: +> “Building Julia requires 2GiB of disk space and approximately 4GiB of virtual memory.” + ### "mkdir: /Volumes/Macintosh: Not a directory" -This can occur if you have [more than one disk drive](https://github.com/sstephenson/ruby-build/issues/748#issuecomment-95143238) +This can occur if you have [more than one disk drive](https://github.com/sstephenson/ruby-build/issues/748#issuecomment-95143238) and your home directory is physically mounted on a volume that might have a space in its name, such as "Macintosh HD": -``` +```sh $ df /dev/disk2 ... / /dev/disk1s2 ... /Volumes/Macintosh HD ``` -The easiest solution is to avoid building a Julia version to any path that has space characters in it. So instead of building into `~/.jlenv/versions/`, which is the default for `jlenv install `, instead you could install into `/opt/julias/` and symlink `/opt/julias` as `~/.jlenv/versions` so jlenv continues to work as before: +The easiest solution is to avoid building a Julia version to any path that has +space characters in it. +Instead of building into `~/.jlenv/versions/`, which is the default +for `jlenv install `, you could install into `/opt/julias/` +and symlink `/opt/julias` as `~/.jlenv/versions` so jlenv continues to work +as before: ```sh sudo mkdir -p /opt/julias sudo chown "${USER}:staff" /opt/julias -rm -rf ~/.jlenv/versions # This will DELETE your existing Julia versions! +# THIS WILL DELETE YOUR EXISTING JULIA VERSIONS! +rm -rf ~/.jlenv/versions ln -s /opt/julias ~/.jlenv/versions ``` Now proceed as following: -``` +```sh julia-build /opt/julias/ ``` ### No space left on device -Some distributions will mount a tmpfs partition with low disk space to `/tmp`, such as 250 MB. You can check this with: +Some distributions will mount a tmpfs partition with low disk space to `/tmp`, +such as 250 MB. You can check this with: - mount | grep tmp - df -h | grep tmp +```sh +mount | grep tmp +df -h | grep tmp +``` -Compiling Julia can require up to 4 or 5GiB, so you should temporarily resize `/tmp` to allow more usage: +Compiling Julia can require up to 4 or 5GiB, so you should temporarily +resize `/tmp` to allow more usage: - rm -rf /tmp/julia-build* - mount -o remount,size=5G,noatime /tmp +```sh +rm -rf /tmp/julia-build* +mount -o remount,size=5G,noatime /tmp +``` ### Lower the number of parallel jobs -On hosts that report a large amount of CPU cores, but don't have plenty of RAM, you might get: +On hosts that report a large amount of CPU cores, but don't have plenty of RAM, +you might get: -``` +```sh gcc: internal compiler error: Killed (program cc1) ``` @@ -245,27 +269,27 @@ TMPDIR=~/tmp MAKE_OPTS=-j2 jlenv install 1.0.3 ```sh # As an jlenv plugin -$ jlenv install --list # lists all available versions of Julia -$ jlenv install v1.0.1 # installs Julia v1.0.1 to ~/.jlenv/versions +jlenv install --list # lists all available versions of Julia +jlenv install v1.0.1 # installs Julia v1.0.1 to ~/.jlenv/versions # As a standalone program -$ julia-build --definitions # lists all available versions of Julia -$ julia-build 1.0.1 ~/local/julia-v1.0.1 # installs Julia v1.0.1 to ~/local/julia-1.0.1 +julia-build --definitions # lists all available versions of Julia +julia-build 1.0.1 ~/local/julia-v1.0.1 # installs Julia v1.0.1 to ~/local/julia-1.0.1 ``` -julia-build does not check for system dependencies before downloading and -attempting to compile the Julia source. Please ensure that [all required -libraries](https://github.com/JuliaLang/julia#required-build-tools-and-external-libraries) are available on your system. +`julia-build` does not check for system dependencies before downloading and +attempting to compile the Julia source. +Please ensure that [all required libraries](https://github.com/JuliaLang/julia#required-build-tools-and-external-libraries) are available on your system. ### Advanced Usage #### Custom Build Definitions If you wish to develop and install a version of Julia that is not yet supported -by julia-build, you may specify the path to a custom “build definition file” in -place of a Julia version number. +by `julia-build`, you may specify the path to a custom “build definition file” +in place of a Julia version number. -Use the [default build definitions][definitions] as a template for your custom +Use the [default build definitions][jldefs] as a template for your custom definitions. #### Custom Build Configuration @@ -274,7 +298,7 @@ The build process may be configured through the following environment variables: | Variable | Function | | ------------------------ | ------------------------------------------------------------------------------------------------ | -| `TMPDIR` | Where temporary files are stored. | +| `TMPDIR` | Where temporary files are stored. | | `JULIA_BUILD_BUILD_PATH` | Where sources are downloaded and built. (Default: a timestamped subdirectory of `TMPDIR`) | | `JULIA_BUILD_CACHE_PATH` | Where to cache downloaded package files. (Default: `~/.jlenv/cache` if invoked as jlenv plugin) | | `JULIA_BUILD_MIRROR_URL` | Custom mirror URL root. | @@ -299,13 +323,13 @@ read from `STDIN`: ```sh # applying a single patch -$ jlenv install --patch 1.0.3-p4 < /path/to/julia.patch +jlenv install --patch 1.0.3-p4 < /path/to/julia.patch # applying a patch from HTTP -$ jlenv install --patch 1.0.3-p4 < <(curl -sSL http://git.io/julia.patch) +jlenv install --patch 1.0.3-p4 < <(curl -sSL http://git.io/julia.patch) # applying multiple patches -$ cat fix1.patch fix2.patch | jlenv install --patch 1.0.3-p4 +cat fix1.patch fix2.patch | jlenv install --patch 1.0.3-p4 ``` #### Checksum Verification @@ -333,7 +357,7 @@ variable when using `--keep` with `julia-build`. Build definitions are simple shell scripts that get sourced in the `julia-build` environment so they can invoke functions that fetch necessary packages and compile them into the destination directory. The complete list of -[Julia definitions](https://github.com/jlenv/julia-build/tree/master/share/julia-build) +[Julia definitions][jldefs] is here. The basic invocation from a build definition is the function to download and @@ -369,21 +393,21 @@ install_svn PACKAGE_NAME SVN_URL REVISION [...] ### Build steps -#### Pre-build steps: +#### Pre-build steps * **ldflags_dirs**: Ensures that directories listed in `LDFLAGS` exist. * **auto_tcltk**: Detects XQuartz on OS X or disables TK. * **autoconf**: Runs `autoconf`. Prerequisite for "standard" step when fetching Julia versions from git/SVN. -#### Build steps: +#### Build steps * **standard**: `./configure` + `make`. This is the default. * **topaz**: copies over pre-built Topaz. * **julia**: `julia setup.jl`. Used when installing Julia Packages. * **mac_openssl**: builds OpenSSL on OS X. -#### Post-build steps: +#### Post-build steps * **verify_openssl**: Checks that openssl extension can be loaded. @@ -418,3 +442,5 @@ before_install_package() { install_package ... ``` + +[jldefs]: https://github.com/jlenv/julia-build/tree/master/share/julia-build \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml index 6ee0d2e..acfa36a 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,19 +1,14 @@ --- -title: Your awesome title +title: Julia-build email: mark@taqtiqa.com description: > # this means to ignore newlines until "baseurl:" - Jlenv. Compile and install multiple versions of Julia. [Julia](https://www.julialang.org/). + Build and install multiple versions of Julia. github_username: jlenv include_related_posts: true plugins: - jekyll-relative-links + - jekyll-remote-theme relative_links: enabled: true collections: true -include: - - README.md - - LICENSE.md - - ISSUE_TEMPLATE.md - - PULL_REQUEST_TEMPLATE.md - - CONTRIBUTING.md - - CONDUCT.md +remote_theme: pmarsceill/just-the-docs From e32de4a1f912c5b94c154b90292f3c0cdbdecb7b Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 31 Oct 2019 15:35:44 +1100 Subject: [PATCH 13/19] Move gh markdown toc generator. --- test/gh-md-toc | 281 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 281 insertions(+) create mode 100755 test/gh-md-toc diff --git a/test/gh-md-toc b/test/gh-md-toc new file mode 100755 index 0000000..792d6ff --- /dev/null +++ b/test/gh-md-toc @@ -0,0 +1,281 @@ +#!/usr/bin/env bash + +# +# Steps: +# +# 1. Download corresponding html file for some README.md: +# curl -s $1 +# +# 2. Discard rows where no substring 'user-content-' (github's markup): +# awk '/user-content-/ { ... +# +# 3.1 Get last number in each row like ' ... sitemap.js.*<\/h/)+2, RLENGTH-5) +# +# 5. Find anchor and insert it inside "(...)": +# substr($0, match($0, "href=\"[^\"]+?\" ")+6, RLENGTH-8) +# + +gh_toc_version="0.6.1" + +gh_user_agent="gh-md-toc v$gh_toc_version" + +# +# Download rendered into html README.md by its url. +# +# +gh_toc_load() { + local gh_url=$1 + + if type curl &>/dev/null; then + curl --user-agent "$gh_user_agent" -s "$gh_url" + elif type wget &>/dev/null; then + wget --user-agent="$gh_user_agent" -qO- "$gh_url" + else + echo "Please, install 'curl' or 'wget' and try again." + exit 1 + fi +} + +# +# Converts local md file into html by GitHub +# +# ➥ curl -X POST --data '{"text": "Hello world github/linguist#1 **cool**, and #1!"}' https://api.github.com/markdown +#

Hello world github/linguist#1 cool, and #1!

'" +gh_toc_md2html() { + local gh_file_md=$1 + URL=https://api.github.com/markdown/raw + if [ ! -z "$GH_TOC_TOKEN" ]; then + TOKEN=$GH_TOC_TOKEN + else + TOKEN="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" + fi + if [ -f "$TOKEN" ]; then + URL="$URL?access_token=$(cat $TOKEN)" + fi + # echo $URL 1>&2 + OUTPUT="$(curl -s --user-agent "$gh_user_agent" \ + --data-binary @"$gh_file_md" -H "Content-Type:text/plain" \ + $URL)" + + if [ "$?" != "0" ]; then + echo "XXNetworkErrorXX" + fi + if [ "$(echo "${OUTPUT}" | awk '/API rate limit exceeded/')" != "" ]; then + echo "XXRateLimitXX" + else + echo "${OUTPUT}" + fi +} + + +# +# Is passed string url +# +gh_is_url() { + case $1 in + https* | http*) + echo "yes";; + *) + echo "no";; + esac +} + +# +# TOC generator +# +gh_toc(){ + local gh_src=$1 + local gh_src_copy=$1 + local gh_ttl_docs=$2 + local need_replace=$3 + + if [ "$gh_src" = "" ]; then + echo "Please, enter URL or local path for a README.md" + exit 1 + fi + + + # Show "TOC" string only if working with one document + if [ "$gh_ttl_docs" = "1" ]; then + + echo "Table of Contents" + echo "=================" + echo "" + gh_src_copy="" + + fi + + if [ "$(gh_is_url "$gh_src")" == "yes" ]; then + gh_toc_load "$gh_src" | gh_toc_grab "$gh_src_copy" + if [ "${PIPESTATUS[0]}" != "0" ]; then + echo "Could not load remote document." + echo "Please check your url or network connectivity" + exit 1 + fi + if [ "$need_replace" = "yes" ]; then + echo + echo "!! '$gh_src' is not a local file" + echo "!! Can't insert the TOC into it." + echo + fi + else + local rawhtml=$(gh_toc_md2html "$gh_src") + if [ "$rawhtml" == "XXNetworkErrorXX" ]; then + echo "Parsing local markdown file requires access to github API" + echo "Please make sure curl is installed and check your network connectivity" + exit 1 + fi + if [ "$rawhtml" == "XXRateLimitXX" ]; then + echo "Parsing local markdown file requires access to github API" + echo "Error: You exceeded the hourly limit. See: https://developer.github.com/v3/#rate-limiting" + TOKEN="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" + echo "or place github auth token here: $TOKEN" + exit 1 + fi + local toc=`echo "$rawhtml" | gh_toc_grab "$gh_src_copy"` + echo "$toc" + if [ "$need_replace" = "yes" ]; then + if grep -Fxq "" $gh_src && grep -Fxq "" $gh_src; then + echo "Found markers" + else + echo "You don't have or in your file...exiting" + exit 1 + fi + local ts="<\!--ts-->" + local te="<\!--te-->" + local dt=`date +'%F_%H%M%S'` + local ext=".orig.${dt}" + local toc_path="${gh_src}.toc.${dt}" + local toc_footer="" + # http://fahdshariff.blogspot.ru/2012/12/sed-mutli-line-replacement-between-two.html + # clear old TOC + sed -i${ext} "/${ts}/,/${te}/{//!d;}" "$gh_src" + # create toc file + echo "${toc}" > "${toc_path}" + echo -e "\n${toc_footer}\n" >> "$toc_path" + # insert toc file + if [[ "`uname`" == "Darwin" ]]; then + sed -i "" "/${ts}/r ${toc_path}" "$gh_src" + else + sed -i "/${ts}/r ${toc_path}" "$gh_src" + fi + echo + echo "!! TOC was added into: '$gh_src'" + echo "!! Origin version of the file: '${gh_src}${ext}'" + echo "!! TOC added into a separate file: '${toc_path}'" + echo + fi + fi +} + +# +# Grabber of the TOC from rendered html +# +# $1 — a source url of document. +# It's need if TOC is generated for multiple documents. +# +gh_toc_grab() { + # if closed is on the new line, then move it on the prev line + # for example: + # was: The command foo1 + # + # became: The command foo1 + sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<\/h/<\/h/g' | + # find strings that corresponds to template + grep -E -o '//g' | sed 's/<\/code>//g' | + # now all rows are like: + # ... .*<\/h/)+2, RLENGTH-5) + href = substr($0, match($0, "href=\"[^\"]+?\"")+6, RLENGTH-7) + print sprintf("%*s", level*3, " ") "* [" text "](" gh_url href ")" }' | + sed 'y/+/ /; s/%/\\x/g')" +} + +# +# Returns filename only from full path or url +# +gh_toc_get_filename() { + echo "${1##*/}" +} + +# +# Options hendlers +# +gh_toc_app() { + local need_replace="no" + + if [ "$1" = '--help' ] || [ $# -eq 0 ] ; then + local app_name=$(basename "$0") + echo "GitHub TOC generator ($app_name): $gh_toc_version" + echo "" + echo "Usage:" + echo " $app_name [--insert] src [src] Create TOC for a README file (url or local path)" + echo " $app_name - Create TOC for markdown from STDIN" + echo " $app_name --help Show help" + echo " $app_name --version Show version" + return + fi + + if [ "$1" = '--version' ]; then + echo "$gh_toc_version" + echo + echo "os: `lsb_release -d | cut -f 2`" + echo "kernel: `cat /proc/version`" + echo "shell: `$SHELL --version`" + echo + for tool in curl wget grep awk sed; do + printf "%-5s: " $tool + echo `$tool --version | head -n 1` + done + return + fi + + if [ "$1" = "-" ]; then + if [ -z "$TMPDIR" ]; then + TMPDIR="/tmp" + elif [ -n "$TMPDIR" -a ! -d "$TMPDIR" ]; then + mkdir -p "$TMPDIR" + fi + local gh_tmp_md + gh_tmp_md=$(mktemp $TMPDIR/tmp.XXXXXX) + while read input; do + echo "$input" >> "$gh_tmp_md" + done + gh_toc_md2html "$gh_tmp_md" | gh_toc_grab "" + return + fi + + if [ "$1" = '--insert' ]; then + need_replace="yes" + shift + fi + + for md in "$@" + do + echo "" + gh_toc "$md" "$#" "$need_replace" + done + + echo "" + echo "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)" +} + +# +# Entry point +# +gh_toc_app "$@" From 5df2fd4ad6194e17bf1fe5c386faa6007d40bd6c Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 31 Oct 2019 15:55:50 +1100 Subject: [PATCH 14/19] Add docs. --- CONDUCT.md | 80 --------- README.md | 4 +- docs/{LICENSE.md => license.md} | 0 docs/{README.md => readme.md} | 0 gh-md-toc | 281 -------------------------------- 5 files changed, 2 insertions(+), 363 deletions(-) delete mode 100644 CONDUCT.md rename docs/{LICENSE.md => license.md} (100%) rename docs/{README.md => readme.md} (100%) delete mode 100755 gh-md-toc diff --git a/CONDUCT.md b/CONDUCT.md deleted file mode 100644 index aebb789..0000000 --- a/CONDUCT.md +++ /dev/null @@ -1,80 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting one of the project maintainers listed below. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Project Maintainers - -* Sam Stephenson <> -* Mislav Marohnić <> -* Erik Michaels-Ober <> - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/README.md b/README.md index 43e15ea..936af3f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # julia-build -[![Build Status](https://travis-ci.com/jlenv/julia-build.svg?branch=master)](https://travis-ci.com/jlenv/julia-build)[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d33f741a507b4cee99ab9d4931ae1163)](https://www.codacy.com/manual/taqtiqa-mark/jlenv-julia-build?utm_source=github.com&utm_medium=referral&utm_content=jlenv/julia-build&utm_campaign=Badge_Grade)[![CodeFactor](https://www.codefactor.io/repository/github/jlenv/julia-build/badge)](https://www.codefactor.io/repository/github/jlenv/julia-build) +[![Build Status](https://travis-ci.com/jlenv/julia-build.svg?branch=master)](https://travis-ci.com/jlenv/julia-build)[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d33f741a507b4cee99ab9d4931ae1163)](https://www.codacy.com/manual/taqtiqa-mark/jlenv-julia-build?utm_source=github.com&utm_medium=referral&utm_content=jlenv/julia-build&utm_campaign=Badge_Grade)[![CodeFactor](https://www.codefactor.io/repository/github/jlenv/julia-build/badge)](https://www.codefactor.io/repository/github/jlenv/julia-build) [![Coverage Status](https://coveralls.io/repos/github/jlenv/jlenv/badge.svg?branch=master)](https://coveralls.io/github/jlenv/jlenv?branch=master) [![codecov](https://codecov.io/gh/jlenv/julia-build/branch/master/graph/badge.svg)](https://codecov.io/gh/jlenv/julia-build) `julia-build` is a command-line utility tool that makes it easy to compile, install and remove virtually any version of [Julia](https://www.julialang.org), @@ -72,4 +72,4 @@ for more detail and solutions to common problems. ## Requested Contributor Conduct In the interest of fostering an excellent code base, we try to encourage anyone -to participate in our project. Please do likewise. \ No newline at end of file +to participate in our project. Please do likewise. diff --git a/docs/LICENSE.md b/docs/license.md similarity index 100% rename from docs/LICENSE.md rename to docs/license.md diff --git a/docs/README.md b/docs/readme.md similarity index 100% rename from docs/README.md rename to docs/readme.md diff --git a/gh-md-toc b/gh-md-toc deleted file mode 100755 index 792d6ff..0000000 --- a/gh-md-toc +++ /dev/null @@ -1,281 +0,0 @@ -#!/usr/bin/env bash - -# -# Steps: -# -# 1. Download corresponding html file for some README.md: -# curl -s $1 -# -# 2. Discard rows where no substring 'user-content-' (github's markup): -# awk '/user-content-/ { ... -# -# 3.1 Get last number in each row like ' ... sitemap.js.*<\/h/)+2, RLENGTH-5) -# -# 5. Find anchor and insert it inside "(...)": -# substr($0, match($0, "href=\"[^\"]+?\" ")+6, RLENGTH-8) -# - -gh_toc_version="0.6.1" - -gh_user_agent="gh-md-toc v$gh_toc_version" - -# -# Download rendered into html README.md by its url. -# -# -gh_toc_load() { - local gh_url=$1 - - if type curl &>/dev/null; then - curl --user-agent "$gh_user_agent" -s "$gh_url" - elif type wget &>/dev/null; then - wget --user-agent="$gh_user_agent" -qO- "$gh_url" - else - echo "Please, install 'curl' or 'wget' and try again." - exit 1 - fi -} - -# -# Converts local md file into html by GitHub -# -# ➥ curl -X POST --data '{"text": "Hello world github/linguist#1 **cool**, and #1!"}' https://api.github.com/markdown -#

Hello world github/linguist#1 cool, and #1!

'" -gh_toc_md2html() { - local gh_file_md=$1 - URL=https://api.github.com/markdown/raw - if [ ! -z "$GH_TOC_TOKEN" ]; then - TOKEN=$GH_TOC_TOKEN - else - TOKEN="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" - fi - if [ -f "$TOKEN" ]; then - URL="$URL?access_token=$(cat $TOKEN)" - fi - # echo $URL 1>&2 - OUTPUT="$(curl -s --user-agent "$gh_user_agent" \ - --data-binary @"$gh_file_md" -H "Content-Type:text/plain" \ - $URL)" - - if [ "$?" != "0" ]; then - echo "XXNetworkErrorXX" - fi - if [ "$(echo "${OUTPUT}" | awk '/API rate limit exceeded/')" != "" ]; then - echo "XXRateLimitXX" - else - echo "${OUTPUT}" - fi -} - - -# -# Is passed string url -# -gh_is_url() { - case $1 in - https* | http*) - echo "yes";; - *) - echo "no";; - esac -} - -# -# TOC generator -# -gh_toc(){ - local gh_src=$1 - local gh_src_copy=$1 - local gh_ttl_docs=$2 - local need_replace=$3 - - if [ "$gh_src" = "" ]; then - echo "Please, enter URL or local path for a README.md" - exit 1 - fi - - - # Show "TOC" string only if working with one document - if [ "$gh_ttl_docs" = "1" ]; then - - echo "Table of Contents" - echo "=================" - echo "" - gh_src_copy="" - - fi - - if [ "$(gh_is_url "$gh_src")" == "yes" ]; then - gh_toc_load "$gh_src" | gh_toc_grab "$gh_src_copy" - if [ "${PIPESTATUS[0]}" != "0" ]; then - echo "Could not load remote document." - echo "Please check your url or network connectivity" - exit 1 - fi - if [ "$need_replace" = "yes" ]; then - echo - echo "!! '$gh_src' is not a local file" - echo "!! Can't insert the TOC into it." - echo - fi - else - local rawhtml=$(gh_toc_md2html "$gh_src") - if [ "$rawhtml" == "XXNetworkErrorXX" ]; then - echo "Parsing local markdown file requires access to github API" - echo "Please make sure curl is installed and check your network connectivity" - exit 1 - fi - if [ "$rawhtml" == "XXRateLimitXX" ]; then - echo "Parsing local markdown file requires access to github API" - echo "Error: You exceeded the hourly limit. See: https://developer.github.com/v3/#rate-limiting" - TOKEN="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" - echo "or place github auth token here: $TOKEN" - exit 1 - fi - local toc=`echo "$rawhtml" | gh_toc_grab "$gh_src_copy"` - echo "$toc" - if [ "$need_replace" = "yes" ]; then - if grep -Fxq "" $gh_src && grep -Fxq "" $gh_src; then - echo "Found markers" - else - echo "You don't have or in your file...exiting" - exit 1 - fi - local ts="<\!--ts-->" - local te="<\!--te-->" - local dt=`date +'%F_%H%M%S'` - local ext=".orig.${dt}" - local toc_path="${gh_src}.toc.${dt}" - local toc_footer="" - # http://fahdshariff.blogspot.ru/2012/12/sed-mutli-line-replacement-between-two.html - # clear old TOC - sed -i${ext} "/${ts}/,/${te}/{//!d;}" "$gh_src" - # create toc file - echo "${toc}" > "${toc_path}" - echo -e "\n${toc_footer}\n" >> "$toc_path" - # insert toc file - if [[ "`uname`" == "Darwin" ]]; then - sed -i "" "/${ts}/r ${toc_path}" "$gh_src" - else - sed -i "/${ts}/r ${toc_path}" "$gh_src" - fi - echo - echo "!! TOC was added into: '$gh_src'" - echo "!! Origin version of the file: '${gh_src}${ext}'" - echo "!! TOC added into a separate file: '${toc_path}'" - echo - fi - fi -} - -# -# Grabber of the TOC from rendered html -# -# $1 — a source url of document. -# It's need if TOC is generated for multiple documents. -# -gh_toc_grab() { - # if closed is on the new line, then move it on the prev line - # for example: - # was: The command foo1 - # - # became: The command foo1 - sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<\/h/<\/h/g' | - # find strings that corresponds to template - grep -E -o '//g' | sed 's/<\/code>//g' | - # now all rows are like: - # ... .*<\/h/)+2, RLENGTH-5) - href = substr($0, match($0, "href=\"[^\"]+?\"")+6, RLENGTH-7) - print sprintf("%*s", level*3, " ") "* [" text "](" gh_url href ")" }' | - sed 'y/+/ /; s/%/\\x/g')" -} - -# -# Returns filename only from full path or url -# -gh_toc_get_filename() { - echo "${1##*/}" -} - -# -# Options hendlers -# -gh_toc_app() { - local need_replace="no" - - if [ "$1" = '--help' ] || [ $# -eq 0 ] ; then - local app_name=$(basename "$0") - echo "GitHub TOC generator ($app_name): $gh_toc_version" - echo "" - echo "Usage:" - echo " $app_name [--insert] src [src] Create TOC for a README file (url or local path)" - echo " $app_name - Create TOC for markdown from STDIN" - echo " $app_name --help Show help" - echo " $app_name --version Show version" - return - fi - - if [ "$1" = '--version' ]; then - echo "$gh_toc_version" - echo - echo "os: `lsb_release -d | cut -f 2`" - echo "kernel: `cat /proc/version`" - echo "shell: `$SHELL --version`" - echo - for tool in curl wget grep awk sed; do - printf "%-5s: " $tool - echo `$tool --version | head -n 1` - done - return - fi - - if [ "$1" = "-" ]; then - if [ -z "$TMPDIR" ]; then - TMPDIR="/tmp" - elif [ -n "$TMPDIR" -a ! -d "$TMPDIR" ]; then - mkdir -p "$TMPDIR" - fi - local gh_tmp_md - gh_tmp_md=$(mktemp $TMPDIR/tmp.XXXXXX) - while read input; do - echo "$input" >> "$gh_tmp_md" - done - gh_toc_md2html "$gh_tmp_md" | gh_toc_grab "" - return - fi - - if [ "$1" = '--insert' ]; then - need_replace="yes" - shift - fi - - for md in "$@" - do - echo "" - gh_toc "$md" "$#" "$need_replace" - done - - echo "" - echo "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)" -} - -# -# Entry point -# -gh_toc_app "$@" From 1e3016ad52a0aabb337021e9735218f2fafffdd2 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 31 Oct 2019 15:56:16 +1100 Subject: [PATCH 15/19] Add version 1.0.0 string. --- bin/julia-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/julia-build b/bin/julia-build index 0955dc4..06a2fd9 100755 --- a/bin/julia-build +++ b/bin/julia-build @@ -16,7 +16,7 @@ # - hostnamectl (Disambiguates Centos, Ubuntu etc.) # - alternatives (Redhat family) update-alternatives (Debian family) -JULIA_BUILD_VERSION="20190821" +JULIA_BUILD_VERSION="1.0.0" OLDIFS="$IFS" From 3b5f9a7e614ab0824acd3705267b8f5c3c2ddc83 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 31 Oct 2019 15:56:47 +1100 Subject: [PATCH 16/19] Add build scripts. Travis config. --- .travis.yml | 57 ++++++++++++++++++++++++++++++++++++++++------ script/release | 46 ------------------------------------- script/report | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ script/test | 3 +-- 4 files changed, 113 insertions(+), 55 deletions(-) delete mode 100755 script/release create mode 100755 script/report diff --git a/.travis.yml b/.travis.yml index e7a13b4..c092829 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,50 @@ -sudo: false -install: git clone --depth 1 https://github.com/sstephenson/bats.git -script: PATH="./bats/bin:$PATH" script/test -language: c -notifications: - email: - on_success: never +after_success: + - bash <(curl -s https://codecov.io/bash) + - bash <(curl -s https://codecov.io/bash) +before_install: "gem update --system --no-doc" +before_script: + - "whereis bash" + - "bash --version" + - ./test/install_bash.bash + - "bash --version" + - "git clone https://github.com/infertux/bashcov.git" + - "cd bashcov/" + - "gem build bashcov.gemspec" + - "gem install bashcov-2.0.0.gem" + - "export PATH=$PATH:$PWD" + - "cd .." + - "gem install codecov" + - "gem install coveralls" + - "gem install codeclimate-test-reporter" +cache: + directories: + - bash +env: + matrix: + - INSTALL_BASH_VERSION=5.0 + - INSTALL_BASH_VERSION=4.4 + - INSTALL_BASH_VERSION=4.3 + - INSTALL_BASH_VERSION=4.2.53 + - INSTALL_BASH_VERSION=4.1 + - INSTALL_BASH_VERSION=4.0 +language: ruby +matrix: + allow_failures: + - + env: INSTALL_BASH_VERSION=4.2.53 + - + env: INSTALL_BASH_VERSION=4.1 + - + env: INSTALL_BASH_VERSION=4.0 + include: + - + rvm: "2.5.5" +os: + - linux +rvm: + - "2.5.5" +script: + - (bashcov script/test || true) + - bash script/test + - (bash script/report || true) +sudo: required diff --git a/script/release b/script/release deleted file mode 100755 index c885b77..0000000 --- a/script/release +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash -# Usage: script/release -# -# - checks out the master branch -# - changes version in `bin/julia-build` to current date -# - commits and tags the change -# - pushes master + tag to GitHub -# - opens pull request to update the Homebrew formula -# -# TODO: handle making multiple releases on the same date - -set -e - -git fetch -q --tags origin master - -existing="$(git tag --points-at HEAD)" -if [ -n "$existing" ]; then - echo "Aborting: HEAD is already tagged as '${existing}'" >&2 - exit 1 -fi - -git checkout -q master - -binfile="bin/julia-build" -new_version="$(date '+%Y%m%d')" -version_tag="v${new_version}" -previous_tag="$(git tag | grep '^v' | sort | tail -1)" - -if git diff --quiet "${previous_tag}..HEAD" -- bin share; then - echo "Aborting: No features to release since '${previous_tag}'" >&2 - exit 1 -fi - -sed -i.bak -E "s!^(JULIA_BUILD_VERSION=).+!\\1\"${new_version}\"!" "$binfile" -rm -f "${binfile}.bak" - -git commit -m "julia-build ${new_version}" "$binfile" -git tag "$version_tag" -git push origin master "${version_tag}" - -{ echo "julia-build ${new_version}" - echo - git log --no-merges --format='%w(0,0,2)* %B' --reverse "${previous_tag}..HEAD^" -- bin share -} | hub release create -dF - "$version_tag" || true - -script/brew-publish julia-build jlenv/julia-build "$version_tag" diff --git a/script/report b/script/report new file mode 100755 index 0000000..0bd7324 --- /dev/null +++ b/script/report @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +# DESC: Generic script initialisation (useful paths) +# ARGS: $@ (optional): Arguments provided to the script +# OUTS: $orig_cwd: The current working directory when the script was run +# $script_path: The full path to the script +# $script_dir: The directory path of the script +# $script_name: The file name of the script +# $script_params: The original parameters provided to the script +# $ta_none: The ANSI control code to reset all text attributes +# NOTE: $script_path only contains the path that was used to call the script +# and will not resolve any symlinks which may be present in the path. +# You can use a tool like GNU CoreUtils readlink or realpath to obtain +# the "true" path. +# The same caveat applies to the $script_dir and $script_name variables. +function script_init() { + + readonly orig_cwd="$PWD" + readonly script_path="${BASH_SOURCE[0]}" + readonly script_dir="$( cd "$( dirname "${script_path}" )" >/dev/null 2>&1 && pwd )" + readonly script_name="$(basename "$script_path")" + readonly script_params="$*" + + # Important to always set as we use it in the exit handler + readonly ta_none="$(tput sgr0 2> /dev/null || true)" +} + +bats_table() +{ + echo 'Bats test failed count:' + cat bats.log | + sed -e '/^not ok\|\.bats/!d' | + tr '[:space:]' '[\n*]' | + sort | + uniq -c | + sort -nr | + grep bats | tee bats.tbl +} + +bats_not_descriptions() +{ + cat bats.log| + sed -e '/^not ok/!d'| + cut -f4- -d ' ' >bats.not +} + +bats_not_cmds() +{ + echo 'export JLENV_DEBUG=1' >bats_not.cmds + cat bats.not | while read -r line; do echo "${script_dir}/libs/bats/bin/bats -f '${line}' test" >>bats_not.cmds; done +} + +script_init + +bats_table +bats_not_descriptions +bats_not_cmds + +cat bats.tbl +cat bats_not.cmds + +bash bats_not.cmds || true diff --git a/script/test b/script/test index 7eebee0..6624d0e 100755 --- a/script/test +++ b/script/test @@ -2,6 +2,5 @@ set -e STATUS=0 -bats ${CI:+--tap} test || STATUS="$?" - +bats ${CI:+--tap} test | tee bats.log || STATUS="$?" exit "$STATUS" From 6f3363e989289d9975942d1b411a910fe3c29c1a Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 31 Oct 2019 15:57:02 +1100 Subject: [PATCH 17/19] Add GH pages config. --- docs/_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_config.yml b/docs/_config.yml index acfa36a..9d6b0c1 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,7 +1,7 @@ --- title: Julia-build email: mark@taqtiqa.com -description: > # this means to ignore newlines until "baseurl:" +description: > # this means to ignore newlines until next element Build and install multiple versions of Julia. github_username: jlenv include_related_posts: true From 0e8920ae7e45bf96950e10ee22e91ee543b205ea Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 31 Oct 2019 15:57:29 +1100 Subject: [PATCH 18/19] Add 1.3.0-rc1-3 build definitions. --- share/julia-build/v1.3.0-rc2 | 1 + share/julia-build/v1.3.0-rc3 | 1 + share/julia-build/v1.3.0-rc4 | 1 + 3 files changed, 3 insertions(+) create mode 100644 share/julia-build/v1.3.0-rc2 create mode 100644 share/julia-build/v1.3.0-rc3 create mode 100644 share/julia-build/v1.3.0-rc4 diff --git a/share/julia-build/v1.3.0-rc2 b/share/julia-build/v1.3.0-rc2 new file mode 100644 index 0000000..34f7ebd --- /dev/null +++ b/share/julia-build/v1.3.0-rc2 @@ -0,0 +1 @@ +install_git "julia-v1.3.0-rc2" "https://github.com/JuliaLang/julia.git" "v1.3.0-rc2" "julia" diff --git a/share/julia-build/v1.3.0-rc3 b/share/julia-build/v1.3.0-rc3 new file mode 100644 index 0000000..0383e3c --- /dev/null +++ b/share/julia-build/v1.3.0-rc3 @@ -0,0 +1 @@ +install_git "julia-v1.3.0-rc3" "https://github.com/JuliaLang/julia.git" "v1.3.0-rc3" "julia" diff --git a/share/julia-build/v1.3.0-rc4 b/share/julia-build/v1.3.0-rc4 new file mode 100644 index 0000000..ed8fd9d --- /dev/null +++ b/share/julia-build/v1.3.0-rc4 @@ -0,0 +1 @@ +install_git "julia-v1.3.0-rc4" "https://github.com/JuliaLang/julia.git" "v1.3.0-rc4" "julia" From 0d03de671d1ae4970c858e1592637ff37b5b6d16 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 31 Oct 2019 16:15:35 +1100 Subject: [PATCH 19/19] Add install bash script. Move toc generator, --- .travis.yml | 2 +- {test => script}/gh-md-toc | 0 script/install_bash.bash | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) rename {test => script}/gh-md-toc (100%) create mode 100755 script/install_bash.bash diff --git a/.travis.yml b/.travis.yml index c092829..d34f7c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ before_install: "gem update --system --no-doc" before_script: - "whereis bash" - "bash --version" - - ./test/install_bash.bash + - ./script/install_bash.bash - "bash --version" - "git clone https://github.com/infertux/bashcov.git" - "cd bashcov/" diff --git a/test/gh-md-toc b/script/gh-md-toc similarity index 100% rename from test/gh-md-toc rename to script/gh-md-toc diff --git a/script/install_bash.bash b/script/install_bash.bash new file mode 100755 index 0000000..a1bdb0c --- /dev/null +++ b/script/install_bash.bash @@ -0,0 +1,34 @@ +#!/bin/bash +set -o errexit # Exit on most errors (see the manual) +# set -o errtrace # Make sure any error trap is inherited +# set -o nounset # Disallow expansion of unset variables +# set -o pipefail # Use last non-zero exit code in a pipeline +set -o xtrace # Trace the execution of the script (debug) + +if [ -z $INSTALL_BASH_VERSION ]; then + echo "No \$INSTALL_BASH_VERSION, using default Bash" + exit +fi + +set -u + +echo "Installing bash $INSTALL_BASH_VERSION..." + +mkdir -p bash +cd bash +wget -N https://ftpmirror.gnu.org/bash/bash-$INSTALL_BASH_VERSION.tar.gz +tar xvf bash-$INSTALL_BASH_VERSION.tar.gz +pushd bash-$INSTALL_BASH_VERSION + +patches="../bash-$INSTALL_BASH_VERSION-patches/bash$(echo $INSTALL_BASH_VERSION | tr -d .)-???" +for patch in $(find .. -wholename "$patches" | sort); do + echo "Applying $patch" + patch -f -p0 <$patch +done + +./configure --exec-prefix / +make +sudo make install + +popd +rm -rf bash-$INSTALL_BASH_VERSION