Commit Graph

328 Commits

Author SHA1 Message Date
Hailey Somerville
c65e163240 gio, gmodule, gthread: compile windows resources only in shared build
When linking static libraries, multiple resources is an error unless
handled in a special way. glib and gobject do not have this problem,
as they already only include resources when building a shared lib.
2024-01-21 18:51:52 +11:00
Marco Trevisan (Treviño)
ade79bcb50 meson: Add tests for generated pkg-config files
Ensure things are generated as we expect and avoid we regress on that.
2023-04-17 14:25:52 +02:00
Marco Trevisan (Treviño)
58031feb17 meson: Use 'tap' test protocol by default
Meson supports tap protocol results parsing, allowing us to track better
the tests that are running (and the ones that are actually skipped) without
manually parsing the test output.

However this also implies that using the verbose mode for a test doesn't
show its output by default (unless there are failures).
2023-01-17 21:08:48 +01:00
Simon McVittie
2b4977635c gthread: Fully initialize GThreadFunctions structure in test
The macOS CI builds with -Werror=missing-field-initializers by default,
making incomplete initializers a compile-time error (even though their
meaning is well-defined: missing fields are initialized as if with
.field = 0).

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2812
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-14 09:43:29 +00:00
Philip Withnall
5585d15d9c tests: Add some trivial tests for g_thread_init()
It’s deprecated, but the big red 0/0/0 line for the `glib/gthread`
directory in the lcov output for GLib is driving me nuts.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-10 15:33:34 +00:00
Xavier Claessens
dcfc9f689e Fix symbol visibility macros on Windows
There is currently no `dllimport` attribute on any of our function,
which prevents MSVC to optimize function calls.

To fix that issue, we need to redeclare all our visibility macros for
each of our libraries, because when compiling e.g. GIO code, we need
dllimport in GLIB headers and dllexport in GIO headers. That means they
cannot use the same GLIB_AVAILABLE_* macro.

Since that's a lot of boilerplate to copy/paste after each version bump,
this MR generate all those macros using a python script.

Also simplify the meson side by using `gnu_symbol_visibility : 'hidden'`
keyword argument instead of passing the cflag manually.

This leaves only API index to add manually into glib-docs.xml when
bumping GLib version. That file cannot be generated because Meson does
not allow passing a buit file to gnome.gtkdoc()'s main_xml kwarg
unfortunately.
2022-10-13 20:53:56 -04:00
Philip Withnall
26409f19cd Add SPDX license headers for LGPL-2.1-or-later to various files
These have all been added manually, as I’ve finished all the files which
I can automatically detect.

All the license headers in this commit are for LGPL-2.1-or-later, and
all have been double-checked against the license paragraph in the file
header.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-06-01 12:44:23 +01:00
Philip Withnall
25ab87d8e5 build: Drop checks and workarounds for older Meson versions
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:01:44 +01:00
Xavier Claessens
10280deebd Meson: Override every dependency glib provides
Meson 0.54.0 added a new method meson.override_dependency() that must be
used to ensure dependency consistency. This patch ensures a project that
depends on glib will never link to a mix of system and subproject
libraries. It would happen in such cases:

The system has glib 2.40 installed, and a project does:
dependency('glib-2.0', version: '>=2.60',
  fallback: ['glib', 'glib_dep'])
dependency('gobject-2.0')

The first call will configure glib subproject because the system libglib
is too old, but the 2nd call will return system libgobject.

By overriding 'gobject-2.0' dependency while configuring glib subproject
during the first call, meson knows that on the 2nd call it must return
the subproject dependency instead of system dependency.

This also has the nice side effect that with Meson >0.54.0 an
application depending on glib can declare the fallback without knowing
the dependency variable name: dependency('glib-2.0', fallback: 'glib').
2020-04-05 00:34:04 -04:00
Philip Withnall
b3efef5b6f build: Drop autotools support
So long, and thanks for everything. We’re a Meson-only shop now.

glib-2-58 will remain the last stable GLib release series which is
buildable using autotools.

We continue to install autoconf macros for autotools-using projects
which depend on GLib; they are stable API.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-15 15:11:43 +00:00
Xavier Claessens
475f0a9b67 Meson: Fix deprecation warning with 0.49.0 release
http://mesonbuild.com/Release-notes-for-0-49-0.html#deprecation-warning-in-pkgconfig-generator
2018-12-10 09:08:28 -05:00
Nirbheek Chauhan
8b3590c231 meson: Add macOS libtool versioning for ABI compatibility
With this, the compatibility version and current version values in macOS
and iOS dylibs will match the values set by Autotools.

See: https://github.com/mesonbuild/meson/issues/1451
2018-10-22 06:51:32 +05:30
Xavier Claessens
4b5bc3f459 Meson: build and install remaining tests 2018-09-21 08:45:54 -04:00
Christoph Reiter
912581340e Remove all static ChangeLog files
They only contain old information which is also available in git
2018-09-04 15:56:54 +02:00
Xavier Claessens
b6cb22f32b Meson: Do not build tests with nodelete/Bsymbolic-functions
-z nodelete breaks the libresourceplugin module usage in the resources.c
test, which expects to be able to unload it.

Make the Meson build match what the autotools build does: only pass
glib_link_flags to the headline libraries (glib-2.0, gio-2.0,
gobject-2.0, gthread-2.0, gmodule-2.0) and omit it from all other build
targets.

https://bugzilla.gnome.org/show_bug.cgi?id=788771
2018-05-09 12:52:59 +01:00
Xavier Claessens
3c76114e73 Meson: Use pkgconfig module to generate all pc files
This requires improved pc file generator from meson 0.45.

https://bugzilla.gnome.org/show_bug.cgi?id=788773
2018-03-28 19:31:20 -04:00
Christoph Reiter
cf93b27ceb meson: fix static build under Windows
Properly define GLIB/GOBJECT_STATIC_COMPILATION when static build is enabled.
Use library() instead of shared_library() to allow selecting static builds.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-01-04 22:21:40 +01:00
Christoph Reiter
aa7c5cbdcb meson: build Windows resource files
configure_file() forces utf-8 atm but .rc files are not utf-8.
To work around the issue just remove the only non-ASCII char.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-01-04 22:19:30 +01:00
Tim-Philipp Müller
2f29ee1735 meson: add -fvisibility=hidden explicitly to selected targets
Don't use it project-wide for building everything. Otherwise
symbols for shared modules won't be exposed, e.g. in the
resourceplugin used by the gio resource unit test.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
fe2a9887a8 meson: Improve MSVC and MinGW support and fix dependencies everywhere
Disable gio tests on Windows, fix .gitignore to not ignore
config.h.meson, and add more things to it.

Rename the library file naming and versioning to match what Autotools
outputs, e.g., libglib-2.0.so.0.5000.2 on Linux, libglib-2.0-0.dll  and
glib-2.0-0.dll on Windows with MSVC.

Several more tiny fixes, more executables built and installed, install
pkg-config and m4 files, fix building of gobject tests.

Changes to gdbus-codegen to support out-of-tree builds without
environment variables set (which you can't in Meson). We now add the
build directory to the Python module search path.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
213957970e meson: Fix glib, add gobject, gio, gthread, gmodule, etc
Several small fixes to the build files.

Lots of tests have also been added, and glib tests pass now.
2017-07-13 19:03:39 -04:00
Philip Withnall
a131134918 build: Drop nmake/MSC build system for GLib
It hasn’t been seriously maintained for the best part of 10 years and is
very outdated. The recommended way to build GLib on Windows is now
Visual Studio:

https://wiki.gnome.org/Projects/GTK%2B/Win32/MSVCCompilationOfGTKStack#GLib

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=722047
2017-07-10 11:22:40 +01:00
Sébastien Wilmet
feacdabb3f gthread/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-24 11:58:19 +02:00
Ryan Lortie
7cbff954b9 win32: fixup lib.exe invocation
We have a configure.ac check for lib.exe that attempts to enable
creation of .lib files for our 5 public libraries.  That has been broken
for a long time for two reasons:

 1) the Makefiles hardcode 'lib' instead of 'lib.exe'

 2) we dropped generation of .def files quite some time ago (except for
    in gthread where we have the two-symbol file under version control)

Add new rules for creating .def files from dumpbin.exe (which you should
have if you have lib.exe) and fix the .lib rules to use lib.exe.

Add a bit of $(AM_V_GEN) all around, as well.

https://bugzilla.gnome.org/show_bug.cgi?id=722033
2014-02-15 16:55:25 -05:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Ryan Lortie
f9eb9eed10 Rework the build system for a new tests approach
Perform a substantial cleanup of the build system with respect to
building and installing testcases.

First, Makefile.decl has been renamed glib.mk and substantially
expanded.  We intend to add more stuff here in the future, like canned
rules for mkenums, marshallers, resources, etc.

By default, tests are no longer compiled as part of 'make'.  They will
be built when 'make check' is run.  The old behaviour can be obtained
with --enable-always-build-tests.

--disable-modular-tests is gone (because tests are no longer built by
default).  There is no longer any way to cause 'make check' to be a
no-op, but that's not very useful anyway.

A new glibtests.m4 file is introduced.  Along with glib.mk, this
provides for consistent handling of --enable-installed-tests and
--enable-always-build-tests (mentioned above).

Port our various test-installing Makefiles to the new framework.

This patch substantially improves the situation in the toplevel tests/
directory.  Things are now somewhat under control there.  There were
some tests being built that weren't even being run and we run those now.
The long-running GObject performance tests in this directory have been
removed from 'make check' because they take too long.

As an experiment, 'make check' now runs the testcases on win32 builds,
by default.  We can't run them under gtester (since it uses a pipe to
communicate with the subprocess) so just toss them in TESTS.  Most of
them are passing on win32.

Things are not quite done here, but this patch is already a substantial
improvement.  More to come.
2013-05-31 23:12:15 -04:00
Colin Walters
156b14cde5 build: Add --disable-compile-warnings
Some (broken) toolchains for example trip up
-Werror=missing-prototypes in system headers.  This patch allows
people to skip the formerly hardcoded "baseline" warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=694757
2013-02-27 08:34:01 -05:00
Ryan Lortie
5d42fdd068 visibility: Use a separate CFLAGS variable
We only want to control the default visibility for our five main
installable libraries: libglib, libgthread, libgmodule, libgobject,
libgio.  We should therefore only set -fvisibility=hidden when building
those.

Use a separate substitution variable for this purpose.

Using CFLAGS directly leads to some modules built in testcases not
exporting their symbols (and then the tests fail).  It also affects the
fam file monitoring module.

Colin had originally done it this way in his visibility patch series but
I failed to understand why so I didn't copy it.  Now I do.

Also: revert changes made to two testcases in an attempt to work around
this issue.

https://bugzilla.gnome.org/show_bug.cgi?id=691756
2013-01-14 23:31:59 -05:00
Ryan Lortie
f8756694cf gthread-impl.c: add missing #include "config.h"
One of the features of our new symbol exporting regime is that it forces
config.h to be included at the top of every .c file.

This was missed in gthread-impl.c.

