Skip to content

Commit 2c2c600

Browse files
macOS: Create folder with gsed symlink
Black magic for macOS. The problem is that default sed on macOS is not compatible with GNU, while some scripts use GNU-specific extensions. GNU sed can be installed with Homebrew, but by default it will have a name `gsed`, so scripts should be modified to use it. While this can be done in ARC scripts, we don't have full control over other projects, Linux in particular, which also require GNU sed. Therefore in followind lines a new directory is created, a link named `sed` is created and is pointed to `gsed` and directory is added to the PATH, so GNU sed will be used by Linux. Alternative solution would be to install GNU sed as `sed` in Homebrew, however that might have some negative effect on other applications, so I don't think it is wise to require this from the user. Signed-off-by: Anton Kolesov <[email protected]>
1 parent d1d3a3f commit 2c2c600

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

build-uclibc.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,24 @@ DEFCFG_DIR=$ARC_GNU/uClibc/extra/Configs/defconfigs/arc/
245245
rm -rf "$build_dir"
246246
mkdir -p "$build_dir"
247247

248+
# -----------------------------------------------------------------------------
249+
# Black magic for macOS. The problem is that default sed on macOS is not
250+
# compatible with GNU, while some scripts use GNU-specific extensions. GNU sed
251+
# can be installed with Homebrew, but by default it will have a name `gsed`, so
252+
# scripts should be modified to use it. While this can be done in ARC scripts,
253+
# we don't have full control over other projects, Linux in particular, which
254+
# also require GNU sed. Therefore in followind lines a new directory is
255+
# created, a link named `sed` is created and is pointed to `gsed` and directory
256+
# is added to the PATH, so GNU sed will be used by Linux. Alternative solution
257+
# would be to install GNU sed as `sed` in Homebrew, however that might have
258+
# some negative effect on other applications, so I don't think it is wise to
259+
# require this from the user.
260+
if [ "$IS_MAC_OS" = yes ]; then
261+
mkdir $build_dir/macos_aliases
262+
ln -s $(which gsed) $build_dir/macos_aliases/sed
263+
export PATH=$build_dir/macos_aliases:$PATH
264+
fi
265+
248266
# -----------------------------------------------------------------------------
249267
# Install the Linux headers
250268

0 commit comments

Comments
 (0)