Initial commit

This commit is contained in:
Jeremy Rand 2017-05-16 22:34:15 -04:00
commit 94cf668398
27 changed files with 761 additions and 0 deletions

59
Makefile Normal file
View File

@ -0,0 +1,59 @@
#
# Makefile
# Apple //GS Build Engine for ORCA
#
include make/head.mk
# Customize this file to control what kind of project you are working on,
# where to find files, etc.
# The name of your system or binary file to build goes here:
PGM=___PACKAGENAME___
# Set the target type you would like to build. The options are:
# shell - A shell command for ORCA, GNO or other GS shell
# desktop - A full desktop application
# cda - A classic desk accessory
# cdev - A control panel device
# nba - A HyperStudio new button action
# nda - A new desk accessory
# xcmd - A HyperCard XCMD or XCFN
#
TARGETTYPE=shell
# TARGETTYPE=desktop
# TARGETTYPE=cda
# TARGETTYPE=cdev
# TARGETTYPE=nba
# TARGETTYPE=nda
# TARGETTYPE=xcmd
# Add any other directories where you are putting C or assembly source
# files to this list:
# SRCDIRS+=
# If you put your main entry point for your project in a file called main.c
# Then you don't need to change this value. If you want to call your entry
# point something other than main.c, set this variable to point to this file.
ROOTCFILE=main.c
# Add any arguments you want passed to the C compiler to this variable:
CFLAGS+=
# Add any arguments you want passed to the resource compiler to this variable:
REZFLAGS+=
# Add any arguments you want passed to the macro generator to this variable:
MACGENFLAGS+=
# Add any other macro libraries to include in this variable:
MACGENMACROS+=
# Add any arguments you want passed to the assembler to this variable:
ASMFLAGS+=
# Add any arguments you want passed to the linker to this variable:
LDFLAGS+=
# Do not change anything else below here...
include make/tail.mk

BIN
make/.DS_Store vendored Normal file

Binary file not shown.

37
make/head.mk Normal file
View File

@ -0,0 +1,37 @@
#
# head.mk
#
ORCA_HOME := $(HOME)/orca
ORCA_BINDIR = /usr/local/bin
export ORCA=$(ORCA_BINDIR)/orca
AC=make/AppleCommander.jar
TARGETTYPE=shell
SRCDIRS=.
COMPILE=make/orca-cc
CFLAGS= -P -I
ROOTCFILE=main.c
DEFINES=
INCLUDE_PATHS=
REZ=make/orca-rez
REZFLAGS=
MACGEN=$(ORCA) macgen
MACGENFLAGS=-P
MACGENMACROS=$(wildcard $(ORCA_HOME)/libraries/ORCAInclude/m*)
ASSEMBLE=make/orca-asm
ASMFLAGS=-P
LINK=$(ORCA) link
LDFLAGS=-P
RM=rm -f
CP=cp

18
make/orca-asm Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
FILENAME="$1"
shift
if echo $FILENAME | grep -v '\.s$' > /dev/null
then
echo Expected first argument to be a *.s file but got $FILENAME
exit 1
fi
DIRNAME=`dirname $FILENAME`
BASENAME=`basename $FILENAME .s`
cd "$DIRNAME"
$ORCA assemble $* keep="${BASENAME}" "${BASENAME}.s"
RESULT=$?
exit $RESULT

