revery-ui / esy-sdl2

Esy-enabled build for SDL2
zlib License
5 stars 9 forks source link

fgrep includes color codes in SDL test files #20

Open ron-wolf opened 3 years ago

ron-wolf commented 3 years ago

While building Revery on macOS 10.14.6 (Mojave), esy install worked just fine, but I encountered this error (text file) while running esy build. Here is how the end of console output appeared on my screen in Terminal.app:

Click to reveal tall image

Revery Esy SDL2 build error

I tracked the issue down to the following line introduced to the Makefile in 5e162af, where fgrep is run but for some reason emits color codes on my machine:

https://github.com/revery-ui/esy-sdl2/blob/0935dbf8c7a770f61f6041b0af743746c18648da/Makefile.in#L126

Here is my default env before any configuration files are loaded:

PWD=/Users/Ron
USER=Ron
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin
XPC_SERVICE_NAME=0
SHLVL=1
SHELL=/usr/local/bin/fish
LOGNAME=Ron
LANG=en_US.UTF-8
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.jFpzme7FdN/Render
TERM_PROGRAM_VERSION=421.2
XPC_FLAGS=0x0
TMPDIR=/var/folders/0v/2rwjmph559v3fv40z4hqt8t40000gn/T/
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.83t7OYqZP9/Listeners
TERM=xterm-256color
TERM_SESSION_ID=4360C789-F456-4851-BE92-38E90324E377
HOME=/Users/Ron
TERM_PROGRAM=Apple_Terminal

And here are the contents of my direnv envrc:

#!/bin/sh

# C environ
export EDITOR=micro

# essential command-line utilities
export SSH_ASKPASS=/usr/local/bin/ssh-askpass
export SUDO_ASKPASS="$SSH_ASKPASS"
# export LESS=-r

# local binary executable files
PATH_add ~/.local/bin

# X Developer Group directory specification
export XDG_DATA_HOME=~/.local/etc # ~/Library/'Application Support'/XDG
export XDG_DATA_DIRS=~/.local/share:/usr/local/share:/usr/share
export XDG_CONFIG_HOME=~/.config
export XDG_CONFIG_DIRS=/etc/xdg
export XDG_CACHE_HOME=~/.cache # ~/Library/Caches/XDG
export XDG_RUNTIME_DIR="$TMPDIR"

# enable coloring in ls
# export CLICOLOR=

# toolchain-specific software
export GEM_PATH=~/.local/etc/gem
export STACK_ROOT=~/.local/stack
export JULIA_DEPOT_PATH=~/.local/etc/julia
export GNUPGHOME=~/.local/etc/gpg
export PYENV_ROOT=~/.local/opt/pyenv
export PYENV_SHELL="$SHELL"
export DEVELOPER_DIR=/Library/Developer/CommandLineTools
export WINEPREFIX=~/.local/etc/wine
# export LUA_PATH='/usr/local/Cellar/luarocks/3.7.0/share/lua/5.4/?.lua'
# export LUA_CPATH='/usr/local/lib/lua/5.4/?.so'
export GOPATH=~/.local/etc/go
export GOTOOLDIR=~/.local/go/pkg/tool/darwin_amd64 # is this necessary?
export ESY__PREFIX=~/.local/esy

# add toolchain paths to PATH
PATH_add "$PYENV_ROOT"/{bin,shims}
PATH_add "$GOPATH"/bin

# instruct Homebrew to install apps as user-local
export HOMEBREW_CASK_OPTS="--appdir=$HOME/Applications"

export DYLD_FALLBACK_LIBRARY_PATH=~/.local/lib:/usr/local/lib:/usr/lib

That should account for pretty much everything that would affect the behavior of fgrep within a subprocess or subshell.

ron-wolf commented 3 years ago

Any guidance on how to test this would also be helpful. I tried the obvious solution of changing the Makefile in-place, but the Esy build system (which I’m unfamiliar with) keeps overwriting it. Would I have to create a fork/branch and use that as a temporary replacement dependency? @bryphe

ron-wolf commented 2 years ago

If anyone else comes upon this issue, the status is best explained here: https://github.com/onivim/oni2/issues/3811#issuecomment-910306404