Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: julia
os:
- linux
julia:
- 0.6
- 1.0
notifications:
email: false
git:
Expand All @@ -19,8 +19,7 @@ sudo: required

# Before anything else, get the latest versions of things
before_script:
- julia -e 'Pkg.clone("https://github.com/JuliaPackaging/BinaryProvider.jl")'
- julia -e 'Pkg.clone("https://github.com/JuliaPackaging/BinaryBuilder.jl"); Pkg.build()'
- julia -e 'using Pkg; pkg"add BinaryProvider"; pkg"add BinaryBuilder#master"; Pkg.build()'

script:
- julia build_tarballs.jl
Expand Down
111 changes: 47 additions & 64 deletions build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -1,88 +1,71 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder

# Collection of sources required to build MySQL
name = "MySQLBuilder"
version = v"0.21.0"

# Collection of sources required to build MySQLBuilder
sources = [
"https://downloads.mariadb.com/Connectors/c/connector-c-3.0.3/mariadb-connector-c-3.0.3-src.tar.gz" =>
"210f0ee3414b235d3db8e98e9e5a0a98381ecf771e67ca4a688036368984eeea",
"https://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-6.1.11-macos10.12-x86_64.tar.gz" =>
"c97d76936c6caf063778395e7ca15862770a1ab77c1731269408a8d5c0eb4b93",
"https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15-linux-glibc2.12-x86_64.tar.xz" =>
"f3f1fd7d720883a8a16fe8ca3cb78150ad2f4008d251ce8ac0a2c676e2cf1e1f",

"https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15-linux-glibc2.12-i686.tar.xz" =>
"b5a18de4e0b8c9209286d887bf187b8e7396e43d4b367870ca870ed95302fc7e",

"https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15-macos10.14-x86_64.tar.gz" =>
"f6b1313e89b549947fa774e160a31cf051742110f7f27beadcdc0b4ebea7baa9",

"https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15-freebsd11-x86_64.tar.gz" =>
"6099b7fc5444c183d0e1ca8973b32429c58060548c15a2056ed2d81269184a39",

]

# Bash recipe for building across all platforms
script = raw"""
if [ $target == "x86_64-apple-darwin14" ]; then
cd $WORKSPACE/srcdir
mkdir $prefix/lib
cp mysql-connector-c-6.1.11-macos10.12-x86_64/lib/libmysqlclient.18.dylib $prefix/lib/libmariadb.dylib
cd $WORKSPACE/srcdir
mkdir $prefix/lib

if [ $target = "x86_64-unknown-freebsd11.1" ]; then

cp mysql-8.0.15-freebsd11-x86_64/lib/libmysqlclient.so.21 $prefix/lib/

elif [ $target = "x86_64-apple-darwin14" ]; then

cp mysql-8.0.15-macos10.14-x86_64/lib/libmysqlclient.21.dylib $prefix/lib/

elif [ $target = "i686-linux-gnu" ]; then

cp mysql-8.0.15-linux-glibc2.12-i686/lib/libmysqlclient.so.21.0.15 $prefix/lib/

else
cd $WORKSPACE/srcdir
cd mariadb-connector-c-3.0.3-src/
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_TOOLCHAIN_FILE=/opt/$target/$target.toolchain
make && make install
mv $prefix/lib/mariadb/* $prefix/lib/.

cp mysql-8.0.15-linux-glibc2.12-x86_64/lib/libmysqlclient.so.21.0.15 $prefix/lib/

fi

"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Linux(:i686, :glibc),
Linux(:x86_64, :glibc),
Linux(:aarch64, :glibc),
Linux(:armv7l, :glibc),
Linux(:powerpc64le, :glibc),
MacOS()
Linux(:x86_64, libc=:glibc),
FreeBSD(:x86_64),
Linux(:x86_64, libc=:musl),
MacOS(:x86_64),
Linux(:i686, libc=:glibc)
]

# The products that we will ensure are always built
products(prefix) = Product[
LibraryProduct(prefix, "libmariadb", :libmariadb)
products(prefix) = [
LibraryProduct(prefix, "libmysqlclient", :libmysql)
]

# 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(), "MySQL", platforms, sources, script, products;
dependencies=dependencies, verbose=verbose)
@show readdir("products")
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
# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)