66
make/orca-cc Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash
TMPFILE=/tmp/orca-cc.$$
FILENAME="$1"
shift
if echo $FILENAME | grep -v '\.c$' > /dev/null
then
echo Expected first argument to be a *.c file but got $FILENAME
exit 1
fi
CCARGS=""
COMPILEARGS=""
for ARG in $*
do
if echo $ARG | grep '^-[id]' > /dev/null
then
CCARGS="$CCARGS cc=$ARG"
else
COMPILEARGS="$COMPILEARGS $ARG"
fi
done
BASENAME=`echo $FILENAME | sed 's/\.c$//'`
DEPSNAME="${BASENAME}.d"
OBJSNAME="${BASENAME}.a"
ROOTNAME="${BASENAME}.root"
$ORCA --trace-gsos compile $COMPILEARGS "$FILENAME" keep="${BASENAME}" $CCARGS 2> $TMPFILE
RESULT=$?
sed '/^[A-Za-z][A-Za-z]*(.*)$/d' $TMPFILE >&2
if [ "$RESULT" -ne 0 ]
then
rm -f $TMPFILE
rm -f $OBJSNAME
rm -f $ROOTNAME
exit $RESULT
fi
DEPS=`awk '
/^FastFileLoad/ {
sub(/^FastFileLoad\(/, "");
sub(/\)$/, "");
print}' $TMPFILE | sort -u | while read FILE
do
if [ -f "$FILE" ]
then
echo $FILE
fi
done | tr '\012' ' '`
rm -f $TMPFILE
# We add a dependency for both the .o and the .root file. If this is the
# main.c file being compiled, we need the dependency on the .root file.
cat > $DEPSNAME << EOF
$OBJSNAME: $DEPS
$ROOTNAME: $DEPS
EOF
exit 0

45
make/orca-rez Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
TMPFILE=/tmp/orca-rez.$$
FILENAME="$1"
shift
if echo $FILENAME | grep -v '\.rez$' > /dev/null
then
echo Expected first argument to be a *.rez file but got $FILENAME
exit 1
fi
BASENAME=`echo $FILENAME | sed 's/\.rez$//'`
DEPSNAME="${BASENAME}.rez.d"
OBJSNAME="${BASENAME}.r"
$ORCA --trace-gsos compile $* keep="${OBJSNAME}" "$FILENAME" 2> $TMPFILE
RESULT=$?
sed '/^[A-Za-z][A-Za-z]*(.*)$/d' $TMPFILE >&2
if [ "$RESULT" -ne 0 ]
then
rm -f $TMPFILE
rm -f $OBJSNAME
exit $RESULT
fi
DEPS=`awk '
/^FastFileLoad/ {
sub(/^FastFileLoad\(/, "");
sub(/\)$/, "");
print}' $TMPFILE | sort -u | while read FILE
do
if [ -f "$FILE" ]
then
echo $FILE
fi
done`
echo $OBJSNAME: $DEPS > $DEPSNAME
rm -f $TMPFILE
exit 0

111
make/tail.mk Normal file
View File

@ -0,0 +1,111 @@
#
# tail.mk
#
export PATH := $(PATH):$(ORCA_BIN)
CWD=$(shell pwd)
ifeq ($(wildcard $(ROOTCFILE)),)
ROOTCFILE=
endif
C_ROOTS=$(ROOTCFILE:.c=.root)
C_SRCS+=$(filter-out $(ROOTCFILE), $(patsubst ./%, %, $(wildcard $(addsuffix /*.c, $(SRCDIRS)))))
C_OBJS=$(C_SRCS:.c=.a)
C_DEPS=$(ROOTCFILE:.c=.d) $(C_SRCS:.c=.d)
ASM_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.s, $(SRCDIRS))))
ASM_MACROS=$(ASM_SRCS:.s=.macros)
ASM_ROOTS=$(ASM_SRCS:.s=.ROOT)
ASM_OBJS=$(ASM_SRCS:.s=.a)
REZ_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.rez, $(SRCDIRS))))
REZ_DEPS=$(REZ_SRCS:.rez=.rez.d)
REZ_OBJS=$(REZ_SRCS:.rez=.r)
ifneq ($(firstword $(REZ_SRCS)), $(lastword $(REZ_SRCS)))
$(error Only a single resource file supported, found $(REZ_SRCS))
endif
BUILD_OBJS=$(C_ROOTS) $(C_OBJS) $(ASM_ROOTS) $(REZ_OBJS)
BUILD_OBJS_NOSUFFIX=$(C_ROOTS:.root=) $(C_OBJS:.a=) $(ASM_ROOTS:.ROOT=)
ALL_OBJS=$(C_ROOTS:.root=.a) $(C_OBJS) $(ASM_OBJS) $(REZ_OBJS)
ALL_ROOTS=$(C_ROOTS) $(C_OBJS:.a=.root) $(ASM_ROOTS)
ALL_DEPS=$(C_DEPS) $(REZ_DEPS)
LINK_ARGS=
EXECCMD=
#ALLTARGET=$(DISKIMAGE)
ifeq ($(TARGETTYPE),shell)
ALLTARGET=execute
else
ALLTARGET=$(PGM)
endif
.PHONY: all execute clean
#.PRECIOUS: $(ASM_MACROS)
all: $(ALLTARGET)
clean:
$(RM) "$(PGM)"
$(RM) $(ALL_OBJS)
$(RM) $(ALL_ROOTS)
$(RM) $(ALL_DEPS)
$(RM) $(ASM_MACROS)
# $(RM) "$(DISKIMAGE)"
createPackage:
pkg/createPackage
cleanMacCruft:
rm -rf pkg
$(PGM): $(BUILD_OBJS)
ifneq ($(REZ_OBJS),)
$(RM) $(PGM)
$(CP) $(REZ_OBJS) $(PGM)
endif
$(LINK) $(BUILD_OBJS_NOSUFFIX) --keep=$(PGM) $(LDFLAGS)
#$(DISKIMAGE): $(PGM)
# make/createDiskImage $(AC) $(MACHINE) "$(DISKIMAGE)" "$(PGM)" "$(START_ADDR)"
#execute: $(DISKIMAGE)
# osascript make/V2Make.scpt "$(CWD)" "$(PGM)" "$(CWD)/make/DevApple.vii" "$(EXECCMD)"
execute: $(PGM)
$(ORCA) $(PGM)
%.a: %.c
$(COMPILE) $< $(CFLAGS) --noroot
%.root: %.c
$(COMPILE) $< $(CFLAGS)
%.macros: %.s
$(MACGEN) $(MACGENFLAGS) $< $@ $(MACGENMACROS)
%.ROOT: %.macros
$(ASSEMBLE) $(<:.macros=.s) $(ASMFLAGS)
%.r: %.rez
$(REZ) $< $(REZFLAGS)
$(OBJS): Makefile
# This adds a dependency to force all .macro targets to be regenerated if
# any of the macro library files have changed. We can't tell which actual
# macros are used so we have to regenerate if any have changed.
ifneq ($(ASM_MACROS),)
$(ASM_MACROS): $(MACGENMACROS)
endif
# Include the C and rez dependencies which were generated from the last build
# so we recompile correctly on .h file changes.
-include $(ALL_DEPS)

BIN
pkg/.DS_Store vendored Normal file

Binary file not shown.

17
pkg/Distribution.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="1">
<title>Apple IIgs XCode Template</title>
<pkg-ref id="com.halcyontouch.Apple2gsTemplate.pkg"/>
<options customize="never" require-scripts="false"/>
<domains enable_currentUserHome="true"/>
<choices-outline>
<line choice="default">
<line choice="com.halcyontouch.Apple2gsTemplate.pkg"/>
</line>
</choices-outline>
<choice id="default"/>
<choice id="com.halcyontouch.Apple2gsTemplate.pkg" visible="false">
<pkg-ref id="com.halcyontouch.Apple2gsTemplate.pkg"/>
</choice>
<pkg-ref id="com.halcyontouch.Apple2gsTemplate.pkg" version="1.1" onConclusion="none">Apple2gsXcodeTemplate.pkg</pkg-ref>
</installer-gui-script>

BIN
pkg/Templates/.DS_Store vendored Normal file

Binary file not shown.

BIN
pkg/Templates/Apple IIgs/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Nodes</key>
<array>
<string>main.s</string>
<string>Makefile</string>
<string>make/head.mk</string>
<string>make/orca-asm</string>
<string>make/orca-cc</string>
<string>make/orca-rez</string>
<string>make/tail.mk</string>
</array>
<key>Definitions</key>
<dict>
<key>main.s</key>
<dict>
<key>Path</key>
<string>main.s</string>
</dict>
<key>make/head.mk</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/head.mk</string>
</dict>
<key>make/orca-asm</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-asm</string>
</dict>
<key>make/orca-cc</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-cc</string>
</dict>
<key>make/orca-rez</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-rez</string>
</dict>
<key>make/tail.mk</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/tail.mk</string>
</dict>
<key>Makefile</key>
<dict>
<key>Path</key>
<string>Makefile</string>
</dict>
</dict>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key>
<string>com.halcyontouch.apple2gsAsmShellCommand</string>
<key>Ancestors</key>
<array>
<string>com.apple.dt.unit.externalBuildSystem</string>
</array>
<key>Concrete</key>
<true/>
<key>Description</key>
<string>This template creates an Apple IIgs assembly code project to build an ORCA or GNO shell command. The project starts with a single assembly file which you can modify. You can also add more assembly or C files as you may like.</string>
<key>Options</key>
<array/>
<key>Targets</key>
<array>
<dict>
<key>TargetType</key>
<string>Legacy</string>
<key>TargetIdentifier</key>
<string>com.apple.dt.cocoaLegacyTarget</string>
<key>BuildToolPath</key>
<string>___VARIABLE_buildToolPath___</string>
<key>BuildToolArgsString</key>
<string>-C ___PACKAGENAME___ $(ACTION)</string>
<key>SharedSettings</key>
<dict>
<key>OTHER_CFLAGS</key>
<string></string>
<key>OTHER_LDFLAGS</key>
<string></string>
</dict>
<key>Configurations</key>
<dict>
<key>Debug</key>
<dict>
<key>DEBUGGING_SYMBOLS</key>
<string>YES</string>
<key>GCC_GENERATE_DEBUGGING_SYMBOLS</key>
<string>YES</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
</dict>
<key>Release</key>
<dict/>
</dict>
</dict>
</array>
</dict>
</plist>

View File

@ -0,0 +1,22 @@
;
; ___FILENAME___
; ___PROJECTNAME___
;
; Created by ___FULLUSERNAME___ on ___DATE___.
;___COPYRIGHT___
;
mcopy main.macros
keep main
Main start
phk
plb
jsl SystemEnvironmentInit
jsl SysIOStartup
puts #'Hello, world!',cr=t
jsl SysIOShutdown
lda #0
rtl
end

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Nodes</key>
<array>
<string>main.c</string>
<string>Makefile</string>
<string>make/head.mk</string>
<string>make/orca-asm</string>
<string>make/orca-cc</string>
<string>make/orca-rez</string>
<string>make/tail.mk</string>
</array>
<key>Definitions</key>
<dict>
<key>main.c</key>
<dict>
<key>Path</key>
<string>main.c</string>
</dict>
<key>make/head.mk</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/head.mk</string>
</dict>
<key>make/orca-asm</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-asm</string>
</dict>
<key>make/orca-cc</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-cc</string>
</dict>
<key>make/orca-rez</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-rez</string>
</dict>
<key>make/tail.mk</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/tail.mk</string>
</dict>
<key>Makefile</key>
<dict>
<key>Path</key>
<string>Makefile</string>
</dict>
</dict>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key>
<string>com.halcyontouch.apple2gsCShellCommand</string>
<key>Ancestors</key>
<array>
<string>com.apple.dt.unit.externalBuildSystem</string>
</array>
<key>Concrete</key>
<true/>
<key>Description</key>
<string>This template creates an Apple IIgs C code project to build an ORCA or GNO shell command. The project starts with a single C file which you can modify. You can also add more assembly or C files as you may like.</string>
<key>Options</key>
<array/>
<key>Targets</key>
<array>
<dict>
<key>TargetType</key>
<string>Legacy</string>
<key>TargetIdentifier</key>
<string>com.apple.dt.cocoaLegacyTarget</string>
<key>BuildToolPath</key>
<string>___VARIABLE_buildToolPath___</string>
<key>BuildToolArgsString</key>
<string>-C ___PACKAGENAME___ $(ACTION)</string>
<key>SharedSettings</key>
<dict>
<key>OTHER_CFLAGS</key>
<string></string>
<key>OTHER_LDFLAGS</key>
<string></string>
</dict>
<key>Configurations</key>
<dict>
<key>Debug</key>
<dict>
<key>DEBUGGING_SYMBOLS</key>
<string>YES</string>
<key>GCC_GENERATE_DEBUGGING_SYMBOLS</key>
<string>YES</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
</dict>
<key>Release</key>
<dict/>
</dict>
</dict>
</array>
</dict>
</plist>

View File

@ -0,0 +1,18 @@
/*
* ___FILENAME___
* ___PACKAGENAME___
*
* Created by ___FULLUSERNAME___ on ___DATE___.
* Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
*
*/
#include <stdio.h>
int main(void)
{
printf("Hello, world!\n");
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DefaultCompletionName</key>
<string>File</string>
<key>Description</key>
<string>An assembly source file.</string>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>MainTemplateFile</key>
<string>___FILEBASENAME___.s</string>
<key>Summary</key>
<string>An assembly source file</string>
</dict>
</plist>

View File

@ -0,0 +1,14 @@
;
; ___FILENAME___
; ___PROJECTNAME___
;
; Created by ___FULLUSERNAME___ on ___DATE___.
;___COPYRIGHT___
;
mcopy ___FILEBASENAME___.macros
keep ___FILEBASENAME___
___FILEBASENAME___ start
rtl
end

View File

@ -0,0 +1,9 @@
/*
* ___FILENAME___
* ___PROJECTNAME___
*
* Created by ___FULLUSERNAME___ on ___DATE___.
* ___COPYRIGHT___
*/
#include <stdio.h>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AllowedTypes</key>
<array>
<string>public.c-source</string>
</array>
<key>DefaultCompletionName</key>
<string>File</string>
<key>Description</key>
<string>An empty C file.</string>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>MainTemplateFile</key>
<string>___FILEBASENAME___.c</string>
<key>Options</key>
<array>
<dict>
<key>Description</key>
<string>The name of the file to create</string>
<key>Identifier</key>
<string>productName</string>
<key>Name</key>
<string>Name:</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Default</key>
<string>true</string>
<key>Description</key>
<string>Whether to create a header file with the same name</string>
<key>Identifier</key>
<string>WithHeader</string>
<key>Name</key>
<string>Also create a header file</string>
<key>NotPersisted</key>
<true/>
<key>Type</key>
<string>checkbox</string>
</dict>
</array>
<key>SortOrder</key>
<string>2</string>
<key>Summary</key>
<string>An empty C file.</string>
</dict>
</plist>

View File

@ -0,0 +1,9 @@
/*
* ___FILENAME___
* ___PROJECTNAME___
*
* Created by ___FULLUSERNAME___ on ___DATE___.
* ___COPYRIGHT___
*/
#include "___FILEBASENAME___.h"

View File

@ -0,0 +1,14 @@
/*
* ___FILENAME___
* ___PROJECTNAME___
*
* Created by ___FULLUSERNAME___ on ___DATE___.
* ___COPYRIGHT___
*/
#ifndef _____PROJECTNAMEASIDENTIFIER________FILEBASENAMEASIDENTIFIER_____
#define _____PROJECTNAMEASIDENTIFIER________FILEBASENAMEASIDENTIFIER_____
#endif /* defined(_____PROJECTNAMEASIDENTIFIER________FILEBASENAMEASIDENTIFIER_____) */

20
pkg/createPackage Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
TMPDIR=/tmp/pkg.$$
cp -R pkg/Templates $TMPDIR
for PROJECT in "Apple IIgs C Shell Command" "Apple IIgs Asm Shell Command"
do
echo cp -R Makefile make "${TMPDIR}/Apple IIgs/${PROJECT}.xctemplate/"
cp -R Makefile make "${TMPDIR}/Apple IIgs/${PROJECT}.xctemplate/"
done
pkgbuild --root $TMPDIR --version 0.1 --identifier com.halcyontouch.Apple2gsTemplate.pkg --install-location /Library/Developer/Xcode/Templates/ --scripts pkg/scripts/ Apple2GSXcodeTemplate.pkg
productbuild --distribution pkg/Distribution.xml --resource ./pkg temp.pkg
rm Apple2GSXcodeTemplate.pkg
#productsign --sign "Developer ID Installer: Halcyon Touch Software" temp.pkg Apple2GSXcodeTemplate.pkg
cp temp.pkg Apple2GSXcodeTemplate.pkg
rm temp.pkg
rm -rf $TMPDIR

9
pkg/scripts/preinstall Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
for item in ~/"Library/Developer/Xcode/Templates/Apple ][gs" ~/"Library/Developer/Xcode/Templates/File Templates/Apple ][gs"
do
if [ -d "$item" ]
then
rm -rf "$item"
fi
done