Skip to content

Commit

Permalink
Add Cosmopolitan libc builds (#65)
Browse files Browse the repository at this point in the history
* let's see how this goes

* add action

* chmod +x

* syntax

* remove unused

* static only

* static

* openssl tweaks

* libffi tweak

* libffi tweaks

* build separate libffis

* use arch specific ar

* log

* Revert "log"

This reverts commit cb756d6.

* merge libffi archives

* patch configure script

* disable shared

* more sed

* Revert "Revert "log""

This reverts commit 6929b91.

* Revert "Revert "Revert "log"""

This reverts commit b591554.

* cmake overrides

* Add quotes

* disable shared

* cmake tweaks

* Drop libuuid

* Disable shared

* Copy aarch64 libs

* Copy some libs

* Copy more libs

* Disable shared

* Disable some asm

* more build tweaks

* try cosmoinstall

* Revert "try cosmoinstall"

This reverts commit a81b001.

* build libgcrypt separately

* set host

* Use aarch64 lib dir

* Fix out dir

* Force lib dir again

* skip gpg-error-config

* more specific aarch64 copys

* fix libfreetype path

* add libbrotlicommon

* Revert "add libbrotlicommon"

This reverts commit a292665.

* wip workflow refactoring

* add libbrotlicommon

* expand multi-os test

* wf tweak

* pin action

* disable fc-cache

* modify freetype pkgconfig

* fix copy

* disable x11/tcl/tk, tweak python build

* disable docs

* tweak job name

* tweaks

* disable linux extensions

* link with expat

* use cmake's cosmocc checks to disable extensions

* add libexpat

* cleanup + disable pip stuff for now

* wf tweaks

* Use extension

* Update build_python.yml

* Update build_cosmo.sh

* Update build_python.yml

* Add cosmo

* Add cosmo

* remove linux arm64 test

* remove macos x86_64 because it requires billing

* disable ctypes

* patch pip script

* use feature branch

* pyclean cosmo

* copy debug symbols into result

* Revert "disable x11/tcl/tk, tweak python build"

This reverts commit c368f80.

* copy aarch64 for proper libs

* only build cosmo

* Revert "copy aarch64 for proper libs"

This reverts commit b171de9.

* Revert "Revert "disable x11/tcl/tk, tweak python build""

This reverts commit a381548.

* probably don't need these libs if x11 isn't going to build

* Remove unused

* Remove unused

* Remove unused

* remove more unused

* test cosmo on freebsd

* Revert "test cosmo on freebsd"

This reverts commit d7fdc3e.

* use older cosmocc

* Revert "Revert "test cosmo on freebsd""

This reverts commit f59c328.

* fix freebsd test

* only save python.com

* fix script path

* use older cosmocc

* only include dbg when in debug build

* copy aarch64 libpython

* bring back all builds

* maybe we don't need libpython

* Revert "maybe we don't need libpython"

This reverts commit 0f6a615.

* Use latest cosmocc with windows fix

* Test NetBSD and OpenBSD

* Split out

* full path

* install unzip

* bash -e

* add cosmopolitan license

* fix dir

* bump cosmocc, fix openbsd pkgs

* Revert "remove more unused"

This reverts commit 289213d.

* poll subprocess in test

* update comment
  • Loading branch information
bjia56 authored Jul 1, 2024
1 parent ac14dff commit 018307c
Show file tree
Hide file tree
Showing 5 changed files with 490 additions and 17 deletions.
181 changes: 179 additions & 2 deletions .github/workflows/build_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
platforms:
required: true
type: string
default: "linux-x86_64,linux-aarch64,linux-i386,linux-arm,linux-riscv64,macos,windows,freebsd13-x86_64,freebsd14-x86_64"
default: "linux-x86_64,linux-aarch64,linux-i386,linux-arm,linux-riscv64,macos,windows,cosmo,freebsd13-x86_64,freebsd14-x86_64"
buildsystem_branch:
required: false
type: string
Expand Down Expand Up @@ -255,6 +255,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ macos-12, macos-14 ]
include:
- os: macos-12
arch: x86_64
Expand Down Expand Up @@ -390,4 +391,180 @@ jobs:
./bin/python -m test -v -ulargefile,network,decimal,cpu,subprocess,urlfetch,tzdata --timeout 60
fi
EOF
bash /tmp/test.sh
bash -e /tmp/test.sh
build_cosmo:
name: Cosmopolitan ${{ inputs.python_version }} (build)
if: ${{ contains(inputs.platforms, 'cosmo') }}
runs-on: ubuntu-latest

steps:
- name: Set up cosmocc
uses: bjia56/[email protected]
with:
version: 3.5.4

- name: Checkout
uses: actions/checkout@v4

- name: Build
run: |
./scripts/build_cosmo.sh unknown ${{ inputs.python_version }}
- name: Interactive debugging
if: ${{ always() && inputs.debug_interactive }}
uses: fawazahmed0/action-debug@v2

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-cosmo-unknown-${{ inputs.python_version }}
path: ./python*.zip

- name: Upload artifacts
if: ${{ always() && inputs.debug }}
uses: actions/upload-artifact@v4
with:
name: build-python-cosmo-unknown-${{ inputs.python_version }}
path: ./*python*.tar.gz

test_cosmo:
name: Cosmopolitan ${{ inputs.python_version }} ${{ matrix.os }} ${{ matrix.arch }} (test)
needs: build_cosmo
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: macos-14
arch: arm64
os: MacOS
- runner: ubuntu-latest
arch: x86_64
os: Linux
- runner: windows-latest
arch: x86_64
os: Windows
- runner: ubuntu-latest
arch: x86_64
os: FreeBSD
- runner: ubuntu-latest
arch: x86_64
os: NetBSD
- runner: ubuntu-latest
arch: x86_64
os: OpenBSD

steps:
- name: Set up cosmocc
if: ${{ matrix.os == 'Linux' }}
uses: bjia56/[email protected]

- name: Checkout
uses: actions/checkout@v4

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: python-cosmo-unknown-${{ inputs.python_version }}
path: ./python/

- name: Test python in clean environment
if: ${{ !contains(matrix.os, 'BSD') }}
shell: bash
run: |
if [[ "${{ matrix.os }}" == "Windows" ]]; then
7z.exe x python/python-${{ inputs.python_version }}-cosmo-unknown.zip
else
unzip python/python-${{ inputs.python_version }}-cosmo-unknown.zip
chmod +x python-${{ inputs.python_version }}-cosmo-unknown/bin/python.com
fi
cd python-${{ inputs.python_version }}-cosmo-unknown
./bin/python.com --version
./bin/python.com -m sysconfig
./bin/python.com ../scripts/test.py
./bin/pip3
if [[ "${{ inputs.run_tests }}" == "true" ]]; then
./bin/python.com -m test -v -ulargefile,network,decimal,cpu,subprocess,urlfetch,tzdata --timeout 60
fi
- name: Test in VM
if: ${{ matrix.os == 'FreeBSD' }}
uses: vmactions/freebsd-vm@v1
with:
envs: 'RUN_TESTS DEBUG_CI VERBOSE_CI PORTABLE_PYTHON_BUILDSYSTEM_BRANCH'
usesh: true
copyback: false
prepare: |
pkg install -y bash
run: |
cat > /tmp/test.sh <<EOF
unzip python/python-${{ inputs.python_version }}-cosmo-unknown.zip
cd python-${{ inputs.python_version }}-cosmo-unknown
chmod +x ./bin/python.com
./bin/python.com --version
./bin/python.com -m sysconfig
./bin/python.com ${{ github.workspace }}/scripts/test.py
./bin/pip3
if [[ "${{ inputs.run_tests }}" == "true" ]]; then
./bin/python.com -m test -v -ulargefile,network,decimal,cpu,subprocess,urlfetch,tzdata --timeout 60
fi
EOF
bash -e /tmp/test.sh
- name: Test in VM
if: ${{ matrix.os == 'NetBSD' }}
uses: vmactions/netbsd-vm@v1
with:
envs: 'RUN_TESTS DEBUG_CI VERBOSE_CI PORTABLE_PYTHON_BUILDSYSTEM_BRANCH'
usesh: true
copyback: false
prepare: |
/usr/sbin/pkg_add bash
run: |
cat > /tmp/test.sh <<EOF
unzip python/python-${{ inputs.python_version }}-cosmo-unknown.zip
cd python-${{ inputs.python_version }}-cosmo-unknown
chmod +x ./bin/python.com
./bin/python.com --version
./bin/python.com -m sysconfig
./bin/python.com ${{ github.workspace }}/scripts/test.py
./bin/pip3
if [[ "${{ inputs.run_tests }}" == "true" ]]; then
./bin/python.com -m test -v -ulargefile,network,decimal,cpu,subprocess,urlfetch,tzdata --timeout 60
fi
EOF
bash -e /tmp/test.sh
- name: Test in VM
if: ${{ matrix.os == 'OpenBSD' }}
uses: vmactions/openbsd-vm@v1
with:
envs: 'RUN_TESTS DEBUG_CI VERBOSE_CI PORTABLE_PYTHON_BUILDSYSTEM_BRANCH'
usesh: true
copyback: false
prepare: |
pkg_add bash unzip-6.0p17
run: |
cat > /tmp/test.sh <<EOF
unzip python/python-${{ inputs.python_version }}-cosmo-unknown.zip
cd python-${{ inputs.python_version }}-cosmo-unknown
chmod +x ./bin/python.com
./bin/python.com --version
./bin/python.com -m sysconfig
./bin/python.com ${{ github.workspace }}/scripts/test.py
./bin/pip3
if [[ "${{ inputs.run_tests }}" == "true" ]]; then
./bin/python.com -m test -v -ulargefile,network,decimal,cpu,subprocess,urlfetch,tzdata --timeout 60
fi
EOF
bash -e /tmp/test.sh
2 changes: 1 addition & 1 deletion .github/workflows/build_python_on_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ jobs:
run_tests: ${{ inputs.run_tests || false }}
debug: ${{ inputs.debug || false }}
verbose: ${{ inputs.verbose || false }}
platforms: "linux-x86_64,linux-aarch64,linux-i386,linux-arm,linux-riscv64,macos,windows,freebsd13-x86_64,freebsd14-x86_64"
platforms: "linux-x86_64,linux-aarch64,linux-i386,linux-arm,linux-riscv64,macos,windows,cosmo,freebsd13-x86_64,freebsd14-x86_64"
buildsystem_branch: ${{ inputs.buildsystem_branch || 'portable-python' }}
Loading

0 comments on commit 018307c

Please sign in to comment.