The only reason this wasn't noticed is because nothing in this file is
being used anymore.  We need those symbols to continue to be exported
for reasons of ABI backwards compatibility, however.
2013-01-14 00:06:26 -05:00
Alexander Larsson
cf3f1b026b Actually Don't define GLIB_COMPILATION in libgthread
Last commit was wrong, fixing it up
2011-10-18 14:15:07 +02:00
Alexander Larsson
be770969e9 Don't define GLIB_COMPILATION in libgthread
This was turning all the GLIB_VARs in the glib headers into
dllexports on windows, causing all sort of nastiness. libgthread is
mostly empty now anyway, so we don't need any GLIB_COMPILATION like
flag.
2011-10-18 13:34:06 +02:00
Ryan Lortie
a6d9cf3380 gthread/: fix up declarations
g_thread_init() is now a deprecated API, so drop G_DISABLE_DEPRECATED
from the CFLAGS for gthread/.  Add the missing declaration for
g_thread_init_with_errorcheck_mutexes() back to deprecated/gthread.h.
2011-10-16 21:50:26 -04:00
Ryan Lortie
a9a1c97904 gthread: move test cases to glib/ 2011-10-16 19:08:59 -04:00
Ryan Lortie
fb4e120d88 tests: merge gthread/ and glib/ atomic tests 2011-10-16 19:04:19 -04:00
Ryan Lortie
430c5635f2 g_thread_new: never fail
Remove the GError argument from g_thread_new() and abort on failure.
Introduce g_thread_try() for those who want to handle failure.
2011-10-13 01:00:57 -04:00
Ryan Lortie
015f4b4513 thread: nuke the concept of 'joinable'
And remove the 'joinable' argument from g_thread_new() and
g_thread_new_full().

Change the wording in the docs.  Clarify expectations for
(deprecated) g_thread_create().
2011-10-13 00:43:33 -04:00
Matthias Clasen
daede1dc27 Disable deprecations where appropriate in tests 2011-10-12 00:48:18 -04:00
Matthias Clasen
749758ec78 Add a warning to g_thread_init_with_errorcheck_mutexes
Should anybody try to use this, we should at least tell them that
its gone.
2011-10-05 22:23:25 -04:00
Ryan Lortie
47444dacc0 Deprecate g_thread_init()
Move the last few things that needed thread-safe initialisation to a
global ctor.

https://bugzilla.gnome.org/show_bug.cgi?id=660744
2011-10-04 15:31:49 -04:00
Matthias Clasen
bc67c23bf9 Define GLIB_COMPILATION when building libgthread.so
This is necessary, because gthreadprivate.h can only be
included inside GLib, otherwise single-include guards trigger.
2011-10-02 22:11:34 -04:00
Ryan Lortie
97972fbb3a g_thread_init: take a gpointer as the arg
GThreadFunctions is about to disappear.
2011-09-21 16:06:56 -04:00
Ryan Lortie
c33cd00739 Stop using GStaticMutex in two testcases 2011-09-21 16:06:53 -04:00
Ryan Lortie
413186a962 emufutex: remove init from g_thread_init_glib
Use a GStaticMutex instead.
2011-09-09 13:23:48 -04:00
Ryan Lortie
cfa1d0540e Move the GThread implementations to glib/
We can now get threads initialised from inside of libglib by calling
g_thread_init_glib().
2011-09-09 12:47:40 -04:00
Ryan Lortie
96e4896804 invert gthread-impl includes
configure.ac defined G_THREAD_SOURCE and gthread-impl would #include it.

Instead, since we only have two thread implementations now, and since we
always use the Windows one only on Windows, move the logic to the
Makefile, predicated on 'if OS_WIN32'.  Then have the chosen backend do
the #include "gthread-impl.c" from there.

Remove the G_THREAD_SOURCE define from configure.ac.
2011-09-09 12:47:40 -04:00
Ryan Lortie
fc6a9275a4 win32 threads: assume TryEnterCriticalSection
Remove the dynamic lookup for TryEnterCriticalSection, which has existed
since Windows 2000.
2011-09-09 12:47:40 -04:00
Ryan Lortie
7cf89847e2 Stop using HAVE_G_THREAD_IMPL_INIT
Just always call the init function.
2011-09-09 12:47:40 -04:00
Ryan Lortie
46af418e05 Move thread priority translation into the backends
The translation of GLib priorities into the thread priorities of
different operating systems belongs in the implementation -- not
half-way in the front end.
2011-09-09 12:47:40 -04:00
Ryan Lortie
a4777122c8 Remove useless macros from when we supported DCE
These are non-ops now, and easily replaced.
2011-09-09 12:47:40 -04:00
Ryan Lortie
715f94e951 Remove support for DCE threads 2011-09-09 12:47:40 -04:00