From 973610d41860bc177dc37d3f62b9f2f38aad97cd Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 17 Mar 2021 00:08:08 -0400 Subject: Force-disable utf8/unicode support in all perl scripts --- Makefile | 29 ++++++++++++++++++----------- newtitle.pl | 5 +++++ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 0a83a95..a95676d 100644 --- a/Makefile +++ b/Makefile @@ -81,6 +81,13 @@ HOSTCFLAGS=-Wall # Perl binary. This Makefile relies heavily on perl. PERL=perl +# Flags to pass to perl. We're dealing with raw binary data, not +# utf-8 encoded unicode text. The -C0 tells perl to ignore any +# PERL_UNICODE setting in the environment (see "perldoc perlrun"). +PERLFLAGS=-C0 + +PERLF=$(PERL) $(PERLFLAGS) + # A few files have no make rules here. LORCHA.DAT is generated as a # side-effect of generating taifont.xex. It's a 49-byte (7x7) blob of # Atari "internal" screen codes. @@ -139,7 +146,7 @@ checkenv: # C. There's probably a clever way to get ctags to handle this, but I # don't know it, so I wrote a perl script to do the job. tags: - @ctags $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) 2>/dev/null && $(PERL) fixtags.pl tags || true + @ctags $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) 2>/dev/null && $(PERLF) fixtags.pl tags || true help: @echo "Top-level targets:" @@ -199,8 +206,8 @@ conio/conio.lib: # have trouble with $FFFF markers at the start of the second and # further segments, so multixex.pl skips them. $(XEX): checkmem.xex taimain.xex taifont.xex newtitle.xex comptitle.xex - $(PERL) multixex.pl checkmem.xex comptitle.xex newtitle.xex taifont.xex taimain.xex > $(XEX) - $(PERL) size.pl $(TAIMAIN_ADDR) $(STACK_SIZE) + $(PERLF) multixex.pl checkmem.xex comptitle.xex newtitle.xex taifont.xex taimain.xex > $(XEX) + $(PERLF) size.pl $(TAIMAIN_ADDR) $(STACK_SIZE) # Bitmap data for the title screen, 256x184 = 47104 pixels, 8 bits # per pixel, or 5888 bytes. Displayed in ANTIC mode F (aka GR.8), @@ -212,12 +219,12 @@ $(XEX): checkmem.xex taimain.xex taifont.xex newtitle.xex comptitle.xex # comptitle.xex, the compressed title screen. For the cartridge, # titledata.dat is included as-is. titledata.dat: newtitle.pl newtitle.png - $(PERL) newtitle.pl > titledata.dat + $(PERLF) newtitle.pl > titledata.dat # compressed title, for faster loading. see titlecompression.txt # for gory details. comptitle.xex: titledata.dat titlecomp.pl comptitle.s.in - $(PERL) titlecomp.pl 133 < titledata.dat + $(PERLF) titlecomp.pl 133 < titledata.dat $(CC) -l comptitle.lst -o comptitle.xex -t none --asm-define destination=$(TITLE_DATA_ADDR) comptitle.s # tiny 1-sector memory checker, aborts the laod if a cart is present. @@ -237,11 +244,11 @@ newtitle.xex: newtitle.s ver.dat help.dat # Version number in Atari screen-data form ver.dat: text2screen.pl - echo "$(VERSION)" | $(PERL) text2screen.pl > ver.dat + echo "$(VERSION)" | $(PERLF) text2screen.pl > ver.dat # Help text for the title screen help.dat: help.txt text2screen.pl - $(PERL) text2screen.pl < help.txt > help.dat + $(PERLF) text2screen.pl < help.txt > help.dat #ver.dat: mkver.pl # $(PERL) mkver.pl $(VERSION) > ver.dat @@ -333,12 +340,12 @@ romable_taimain.raw: $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(TAIMAIN_HDRS) $(BIGNU # partial last page to copy), and guarantees I don't accidentally end # up with a 0 in the "cart present" byte of the cart trailer. fill256: - $(PERL) -Mbytes -e 'print chr(0xff) x 256' > fill256 + $(PERLF) -Mbytes -e 'print chr(0xff) x 256' > fill256 # 8192 bytes of $ff filler, for unused banks. Possibly these will be # used for something like an interactive game manual/tutorial. blankbank: - $(PERL) -Mbytes -e 'print chr(0xff) x 8192' > blankbank + $(PERLF) -Mbytes -e 'print chr(0xff) x 8192' > blankbank splitrom.raw.0: splitrom.raw.2 @@ -402,10 +409,10 @@ push: sh push.sh size: clean all - $(PERL) size.pl $(TAIMAIN_ADDR) $(STACK_SIZE) + $(PERLF) size.pl $(TAIMAIN_ADDR) $(STACK_SIZE) procsizes: clean all taipan.lst - $(PERL) procsizes.pl > procsizes + $(PERLF) procsizes.pl > procsizes cat procsizes # Cruft. Was used for testing the enemy ship animation. diff --git a/newtitle.pl b/newtitle.pl index 623b411..36e8baf 100644 --- a/newtitle.pl +++ b/newtitle.pl @@ -26,6 +26,11 @@ for $y (0..183) { } } +# turn off utf-8 encoding for stdout. without doing this, the build +# break if someone's set PERL_UNICODE in the environment. plus, I +# strongly suspect utf-8 will be enabled by default in perl 7. +binmode STDOUT, ':raw'; + # just output the raw data, no xex header. print chr($_) for @bytes; -- cgit v1.2.3