2018-01-14 20:51:24 -08:00
|
|
|
#!/bin/sh
|
2018-06-05 04:15:16 -07:00
|
|
|
TEMP_FILE=$(mktemp)
|
Don’t use GNU extensions when calling sed
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.
2018-06-03 07:18:49 -07:00
|
|
|
sed \
|
2018-01-01 19:40:35 -08:00
|
|
|
-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" \
|
2018-08-25 11:28:22 -07:00
|
|
|
-e "s/^..:[F-F]/6_HRAM@&/g" \
|
Don’t use GNU extensions when calling sed
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.
2018-06-03 07:18:49 -07:00
|
|
|
$1 \
|
2018-06-05 04:22:25 -07:00
|
|
|
| sort \
|
|
|
|
| sed -e "s/^.*@//g" > $TEMP_FILE
|
|
|
|
mv $TEMP_FILE $1
|