From c5fca92a08a8a63ad4d746b4d3a44a9cf724ea61 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 7 Sep 2021 02:46:07 +0200 Subject: Change buildsystem to use a ./configure script This is done to support webkit2gtk-4.1 (libsoup3) vs. webkit2gtk-4.0 (libsoup2). It will also be useful once WebKitGTK with support for GTK4 lands in badwolf. --- configure | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 configure (limited to 'configure') diff --git a/configure b/configure new file mode 100755 index 0000000..17510a0 --- /dev/null +++ b/configure @@ -0,0 +1,110 @@ +#!/bin/sh +VERSION=1.1.0 +VERSION_FULL=${VERSION}$(./version.sh) +PREFIX="${PREFIX:-/usr/local}" +BINDIR="${BINDIR:-${PREFIX}/bin}" +MANDIR="${MANDIR:-${PREFIX}/share/man}" +DOCDIR="${DOCDIR:-${PREFIX}/share/doc/badwolf-${VERSION}}" +DATADIR="${DATADIR:-${PREFIX}/share/badwolf}" +APPSDIR="${APPSDIR:-${PREFIX}/share/applications}" + +PKGCONFIG="${PKGCONFIG:-pkg-config}" +MSGFMT="${MSGFMT:-msgfmt}" +INKSCAPE="${INKSCAPE:-inkscape}" +CC="${CC:-cc}" +CFLAGS="${CFLAGS:--g -O2 -pie -fPIE} -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wconversion -Wsign-conversion -Werror=implicit-function-declaration -Werror=implicit-int -Werror=vla ${EXTRA_CFLAGS}" + +DEPS="gtk+-3.0 libxml-2.0" + +is_ok() { + status="$?" + + if test "$status" == 0; then + printf " OK\n" + else + printf " FAIL\n" + fi + + return $status +} + +required() { + is_ok || exit 1 +} + +pkg_config_check() { + printf 'Checking: %s %s ...' "${PKGCONFIG}" "$*" + "${PKGCONFIG}" "$@" + is_ok +} + +printf 'Checking %s command existance ...' "${PKGCONFIG}" +command -v "${PKGCONFIG}" >/dev/null ; required + +printf 'Checking %s command existance ...' "${CC}" +command -v "${CC}" >/dev/null ; required + +for dep in ${DEPS} +do + pkg_config_check --exists "$dep" || exit 1 +done + +case "${WITH_WEBKITGTK}n" in + 4.1n) + pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.1 || exit 1 + DEPS="${DEPS} webkit2gtk-4.1 libsoup-3.0" + ;; + 4.0n) + pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.0 || exit 1 + DEPS="${DEPS} webkit2gtk-4.0 libsoup-2.4" + ;; + n) + echo "warning: Packagers should specify the ABI version (4.0 or 4.1) in WITH_WEBKITGTK" >&2 + if pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.1 + then + DEPS="${DEPS} webkit2gtk-4.1 libsoup-3.0" + else + pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.0 || exit 1 + DEPS="${DEPS} webkit2gtk-4.0 libsoup-2.4" + fi + ;; + *) + echo "error: invalid webkit2gtk version in WITH_WEBKITGTK environment variable, must be 4.0 or 4.1" >&2 + exit 1 + ;; +esac + +get_cflags() { "${PKGCONFIG}" --cflags "${DEPS}"; } +DEPS_cflags="$(get_cflags)" +get_libs() { "${PKGCONFIG}" --libs "${DEPS}"; } +DEPS_libs="$(get_libs)" + +ICON_SIZES="$(for i in 24 32 48 64 128 256; do printf 'icons/hicolor/%sx%s/apps/badwolf.png ' $i $i ; done)" + +printf 'Writing to config.mk ...' +cat >config.mk <