-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing arch to the nix install script and adjusting brew libs + use macos-14 to build if needed #277
Open
jmarrec
wants to merge
5
commits into
actions:main
Choose a base branch
from
jmarrec:passing_arch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+46
−22
Open
Passing arch to the nix install script and adjusting brew libs + use macos-14 to build if needed #277
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4685626
Don't hardcode to brew prefix, not the same on arm64 + adjust tcl-tk …
jmarrec 582fe5f
Print influencial env vars (CFLAGS/LDFLAGS, etc)
jmarrec 1f52246
Pass arch to the install nix script
jmarrec e878f62
Use macos-14 (arm64) to prepare the package.
jmarrec 00663d1
Force build on macos-arm64
jmarrec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,10 +31,10 @@ class macOSPythonBuilder : NixPythonBuilder { | |
.SYNOPSIS | ||
Prepare system environment by installing dependencies and required packages. | ||
#> | ||
|
||
if ($this.Version -eq "3.7.17") { | ||
# We have preinstalled ncurses and readLine on the hoster runners. But we need to install bzip2 for | ||
# setting up an environemnt | ||
# We have preinstalled ncurses and readLine on the hoster runners. But we need to install bzip2 for | ||
# setting up an environment | ||
# If we get any issues realted to ncurses or readline we can try to run this command | ||
# brew install ncurses readline | ||
Execute-Command -Command "brew install bzip2" | ||
|
@@ -68,21 +68,37 @@ class macOSPythonBuilder : NixPythonBuilder { | |
### and then add the appropriate paths for the header and library files to configure command. | ||
### Link to documentation (https://cpython-devguide.readthedocs.io/setup/#build-dependencies) | ||
if ($this.Version -lt "3.7.0") { | ||
$env:LDFLAGS = "-L/usr/local/opt/[email protected]/lib -L/usr/local/opt/zlib/lib" | ||
$env:CFLAGS = "-I/usr/local/opt/[email protected]/include -I/usr/local/opt/zlib/include" | ||
$env:LDFLAGS = "-L$(brew --prefix [email protected])/lib -L$(brew --prefix zlib)/lib" | ||
$env:CFLAGS = "-I$(brew --prefix [email protected])/include -I$(brew --prefix zlib)/include" | ||
} else { | ||
$configureString += " --with-openssl=/usr/local/opt/[email protected]" | ||
$configureString += " --with-openssl=$(brew --prefix [email protected])" | ||
|
||
# Configure may detect libintl from non-system sources, such as Homebrew (it **does** on macos arm64) so turn it off | ||
# $configureString += " ac_cv_lib_intl_textdomain=no" | ||
# This has libintl.a in there, so hopefully it picks it up | ||
$env:LDFLAGS = "-L$(brew --prefix gettext)/lib" | ||
$env:CFLAGS = "-I$(brew --prefix gettext)/include" | ||
|
||
# For Python 3.7.2 and 3.7.3 we need to provide PATH for zlib to pack it properly. Otherwise the build will fail | ||
# with the error: zipimport.ZipImportError: can't decompress data; zlib not available | ||
if ($this.Version -eq "3.7.2" -or $this.Version -eq "3.7.3" -or $this.Version -eq "3.7.17") { | ||
$env:LDFLAGS = "-L/usr/local/opt/zlib/lib" | ||
$env:CFLAGS = "-I/usr/local/opt/zlib/include" | ||
$env:LDFLAGS += " -L$(brew --prefix zlib)/lib" | ||
$env:CFLAGS += " -I$(brew --prefix zlib)/include" | ||
} | ||
|
||
if ($this.Version -gt "3.7.12") { | ||
$configureString += " --with-tcltk-includes='-I /usr/local/opt/tcl-tk/include' --with-tcltk-libs='-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6'" | ||
} | ||
if ($this.Version -ge "3.11.0") { | ||
# Python 3.11+: configure: WARNING: unrecognized options: --with-tcltk-includes, --with-tcltk-libs | ||
# https://github.com/python/cpython/blob/762f489b31afe0f0589aa784bf99c752044e7f30/Doc/whatsnew/3.11.rst#L2167-L2172 | ||
$tcl_inc_dir = "$(brew --prefix tcl-tk)/include" | ||
# In Homebrew Tcl/Tk 8.6.13, headers have been moved to the 'tcl-tk' subdir | ||
if (Test-Path -Path "$tcl_inc_dir/tcl-tk") { | ||
$tcl_inc_dir = "$tcl_inc_dir/tcl-tk" | ||
} | ||
$env:TCLTK_CFLAGS = "-I$tcl_inc_dir" | ||
$env:TCLTK_LIBS = "-L$(brew --prefix tcl-tk)/lib -ltcl8.6 -ltk8.6" | ||
} elseif ($this.Version -gt "3.7.12") { | ||
$configureString += " --with-tcltk-includes='-I $(brew --prefix tcl-tk)/include' --with-tcltk-libs='-L$(brew --prefix tcl-tk)/lib -ltcl8.6 -ltk8.6'" | ||
} | ||
|
||
if ($this.Version -eq "3.7.17") { | ||
$env:LDFLAGS += " -L$(brew --prefix bzip2)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix ncurses)/lib" | ||
|
@@ -101,6 +117,12 @@ class macOSPythonBuilder : NixPythonBuilder { | |
|
||
Write-Host "The passed configure options are: " | ||
Write-Host $configureString | ||
Write-Host "Flags: " | ||
Write-Host "CFLAGS='$env:CFLAGS'" | ||
Write-Host "CPPFLAGS='$env:CPPFLAGS'" | ||
Write-Host "LDFLAGS='$env:LDFLAGS'" | ||
Write-Host "TCLTK_CFLAGS='$env:TCLTK_CFLAGS'" | ||
Write-Host "TCLTK_LIBS='$env:TCLTK_LIBS'" | ||
|
||
Execute-Command -Command $configureString | ||
} | ||
|
@@ -180,7 +202,7 @@ class macOSPythonBuilder : NixPythonBuilder { | |
|
||
$PkgVersion = [semver]"3.11.0-beta.1" | ||
|
||
if (($this.Version -ge $PkgVersion) -or ($this.Architecture -eq "arm64")) { | ||
if (($this.Version -ge $PkgVersion) -and ($this.Architecture -eq "x64")) { | ||
Write-Host "Download Python $($this.Version) [$($this.Architecture)] package..." | ||
$this.DownloadPkg() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arm64 always uses the universal2 installer.
most of the changes here are not required if this stays the same.