Skip to content

Add Cosmopolitan build - #1854

Closed
saghul wants to merge 1 commit into
masterfrom
cosmopolitan-build
Closed

saghul wants to merge 1 commit into
masterfrom
cosmopolitan-build

Conversation

@saghul

@saghul saghul commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Add Makefile.cosmo, which builds qjs and qjsc as Actually Portable
Executables with cosmocc, starting from the amalgamation. The resulting
binaries run on Linux, macOS, Windows and the BSDs, on x86_64 and arm64.

Since a single binary runs on multiple OSes, os.platform is determined
at runtime in Cosmopolitan builds.

CI builds and tests on Linux x86_64, then runs the same binaries on
Linux arm64, macOS and Windows. The release workflow publishes them as
qjs-cosmo and qjsc-cosmo.

Add Makefile.cosmo, which builds qjs and qjsc as Actually Portable
Executables with cosmocc, starting from the amalgamation. The resulting
binaries run on Linux, macOS, Windows and the BSDs, on x86_64 and arm64.

Since a single binary runs on multiple OSes, os.platform is determined
at runtime in Cosmopolitan builds.

CI builds and tests on Linux x86_64, then runs the same binaries on
Linux arm64, macOS and Windows. The release workflow publishes them as
qjs-cosmo and qjsc-cosmo.
Comment thread quickjs-libc.c
if (JS_SetModuleExportList(ctx, m, js_os_funcs, countof(js_os_funcs)))
return -1;

#if defined(__COSMOPOLITAN__)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@bnoordhuis WDYT about this?

Comment thread Makefile.cosmo
@@ -0,0 +1,76 @@
#

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Last I tried cosmo + cmake I wasn't very successful so I tried this route...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seemed to work okay in #1839, although admittedly I didn't check if the final executable is actually an APE binary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤦 Missed that one, sorry. Feel free to close then, reusing CMake does make things simpler.

@bnoordhuis

Copy link
Copy Markdown
Contributor

Superseded/subsumed by #1839.

@bnoordhuis bnoordhuis closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants