zig icon indicating copy to clipboard operation
zig copied to clipboard

cmake: install zig to 'build_dir/stage3' during building

Open BratishkaErik opened this issue 3 years ago • 7 comments

See https://github.com/ziglang/zig/issues/14240#issuecomment-1374642063

BratishkaErik avatar Jan 10 '23 07:01 BratishkaErik

Just rebased against master.

BratishkaErik avatar Jan 11 '23 05:01 BratishkaErik

Found a bug that may or may not affect distros' package installing 👀

BratishkaErik avatar Jan 13 '23 09:01 BratishkaErik

What I find out so far:

  • Current installing procedure invokes last command [that was used during building] again, since it assumes that custom target "stage3" is always in out-of-date state:

The target has no output file and is always considered out of date even if the commands try to create a file with the name of the target.

  • Before this patch, it wasn't a problem since all it did was (simplified) "Oh, I know that program is already compiled, finish"

  • After this patch, it started to copy files to temporary "stage3/" destination not only during building, but also during installing (1). This caused in Gentoo's Portage (perhaps other package managers too) installing these files too, because they were copied during installation. IIUC ofc, maybe I'm wrong.

Following changes splits add_custom_target(stage3 ALL and command that it invokes, so that it won't retry it when installing as target will be considered not out-of-date. I'd like to know core team's opinion whether (1) is a bug or feature or smth else.

BratishkaErik avatar Jan 13 '23 11:01 BratishkaErik

What I find out so far:

* Current installing procedure invokes last command [that was used during building] again, since it assumes that custom target "stage3" is [always in out-of-date state](https://cmake.org/cmake/help/latest/command/add_custom_target.html):

The target has no output file and is always considered out of date even if the commands try to create a file with the name of the target.

* Before this patch, it wasn't a problem since all it did was (simplified) "Oh, I know that program is already compiled, finish"

* After this patch, it started to copy files to temporary "stage3/" destination not only during building, but also during installing (1). This caused in Gentoo's Portage installing these files too, because they were copied during installation. IIUC ofc, maybe I'm wrong.

Following changes splits add_custom_target(stage3 ALL and command that it invokes, so that it won't retry it when installing as target will be considered not out-of-date. I'd like to know core team's opinion whether (1) is a bug or feature or smth else.

I'm still not sure about explanation above, and sorry if my bad English made this hardly readable.

BratishkaErik avatar Jan 13 '23 11:01 BratishkaErik

Rebased for more checks

BratishkaErik avatar Jan 25 '23 02:01 BratishkaErik

ping

BratishkaErik avatar Mar 05 '23 13:03 BratishkaErik

Again, new CI checks :)

BratishkaErik avatar Mar 09 '23 14:03 BratishkaErik