Skip to content

Tidying on external_deps#1992

Open
illwieckz wants to merge 9 commits into
masterfrom
illwieckz/deps-1
Open

Tidying on external_deps#1992
illwieckz wants to merge 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.

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