Skip to content

Commit

Permalink
Restore old libraries in darwin.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Nov 14, 2023
1 parent a36e1e5 commit 9741e1e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/scripts/darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ add_brew_extension() {
update_dependencies >/dev/null 2>&1
disable_dependency_extensions "$extension" >/dev/null 2>&1
(brew install -f "$ext_tap/$formula@$version" >/dev/null 2>&1 && copy_brew_extensions "$formula") || pecl_install "$extension" >/dev/null 2>&1
restore_libraries >/dev/null 2>&1
add_extension_log "$extension" "Installed and enabled"
fi
}
Expand Down Expand Up @@ -98,13 +99,21 @@ add_pecl() {
link_libraries() {
formula=$1
formula_prefix="$(brew --prefix "$formula")"
sudo mkdir -p "$formula_prefix"/lib
sudo mkdir -p "$formula_prefix"/lib /tmp/brew_libs
for lib in "$formula_prefix"/lib/*.dylib; do
lib_name=$(basename "$lib")
sudo cp -a "$lib" "$brew_prefix/lib/$lib_name" 2>/dev/null || true
[ -L "$lib" ] || sudo cp -a "$lib" /tmp/brew_libs/"$lib_name" 2>/dev/null || true
done
}

# Function to restore all libraries of a formula.
restore_libraries() {
sudo mkdir -p "$brew_prefix/lib"
sudo cp -a /tmp/brew_libs/* "$brew_prefix/lib" 2>/dev/null || true
sudo rm -rf /tmp/brew_libs >/dev/null 2>&1
}

# Link opcache extension to extensions directory.
link_opcache() {
opcache_ini="$brew_prefix"/etc/php/"$version"/conf.d/ext-opcache.ini
Expand Down

0 comments on commit 9741e1e

Please sign in to comment.