Skip to content

Instantly share code, notes, and snippets.

@vic3t3chn0
Forked from cielavenir/linuxbrew_freebsd.patch
Last active January 31, 2022 18:36
Show Gist options
  • Save vic3t3chn0/4cff9106712b219b09e33256e66b2099 to your computer and use it in GitHub Desktop.
Save vic3t3chn0/4cff9106712b219b09e33256e66b2099 to your computer and use it in GitHub Desktop.
Linuxbrew on FreeBSD
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 0f9a00a..c2bed9e 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -299,7 +299,7 @@ module Homebrew
def symlink_ld_so
ld_so = HOMEBREW_PREFIX/"lib/ld.so"
return if ld_so.readable?
- sys_interpreter = ["/lib64/ld-linux-x86-64.so.2", "/lib/ld-linux.so.3", "/lib/ld-linux.so.2", "/lib/ld-linux-armhf.so.3"].find do |s|
+ sys_interpreter = ['/libexec/ld-elf.so.1'].find do |s|
Pathname.new(s).executable?
end
raise "Unable to locate the system's ld.so" unless sys_interpreter
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index ad3fbae..9d14d72 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -551,7 +551,7 @@ EOS
export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$CURRENT_REVISION"
export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$CURRENT_REVISION"
else
- merge_or_rebase "$DIR" "$TAP_VAR" "$UPSTREAM_BRANCH"
+ # merge_or_rebase "$DIR" "$TAP_VAR" "$UPSTREAM_BRANCH"
[[ -n "$HOMEBREW_VERBOSE" ]] && echo
fi
done
diff --git a/Library/Homebrew/development_tools.rb b/Library/Homebrew/development_tools.rb
index 3b95ff1..9882865 100644
--- a/Library/Homebrew/development_tools.rb
+++ b/Library/Homebrew/development_tools.rb
@@ -55,7 +55,7 @@ class DevelopmentTools
@gcc_4_2_build_version ||= begin
gcc = locate("gcc-4.2") || HOMEBREW_PREFIX.join("opt/apple-gcc42/bin/gcc-4.2")
if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm")&&
- build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
+ build_version = `#{gcc} --version`[/g?cc(?:(?:-\d(?:\.\d)?)? \(.+\))? (\d\.\d\.\d)/, 1]
Version.new build_version
else
Version::NULL
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index 11d6320..3eabb75 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -110,7 +110,7 @@ module Superenv
paths += deps.map { |d| d.opt_bin.to_s }
paths += homebrew_extra_paths
- paths += %w[/usr/bin /bin /usr/sbin /sbin]
+ paths += %w[/usr/bin /bin /usr/sbin /sbin /usr/local/bin]
# Homebrew's apple-gcc42 will be outside the PATH in superenv,
# so xcrun may not be able to find it
diff --git a/Library/Homebrew/extend/os/linux/hardware/cpu.rb b/Library/Homebrew/extend/os/linux/hardware/cpu.rb
index 10d1826..df23ea3 100644
--- a/Library/Homebrew/extend/os/linux/hardware/cpu.rb
+++ b/Library/Homebrew/extend/os/linux/hardware/cpu.rb
@@ -28,7 +28,7 @@ module Hardware
end
def cpuinfo
- @cpuinfo ||= File.read("/proc/cpuinfo")
+ @cpuinfo ||= '' #File.read("/proc/cpuinfo")
end
def type
@@ -44,7 +44,7 @@ module Hardware
def family
return :arm if arm?
- return :dunno unless intel?
+ return :dunno #unless intel?
# See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers
cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i
cpu_model = cpuinfo[/^model\s*: ([0-9]+)/, 1].to_i
@@ -94,11 +94,11 @@ module Hardware
end
def cores
- cpuinfo.scan(/^processor/).size
+ 1 # cpuinfo.scan(/^processor/).size
end
def flags
- @flags ||= cpuinfo[/^(flags|Features).*/, 0].split
+ @flags ||= [] #cpuinfo[/^(flags|Features).*/, 0].split
end
# Compatibility with Mac method, which returns lowercase symbols
diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb
index 66e5798..da44e68 100644
--- a/Library/Homebrew/os.rb
+++ b/Library/Homebrew/os.rb
@@ -1,12 +1,10 @@
module OS
def self.mac?
- return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
- RUBY_PLATFORM.to_s.downcase.include? "darwin"
+ return false
end
def self.linux?
- return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
- RUBY_PLATFORM.to_s.downcase.include?("linux") || RbConfig::CONFIG["host_os"].downcase.include?("linux")
+ return false
end
def self.airyx?
- return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
- RUBY_PLATFORM.to_s.downcase.include?("airyx") || RbConfig::CONFIG["host_os"].downcase.include?("airyx")
+ return true
end
::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
diff --git a/Library/Homebrew/requirements/glibc_requirement.rb b/Library/Homebrew/requirements/glibc_requirement.rb
index fdbd2cd..44068a5 100644
--- a/Library/Homebrew/requirements/glibc_requirement.rb
+++ b/Library/Homebrew/requirements/glibc_requirement.rb
@@ -3,7 +3,7 @@ require "requirement"
class GlibcRequirement < Requirement
fatal true
default_formula "glibc"
- @system_version = nil
+ @system_version = "9"
def initialize
# Bottles for Linuxbrew are built using glibc 2.19.
@@ -13,7 +13,7 @@ class GlibcRequirement < Requirement
def self.system_version
return @system_version if @system_version
- libc = ["/lib/x86_64-linux-gnu/libc.so.6", "/lib64/libc.so.6", "/lib/libc.so.6", "/lib/i386-linux-gnu/libc.so.6", "/lib/arm-linux-gnueabihf/libc.so.6"].find do |s|
+ libc = ["/compat/linux/lib/x86_64-linux-gnu/libc.so.6", "/compat/linux/lib64/libc.so.6", "/compat/linux/lib/libc.so.6", "/compat/linux/lib/i386-linux-gnu/libc.so.6", "/compat/linux/lib/arm-linux-gnueabihf/libc.so.6"].find do |s|
Pathname.new(s).executable?
end
raise "Unable to locate the system's glibc" unless libc
diff --git a/Library/Homebrew/shims/scm/git b/Library/Homebrew/shims/scm/git
index 82bb47c..dd97f21 100755
--- a/Library/Homebrew/shims/scm/git
+++ b/Library/Homebrew/shims/scm/git
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/local/bin/bash
# This script because we support $GIT, $HOMEBREW_SVN, etc., Xcode-only and
# no Xcode/CLT configurations. Order is careful to be what the user would want.
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 2c665ec..0add0bc 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -256,7 +256,7 @@ end
def with_system_path
old_path = ENV["PATH"]
- ENV["PATH"] = "/usr/bin:/bin"
+ ENV["PATH"] = "/usr/bin:/bin:/usr/local/bin"
ENV["PATH"] = "#{HOMEBREW_PREFIX}/bin:#{ENV["PATH"]}" unless OS.mac?
yield
ensure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment