Add a Unix shell script to set file types

Because the previous README instructions did not specify *.sh files as
exempt from line-ending filtering, I have added SetFileTypes.sh as one-
liner.
This commit is contained in:
Elliot Nunn 2018-02-10 19:36:31 +08:00
parent bbe9f79aaf
commit 6d103981d8
3 changed files with 9 additions and 49 deletions

View File

@ -1,49 +0,0 @@
# Takes no arguments -- expects to be inside the Make directory,
# or run in place (select all, then cmd-return)
If "{0}" == ""
Set 0 "{Active}"
End
Set Tree "`Files -f "{0}" | StreamEdit -e '1 Replace /[Â:]*:[Â:]*°/ -n'`"
If {#} == 1
Set Tree "{1}"
Else If {#} == 0
Set MyPath "`Files -f "{0}"`"
Set Tree "`Echo "{MyPath}" | StreamEdit -e '1 Replace /[Â:]*:[Â:]*°/ -n'`"
Else
Echo "# USAGE: {0} [PATH]"
Exit 1
End
Set Count 0
Echo "# Suggested commands:"
For RootFolder in `Files -f "{Tree}" | StreamEdit -e '¥,° Replace /Å:.Å/ -n'`
For UntypedFile in `Files -f -r -o -s -t '' {RootFolder}`
Set NewT "TEXT"
Set NewC "MPS "
If "{UntypedFile}" =~ /Å.x/
Set NewT "XCOF"
Else If "{UntypedFile}" =~ /Å.o/
Set NewT "OBJ "
Else If "{UntypedFile}" =~ /Å.lib/
Set NewT "OBJ "
Else If "{UntypedFile}" =~ /Å.rsrc/
Set NewT "rsrc"
Set NewC "RSED"
Else If "{UntypedFile}" =~ /ÅGoNativeResources/
Set NewT "rsrc"
Set NewC "RSED"
End
Echo " SetFile -t ¶"{NewT}¶" -c ¶"{NewC}¶" ¶"{UntypedFile}¶""
Set Count `Evaluate {Count} + 1`
End
End
Echo "# Total: {Count}"

1
Misc/SetFileTypes.sh Normal file
View File

@ -0,0 +1 @@
cd "`dirname "$0"`"; cd ..; find . -type f -not -path '*/.*' -not -ipath './BuildResults/*' -not -ipath './Tools/*' -exec SetFile -t 'TEXT' -c 'MPS ' {} \;; find Tools -type f -not -path '*/.*' \( -ipath '*.c' -o -ipath '*.h' -o -ipath '*.make' \) -exec SetFile -t 'TEXT' -c 'MPS ' {} \;; find BuildResults -type f -not -path '*/.*' \( -ipath '*.o' -o -ipath '*.lib' \) -exec SetFile -t 'OBJ ' -c 'MPS ' {} \;; find . -type f -not -path '*/.*' \( -ipath '*.rsrc' -o -iname GoNativeResources \) -exec SetFile -t 'rsrc' -c 'RSED' {} \;

View File

@ -18,6 +18,7 @@ Append this to `.git/info/attributes`:
* filter=maclines
*.lib -filter
*.o -filter
*.sh -filter
.gitignore -filter
Finally, do a once-off "re-smudge":
@ -25,6 +26,13 @@ Finally, do a once-off "re-smudge":
rm -rf ../mac-rom/*
git checkout .
Setting type and creator codes
------------------------------
Some MPW Tools require their input files to have the correct Mac OS file type ("TEXT" or "OBJ "), but Git does not save Mac OS type and creator codes. This shell script will correct the file types in a freshly cloned repo:
sh Misc/SetFileTypes.sh
Building
--------
This code is built with the [Macintosh Programmer's Workshop](https://en.wikipedia.org/wiki/Macintosh_Programmer%27s_Workshop) (MPW), which runs on the Classic Mac OS. To satisfy the memory requirements of the build process, the MPW Shell should get a memory partition of at least 16 MB. Once you have MPW set up, the build process is not particularly fussy.