Last active
April 2, 2025 17:23
-
-
Save joshcooper/2e2bfbe75081621f7530b7f14ef6816e to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Install homebrew | |
export HOMEBREW_NO_EMOJI=true | |
export HOMEBREW_NO_ANALYTICS=1 | |
sudo dscl . -create /Users/test | |
sudo dscl . -create /Users/test UserShell /bin/bash | |
sudo dscl . -create /Users/test UniqueID 1001 | |
sudo dscl . -create /Users/test PrimaryGroupID 1000 | |
sudo dscl . -create /Users/test NFSHomeDirectory /Users/test | |
sudo dscl . -passwd /Users/test password | |
sudo dscl . -merge /Groups/admin GroupMembership test | |
echo "test ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/username | |
mkdir -p /etc/homebrew | |
cd /etc/homebrew | |
createhomedir -c -u test | |
su test -c 'echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' | |
# REMIND: /opt/homebrew vs /usr/local | |
echo >> /Users/test/.bash_profile | |
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/test/.bash_profile | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
# Install openssl@3, which installs 3.3.0 | |
su test -c 'brew install openssl@3' | |
# Unlink openssl so it's not visible to our build | |
su test -c 'brew unlink openssl' | |
# Build and install openssl 3.0.13 to /opt/foobar | |
mkdir /var/tmp/foobar | |
cd /var/tmp/foobar | |
curl -LO https://github.com/openssl/openssl/releases/download/openssl-3.0.13/openssl-3.0.13.tar.gz | |
tar xf openssl-3.0.13.tar.gz | |
cd openssl-3.0.13 | |
./Configure --prefix=/opt/foobar --libdir=lib --openssldir=/opt/foobar/ssl shared darwin64-x86_64 | |
make | |
make install | |
# Build and install curl 8.7.1 using openssl 3.0.13 | |
cd /var/tmp/foobar | |
curl -LO https://github.com/curl/curl/releases/download/curl-8_7_1/curl-8.7.1.tar.gz | |
tar xf curl-8.7.1.tar.gz | |
cd curl-8.7.1 | |
export CFLAGS='-mmacosx-version-min=12.0' | |
export CPPFLAGS='-I/opt/foobar/include' | |
export LDFLAGS='-L/opt/foobar/lib' | |
./configure --prefix=/opt/foobar --with-ssl=/opt/foobar --host x86_64-apple-darwin --build x86_64-apple-darwin | |
make | |
make install | |
# Curl imports this symbol which is only present in openssl 3.2.0 and up | |
nm -m /opt/foobar/lib/libcurl.dylib | grep SSL_get0_group_name | |
# Our openssl doesn't export this symbol | |
nm -gU /opt/foobar/lib/libssl.dylib | grep SSL_get0_group_name |
Author
joshcooper
commented
May 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment