From 2dd2ec97f1cbc5ba32f79535087d265610fa1dcb Mon Sep 17 00:00:00 2001 From: Ben10do Date: Sun, 3 Jun 2018 15:18:49 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Don=E2=80=99t=20use=20GNU=20extensions=20wh?= =?UTF-8?q?en=20calling=20sed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently, GNU sed has a few extensions that aren’t supported by the version of BSD sed that currently comes with Macs. This would cause sort_symfile.sh to fail on macOS, causing the build to appear to fail at the last minute. Admittedly, I’m not very familiar with sed, but this seems to do the trick on both macOS and Ubuntu. - The input file must be last in the arguments list. - The -i option, allowing the same file for input and output, doesn’t appear to be supported. Instead, I’m writing the output to a temporary file, and replacing the original file with that temporary file. - Apparently ‘\w’ isn’t supported, so I’m simply using ‘.’ instead, as it appears to match “0_ROM0@” etc. just as well. --- tools/sort_symfile.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/sort_symfile.sh b/tools/sort_symfile.sh index d53150faa..82fced560 100755 --- a/tools/sort_symfile.sh +++ b/tools/sort_symfile.sh @@ -1,10 +1,12 @@ #!/bin/sh -sed $1 \ +sed \ -e "s/^..:[0-3]/0_ROM0@&/g" \ -e "s/^..:[4-7]/1_ROMX@&/g" \ -e "s/^..:[8-9]/2_VRAM@&/g" \ -e "s/^..:[A-B]/3_SRAM@&/g" \ -e "s/^00:[C-D]/4_WRAM0@&/g" \ -e "s/^..:[D-D]/5_WRAMX@&/g" \ + $1 \ | sort -o $1 -sed -i $1 -e "s/^\w*@//g" +TEMP_FILE=$(mktemp) +sed -e "s/^.*@//g" $1 > $TEMP_FILE && mv $TEMP_FILE $1 From 1baea408e225ab4a2c01f0204384eee55e6afd06 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 5 Jun 2018 07:15:16 -0400 Subject: [PATCH 2/3] sort_symfile: don't overwrite the symfile with an intermediate file --- tools/sort_symfile.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/sort_symfile.sh b/tools/sort_symfile.sh index 82fced560..896b8e973 100755 --- a/tools/sort_symfile.sh +++ b/tools/sort_symfile.sh @@ -1,4 +1,5 @@ #!/bin/sh +TEMP_FILE=$(mktemp) sed \ -e "s/^..:[0-3]/0_ROM0@&/g" \ -e "s/^..:[4-7]/1_ROMX@&/g" \ @@ -7,6 +8,6 @@ sed \ -e "s/^00:[C-D]/4_WRAM0@&/g" \ -e "s/^..:[D-D]/5_WRAMX@&/g" \ $1 \ -| sort -o $1 -TEMP_FILE=$(mktemp) -sed -e "s/^.*@//g" $1 > $TEMP_FILE && mv $TEMP_FILE $1 +| sort -o $TEMP_FILE +sed -e "s/^.*@//g" $TEMP_FILE > $1 +rm $TEMP_FILE From e58688c09b76f097aa011af2cae0d25773817f09 Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 5 Jun 2018 07:22:25 -0400 Subject: [PATCH 3/3] sort_symfile: don't need to use sort -o with a temp file --- tools/sort_symfile.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/sort_symfile.sh b/tools/sort_symfile.sh index 896b8e973..edde25e75 100755 --- a/tools/sort_symfile.sh +++ b/tools/sort_symfile.sh @@ -8,6 +8,6 @@ sed \ -e "s/^00:[C-D]/4_WRAM0@&/g" \ -e "s/^..:[D-D]/5_WRAMX@&/g" \ $1 \ -| sort -o $TEMP_FILE -sed -e "s/^.*@//g" $TEMP_FILE > $1 -rm $TEMP_FILE +| sort \ +| sed -e "s/^.*@//g" > $TEMP_FILE +mv $TEMP_FILE $1