Nick Bowler [Thu, 24 Feb 2022 04:20:34 +0000 (23:20 -0500)]
Ditch local orderonly trick.
The orderonly trick used here is missing various updates in fix-gnulib
that improve interoperability with various make implementations.
We can just rely on the logic in $(gnulib_headers) to get its version
of the order-only behaviour, particularly since every file including
these ones should have gnulib header dependencies.
Nick Bowler [Thu, 24 Feb 2022 03:02:20 +0000 (22:02 -0500)]
Use AC_CONFIG_HEADERS rather than AC_CONFIG_HEADER.
The former name has been supported since approximately forever ago and
the latter form is now formally deprecated (with a warning) in recent
versions of Autoconf.
Nick Bowler [Thu, 24 Feb 2022 02:49:33 +0000 (21:49 -0500)]
Disable deprecation warnings from Glib.
Having glib spew out pages of warnings just because we happened to
build on a machine with a newer version installed, telling us to modify
perfectly working code to break compatibility and risk regressions for
no reason... seems a bit daft.
Fortunately we can simply define a macro to shut it all up.
Doing this in config.h revealed that many source files don't include it,
which is a bug in its own right so fix that up at the same time.
Nick Bowler [Thu, 24 Feb 2022 02:01:46 +0000 (21:01 -0500)]
tests: Fix libupkg-index-decode test failure on dash.
We need to quote the decode_val assignment which we pass to 'eval',
because $val may be the string (empty), and assignments of the form
decode_val=(empty) are rejected by dash and other shells.
Nick Bowler [Fri, 31 Jan 2020 22:39:30 +0000 (17:39 -0500)]
Improve incremental builds with unmodified GOB headers.
It's nice to not touch header files which are unchanged during an
incremental build, because that will trigger pointless rebuilds of
other files. Pass --no-touch-headers to gob2 which enables this
behaviour.
Add a dist-hook to update the header timestamps when distributing
so that everything is fully up-to-date in the tarball.
Nick Bowler [Fri, 31 Jan 2020 20:04:14 +0000 (15:04 -0500)]
Improve GOB rebuild rules for VPATH builds.
In a VPATH build, if make explicitly targets a .gobstamp in srcdir, the
.c and .h outputs currently end up in builddir while the .gobstamp ends
up in srcdir.
This behaviour can be triggered when distributed headers in srcdir are
referenced by the automatic dependency tracking and then the .gob file
is updated.
Ideally everything would always go in builddir whenever gob files are
rebuilt but it turns out this is rather difficult to get right: when
headers originally in srcdir are updated in builddir, make will not
detect all necessary rebuilds.
However we can avoid most problems by just ensuring all the files end
up wherever make is trying to update the gobstamp. This will typically
be builddir from a clean build but may be srcdir if automatic dependency
tracking is used. The gob2 interface is a bit annoying because we cannot
explicitly specify the output filename but it is fairly simple to work
around in the shell.
While we are here, make sure the .gobstamp timestamp precedes the
other generated files, as otherwise the deletion recovery rules will
be run every build.
Nick Bowler [Fri, 31 Jan 2020 19:56:21 +0000 (14:56 -0500)]
Fix VPATH builds from clean checkout.
When doing a VPATH build from a fully clean checkout, the GOB outputs
end up in the build directory. When this happens, #include "pcx.h"
won't find the header because this header is in srcdir.
The solution is to make sure we always #include relative to the top
src/ directory, which is already explicitly added to the compiler
search path.
Nick Bowler [Mon, 27 Jan 2020 20:00:16 +0000 (15:00 -0500)]
Make GOB2 optional.
When building from a distribution tarball, gob2 should not actually be
required because all its outputs are distributed. Allow configure to
proceed in this case, and defer the failure until later, when make
actually tries to process a gob file.
And add a proper configure test for the dynamic type support in the
gob-dx fork, which we require.
Nick Bowler [Wed, 27 Feb 2019 18:35:39 +0000 (13:35 -0500)]
Fix build with more recent libmodplug.
Modern versions of libmodplug no longer put -I${includedir}/libmodplug
in the pkg-config file, which breaks our files that #include <modplug.h>.
Seems the expectation is for packges to #include <libmodplug/modplug.h>
instead, which should work totally fine with old versions too. The new
libmodplug helper macro in dxcommon uses that, so just update the the
rest of the code accordingly.
Nick Bowler [Thu, 30 Apr 2015 03:51:44 +0000 (23:51 -0400)]
Fix bootstrapping with recent bits.
I can no longer bootstrap this package on my systems for a few reasons:
- Libtool has changed how nonrecursive libltdl is integrated
- The version of Gnulib in use does not bootstrap with dash
- The dxcommon scripts use Perl modules that I no longer install.
Do the necessary dance to fix all those issues, and resolve all the
resulting fallout.
Nick Bowler [Fri, 13 Jul 2012 14:22:43 +0000 (10:22 -0400)]
libupkg: Kill upkg_export_class.
This function was quite broken, and crapped out on a number of the
objects in Engine.u. Kill it off because we now have the machinery
to do this more properly.
Nick Bowler [Mon, 21 May 2012 01:34:42 +0000 (21:34 -0400)]
uobject: Make module loader understand exports/imports.
It's possible for a package to have an instance of a class defined in
that same package; therefore the module loader needs to know about this.
Bring the export class index up to the public struct so that it's
possible to tell the difference.
This makes it possible to export the textures defined in Engine.u.
There's still a few vestigial bugs left over here, but we can fix those
later.
Nick Bowler [Sun, 20 May 2012 19:54:24 +0000 (15:54 -0400)]
uobject: Make logging more generic.
The logging functions can now be used on any GObject, not just UObject
subclasses. In particular, it should be possible to call it on UPkg
instances which do not derive from UObject.
Nick Bowler [Sun, 20 May 2012 04:08:12 +0000 (00:08 -0400)]
music: Check data size against actual file size.
Blindly setting the file size to something potentially larger than it
seems outright silly. All this mucking about with the upkg_file struct
members should probably be eliminated eventually, but may as well do it
sanely for now.
Nick Bowler [Sat, 19 May 2012 17:40:03 +0000 (13:40 -0400)]
uobject: Initial support for object imports.
This is missing a lot of features currently; in particular, imports will
get loaded multiple times, but we can at least resolve them and create
the relevant objects.
Add a DetailTexture property to Engine.Texture to demonstrate.
Nick Bowler [Wed, 16 May 2012 23:55:15 +0000 (19:55 -0400)]
libupkg: Make export parent handling match imports.
It seems pretty clear that this is meant to be a signed quantity like
other object references, although it really doesn't matter since it
should never be negative. Nevertheless, we may as well keep
import/export handling as similar as possible.
Nick Bowler [Wed, 16 May 2012 00:29:08 +0000 (20:29 -0400)]
uobject: Make the relevant UPkg available to objects.
Instead of passing around raw "struct upkg" pointers, keep the
GTypeModule implementation around instead (which contains this
information). This allows access to all package functions; in
particular, it allows access to the package name.
Modify implementations to get the raw "struct upkg" from the upkg_file
reference instead.
Nick Bowler [Wed, 16 May 2012 00:23:43 +0000 (20:23 -0400)]
upkg: Use proper library routines in package_export.
Not sure why this function contained a complete re-implementation of
u_object_new_from_package, but here we are. Call the appropriate
library function to eliminate a pile of code.
Nick Bowler [Wed, 16 May 2012 00:09:22 +0000 (20:09 -0400)]
libupkg: Don't store upkg_priv pointer in struct upkg_file.
If this is going to be stored in a public struct, make it actually
useful to users outside of libupkg by giving them a pointer type that
can actually be used.
Nick Bowler [Tue, 15 May 2012 02:15:01 +0000 (22:15 -0400)]
libuobject: Store hierarchical object names for UObjects.
Such names are useful for logging and, in general, displaying object
references in a human-readable manner. This is only a partial
implementation, as package names are not yet available to the
deserialize method.
Nick Bowler [Tue, 15 May 2012 01:02:51 +0000 (21:02 -0400)]
uobject: Add support for decoding boolean properties.
Boolean properties have an encoded length of zero, but we were failing
spuriously due to an excessively broad error check. Other than that, we
have already done all the necessary decoding for boolean properties, so
just wire up the appropriate GObject calls to make it happen.
Nick Bowler [Mon, 14 May 2012 21:47:14 +0000 (17:47 -0400)]
libupkg: Store export parent pointers directly.
Making users handle the package member directly leads to some fairly
ridiculous and somewhat tricky code. Resolve them all at package load
time and store pointers directly in the upkg_export structure, which
should help simplify the callers.
At this point, we codify the "exports cannot have packages which are
imports" assumption, which appears to be valid. It's not obvious how
name lookup could possibly succeed if this were not the case.
Nick Bowler [Sat, 12 May 2012 01:14:03 +0000 (21:14 -0400)]
build: Punt BUNDLED_LIBLDTL conditional.
Now that fix-ltdl removes the unconditional builds of the bundled
libltdl, instead relying on normal prerequisites, there is no need for
this Automake conditional.
Nick Bowler [Fri, 11 May 2012 23:39:36 +0000 (19:39 -0400)]
engine: Fix off-by-one in PCX run-length encoder.
Runs of 64 bytes are invalid, but the encoder would emit them anyway
(which get subsequently interpreted as a run of 0). This obviously
causes some textures to export incorrectly.
Nick Bowler [Fri, 11 May 2012 23:30:57 +0000 (19:30 -0400)]
engine: Add a unit test for the PCX run-length encoder.
Since there ended up being an off-by-one bug here, we should test it.
We use the same hex decoder as decodeindex, so move that into a common
test library.
Nick Bowler [Wed, 9 May 2012 04:06:19 +0000 (00:06 -0400)]
uobject: First stab at a generic logging mechanism.
Let's build something on top of Glib's logging facilities which probably
work well enough for what we want to do. Add a couple calls to the
texture class for starters.
Nick Bowler [Sat, 5 May 2012 02:53:02 +0000 (22:53 -0400)]
uobject: Overhaul the UObject property decoding code.
Mostly a total rewrite, this version actually handles struct and array
properties (read: advances something resembling the correct number of
bytes instead of trying to start the next property somewhere in the
middle of the last). This version also has (hopefully) much clearer
tracking of file offsets.
Nick Bowler [Fri, 4 May 2012 22:47:11 +0000 (18:47 -0400)]
upkg: Print out object file offsets at high verbosity levels.
When debugging deserialize methods, it can be useful to see the actual
location within the package file of the object being deserialized. Add
a mode to print out these raw offsets when displaying object info at
high (-vvv) verbosity levels.
Nick Bowler [Fri, 4 May 2012 00:28:52 +0000 (20:28 -0400)]
libupkg: Fix spurious success in upkg_decode_index.
Make the upkg_decode_index function fail if the input is truncated,
rather than successfully returning a bogus value. As an added bonus,
this actually simplifies the code.
Nick Bowler [Fri, 4 May 2012 00:24:48 +0000 (20:24 -0400)]
tests: Test some corner cases of upkg_decode_index.
It turns out that upkg_decode_index does not fail when there is not
a complete index encoding in the available data. Add a test case (which
currently does not pass) to verify that the function fails in that
situation.
Nick Bowler [Fri, 25 Mar 2011 14:59:44 +0000 (10:59 -0400)]
engine: Start using GOB2 to generate GObject classes.
GOB2 allows us to eliminate a lot of boilerplate. Unfortunately,
current versions of GOB2 don't directly support dynamic types, so you
will need a patched version of GOB2 as of this writing. For now, just
the Palette class is built using GOB2.
Nick Bowler [Fri, 25 Mar 2011 00:57:22 +0000 (20:57 -0400)]
engine: Include object headers as <engine/xyz.h>.
This will work with VPATH builds even if the .h file is in the build
tree while the .c file is in the source tree, and vice versa. For
non-VPATH builds, there should be no change in behaviour.
Nick Bowler [Thu, 3 Mar 2011 02:46:19 +0000 (21:46 -0500)]
libupkg: Split the upkg_export struct into public/private parts.
This eliminates the need for dedicated functions to extract the name
and flag fields from the export struct. It should now be easy to convey
export information to applications.