-
Notifications
You must be signed in to change notification settings - Fork 235
Termux support #621
Termux support #621
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ onoe() { | |
| fi | ||
| if [[ $# -eq 0 ]] | ||
| then | ||
| /bin/cat >&2 | ||
| cat >&2 | ||
| else | ||
| echo "$*" >&2 | ||
| fi | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -324,7 +324,7 @@ def check_cellar | |
| 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 = ["/lib64/ld-linux-x86-64.so.2", "/lib/ld-linux.so.3", "/lib/ld-linux.so.2", "/lib/ld-linux-armhf.so.3", "/system/bin/linker"].find do |s| | ||
| Pathname.new(s).executable? | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can submit this change to Linuxbrew/brew.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please submit this change to Linuxbrew/brew in a separate PR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| end | ||
| raise "Unable to locate the system's ld.so" unless sys_interpreter | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,7 +42,8 @@ | |
| (OS.mac? ? "~/Library/Logs/Homebrew/" : "~/.cache/Homebrew/Logs")).expand_path | ||
|
|
||
| # Must use /tmp instead of $TMPDIR because long paths break Unix domain sockets | ||
| HOMEBREW_TEMP = Pathname.new(ENV.fetch("HOMEBREW_TEMP", "/tmp")) | ||
| # IF ANDROID | ||
| HOMEBREW_TEMP = Pathname.new(ENV.fetch("HOMEBREW_TEMP", "/data/data/com.termux/files/usr/tmp")) | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to just use $TMPDIR, but the line above dissuaded me. Do you think the above suggestion could fit upstream?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My guess is that they'd prefer to keep the existing behaviour, using
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| unless defined? HOMEBREW_LIBRARY_PATH | ||
| # Root of the Homebrew code base | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,9 @@ def locate(tool) | |
| path | ||
| elsif File.executable?(path = "/usr/bin/#{tool}") | ||
| Pathname.new path | ||
| # IF ANDROID | ||
| elsif File.executable?(path = "/data/data/com.termux/files/usr/bin/#{tool}") | ||
| Pathname.new path | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add to https://github.com/Linuxbrew/brew/wiki/Android ln -s /data/data/com.termux/files/usr/bin/* ~/.linuxbrew/bin/
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| # Homebrew GCCs most frequently; much faster to check this before xcrun | ||
| elsif (path = HOMEBREW_PREFIX/"bin/#{tool}").executable? | ||
| path | ||
|
|
@@ -79,6 +82,9 @@ def clang_build_version | |
| if (path = locate("clang")) && | ||
| build_version = `#{path} --version`[/clang-(\d{2,})/, 1] | ||
| Version.new build_version | ||
| elsif (path = locate("clang")) && | ||
| build_version = `#{path} --version`[/clang version (\d\.\d\.\d)/, 1] | ||
| Version.new build_version | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest removing this chunk and changing line 83 to (untested) build_version = Utils.popen_read(path, "--version")[/clang(-| version )(\d{2,})/, 2]If
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems to!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| else | ||
| Version::NULL | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ module SharedEnvExtension | |
| MACOSX_DEPLOYMENT_TARGET SDKROOT DEVELOPER_DIR | ||
| CMAKE_PREFIX_PATH CMAKE_INCLUDE_PATH CMAKE_FRAMEWORK_PATH | ||
| GOBIN GOPATH GOROOT PERL_MB_OPT PERL_MM_OPT | ||
| LIBRARY_PATH LD_LIBRARY_PATH LD_PRELOAD LD_RUN_PATH | ||
| LIBRARY_PATH LD_PRELOAD LD_RUN_PATH | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Termux can use |
||
| ].freeze | ||
|
|
||
| def inherit? | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ def xorg_recursive_deps | |
|
|
||
| def homebrew_extra_paths | ||
| paths = [] | ||
| # IF ANDROID | ||
| paths += ["/data/data/com.termux/files/usr/bin", "/data/data/com.termux/files/usr/bin/applets"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add to https://github.com/Linuxbrew/brew/wiki/Android ln -s /data/data/com.termux/files/usr/bin/applets/* ~/.linuxbrew/bin/
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
|
||
| paths += %w[binutils make].map do |f| | ||
| begin | ||
|
|
@@ -39,15 +41,16 @@ def homebrew_extra_paths | |
| end | ||
|
|
||
| def determine_extra_rpath_paths | ||
| paths = ["#{HOMEBREW_PREFIX}/lib"] | ||
| paths = ["/data/data/com.termux/files/usr/lib"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add to https://github.com/Linuxbrew/brew/wiki/Android ln -s /data/data/com.termux/files/usr/lib/* ~/.linuxbrew/lib/
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| paths += ["#{HOMEBREW_PREFIX}/lib"] | ||
| paths += run_time_deps.map { |d| d.opt_lib.to_s } | ||
| paths += homebrew_extra_library_paths | ||
| paths | ||
| end | ||
|
|
||
| def determine_dynamic_linker_path(formula) | ||
| return "" if formula&.name == "glibc" | ||
| "#{HOMEBREW_PREFIX}/lib/ld.so" | ||
| "/system/bin/linker" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be no need for this chunk. |
||
| end | ||
|
|
||
| # @private | ||
|
|
@@ -93,12 +96,14 @@ def homebrew_extra_isystem_paths | |
|
|
||
| def homebrew_extra_library_paths | ||
| paths = [] | ||
| paths += ["/data/data/com.termux/files/usr/lib"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Symlink these libraries. |
||
| paths += xorg_lib_paths if x11? | ||
| paths | ||
| end | ||
|
|
||
| def homebrew_extra_cmake_include_paths | ||
| paths = [] | ||
| paths += ["/data/data/com.termux/files/usr/include"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add to https://github.com/Linuxbrew/brew/wiki/Android ln -s /data/data/com.termux/files/usr/include ~/.linuxbrew/include/ |
||
| paths += xorg_include_paths if x11? | ||
| paths | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ module Glibc | |
|
|
||
| def system_version | ||
| return @system_version if @system_version | ||
| version = Utils.popen_read("/usr/bin/ldd", "--version")[/ (\d+\.\d+)/, 1] | ||
| version = Utils.popen_read("/usr/bin/objdump", "--version")[/ (\d+\.\d+)/, 1] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should be able to revert this chunk. Linuxbrew should operate correctly if it's not able to determine the version of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It crashes on this line. I forget why. Will file.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, machomebrew crashes, but linuxbrew seems fine. I don't think it's possible that I was on the wrong fork, but I can't tell if this is an actionable bug: |
||
| return Version::NULL unless version | ||
| @system_version = Version.new version | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,7 +192,10 @@ class Cmd | |
| # -R is not the correct way to pass rpaths to the linker | ||
| path = chuzzle($1) || enum.next | ||
| wl = "-Wl," unless mode == :ld | ||
| args << "#{wl}-rpath=" if keep?(path) | ||
| if keep?(path) | ||
| args << "#{wl}--enable-new-dtags" | ||
| args << "#{wl}-rpath=" | ||
| end | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change cannot be sent upstream. Since the Android dynamic linker is open source, playing the long game, I'd suggest contributing a patch to Android to add support for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't imagine Android being amenable to that since "rpath is a design bug". I'll look into option B. |
||
| else | ||
| args << arg | ||
| end | ||
|
|
@@ -255,6 +258,7 @@ class Cmd | |
| args += ["#{wl}--dynamic-linker=#{dynamic_linker_path}"] if dynamic_linker_path | ||
| args << "-B#{@opt}/glibc/lib" unless mode == :ld | ||
| args += path_flags("-L", library_paths) | ||
| args << "#{wl}--enable-new-dtags" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
| args += rpath_flags("#{wl}-rpath=", rpath_paths) | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,7 +99,7 @@ brew_repo_version="$(quiet_safe_cd "$SCM_DIR/../../../../bin" && pwd -P)/$SCM_FI | |
| safe_exec "$brew_repo_version" "$@" | ||
|
|
||
| IFS=$'\n' | ||
| for path in $(/usr/bin/which -a "$SCM_FILE" 2>/dev/null) | ||
| for path in $(command -v "$SCM_FILE" 2>/dev/null) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This patch can go upstream to Homebrew/brew.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you suggest a separate CL for each of these little bits?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's a CL? I'd suggest a separate PR for each change.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, yes. "CL" is our jargon at work for PR. You'll see a bunch of small PRs for this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| do | ||
| if [[ "$path" != "/usr/bin/$SCM_FILE" ]] | ||
| then | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,11 +66,12 @@ done | |
| # test-bot does environment filtering itself | ||
| if [[ -z "$HOMEBREW_NO_ENV_FILTERING" && "$1" != "test-bot" ]] | ||
| then | ||
| PATH="/usr/bin:/bin:/usr/sbin:/sbin" | ||
| PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin/applets" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Symlink |
||
|
|
||
| FILTERED_ENV=() | ||
| # Filter all but the specific variables. | ||
| for VAR in HOME SHELL PATH TERM LOGNAME USER CI CIRCLECI TRAVIS SSH_AUTH_SOCK SUDO_ASKPASS \ | ||
| LD_LIBRARY_PATH ANDROID_ROOT ANDROID_DATA \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This patch cannot go upstream. As a workaround, you can use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hope to convince termux to switch to using DT_RUNPATH, then we don't need this any more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the environment variable to the android wiki page, and suggested upstream that termux enable RUNPATH by default like the rest of Linux. IMHO Homebrew should as well, but I'll leave well enough alone :) |
||
| http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY \ | ||
| "${!HOMEBREW_@}" "${!TRAVIS_@}" "${!JENKINS_@}" | ||
| do | ||
|
|
||
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.
You can submit this change to Homebrew/brew.
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.
Homebrew/brew#3942