Formalize the procedure for building the Mac installer package in the makefile. Create a C and assembly project template. Add file templates for C and assembly files for the Apple //

This commit is contained in:
Jeremy Rand 2014-10-25 00:50:44 -04:00
parent 7d9cbf5479
commit e0bb3c33d0
23 changed files with 331 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
<pkgref spec="1.12" uuid="2E06E074-E9FA-448C-B8DA-B2268ECF4F3E"><config><identifier>com.halcyontouch.Apple2Template.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><installFrom relative="true" mod="true">.</installFrom><installTo mod="true">/Library/Developer/Xcode/Templates/Apple ][/Apple ][ Project.xctemplate</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>installTo.isRelativeType</mod><mod>installTo</mod><mod>relocatable</mod><mod>installFrom.path</mod><mod>identifier</mod><mod>parent</mod><mod>requireAuthorization</mod><mod>installTo.path</mod><mod>installFrom.isRelativeType</mod></config><contents><file-list>01apple-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>

View File

@ -1 +0,0 @@
<pkmkdoc spec="1.12"><properties><title>Apple ][ XCode Template</title><build>/Volumes/BigHD/jrand/Desktop/Apple ][ XCode Template.pkg</build><organization>com.halcyontouch</organization><userSees ui="easy"/><min-target os="3"/><domain user="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><contents><choice title="Apple ][" id="choice1" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.halcyontouch.Apple2Template.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"/></resources><flags/><item type="file">01apple.xml</item><mod>properties.title</mod><mod>properties.userDomain</mod><mod>properties.anywhereDomain</mod></pkmkdoc>

View File

@ -21,22 +21,21 @@ Mac OS X Installation:
In order to use this infrastructure from Mac OS X, follow these instructions: In order to use this infrastructure from Mac OS X, follow these instructions:
1. Install [Xcode from Apple](https://itunes.apple.com/us/app/xcode/id497799835?mt=12&uo=4). Xcode is generally the most popular app in the Mac App Store in the "Developer Tools" category. Xcode is free and you do not need to be a registered Apple developer to download and use it, especially if you are building Apple \]\[ programs. I have only tested with Xcode 6 which is the latest version. It appears as though project templates are a feature introduced in Xcode 4 so the Apple // project template may work with Xcode 4 or 5 but I have not tested them. 1. Install [Xcode from Apple](https://itunes.apple.com/us/app/xcode/id497799835?mt=12&uo=4). Xcode is generally the most popular app in the Mac App Store in the "Developer Tools" category. Xcode is free and you do not need to be a registered Apple developer to download and use it, especially if you are building Apple \]\[ programs. I have only tested with Xcode 6 which is the latest version. It appears as though project templates are a feature introduced in Xcode 4 so the Apple // project template may work with Xcode 4 or 5 but I have not tested them.
2. Install the [cc65 v2.13.3 package](https://github.com/jeremysrand/Apple2BuildPipeline/releases/download/1.0/cc65.2.13.3.pkg). 2. Install the [cc65 v2.13.3 package](https://github.com/jeremysrand/Apple2BuildPipeline/releases/download/1.0/cc65.2.13.3.pkg).
4. Install the [Apple // project template](https://github.com/jeremysrand/Apple2BuildPipeline/releases/download/1.0/Apple.XCode.Template.pkg). 4. Install the [Apple // project template](https://github.com/jeremysrand/Apple2BuildPipeline/releases/download/1.1/AppleXcodeTemplate.pkg).
5. Install [Virtual \]\[](http://www.virtualii.com). 5. Install and setup [Virtual \]\[](http://www.virtualii.com).
Your First Project: Your First Project:
------------------- -------------------
Everything you need is now installed. To create a new Apple \]\[ project in Xcode: Everything you need is now installed. To create a new Apple \]\[ project in Xcode:
1. Start Xcode and create a new project by using File->New->Project... 1. Start Xcode and create a new project by using File->New->Project...
2. In the dialog, you will see an Apple \]\[ option below the OS X section. Select that and select "Apple \]\[ Project". Click "Next". 2. In the dialog, you will see an Apple \]\[ option below the OS X section. Select that and select "Apple \]\[ C Project". Click "Next".
3. A dialog box with a few text fields will appear. In product name, put in the name of the Apple \]\[ executable you want to build. Organization Name and Organization Identifier can be anything you want it to be. Leave Build Tool set to "/usr/bin/make". Click "Next". 3. A dialog box with a few text fields will appear. In product name, put in the name of the Apple \]\[ executable you want to build. Organization Name and Organization Identifier can be anything you want it to be. Leave Build Tool set to "/usr/bin/make". Click "Next".
4. Xcode now prompts you where you want to save your project. The name of the project will be the product name you already gave. Pick a good directory for your project. Your Documents foler is a reasonable option. Click "Create". 4. Xcode now prompts you where you want to save your project. The name of the project will be the product name you already gave. Pick a good directory for your project. Your Documents foler is a reasonable option. Click "Create".
5. Your project is now ready for you. If you select Product->Build, it will build and execute the template code in Virtual \]\[. On your first build, you may be prompted by Mac OS X to install a Java runtime. Java is required so if you get this prompt, you should install it. Once Java is installed, go back to Xcode and select Product->Clean and then Product->Build. Virtual \]\[ should launch this time. 5. Your project is now ready for you. If you select Product->Build, it will build and execute the template code in Virtual \]\[. On your first build, you may be prompted by Mac OS X to install a Java runtime. Java is required so if you get this prompt, you should install it. Once Java is installed, go back to Xcode and select Product->Clean and then Product->Build. Virtual \]\[ should launch this time.
6. The build environmnt includes a template Virtual \]\[ machine configuration, but it is possible that the configuration will not be able to find your ROM file. If so, select Setup from the toolbar and set the folder with your ROM file. You can also change any attributes of the machine on which you want to execute your program here. When you are done, be sure to select File->Save Configuration. Try your build again from Xcode now that you have your machine configuration set. 6. At this point everything should work and you should see "HELLO, WORLD!" in the emulator. Press any key in the emulator to quit the executable and go back to the BASIC prompt.
7. At this point everything should work and you should see "HELLO, WORLD!" in the emulator. Press any key in the emulator to quit the executable and go back to the BASIC prompt. 7. Review the Makefile and set any options you want. The file has lots of comments to help you understand the configuration options.
8. Review the Makefile and set any options you want. The file has lots of comments to help you understand the configuration options. 8. Change main.c and write more code in new C or assembly files until you have the program you always wanted to build. To add new files, select File->New->File. In the dialog, you will see an Apple \]\[ option in the OS X section. Select that and in there, you will see options to create a new C file or a new Assembly File. Select the one you want to add the file to your project. Put the file in the same directory as main.c.
9. Change main.c and write more code in new C or assembly files until you have the program you always wanted to build...
UNIX Installation: UNIX Installation:
------------------ ------------------

View File

@ -79,9 +79,11 @@ clean:
rm -f $(ASM_LSTS) rm -f $(ASM_LSTS)
rm -f $(DISKIMAGE) rm -f $(DISKIMAGE)
createPackage:
pkg/createPackage
cleanMacCruft: cleanMacCruft:
rm -rf Apple2Template.pmdoc rm -rf pkg
rm -rf TemplateInfo.plist
$(PGM): $(OBJS) $(PGM): $(OBJS)
$(CL65) $(MACHCONFIG) --mapfile $(MAPFILE) $(LDFLAGS) -o $(PGM) $(OBJS) $(CL65) $(MACHCONFIG) --mapfile $(MAPFILE) $(LDFLAGS) -o $(PGM) $(OBJS)

BIN
pkg/.createPackage.swp 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 ][ XCode Template</title>
<pkg-ref id="com.halcyontouch.Apple2Template.pkg"/>
<options customize="never" require-scripts="false"/>
<domains enable_currentUserHome="true"/>
<choices-outline>
<line choice="default">
<line choice="com.halcyontouch.Apple2Template.pkg"/>
</line>
</choices-outline>
<choice id="default"/>
<choice id="com.halcyontouch.Apple2Template.pkg" visible="false">
<pkg-ref id="com.halcyontouch.Apple2Template.pkg"/>
</choice>
<pkg-ref id="com.halcyontouch.Apple2Template.pkg" version="1.1" onConclusion="none">AppleXcodeTemplate.pkg</pkg-ref>
</installer-gui-script>

View File

@ -0,0 +1,136 @@
<?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/AppleCommander.jar</string>
<string>make/createDiskImage</string>
<string>make/DevApple.vii</string>
<string>make/dos33_template.dsk</string>
<string>make/head.mk</string>
<string>make/prodos_template.dsk</string>
<string>make/tail.mk</string>
<string>make/V2Make.scpt</string>
</array>
<key>Definitions</key>
<dict>
<key>main.s</key>
<dict>
<key>Path</key>
<string>main.s</string>
</dict>
<key>make/V2Make.scpt</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/V2Make.scpt</string>
</dict>
<key>make/tail.mk</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/tail.mk</string>
</dict>
<key>make/prodos_template.dsk</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/prodos_template.dsk</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/dos33_template.dsk</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/dos33_template.dsk</string>
</dict>
<key>make/DevApple.vii</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/DevApple.vii</string>
</dict>
<key>make/createDiskImage</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/createDiskImage</string>
</dict>
<key>make/AppleCommander.jar</key>
<dict>
<key>Path</key>
<string>make/AppleCommander.jar</string>
<key>Group</key>
<string>make</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.apple2AsmBuildSystem</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 ][ assembly code project. 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,30 @@
;
; ___FILENAME___
; ___PROJECTNAME___
;
; Created by ___FULLUSERNAME___ on ___DATE___.
;___COPYRIGHT___
;
COUT = $fded
KEYBOARD = $c000
STROBE = $c010
main:
ldx #$00
loop:
lda msg, X
beq wait
ora #$80
jsr COUT
inx
jmp loop
wait:
lda KEYBOARD
bpl wait
lda STROBE
rts
msg: .asciiz "HELLO, WORLD"

View File

@ -87,7 +87,7 @@
<key>Kind</key> <key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string> <string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key> <key>Identifier</key>
<string>com.halcyontouch.apple2BuildSystem</string> <string>com.halcyontouch.apple2CBuildSystem</string>
<key>Ancestors</key> <key>Ancestors</key>
<array> <array>
<string>com.apple.dt.unit.externalBuildSystem</string> <string>com.apple.dt.unit.externalBuildSystem</string>
@ -95,7 +95,7 @@
<key>Concrete</key> <key>Concrete</key>
<true/> <true/>
<key>Description</key> <key>Description</key>
<string>This template builds Apple ][ programs using cc65.</string> <string>This template creates an Apple ][ C code project. 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> <key>Options</key>
<array/> <array/>
<key>Targets</key> <key>Targets</key>

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,7 @@
;
; ___FILENAME___
; ___PROJECTNAME___
;
; Created by ___FULLUSERNAME___ on ___DATE___.
;___COPYRIGHT___
;

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
cp -R make $TMPDIR/'Apple ][/Apple ][ C Project.xctemplate/'
cp Makefile $TMPDIR/'Apple ][/Apple ][ C Project.xctemplate/'
cp main.c $TMPDIR/'Apple ][/Apple ][ C Project.xctemplate/'
cp -R make $TMPDIR/'Apple ][/Apple ][ Asm Project.xctemplate/'
cp Makefile $TMPDIR/'Apple ][/Apple ][ Asm Project.xctemplate/'
pkgbuild --root $TMPDIR --version 1.1 --identifier com.halcyontouch.Apple2Template.pkg --install-location /Library/Developer/Xcode/Templates/ --scripts pkg/scripts/ AppleXcodeTemplate.pkg
productbuild --distribution pkg/Distribution.xml --resource ./pkg temp.pkg
rm AppleXcodeTemplate.pkg
productsign --sign "Developer ID Installer" temp.pkg AppleXcodeTemplate.pkg
rm temp.pkg
rm -rf $TMPDIR

BIN
pkg/scripts/.preinstall.swp Normal file

Binary file not shown.

8
pkg/scripts/preinstall Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
OLDTEMPLATE=~/"Library/Developer/Xcode/Templates/Apple ][/Apple ][ Project.xctemplate"
if [ -d "$OLDTEMPLATE" ]
then
rm -rf "$OLDTEMPLATE"
fi