Skip to content

Commit

Permalink
Add HelloWorldX builders, test suites for our various compilers
Browse files Browse the repository at this point in the history
Currently contains:

* C
* C++
* Fortran
* Rust
* Go

The `Rust` test suite is quite restricted in platform, as we have a bit
of breakage there.
  • Loading branch information
staticfloat committed Nov 17, 2019
1 parent 4d9c7f7 commit 74c30ca
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 0 deletions.
30 changes: 30 additions & 0 deletions H/HelloWorldC/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using BinaryBuilder

name = "HelloWorldC"
version = v"1.0.0"

# No sources, we're just building the testsuite
sources = [
]

# Bash recipe for building across all platforms
script = raw"""
mkdir -p ${prefix}/bin
cc -o ${prefix}/bin/hello_world${exeext} -g -O2 /usr/share/testsuite/c/hello_world/hello_world.c
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms()

# The products that we will ensure are always built
products = [
ExecutableProduct("hello_world", :hello_world),
]

# Dependencies that must be installed before this package can be built
dependencies = [
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)
30 changes: 30 additions & 0 deletions H/HelloWorldCxx/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using BinaryBuilder

name = "HelloWorldCxx"
version = v"1.0.0"

# No sources, we're just building the testsuite
sources = [
]

# Bash recipe for building across all platforms
script = raw"""
mkdir -p ${prefix}/bin
c++ -o ${prefix}/bin/hello_world${exeext} -g -O2 /usr/share/testsuite/cxx/hello_world/hello_world.cc
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_cxxstring_abis(supported_platforms())

# The products that we will ensure are always built
products = [
ExecutableProduct("hello_world", :hello_world),
]

# Dependencies that must be installed before this package can be built
dependencies = [
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)
30 changes: 30 additions & 0 deletions H/HelloWorldFortran/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using BinaryBuilder

name = "HelloWorldFortran"
version = v"1.0.0"

# No sources, we're just building the testsuite
sources = [
]

# Bash recipe for building across all platforms
script = raw"""
mkdir -p ${prefix}/bin
f77 -o ${prefix}/bin/hello_world${exeext} -g -O2 /usr/share/testsuite/fortran/hello_world/hello_world.f
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_gfortran_versions(supported_platforms())

# The products that we will ensure are always built
products = [
ExecutableProduct("hello_world", :hello_world),
]

# Dependencies that must be installed before this package can be built
dependencies = [
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)
30 changes: 30 additions & 0 deletions H/HelloWorldGo/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using BinaryBuilder

name = "HelloWorldGo"
version = v"1.0.0"

# No sources, we're just building the testsuite
sources = [
]

# Bash recipe for building across all platforms
script = raw"""
mkdir -p ${prefix}/bin
go build -o ${prefix}/bin/hello_world${exeext} /usr/share/testsuite/go/hello_world/hello_world.go
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms()

# The products that we will ensure are always built
products = [
ExecutableProduct("hello_world", :hello_world),
]

# Dependencies that must be installed before this package can be built
dependencies = [
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; compilers=[:c, :go])
39 changes: 39 additions & 0 deletions H/HelloWorldRust/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using BinaryBuilder

name = "HelloWorldRust"
version = v"1.0.0"

# No sources, we're just building the testsuite
sources = [
]

# Bash recipe for building across all platforms
script = raw"""
mkdir -p ${prefix}/bin
rustc -o ${prefix}/bin/hello_world${exeext} -g /usr/share/testsuite/rust/hello_world/hello_world.rs
"""

# We build for a restricted set of platforms, because our rust toolchain is a little broken
platforms = supported_platforms()

# First, FreeBSD has -fPIC problems when linking in `crt.o`
filter!(p -> !isa(p, FreeBSD), platforms)

# Next, :musl libcs have a hard time linking
filter!(p -> libc(p) != :musl, platforms)

# Finally, windows seems to be broken
# https://github.com/JuliaPackaging/BinaryBuilder.jl/issues/499
filter!(p -> !isa(p, Windows), platforms)

# The products that we will ensure are always built
products = [
ExecutableProduct("hello_world", :hello_world),
]

# Dependencies that must be installed before this package can be built
dependencies = [
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; compilers=[:c, :rust])

0 comments on commit 74c30ca

Please sign in to comment.