Building fzf on powerpc / AIX 7.2
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 83.1k
- Forks
- 3.1k
- Avg merge
- 17h 8m
- Merged PRs (30d)
- 10
Description
- [ X] I have read through the manual page (
man fzf) - I have the latest version of fzf
- [ X] I have searched through the existing issues
Info
- OS
- Linux
- Mac OS X
- Windows
- [X ] Etc.
- Shell
- [ X] bash
- zsh
- fish
Problem / Steps to reproduce
root@aixhost01:/tmp/fzf# gmake
Makefile:66: *** Build on 00FBED344C00 is not supported, yet.. Stop.
I want to describe what i have done to build fzf (tags/0.29.0) it might be helpful. I don't have much knowledge about Makefile
Maybe someone can integrate the ppc/AIX part into a normal release (also completion.bash,key-bindings.bash ?
# git checkout tags/0.29.0 -b 0.29.0
System info / Build environment:
- AIX 7200-05-03-2148
- go1.16.12 aix/ppc64
Try to build
# gmake
Makefile:66: *** Build on 00C317904B00 is not supported, yet.. Stop.
Problem: uname command should use switch -p not -m!
Actions: Adapt Makefile
-UNAME_M := $(shell uname -m)
+UNAME_M := $(shell uname -p)
# gmake
Makefile:66: *** Build on powerpc is not supported, yet.. Stop.
Problem: Makefile is missing powerpc
Changes to Makefile:
# git diff Makefile
diff --git a/Makefile b/Makefile
index 8b37ef9..2fe4525 100644
--- a/Makefile
+++ b/Makefile
@@ -34,9 +34,10 @@ BINARYARM6 := fzf-$(GOOS)_arm6
BINARYARM7 := fzf-$(GOOS)_arm7
BINARYARM8 := fzf-$(GOOS)_arm8
BINARYPPC64LE := fzf-$(GOOS)_ppc64le
+BINARYPPC64 := fzf-$(GOOS)_ppc64
# https://en.wikipedia.org/wiki/Uname
-UNAME_M := $(shell uname -m)
+UNAME_M := $(shell uname -p)
ifeq ($(UNAME_M),x86_64)
BINARY := $(BINARY64)
else ifeq ($(UNAME_M),amd64)
@@ -59,6 +60,8 @@ else ifeq ($(UNAME_M),aarch64)
BINARY := $(BINARYARM8)
else ifeq ($(UNAME_M),ppc64le)
BINARY := $(BINARYPPC64LE)
+else ifeq ($(UNAME_M),powerpc)
+ BINARY := $(BINARYPPC64)
else
$(error Build on $(UNAME_M) is not supported, yet.)
endif
@@ -141,6 +144,9 @@ target/$(BINARYARM8): $(SOURCES)
target/$(BINARYPPC64LE): $(SOURCES)
GOARCH=ppc64le $(GO) build $(BUILD_FLAGS) -o $@
+target/$(BINARYPPC64): $(SOURCES)
+ GOARCH=ppc64 $(GO) build $(BUILD_FLAGS) -o $@
+
bin/fzf: target/$(BINARY) | bin
cp -f target/$(BINARY) bin/fzf
# gmake
GOARCH=ppc64 go build -a -ldflags "-s -w -X main.version=0.29.0 -X main.revision=34fe5ab" -tags "" -o target/fzf-aix_ppc64
Result: Build successful
Limitations of AIX native find
Note: /opt/freeware/bin has to be in your PATH or you must use the full path to find_64
Because the native find command of AIX is limited we have to use find from the AIX-Toolbox some changes must be made to the following files:
- shell/completion.bash
- shell/key-bindings.bash
shell/completion.bash
# git diff shell/completion.bash
diff --git a/shell/completion.bash b/shell/completion.bash
index bc9f29f..4395a7e 100644
--- a/shell/completion.bash
+++ b/shell/completion.bash
@@ -15,7 +15,7 @@ if [[ $- =~ i ]]; then
if ! declare -f _fzf_compgen_path > /dev/null; then
_fzf_compgen_path() {
echo "$1"
- command find -L "$1" \
+ command find_64 -L "$1" \
-name .git -prune -o -name .hg -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \
-a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
}
@@ -23,7 +23,7 @@ fi
if ! declare -f _fzf_compgen_dir > /dev/null; then
_fzf_compgen_dir() {
- command find -L "$1" \
+ command find_64 -L "$1" \
-name .git -prune -o -name .hg -prune -o -name .svn -prune -o -type d \
-a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
}
shell/key-bindings.bash
# git diff shell/key-bindings.bash
diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash
index 0cfc423..ca2593f 100644
--- a/shell/key-bindings.bash
+++ b/shell/key-bindings.bash
@@ -14,7 +14,7 @@
# Key bindings
# ------------
__fzf_select__() {
- local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
+ local cmd="${FZF_CTRL_T_COMMAND:-"command find_64 -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | cut -b3-"}"
@@ -39,7 +39,7 @@ fzf-file-widget() {
__fzf_cd__() {
local cmd dir
- cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
+ cmd="${FZF_ALT_C_COMMAND:-"command find_64 -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type d -print 2> /dev/null | cut -b3-"}"
dir=$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" $(__fzfcmd) +m) && printf 'cd %q' "$dir"
}
Installation
To install fzf simply call ./install
Modification to ~/.bashrc
Because the limitations of native find we have to modificate the ~/.bashrc
by adding FZF_DEFAULT_COMMAND and FZF_CTRL_T_COMMAND variables.
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# using find from /opt/freeware/bin because original find does not work properly
export FZF_DEFAULT_COMMAND='find_64 -type f'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the architecture detection and build targets in Makefile, then review shell/completion.bash and shell/key-bindings.bash for AIX find limitations. Reproduce the reported build with gmake and Go on AIX/powerpc; done means the supported build completes and the documented shell integration works with the available find implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, go
- Domain
- build-system, cli, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100