|
| 1 | +# This file is a part of Julia. License is MIT: https://julialang.org/license |
| 2 | + |
| 3 | +# Invoke this with no arguments to refresh all tarballs, or with a project name to refresh only that project. |
| 4 | +# |
| 5 | +# Example: |
| 6 | +# make -f contrib/refresh_checksums.mk gmp |
| 7 | + |
| 8 | +SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) |
| 9 | +JULIAHOME := $(abspath $(SRCDIR)/..) |
| 10 | + |
| 11 | +# Default target that will have everything else added to it as a dependency |
| 12 | +all: |
| 13 | + |
| 14 | +# Get this list via: |
| 15 | +# using BinaryBuilder |
| 16 | +# print("TRIPLETS=\"$(join(sort(triplet.(BinaryBuilder.supported_platforms(;experimental=true))), " "))\"") |
| 17 | +TRIPLETS=aarch64-apple-darwin aarch64-linux-gnu aarch64-linux-musl armv6l-linux-gnueabihf armv6l-linux-musleabihf armv7l-linux-gnueabihf armv7l-linux-musleabihf i686-linux-gnu i686-linux-musl i686-w64-mingw32 powerpc64le-linux-gnu x86_64-apple-darwin x86_64-linux-gnu x86_64-linux-musl x86_64-unknown-freebsd x86_64-w64-mingw32 |
| 18 | +CLANG_TRIPLETS=$(filter %-darwin %-freebsd,$(TRIPLETS)) |
| 19 | +NON_CLANG_TRIPLETS=$(filter-out %-darwin %-freebsd,$(TRIPLETS)) |
| 20 | + |
| 21 | +# These are the projects currently using BinaryBuilder; both GCC-expanded and non-GCC-expanded: |
| 22 | +BB_PROJECTS=mbedtls libssh2 nghttp2 mpfr curl libgit2 pcre libuv unwind dsfmt objconv p7zip zlib suitesparse openlibm |
| 23 | +BB_GCC_EXPANDED_PROJECTS=openblas |
| 24 | +BB_CXX_EXPANDED_PROJECTS=gmp llvm |
| 25 | +# These are non-BB source-only deps |
| 26 | +NON_BB_PROJECTS=patchelf mozillacert lapack |
| 27 | + |
| 28 | +# Convert `openblas` to `OPENBLAS` |
| 29 | +define upper |
| 30 | +$(shell echo $(1) | tr 'a-z' 'A-Z') |
| 31 | +endef |
| 32 | + |
| 33 | +# If $(2) == `src`, this will generate a `USE_BINARYBUILDER_FOO=0` make flag |
| 34 | +# It will also generate a `FOO_BB_TRIPLET=$(2)` make flag. |
| 35 | +define make_flags |
| 36 | +USE_BINARYBUILDER_$(call upper,$(1))=$(if $(filter src,$(2)),0,1) $(call upper,$(1))_BB_TRIPLET=$(if $(filter src,$(2)),,$(2)) DEPS_GIT=0 |
| 37 | +endef |
| 38 | + |
| 39 | +# checksum_bb_dep takes in (name, triplet), and generates a `checksum-$(1)-$(2)` target. |
| 40 | +# note that `"src"` is a special triplet value. |
| 41 | +define checksum_dep |
| 42 | +checksum-$(1)-$(2): |
| 43 | + @-$(MAKE) -C "$(JULIAHOME)/deps" $(call make_flags,$(1),$(2)) checksum-$(1) |
| 44 | + |
| 45 | +# Add this guy to his project target (e.g. `make -f contrib/refresh_checksums.mk openblas`) |
| 46 | +$(1): checksum-$(1)-$(2) |
| 47 | + |
| 48 | +# Add this guy to the `all` default target |
| 49 | +all: checksum-$(1)-$(2) |
| 50 | +endef |
| 51 | + |
| 52 | +# Generate targets for source hashes for all our projects |
| 53 | +$(foreach project,$(BB_PROJECTS) $(BB_GCC_EXPANDED_PROJECTS) $(BB_CXX_EXPANDED_PROJECTS) $(NON_BB_PROJECTS),$(eval $(call checksum_dep,$(project),src))) |
| 54 | + |
| 55 | +# Generate targets for triplet-specific hashes for all our BB projects |
| 56 | +$(foreach project,$(BB_PROJECTS),$(foreach triplet,$(TRIPLETS),$(eval $(call checksum_dep,$(project),$(triplet))))) |
| 57 | +$(foreach project,$(BB_GCC_EXPANDED_PROJECTS),$(foreach triplet,$(TRIPLETS),$(foreach libgfortran_version,libgfortran3 libgfortran4 libgfortran5,$(eval $(call checksum_dep,$(project),$(triplet)-$(libgfortran_version)))))) |
| 58 | + |
| 59 | +# Because MacOS and FreeBSD use clang, they don't actually use cxxstring_abi expansion: |
| 60 | +$(foreach project,$(BB_CXX_EXPANDED_PROJECTS),$(foreach triplet,$(NON_CLANG_TRIPLETS),$(foreach cxxstring_abi,cxx11 cxx03,$(eval $(call checksum_dep,$(project),$(triplet)-$(cxxstring_abi)))))) |
| 61 | +$(foreach project,$(BB_CXX_EXPANDED_PROJECTS),$(foreach triplet,$(CLANG_TRIPLETS),$(eval $(call checksum_dep,$(project),$(triplet))))) |
| 62 | + |
| 63 | +# External stdlibs |
| 64 | +checksum-stdlibs: |
| 65 | + @-$(MAKE) -C "$(JULIAHOME)/stdlib" checksumall |
| 66 | +all: checksum-stdlibs |
| 67 | + |
| 68 | +# doc unicode data |
| 69 | +checksum-doc-unicodedata: |
| 70 | + @-$(MAKE) -C "$(JULIAHOME)/doc" checksum-unicodedata |
| 71 | +all: checksum-doc-unicodedata |
| 72 | + |
| 73 | +# Special LLVM source hashes for optional targets |
| 74 | +checksum-llvm-special-src: |
| 75 | + @-$(MAKE) -C "${JULIAHOME}/deps" USE_BINARYBUILDER_LLVM=0 DEPS_GIT=0 BUILD_LLDB=1 BUILD_LLVM_CLANG=1 BUILD_CUSTOM_LIBCXX=1 checksum-llvm |
| 76 | +all: checksum-llvm-special-src |
| 77 | + |
| 78 | +# This file is completely phony |
| 79 | +.PHONY: checksum-* |
| 80 | + |
| 81 | +# Debugging helper |
| 82 | +print-%: |
| 83 | + @echo '$*=$(subst ','\'',$($*))' |
0 commit comments