diff options
author | Bastien Nocera <hadess@hadess.net> | 2019-11-06 13:35:50 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2019-11-06 13:35:50 +0000 |
commit | d79678ecd28cc9543f90848a62174b84cead880c (patch) | |
tree | 74d37b9837514998ac55398345d944e8ce7b654a | |
parent | 80a8abbd82d9ff24892419170709150b4dd1fad3 (diff) | |
parent | 96f798ebcce9fdaabd55622f1bedae88ff3bb88c (diff) | |
download | geocode-glib-d79678ecd28cc9543f90848a62174b84cead880c.tar.gz |
Merge branch 'wip/hadess/fixes' into 'master'
Build fixes
Closes #2 and #3
See merge request GNOME/geocode-glib!8
-rwxr-xr-x | .ci/check-abi | 113 | ||||
-rw-r--r-- | .gitlab-ci.yml | 13 | ||||
-rwxr-xr-x | configure | 159 | ||||
-rw-r--r-- | geocode-glib/meson.build | 3 | ||||
-rw-r--r-- | git.mk | 301 |
5 files changed, 125 insertions, 464 deletions
diff --git a/.ci/check-abi b/.ci/check-abi new file mode 100755 index 0000000..cbccc2a --- /dev/null +++ b/.ci/check-abi @@ -0,0 +1,113 @@ +#!/usr/bin/python3 + + +import argparse +import contextlib +import os +import shutil +import subprocess +import sys + + +def format_title(title): + box = { + 'tl': '╔', 'tr': '╗', 'bl': '╚', 'br': '╝', 'h': '═', 'v': '║', + } + hline = box['h'] * (len(title) + 2) + + return '\n'.join([ + f"{box['tl']}{hline}{box['tr']}", + f"{box['v']} {title} {box['v']}", + f"{box['bl']}{hline}{box['br']}", + ]) + + +def rm_rf(path): + try: + shutil.rmtree(path) + except FileNotFoundError: + pass + + +def sanitize_path(name): + return name.replace('/', '-') + + +def get_current_revision(): + revision = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], + encoding='utf-8').strip() + + if revision == 'HEAD': + # This is a detached HEAD, get the commit hash + revision = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip().decode('utf-8') + + return revision + + +@contextlib.contextmanager +def checkout_git_revision(revision): + current_revision = get_current_revision() + subprocess.check_call(['git', 'checkout', '-q', revision]) + + try: + yield + finally: + subprocess.check_call(['git', 'checkout', '-q', current_revision]) + + +def build_install(revision): + build_dir = '_build' + dest_dir = os.path.abspath(sanitize_path(revision)) + print(format_title(f'# Building and installing {revision} in {dest_dir}'), + end='\n\n', flush=True) + + with checkout_git_revision(revision): + rm_rf(build_dir) + rm_rf(revision) + + subprocess.check_call(['meson', build_dir, + '--prefix=/usr', '--libdir=lib', + '-Db_coverage=false', '-Denable-gtk-doc=false']) + subprocess.check_call(['ninja', '-v', '-C', build_dir]) + subprocess.check_call(['ninja', '-v', '-C', build_dir, 'install'], + env={'DESTDIR': dest_dir}) + + return dest_dir + + +def compare(old_tree, new_tree): + print(format_title(f'# Comparing the two ABIs'), end='\n\n', flush=True) + + old_headers = os.path.join(old_tree, 'usr', 'include') + old_lib = os.path.join(old_tree, 'usr', 'lib', 'libgeocode-glib.so.0') + + new_headers = os.path.join(new_tree, 'usr', 'include') + new_lib = os.path.join(new_tree, 'usr', 'lib', 'libgeocode-glib.so.0') + + subprocess.check_call([ + 'abidiff', '--headers-dir1', old_headers, '--headers-dir2', new_headers, + '--drop-private-types', '--fail-no-debug-info', '--no-added-syms', old_lib, new_lib]) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + + parser.add_argument('old', help='the previous revision, considered the reference') + parser.add_argument('new', help='the new revision, to compare to the reference') + + args = parser.parse_args() + + if args.old == args.new: + print("Let's not waste time comparing something to itself") + sys.exit(0) + + old_tree = build_install(args.old) + new_tree = build_install(args.new) + + try: + compare(old_tree, new_tree) + + except Exception: + sys.exit(1) + + print(f'Hurray! {args.old} and {args.new} are ABI-compatible!') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b491643..7961bdc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,17 @@ +variables: + LAST_ABI_BREAK: 5cd4856c207e169aa535a9e32f3361b61af639b2 + build-fedora: image: fedora:latest before_script: - - dnf install -y redhat-rpm-config meson json-glib-devel gettext itstool gobject-introspection-devel libsoup-devel gtk-doc + # Undo delangification present in the Fedora Docker images + - rm -f /etc/rpm/macros.image-language-conf + - dnf reinstall -y glib2 glibc + # Add locales support required for tests + - dnf install -y glibc-langpack-fr glibc-langpack-cs glibc-langpack-en + - dnf install -y glib2-devel json-glib-devel libsoup-devel gtk-doc meson git gcc gcc-c++ glibc-devel libabigail script: - meson _build - - ninja -C _build test - ninja -C _build install + - ninja -C _build test + - ./.ci/check-abi ${LAST_ABI_BREAK} $(git rev-parse HEAD) diff --git a/configure b/configure deleted file mode 100755 index 740a9ad..0000000 --- a/configure +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -# configure script adapter for Meson -# Based on build-api: https://github.com/cgwalters/build-api -# Copyright 2010, 2011, 2013 Colin Walters <walters@verbum.org> -# Copyright 2016, 2017 Emmanuele Bassi -# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php) - -# Build API variables: - -# Little helper function for reading args from the commandline. -# it automatically handles -a b and -a=b variants, and returns 1 if -# we need to shift $3. -read_arg() { - # $1 = arg name - # $2 = arg value - # $3 = arg parameter - local rematch='^[^=]*=(.*)$' - if [[ $2 =~ $rematch ]]; then - read "$1" <<< "${BASH_REMATCH[1]}" - else - read "$1" <<< "$3" - # There is no way to shift our callers args, so - # return 1 to indicate they should do it instead. - return 1 - fi -} - -sanitycheck() { - # $1 = arg name - # $1 = arg command - # $2 = arg alternates - local cmd=$( which $2 2>/dev/null ) - - if [ -x "$cmd" ]; then - read "$1" <<< "$cmd" - return 0 - fi - - test -z $3 || { - for alt in $3; do - cmd=$( which $alt 2>/dev/null ) - - if [ -x "$cmd" ]; then - read "$1" <<< "$cmd" - return 0 - fi - done - } - - echo -e "\e[1;31mERROR\e[0m: Command '$2' not found" - exit 1 -} - -sanitycheck MESON 'meson' -sanitycheck MESONTEST 'mesontest' -sanitycheck NINJA 'ninja' 'ninja-build' - -enable_docs='-Denable-gtk-doc=false' -enable_introspection='-Denable-introspection=true' -enable_installed_tests='-Denable-installed-tests=true' - -while (($# > 0)); do - case "${1%%=*}" in - --prefix) read_arg prefix "$@" || shift;; - --bindir) read_arg bindir "$@" || shift;; - --sbindir) read_arg sbindir "$@" || shift;; - --libexecdir) read_arg libexecdir "$@" || shift;; - --datarootdir) read_arg datarootdir "$@" || shift;; - --datadir) read_arg datadir "$@" || shift;; - --sysconfdir) read_arg sysconfdir "$@" || shift;; - --libdir) read_arg libdir "$@" || shift;; - --mandir) read_arg mandir "$@" || shift;; - --includedir) read_arg includedir "$@" || shift;; - --enable-gtk-doc) enable_docs='-Denable-gtk-doc=true';; - --disable-gtk-doc) enable_docs='-Denable-gtk-doc=false';; - --enable-introspection) enable_introspection='-Denable-introspection=true';; - --disable-introspection) enable_introspection='-Denable-introspection=false';; - --enable-installed-tests) enable_installed_tests='-Denable-installed-tests=true';; - --disable-installed-tests) enable_installed_tests='-Denable-installed-tests=false';; - *) echo -e "\e[1;33mINFO\e[0m: Ignoring unknown option '$1'";; - esac - shift -done - -# Defaults -test -z ${prefix} && prefix="/usr/local" -test -z ${bindir} && bindir=${prefix}/bin -test -z ${sbindir} && sbindir=${prefix}/sbin -test -z ${libexecdir} && libexecdir=${prefix}/bin -test -z ${datarootdir} && datarootdir=${prefix}/share -test -z ${datadir} && datadir=${datarootdir} -test -z ${sysconfdir} && sysconfdir=${prefix}/etc -test -z ${libdir} && libdir=${prefix}/lib -test -z ${mandir} && mandir=${prefix}/share/man -test -z ${includedir} && includedir=${prefix}/include - -# The source directory is the location of this file -srcdir=$(dirname $0) - -# The build directory is the current location -builddir=`pwd` - -# If we're calling this file from the source directory then -# we automatically create a build directory and ensure that -# both Meson and Ninja invocations are relative to that -# location -if [[ -f "${builddir}/meson.build" ]]; then - mkdir -p _build - builddir="${builddir}/_build" - NINJA_OPT="-C ${builddir}" -fi - -# Wrapper Makefile for Ninja -cat > Makefile <<END -# Generated by configure; do not edit - -all: - CC="\$(CC)" CXX="\$(CXX)" ${NINJA} ${NINJA_OPT} - -install: - DESTDIR="\$(DESTDIR)" ${NINJA} ${NINJA_OPT} install - -check: - ${MESONTEST} ${NINJA_OPT} -END - -echo "Summary:" -echo " meson:....... ${MESON}" -echo " ninja:....... ${NINJA}" -echo " prefix:...... ${prefix}" -echo " bindir:...... ${bindir}" -echo " sbindir:..... ${sbindir}" -echo " libexecdir:.. ${libexecdir}" -echo " datarootdir:. ${datarootdir}" -echo " datadir:..... ${datadir}" -echo " sysconfdir:.. ${sysconfdir}" -echo " libdir:...... ${libdir}" -echo " mandir:...... ${mandir}" -echo " includedir:.. ${includedir}" -echo " additional:.." -echo " - ${enable_docs} ${enable_installed_tests} ${enable_introspection}" - -exec ${MESON} \ - --prefix=${prefix} \ - --libdir=${libdir} \ - --libexecdir=${libexecdir} \ - --datadir=${datadir} \ - --sysconfdir=${sysconfdir} \ - --bindir=${bindir} \ - --includedir=${includedir} \ - --mandir=${mandir} \ - --default-library shared \ - ${enable_docs} \ - ${enable_introspection} \ - ${enable_installed_tests} \ - ${builddir} \ - ${srcdir} - -# vim: ai ts=8 noet sts=2 ft=sh diff --git a/geocode-glib/meson.build b/geocode-glib/meson.build index 85f0f18..561da9d 100644 --- a/geocode-glib/meson.build +++ b/geocode-glib/meson.build @@ -86,10 +86,9 @@ pkgconf.generate(libraries: libgcglib, ]) gir = find_program('g-ir-scanner', required: false) -cross_build = meson.is_cross_build() enable_gir = get_option('enable-introspection') -if gir.found() and not cross_build and enable_gir +if gir.found() and enable_gir gir_args = [ '--quiet', '--c-include=geocode-glib/geocode-glib.h' @@ -1,301 +0,0 @@ -# git.mk -# -# Copyright 2009, Red Hat, Inc. -# Copyright 2010,2011,2012,2013 Behdad Esfahbod -# Written by Behdad Esfahbod -# -# Copying and distribution of this file, with or without modification, -# is permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. -# -# The latest version of this file can be downloaded from: -# https://raw.github.com/behdad/git.mk/master/git.mk -# Bugs, etc, should be reported upstream at: -# https://github.com/behdad/git.mk -# -# To use in your project, import this file in your git repo's toplevel, -# then do "make -f git.mk". This modifies all Makefile.am files in -# your project to -include git.mk. Remember to add that line to new -# Makefile.am files you create in your project, or just rerun the -# "make -f git.mk". -# -# This enables automatic .gitignore generation. If you need to ignore -# more files, add them to the GITIGNOREFILES variable in your Makefile.am. -# But think twice before doing that. If a file has to be in .gitignore, -# chances are very high that it's a generated file and should be in one -# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES. -# -# The only case that you need to manually add a file to GITIGNOREFILES is -# when remove files in one of mostlyclean-local, clean-local, distclean-local, -# or maintainer-clean-local make targets. -# -# Note that for files like editor backup, etc, there are better places to -# ignore them. See "man gitignore". -# -# If "make maintainer-clean" removes the files but they are not recognized -# by this script (that is, if "git status" shows untracked files still), send -# me the output of "git status" as well as your Makefile.am and Makefile for -# the directories involved and I'll diagnose. -# -# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see -# Makefile.am.sample in the git.mk git repo. -# -# Don't EXTRA_DIST this file. It is supposed to only live in git clones, -# not tarballs. It serves no useful purpose in tarballs and clutters the -# build dir. -# -# This file knows how to handle autoconf, automake, libtool, gtk-doc, -# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu. -# -# This makefile provides the following targets: -# -# - all: "make all" will build all gitignore files. -# - gitignore: makes all gitignore files in the current dir and subdirs. -# - .gitignore: make gitignore file for the current dir. -# - gitignore-recurse: makes all gitignore files in the subdirs. -# -# KNOWN ISSUES: -# -# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the -# submodule doesn't find us. If you have configure.{in,ac} files in -# subdirs, add a proxy git.mk file in those dirs that simply does: -# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste. -# And add those files to git. See vte/gnome-pty-helper/git.mk for -# example. -# - - - -############################################################################### -# Variables user modules may want to add to toplevel MAINTAINERCLEANFILES: -############################################################################### - -# -# Most autotools-using modules should be fine including this variable in their -# toplevel MAINTAINERCLEANFILES: -GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL = \ - $(srcdir)/aclocal.m4 \ - $(srcdir)/autoscan.log \ - $(srcdir)/configure.scan \ - `AUX_DIR=$(srcdir)/$$($(AUTOCONF) --trace 'AC_CONFIG_AUX_DIR:$$1' $(srcdir)/configure.ac); \ - test "x$$AUX_DIR" = "x$(srcdir)/" && AUX_DIR=$(srcdir); \ - for x in \ - ar-lib \ - compile \ - config.guess \ - config.sub \ - depcomp \ - install-sh \ - ltmain.sh \ - missing \ - mkinstalldirs \ - ; do echo "$$AUX_DIR/$$x"; done` \ - `$(AUTOCONF) --trace 'AC_CONFIG_HEADERS:$$1' $(srcdir)/configure.ac | \ - head -n 1 | while read f; do echo "$(srcdir)/$$f.in"; done` -# -# All modules should also be fine including the following variable, which -# removes automake-generated Makefile.in files: -GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN = \ - `$(AUTOCONF) --trace 'AC_CONFIG_FILES:$$1' $(srcdir)/configure.ac | \ - while read f; do \ - case $$f in Makefile|*/Makefile) \ - test -f "$(srcdir)/$$f.am" && echo "$(srcdir)/$$f.in";; esac; \ - done` -# -# Modules that use libtool /and/ use AC_CONFIG_MACRO_DIR([m4]) may also -# include this: -GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL = \ - $(srcdir)/m4/libtool.m4 \ - $(srcdir)/m4/ltoptions.m4 \ - $(srcdir)/m4/ltsugar.m4 \ - $(srcdir)/m4/ltversion.m4 \ - $(srcdir)/m4/lt~obsolete.m4 - - - -############################################################################### -# Default rule is to install ourselves in all Makefile.am files: -############################################################################### - -git-all: git-mk-install - -git-mk-install: - @echo "Installing git makefile" - @any_failed=; \ - find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \ - if grep 'include .*/git.mk' $$x >/dev/null; then \ - echo "$$x already includes git.mk"; \ - else \ - failed=; \ - echo "Updating $$x"; \ - { cat $$x; \ - echo ''; \ - echo '-include $$(top_srcdir)/git.mk'; \ - } > $$x.tmp || failed=1; \ - if test x$$failed = x; then \ - mv $$x.tmp $$x || failed=1; \ - fi; \ - if test x$$failed = x; then : else \ - echo "Failed updating $$x"; >&2 \ - any_failed=1; \ - fi; \ - fi; done; test -z "$$any_failed" - -.PHONY: git-all git-mk-install - - - -############################################################################### -# Actual .gitignore generation: -############################################################################### - -$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk - @echo "git.mk: Generating $@" - @{ \ - if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \ - for x in \ - $(DOC_MODULE)-decl-list.txt \ - $(DOC_MODULE)-decl.txt \ - tmpl/$(DOC_MODULE)-unused.sgml \ - "tmpl/*.bak" \ - xml html \ - ; do echo "/$$x"; done; \ - fi; \ - if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \ - for lc in $(DOC_LINGUAS); do \ - for x in \ - $(if $(DOC_MODULE),$(DOC_MODULE).xml) \ - $(DOC_PAGES) \ - $(DOC_INCLUDES) \ - ; do echo "/$$lc/$$x"; done; \ - done; \ - for x in \ - $(_DOC_OMF_ALL) \ - $(_DOC_DSK_ALL) \ - $(_DOC_HTML_ALL) \ - $(_DOC_MOFILES) \ - $(DOC_H_FILE) \ - "*/.xml2po.mo" \ - "*/*.omf.out" \ - ; do echo /$$x; done; \ - fi; \ - if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \ - for lc in $(HELP_LINGUAS); do \ - for x in \ - $(HELP_FILES) \ - "$$lc.stamp" \ - "$$lc.mo" \ - ; do echo "/$$lc/$$x"; done; \ - done; \ - fi; \ - if test "x$(gsettings_SCHEMAS)" = x; then :; else \ - for x in \ - $(gsettings_SCHEMAS:.xml=.valid) \ - $(gsettings__enum_file) \ - ; do echo "/$$x"; done; \ - fi; \ - if test -f $(srcdir)/po/Makefile.in.in; then \ - for x in \ - po/Makefile.in.in \ - po/Makefile.in.in~ \ - po/Makefile.in \ - po/Makefile \ - po/Makevars.template \ - po/POTFILES \ - po/Rules-quot \ - po/stamp-it \ - po/.intltool-merge-cache \ - "po/*.gmo" \ - "po/*.header" \ - "po/*.mo" \ - "po/*.sed" \ - "po/*.sin" \ - po/$(GETTEXT_PACKAGE).pot \ - intltool-extract.in \ - intltool-merge.in \ - intltool-update.in \ - ; do echo "/$$x"; done; \ - fi; \ - if test -f $(srcdir)/configure; then \ - for x in \ - autom4te.cache \ - configure \ - config.h \ - stamp-h1 \ - libtool \ - config.lt \ - ; do echo "/$$x"; done; \ - fi; \ - if test "x$(DEJATOOL)" = x; then :; else \ - for x in \ - $(DEJATOOL) \ - ; do echo "/$$x.sum"; echo "/$$x.log"; done; \ - echo /site.exp; \ - fi; \ - if test "x$(am__dirstamp)" = x; then :; else \ - echo "$(am__dirstamp)"; \ - fi; \ - if test "x$(LTCOMPILE)" = x; then :; else \ - for x in \ - "*.lo" \ - ".libs" "_libs" \ - ; do echo "$$x"; done; \ - fi; \ - for x in \ - .gitignore \ - $(GITIGNOREFILES) \ - $(CLEANFILES) \ - $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \ - $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \ - $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \ - so_locations \ - $(MOSTLYCLEANFILES) \ - "*.$(OBJEXT)" \ - $(DISTCLEANFILES) \ - $(am__CONFIG_DISTCLEAN_FILES) \ - $(CONFIG_CLEAN_FILES) \ - TAGS ID GTAGS GRTAGS GSYMS GPATH tags \ - "*.tab.c" \ - $(MAINTAINERCLEANFILES) \ - $(BUILT_SOURCES) \ - $(DEPDIR) \ - $(patsubst %.vala,%.c,$(filter %.vala,$(SOURCES))) \ - $(filter %_vala.stamp,$(DIST_COMMON)) \ - $(filter %.vapi,$(DIST_COMMON)) \ - $(patsubst %.vapi,%.h,$(filter %.vapi,$(DIST_COMMON))) \ - Makefile \ - Makefile.in \ - "*.orig" \ - "*.rej" \ - "*.bak" \ - "*~" \ - ".*.sw[nop]" \ - ".dirstamp" \ - ; do echo "/$$x"; done; \ - } | \ - sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \ - sed 's@/[.]/@/@g' | \ - LC_ALL=C sort | uniq > $@.tmp && \ - mv $@.tmp $@; - -all: $(srcdir)/.gitignore gitignore-recurse-maybe -gitignore: $(srcdir)/.gitignore gitignore-recurse - -gitignore-recurse-maybe: - @for subdir in $(DIST_SUBDIRS); do \ - case " $(SUBDIRS) " in \ - *" $$subdir "*) :;; \ - *) test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir");; \ - esac; \ - done -gitignore-recurse: - @for subdir in $(DIST_SUBDIRS); do \ - test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir"); \ - done - -maintainer-clean: gitignore-clean -gitignore-clean: - -rm -f $(srcdir)/.gitignore - -.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe - |