# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder

name = "iso_codes"
version = v"4.20.1"

# Collection of sources required to build iso-codes
sources = [
    ArchiveSource("https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/v$(version)/iso-codes-v$(version).tar.bz2",
                  "66ea9879f9a4d6f767f424bf74bc5471215d36d54f8940f6d32dd7737ceef046"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/iso-codes-*
apk update
apk add gettext
meson setup builddir --cross-file="${MESON_TARGET_TOOLCHAIN}"
meson compile -C builddir
meson install -C builddir
cd LICENSES
install_license FSFAP.txt LGPL-2.1-or-later.txt
"""

# The files are identical for all platforms.
platforms = [AnyPlatform()]

# The products that we will ensure are always built
products = Product[
    FileProduct("share/iso-codes", :iso_codes_dir),
]

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

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6")
