Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ config_data.set_quoted('DEBUGEDIT', debugedit.full_path())
config_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_data.set_quoted('PACKAGE_VERSION', meson.project_version())
config_data.set_quoted('PACKAGE_STRING', '@0@-@1@'.format(meson.project_name(), meson.project_version()))
config_data.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_70')
config_data.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_76')
config_data.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_66')

# We support targeting specific fuse versions to optimize performance.
Expand Down
109 changes: 102 additions & 7 deletions subprojects/libglnx/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,72 @@
# Copyright 2019 Endless OS Foundation LLC
# SPDX-License-Identifier: LGPL-2.0-or-later

image: registry.fedoraproject.org/fedora:30
variables:
SETUP_ARGS: "-Db_sanitize=address,undefined"
CAN_MESON_DIST: "yes"

stages:
- build

before_script:
- dnf install -y gcc git meson ninja-build "pkgconfig(gio-2.0)" "pkgconfig(gio-unix-2.0)" "pkgconfig(glib-2.0)" xz
.deps_fedora: &deps_fedora
- |
dnf install -y \
"pkgconfig(gio-2.0)" \
"pkgconfig(gio-unix-2.0)" \
"pkgconfig(glib-2.0)" \
gcc \
git \
libasan \
libubsan \
meson \
ninja-build \
xz \
${NULL+}

build:
.deps_debian: &deps_debian
- apt-get update
- apt-get install -y build-essential git meson ninja-build pkg-config libglib2.0-dev xz-utils

.deps_ubuntu_oldlts: &deps_ubuntu_oldlts
- apt-get update
- |
apt-get install -y \
build-essential \
git \
libglib2.0-dev \
ninja-build \
pkg-config \
python3 \
python3-pip \
python3-setuptools \
python3-wheel \
xz-utils \
${NULL+}
# Modern versions of Meson need a modern version of Python,
# and we still aim to support building with 0.49
- pip3 install meson==0.49

.build:
stage: build
before_script: *deps_fedora
script:
- meson _build .
- meson setup _build . $SETUP_ARGS
- ninja -C _build
- meson test -C _build
# Run it again! This previously did not work.
- meson test -C _build
# Ensure that we can build as a subproject
- rm -fr _build/meson-dist
- meson dist -C _build
- |
if [ "$CAN_MESON_DIST" = yes ]; then
meson dist -C _build
else
mkdir -p _build/meson-dist
git archive --prefix=libglnx/ HEAD | xz > _build/meson-dist/libglnx.tar.xz
fi
- mkdir -p tests/use-as-subproject/subprojects/libglnx
- tar --strip-components=1 -C tests/use-as-subproject/subprojects/libglnx -xf _build/meson-dist/*.tar.xz
- meson tests/use-as-subproject/_build tests/use-as-subproject
- meson setup tests/use-as-subproject/_build tests/use-as-subproject
- ninja -C tests/use-as-subproject/_build
- meson test -C tests/use-as-subproject/_build
artifacts:
Expand All @@ -31,6 +75,57 @@ build:
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"

build:fedora-latest:
extends: .build
image: registry.fedoraproject.org/fedora:latest

build:fedora-rawhide:
extends: .build
image: registry.fedoraproject.org/fedora:rawhide

# Linux 3.2 headers, glibc 2.15, Python 3.5 backport, GLib 2.58 backport
build:steam-runtime1:
extends: .build
image: registry.gitlab.steamos.cloud/steamrt/scout/sdk:latest
before_script: *deps_debian
variables:
# gcc-4.8 is too old to have useful sanitizers
SETUP_ARGS: ""

# Linux 4.19 headers, glibc 2.28, GLib 2.58, Python 3.7, Meson 0.49
build:debian10:
extends: .build
image: debian/eol:buster
before_script: *deps_debian
variables:
CAN_MESON_DIST: no

build:debian-stable:
extends: .build
image: debian:stable
before_script: *deps_debian

build:debian-testing:
extends: .build
image: debian:testing
before_script: *deps_debian

# Linux 4.4 headers, glibc 2.23, GLib 2.48, Python 3.5, Meson 0.49 from pip
build:ubuntu1604:
extends: .build
image: ubuntu:xenial
before_script: *deps_ubuntu_oldlts
variables:
CAN_MESON_DIST: no

# Linux 4.15 headers, glibc 2.27, GLib 2.56, Python 3.6, Meson 0.49 from pip
build:ubuntu1804:
extends: .build
image: ubuntu:bionic
before_script: *deps_ubuntu_oldlts
variables:
CAN_MESON_DIST: no

reuse:
stage: build
image:
Expand Down
2 changes: 2 additions & 0 deletions subprojects/libglnx/Makefile-libglnx.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ libglnx_la_SOURCES = \
$(libglnx_srcpath)/glnx-backport-testutils.c \
$(libglnx_srcpath)/glnx-backports.h \
$(libglnx_srcpath)/glnx-backports.c \
$(libglnx_srcpath)/glnx-chase.h \
$(libglnx_srcpath)/glnx-chase.c \
$(libglnx_srcpath)/glnx-local-alloc.h \
$(libglnx_srcpath)/glnx-local-alloc.c \
$(libglnx_srcpath)/glnx-errors.h \
Expand Down
34 changes: 34 additions & 0 deletions subprojects/libglnx/glnx-backports.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,40 @@ g_clear_fd (int *fd_ptr,
return _glnx_close (fd, error);
G_GNUC_END_IGNORE_DEPRECATIONS
}

#else

static inline gboolean
_glnx_clear_fd (int *fd_ptr,
GError **error)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
return g_clear_fd (fd_ptr, error);
G_GNUC_END_IGNORE_DEPRECATIONS
}
#define g_clear_fd _glnx_clear_fd

#endif

/* This is part of the backport of g_autofd, but we define it
* unconditionally because it's also used to implement glnx_close_fd() */
static inline void
_glnx_clear_fd_ignore_error (int *fd_ptr)
{
/* Don't overwrite thread-local errno if closing the fd fails */
int errsv = errno;

if (!g_clear_fd (fd_ptr, NULL))
{
/* Do nothing: we ignore all errors, except for EBADF which
* is a programming error, checked for by g_close(). */
}

errno = errsv;
}

#if !GLIB_CHECK_VERSION(2, 76, 0)
#define g_autofd __attribute__((cleanup(_glnx_clear_fd_ignore_error)))
#endif

#if !GLIB_CHECK_VERSION(2, 40, 0)
Expand Down
Loading