Skip to content

Commit

Permalink
Add autotools build system for libfoo, test with it
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Oct 19, 2021
1 parent ec5efef commit 216908b
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/auditing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,39 @@ using BinaryBuilder.Auditor: compatible_marchs, valid_library_path
#end


@testset "Auditor - .la removal" begin
for os in ["linux", "macos", "freebsd", "windows"]
mktempdir() do build_path
build_output_meta = nothing
@test_logs (:info, r"removing libtool file .*/destdir/lib/libfoo.la$") match_mode=:any begin
build_output_meta = autobuild(
build_path,
"libfoo",
v"1.0.0",
# Copy in the libfoo sources
[DirectorySource(build_tests_dir)],
# Use the particular build script we're interested in
libfoo_autotools_script,
# Build for our platform
[Platform("x86_64", os)],
# The products we expect to be build
libfoo_products,
# No dependencies
Dependency[]
)
end

@test haskey(build_output_meta, platform)
tarball_path, tarball_hash = build_output_meta[platform][1:2]
@test isfile(tarball_path)

# Test that `libfoo.la` has been removed
contents = list_tarball_files(tarball_path)
@test ! "lib/libfoo.la" in contents
end
end
end

@testset "Auditor - .dll moving" begin
for platform in [Platform("x86_64", "windows")]
mktempdir() do build_path
Expand Down
8 changes: 8 additions & 0 deletions test/build_tests/libfoo/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ACLOCAL_AMFLAGS = -I m4

lib_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = libfoo.c

bin_PROGRAMS = fooifier
fooifier_SOURCES = fooifier.cpp
fooifier_LDADD = libfoo.la
18 changes: 18 additions & 0 deletions test/build_tests/libfoo/configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AC_PREREQ([2.69])
AC_INIT([libfoo], [1.0])
AC_CONFIG_MACRO_DIRS([m4])

AM_INIT_AUTOMAKE([-Wall -Werror foreign])

AM_PROG_AR

LT_PREREQ([2.4.6])
LT_INIT([dlopen])

#AC_CANONICAL_TARGET

AC_PROG_CC
AC_PROG_CXX

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ fi
install_license ${WORKSPACE}/srcdir/libfoo/LICENSE.md
"""

libfoo_autotools_script = raw"""
cd ${WORKSPACE}/srcdir/libfoo
autoreconf -fiv
./configure --prefix=${prefix} --build=${MACHTYPE} --host=${target} --disable-static
make install
install_license ${WORKSPACE}/srcdir/libfoo/LICENSE.md
"""

# Run all our tests
include("basic.jl")
include("building.jl")
Expand Down

0 comments on commit 216908b

Please sign in to comment.