commit 1cbc87a5628e9a06fd455f54ea80b26955d079c6
parent d141c103d6c3057db58bb70a6bc29a3765236d23
Author: Georges Dupéron <georges.duperon@gmail.com>
Date: Wed, 11 Jul 2018 18:52:14 +0200
macos: sed compatibility
Diffstat:
4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -95,7 +95,6 @@
/build/test_pass/noemu_zip
/build/test_pass/sudo_fat12_mount
/build/test_pass/sudo_iso_mount
-/deploy-screenshots
/deploy-screenshots/bochs-anim.gif
/deploy-screenshots/bochs.png
/deploy-screenshots/dosbox-anim.gif
diff --git a/Makefile b/Makefile
@@ -123,10 +123,10 @@ build/makefile_built_files: build/check_makefile_w_arnings
@echo ${built_files} | tr ' ' '\n' | grep -v '^\s*$$' | sort > $@
build/makefile_phony: build/makefile_database_files build/check_makefile_w_arnings
- @sed -r -n -e 's/^.PHONY: (.*)$$/\1/p' $< | tr ' ' '\n' | grep -v '^\s*$$' | sort > $@
+ @sed -n -e 's/^\.PHONY: \(.*\)$$/\1/p' $< | tr ' ' '\n' | grep -v '^\s*$$' | sort > $@
build/makefile_targets: build/makefile_database_files build/check_makefile_w_arnings
- @grep -E -v '^(\s|#|\.|$$|^[^:]*:$$)' $< | grep '^[^ :]*:' | sed -r -e 's|^([^:]*):.*$$|\1|' | sort > $@
+ @grep -E -v '^(\s|#|\.|$$|^[^:]*:$$)' $< | grep '^[^ :]*:' | sed -e 's|^\([^:]*\):.*$$|\1|' | sort > $@
build/makefile_non_file_targets: build/makefile_phony build/makefile_built_directories build/check_makefile_w_arnings
@cat build/makefile_phony build/makefile_built_directories | sort > $@
@@ -289,13 +289,13 @@ build/offsets/%.hex: build/offsets/%.dec
build/os.hex_with_offsets: ${os_filename} build/os.offsets
hexdump -C $< \
- | grep -E -e "($$(cat build/os.offsets | cut -d '=' -f 2 | sed -r -e 's/^\s*0x(.*).$$/^\10/' | tr '\n' '|')^)" --color=yes > $@
+ | grep -E -e "($$(cat build/os.offsets | cut -d '=' -f 2 | sed -e 's/^\s*0x\(.*\).$$/^\10/' | tr '\n' '|')^)" --color=yes > $@
build/os.ndisasm.disasm: ${os_filename} utils/compact-ndisasm.sh build/check_makefile
./utils/compact-ndisasm.sh $< $@
build/os.reasm.asm: build/os.ndisasm.disasm build/check_makefile
- sed -r -e 's/^[^ ]+ +[^ ]+ +//' $< > $@
+ sed -e 's/^[^ ]\+ \+[^ ]\+ \+//' $< > $@
build/test_pass/noemu_%.reasm build/%.reasm: build/%.reasm.asm ${os_filename} utils/compact-ndisasm.sh build/check_makefile
# For now ignore this test, since we cannot have a reliable re-assembly of arbitrary data.
@@ -334,7 +334,10 @@ test: ${tests_emu:test/%=build/test_pass/emu_%} \
${tests_emu}: build/test_pass/emu_$$(@F)
build/test_pass/emu_% deploy-screenshots/%.png deploy-screenshots/%-anim.gif: \
- ${os_filename} utils/gui-wrapper.sh test/%.sh build/check_makefile \
+ ${os_filename} \
+ utils/gui-wrapper.sh utils/ansi-screenshots/ansi_screenshot.sh utils/ansi-screenshots/to_ansi.sh \
+ test/%.sh \
+ build/check_makefile \
| build/test_pass deploy-screenshots
./utils/gui-wrapper.sh 800x600x24 ./test/$*.sh $<
touch build/test_pass/emu_$*
diff --git a/utils/ansi-screenshots/to_ansi.sh b/utils/ansi-screenshots/to_ansi.sh
@@ -31,9 +31,9 @@ done
&& convert "${indexed_gif}" "${indexed_pgm}" \
&& tail -n +4 "${indexed_pgm}" \
| hexdump -Cv \
- | sed -n -r -e 's/^[0-9a-f]* (([0-9a-f]{2} ?){1,16}).*$/\1/p' \
+ | sed -n -e 's/^[0-9a-f]* \(\([0-9a-f]\{2\} \?\)\{1,16\}\).*$/\1/p' \
| tr '\n' ' ' \
- | sed -r -e 's/ +/ /g' \
+ | sed -e 's/ \+/ /g' \
| fold -w $((width*3)) \
| awk "{ if (NR % 2 == 0) print > \"$even_lines\"; else print > \"$odd_lines\"; }"
nodd="$(wc -l "$odd_lines" | cut -d ' ' -f 1)"
@@ -44,7 +44,7 @@ head -n "$nlines" "$even_lines" | sed -e 's/ $//' | tr ' ' '\n' > "$even_lines_p
paste "$odd_lines_px" "$even_lines_px" \
| tr '\t\n' ' ' \
| fold -w $((width*6)) \
- | sed -r -e 's/([01])([0-7]) ([01])([0-7]) /[\1;3\2;4\4m▀/g' -e 's/$/[m/' \
+ | sed -e 's/\([01]\)\([0-7]\) \([01]\)\([0-7]\) /[\1;3\2;4\4m▀/g' -e 's/$/[m/' \
| if test "$CI" = "true" -a "$TRAVIS" = "true"; then sed -e 's/▀/"/g'; else cat; fi
# Using the line below instead of the one above will ensure that the output is
# printed slow enought that unicode corruption by Travis is unlikely.
diff --git a/utils/compact-ndisasm.sh b/utils/compact-ndisasm.sh
@@ -14,7 +14,7 @@ for i in `seq 0 255`; do skip="$skip -s 0x7e$(printf %02x $i)"; done
echo "[ORG 0x7c00]"; \
ndisasm -s 0x7c78 $skip -o 0x7C00 -b 16 "$in" \
| uniq -s 8 -c \
- | sed -r -e 's/^\s*1 //; t; s/^\s*([0-9]+) ([^ ]+\s+[^ ]+\s+)/\2times \1 /' \
- | sed -r -e 's/([^ ]+\s+[0-9A-F]{4}\s+j[^ ]+ )0x/\1short 0x/') > "$out"
+ | sed -e 's/^\s*1 //' -e 't' -e 's/^\s*\([0-9]\+\) \([^ ]\+\s\+[^ ]\+\s\+\)/\2times \1 /' \
+ | sed -e 's/\([^ ]\+\s\+[0-9A-F]\{4\}\s\+j[^ ]\+ \)0x/\1short 0x/') > "$out"
# The last sed line just above fixes an issue with ndisasm
# (it fails to annotate jz and jnc (and possibly other) with short).