This repository has been archived by the owner on May 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_tarballs.jl
85 lines (70 loc) · 2.85 KB
/
build_tarballs.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using BinaryBuilder
# Collection of sources required to build Gumbo
sources = [
"https://github.com/google/gumbo-parser.git" =>
"aa91b27b02c0c80c482e24348a457ed7c3c088e0",
]
# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir
cd gumbo-parser/
./autogen.sh
./configure --prefix=$prefix --host=$target
make
make install
"""
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
BinaryProvider.Linux(:i686, :glibc),
BinaryProvider.Linux(:x86_64, :glibc),
BinaryProvider.Linux(:aarch64, :glibc),
BinaryProvider.Linux(:armv7l, :glibc),
BinaryProvider.Linux(:powerpc64le, :glibc),
BinaryProvider.MacOS(),
BinaryProvider.Windows(:i686),
BinaryProvider.Windows(:x86_64)
]
# The products that we will ensure are always built
products(prefix) = Product[
LibraryProduct(prefix, "libgumbo", :libgumbo)
]
# Dependencies that must be installed before this package can be built
dependencies = [
]
# Parse out some command-line arguments
BUILD_ARGS = ARGS
# This sets whether we should build verbosely or not
verbose = "--verbose" in BUILD_ARGS
BUILD_ARGS = filter!(x -> x != "--verbose", BUILD_ARGS)
# This flag skips actually building and instead attempts to reconstruct a
# build.jl from a GitHub release page. Use this to automatically deploy a
# build.jl file even when sharding targets across multiple CI builds.
only_buildjl = "--only-buildjl" in BUILD_ARGS
BUILD_ARGS = filter!(x -> x != "--only-buildjl", BUILD_ARGS)
if !only_buildjl
# If the user passed in a platform (or a few, comma-separated) on the
# command-line, use that instead of our default platforms
if length(BUILD_ARGS) > 0
platforms = platform_key.(split(BUILD_ARGS[1], ","))
end
info("Building for $(join(triplet.(platforms), ", "))")
# Build the given platforms using the given sources
autobuild(pwd(), "Gumbo", platforms, sources, script, products;
dependencies=dependencies, verbose=verbose)
else
# If we're only reconstructing a build.jl file on Travis, grab the information and do it
if !haskey(ENV, "TRAVIS_REPO_SLUG") || !haskey(ENV, "TRAVIS_TAG")
error("Must provide repository name and tag through Travis-style environment variables!")
end
repo_name = ENV["TRAVIS_REPO_SLUG"]
tag_name = ENV["TRAVIS_TAG"]
product_hashes = product_hashes_from_github_release(repo_name, tag_name; verbose=verbose)
bin_path = "https://github.com/$(repo_name)/releases/download/$(tag_name)"
dummy_prefix = Prefix(pwd())
print_buildjl(pwd(), products(dummy_prefix), product_hashes, bin_path)
if verbose
info("Writing out the following reconstructed build.jl:")
print_buildjl(STDOUT, product_hashes; products=products(dummy_prefix), bin_path=bin_path)
end
end