Skip to content

Tidying on external_deps - #1992

Merged
illwieckz merged 9 commits into
masterfrom
illwieckz/deps-1
Oct 5, 2026
Merged

illwieckz merged 9 commits into
masterfrom
illwieckz/deps-1

Conversation

@illwieckz

Copy link
Copy Markdown
Member

Tidying on external_deps.

Extracted from:

The unify style commit is just bikeshedding, it's just to be consistent within the file (not claiming that new files should do it that way), so later code I already wrote will also be consistent
The rewriting comment commit is also just bikeshedding, but future architecture implementations (already written) will match that wording.

The smart_copy commit is useful as it uses copy-on-write enabled cp when available (much faster copy because data is not duplicated on disk). The copy-on-write enabled cp already knows how to do a standard copy when the feature is not provided by the filesystem, the test to fallback on the standard cp tool on systems like macOS.

Some commits rewrite the way things are copied, in better way (for example to avoid globbing when unneeded).
In some cases, it actually fixes a bug where a folder is copied in itself the second time the script is run. This only applied to a software we don't package yet (WASI), but letter have this ready for the day we continue this effort.

The EXE_EXT thing will reduce diff noise when future code will land.

The xz compression stuff should be obvious, it's just an extra option to make the compression more extreme.

We don't have to wait for more meaningful changes to merge that, and it makes my branch smaller.

@illwieckz

illwieckz commented Jul 10, 2026 •

Copy link
Copy Markdown
Member Author

I forgot to say may the smart_copy commit also unifies the used copy options (and avoids some GNUism).

Comment thread external_deps/build.sh
}

smart_copy() {
if ! cp --reflink=auto -P "${@}" 2>/dev/null

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of GNU cp 9.x which is a few years old --reflink=auto is the default. So this is unnecessary.

@illwieckz illwieckz Jul 14, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We better be picky, and we still build the game and its external deps on Debian Bullseye which has coreutils 8.32-4+b1 anyway.

Comment thread external_deps/build.sh
cd "${dir_name}"
cp -r include/* "${PREFIX}/include"
cp -r lib/* "${PREFIX}/lib"
smart_copy -R 'include/.' "${PREFIX}/include/"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this weird /. syntax?

@illwieckz illwieckz Jul 14, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It copies all the content of the folder without globbing (and, even if it's not needed there, it likely copies hidden files too, that globbing may misses).

If you copy dir to dir you may end up with dir/dir, while by coyping dir/. to dir/., you make sure only the content get copied.

That's because . is “self”, and doesn't have any name, and one cannot create . in a folder, it's non-ambiguous.

Edit: And dir/./. is dir/. wichi is dir/ so by copying . into dir/. even if you may be copying . into dir/. and get dir/./., then dir/./. is still dir/…

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I looked it up and it's a trick to get the same behavior from GNU and BSD cp.

Seems doubtful that we actually want dot files (e.g. Mac .DS_Store), but ones more than one level down would be copied anyway so at least it's consistent?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems doubtful that we actually want dot files (e.g. Mac .DS_Store), but ones more than one level down would be copied anyway so at least it's consistent?

Yes, it makes things consistent. If we need to filter-out .DS_Store, we better hunt for them than to rely on implicit behaviors.

Comment thread external_deps/build.sh Outdated
mkdir -p "${PREFIX}/SDL3/include/SDL3"
cp "include/SDL3/"* "${PREFIX}/SDL3/include/SDL3"
mkdir -p "${PREFIX}/SDL3"
rm -rf "${PREFIX}/SDL3/cmake"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this rm need to be added?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the next line copies into cmake/, it doesn't replace cmake/.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I forgot to also delete "${PREFIX}/SDL3/${sdl3_lib_dir}", as building a test deps archive after upgrading the SDL3 version but before bumping the deps version also keep leftovers.

The easiest is just to prune ${PREFIX}/SDL3 once for all instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The easiest is just to prune ${PREFIX}/SDL3 once for all instead.

Now done.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making a clean/minimal archive after having changed the build instructions in the middle of the build must be a non-goal for the script. So the rm is not needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, removed.

@illwieckz
illwieckz force-pushed the illwieckz/deps-1 branch 2 times, most recently from 25c66d4 to baaec2c Compare October 5, 2026 00:31
@slipher

slipher commented Oct 5, 2026

Copy link
Copy Markdown
Member

LGTM

@illwieckz
illwieckz merged commit 7e1370d into master Oct 5, 2026
4 checks passed
@illwieckz
illwieckz deleted the illwieckz/deps-1 branch October 5, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants