Skip to content

Instantly share code, notes, and snippets.

@mikoim
Created May 2, 2017 13:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikoim/d86176c827fe1cee25b92576ed9bd99e to your computer and use it in GitHub Desktop.
Save mikoim/d86176c827fe1cee25b92576ed9bd99e to your computer and use it in GitHub Desktop.
This patch solves some issues when Linuxbrew runs on FreeBSD, but it can't detect system gcc or clang. So you can't install packages...
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 0a7a8dc8b..7bea96cf8 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -286,7 +286,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 = ["/compat/linux/lib64/ld-linux-x86-64.so.2", "/compat/linux/lib/ld-linux.so.3", "/compat/linux/lib/ld-linux.so.2", "/compat/linux/lib/ld-linux-armhf.so.3"].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 b4904e4b8..04e553ef1 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -559,7 +559,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/extend/os/development_tools.rb b/Library/Homebrew/extend/os/development_tools.rb
index 5bd5cb81a..11809e651 100644
--- a/Library/Homebrew/extend/os/development_tools.rb
+++ b/Library/Homebrew/extend/os/development_tools.rb
@@ -1,2 +1 @@
require "development_tools"
-require "extend/os/mac/development_tools" if OS.mac?
diff --git a/Library/Homebrew/extend/os/emoji.rb b/Library/Homebrew/extend/os/emoji.rb
index 8fd99e1d3..3d7db9586 100644
--- a/Library/Homebrew/extend/os/emoji.rb
+++ b/Library/Homebrew/extend/os/emoji.rb
@@ -1,3 +1,2 @@
require "os"
require "emoji"
-require "extend/os/mac/emoji" if OS.mac?
diff --git a/Library/Homebrew/extend/os/hardware.rb b/Library/Homebrew/extend/os/hardware.rb
index 6128072f4..2404197c0 100644
--- a/Library/Homebrew/extend/os/hardware.rb
+++ b/Library/Homebrew/extend/os/hardware.rb
@@ -1,5 +1 @@
-if OS.mac?
- require "extend/os/mac/hardware/cpu"
-elsif OS.linux?
- require "extend/os/linux/hardware/cpu"
-end
+require "extend/os/linux/hardware/cpu"
diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb
index 66e579844..da44e68c3 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 true
end
::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
diff --git a/Library/Homebrew/os/mac/pathname.rb b/Library/Homebrew/os/mac/pathname.rb
index 28907cdf4..6c599745c 100644
--- a/Library/Homebrew/os/mac/pathname.rb
+++ b/Library/Homebrew/os/mac/pathname.rb
@@ -1,9 +1,4 @@
class Pathname
- if OS.mac?
- require "os/mac/mach"
- include MachOShim
- elsif OS.linux?
require "os/linux/elf"
include ELF
- end
end
diff --git a/Library/Homebrew/requirements/glibc_requirement.rb b/Library/Homebrew/requirements/glibc_requirement.rb
index fdbd2cd0a..2677fe7d5 100644
--- a/Library/Homebrew/requirements/glibc_requirement.rb
+++ b/Library/Homebrew/requirements/glibc_requirement.rb
@@ -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/utils/git.rb b/Library/Homebrew/utils/git.rb
index 1b4d24894..21d011fc7 100644
--- a/Library/Homebrew/utils/git.rb
+++ b/Library/Homebrew/utils/git.rb
@@ -1,20 +1,20 @@
module Utils
def self.git_available?
return @git if instance_variable_defined?(:@git)
- @git = quiet_system HOMEBREW_SHIMS_PATH/"scm/git", "--version"
+ @git = quiet_system "/usr/local/bin/git", "--version"
end
def self.git_path
return unless git_available?
@git_path ||= Utils.popen_read(
- HOMEBREW_SHIMS_PATH/"scm/git", "--homebrew=print-path"
+ "/usr/local/bin/git", "--homebrew=print-path"
).chuzzle
end
def self.git_version
return unless git_available?
@git_version ||= Utils.popen_read(
- HOMEBREW_SHIMS_PATH/"scm/git", "--version"
+ "/usr/local/bin/git", "--version"
).chomp[/git version (\d+(?:\.\d+)*)/, 1]
end
@cielavenir
Copy link

I modified your patch and now it works almost fully. Thank you!
http://qiita.com/cielavenir/items/741921fcecb281555f77

@mikoim
Copy link
Author

mikoim commented Jun 23, 2017

@cielavenir (*´・ω・) nice work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment