diff --git a/Dockerfile b/Dockerfile index 9ed9575..95661c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,16 +2,42 @@ FROM alpine:latest LABEL description="This is a cc65 Docker container intended to be used for build pipelines." -ENV VERSION="V2.16" +ENV BUILD_DIR="/tmp" \ + CC65_VERSION="V2.16" \ + NULIB2_VERSION="v3.1.0" \ + AC_VERSION="1.3.5.14" + +COPY bin /usr/local/bin RUN apk add --no-cache build-base && \ - wget -P /tmp https://github.com/cc65/cc65/archive/${VERSION}.tar.gz && \ - cd /tmp && \ - tar xzf *.tar.gz && \ + echo "Building CC65 ${CC65_VERSION}" && \ + cd ${BUILD_DIR} && \ + wget https://github.com/cc65/cc65/archive/${CC65_VERSION}.tar.gz && \ + tar xzf ${CC65_VERSION}.tar.gz && \ cd cc65* && \ env prefix=/usr/local make && \ env prefix=/usr/local make install && \ - cd - && \ - rm -rf *.tar.gz cc65* && \ + echo "Building NuLib2 ${NULIB2_VERSION}" && \ + cd ${BUILD_DIR} && \ + wget https://github.com/fadden/nulib2/archive/${NULIB2_VERSION}.tar.gz && \ + tar xzf ${NULIB2_VERSION}.tar.gz && \ + cd nulib2* && \ + cd nufxlib && \ + ./configure && \ + make && \ + make install && \ + cd ../nulib2 && \ + ./configure && \ + make && \ + make install && \ + echo "Adding AppleCommander" && \ + wget https://sites.google.com/site/drjohnbmatthews/applecommander/AppleCommander-${AC_VERSION}-ac.jar && \ + mkdir -p /usr/local/share/java && \ + mv AppleCommander-${AC_VERSION}-ac.jar /usr/local/share/java/AppleCommander-ac.jar && \ + echo "Cleaning up" && \ + cd ${BUILD_DIR} && \ + rm -rf * && \ apk del --no-cache build-base && \ - apk add --no-cache make + echo "Adding other required build-tools exclusive of other C compilers!" && \ + apk add --no-cache make openjdk8-jre && \ + chmod +x /usr/local/bin/* diff --git a/README.md b/README.md index 6013d80..68f6386 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,93 @@ This Docker image is intended to be used in a build pipeline to build [Alpine Linux](https://alpinelinux.org/) and [cc65](http://cc65.github.io/cc65/). -In an effort to keep the image small, it currently only contains (beyond the base Alpine Linux Docker image) `make` and `cc65`. +In an effort to keep the image small, it currently only contains (beyond the base +Alpine Linux Docker image) `make` and `cc65`. + +Note that most tools are installed into `/usr/local` in some capacity and +configured to be executed from there. You can always run `docker run -it a2geek/cc65-pipeline /bin/sh` +to poke around the container for locations and/or tools. + +# Targets + +In order to support the variety of targets that `cc65` addresses, a number of +platform-specific tools need to be present. This section identifies the various +tools for each target. If a target or tool is not supported, please feel free +to submit a pull request! + +## Apple II + +* [NuLib2](http://nulib.com/) to support creation of ShrinkIt archives. +* [AppleCommander](https://applecommander.github.io/) to support creation of disk + images. Specifically [John Matthews'](https://sites.google.com/site/drjohnbmatthews/applecommander) + `ac` command is present. + +# Samples + +Please contribute sample configs for building the proverbial "Hello, World" +application! + +`hello.c`: +```C +#include + +void main(void) +{ + printf("Hello, world!\n"); +} +``` + +`Makefile` (Apple II-centric): +```Makefile +CC = cl65 -t apple2 + +.PHONY: clean + +hello: hello.c + +clean: + rm -f *.o +``` + +Obviously, many of the commands detailed in the sample scripts probably should be in your Makefile, but for these samples, they are not. :-) + +## Apple II + GitLab CI + +Sample configuration to produce both `hello.po` and `hello.shk`: + +`.gitlab-ci.yml`: +```yaml +build: + image: a2geek/cc65-pipeline + stage: build + script: + - make hello + - make clean + - ac -pro140 hello.po + - cat hello | ac -cc65 hello.po hello BIN + - ac -l hello.po + - nulib2 -ak hello.shk hello.po + - nulib2 -v hello.shk + artifacts: + paths: + - ./hello.po + - ./hello.shk +``` + +The output from the `ac -l hello.po` command is: +``` +hello.po /HELLO/ + HELLO BIN 007 01/20/2018 01/20/2018 2,928 A=$0803 +ProDOS format; 136,192 bytes free; 7,168 bytes used. +``` + +The output from the `nulib2 -v hello.shk` command is: +``` +hello.shk Created:20-Jan-18 19:21 Mod:20-Jan-18 19:21 Recs: 1 + +Name Type Auxtyp Archived Fmat Size Un-Length +----------------------------------------------------------------------------- +hello.po Disk 140k 20-Jan-18 19:21 lz2 02% 143360 +----------------------------------------------------------------------------- +Uncomp: 143360 Comp: 3248 %of orig: 2% +``` diff --git a/bin/ac b/bin/ac new file mode 100644 index 0000000..0cff225 --- /dev/null +++ b/bin/ac @@ -0,0 +1,2 @@ +#!/bin/sh +java -jar /usr/local/share/java/AppleCommander-ac.jar "${@}"