cc65 for cygwin

Part 1 – Setting up Cygwin

Note: If you already have cygwin installed you might just want to breeze through the steps to make sure you have all the required packages.

  1. Download the cygwin installer from http://www.cygwin.com to a directory you will want to keep for later updates. ex c:\downloads\cygwin.
  2. Run the setup.exe that you downloaded to start the install.
  3. Choose Next then choose install from internet.
  4. Make your choices for install path, install for and default file types.
  5. Recommend you take the recommended settings which should be c:\cygwin, install for all and unix filetype. Choose next.
  6. The next two choices, local package directory and direct connection can most likely be left as is.
  7. Its best to chose a few mirrors in case one is not available later, my personal choices are, ftp.planetmirror.com, mirrors.kernel.org. Use CTRL to multi select them. Choose next
  8. Maximize the window and we will walk through the recommended software to install
    • Archive: zip, unzip.
    • Base: All is selected by default.
    • Devel: binutils, cvsutils, gcc:g++ compiler, make, subversion.
    • Feel free to browse through and pick any additional software you might want or need like editors etc …
  9. Choose next to start teh download and install.
  10. Accept the creation of the icons.

Next you have to decide if you want to download the source code for cc65 and build it all yourself (Part 2) or just download the binaries and intergrate them with cygwin (Part 3).

Part 2 – Building/installing CC65 for cygwin

  1. My preference it to build cc65 from source. Not only do you see what a big package it is, you also get a feel for what ends up where.
  2. Make a src directory under c:\cygwin. You can place your source where ever you please but I find it convienient to put it under cygwin so that I can just cd to /src.
  3. In your web browser goto ftp://ftp.musoftware.de/pub/uz/cc65/snapshot
  4. Download ftp://ftp.musoftware.de/pub/uz/cc65/snapshot/cc65-snapshot-sources-2.11.9.yyyymmdd.tar.bz2 to the c:\cygwin\src directory.
  5. Download cc65-snapshot-doc-2.11.9.yyyymmdd-1.zip to the c:\cygwin\src directory.
  6. From a Cygwin bash command window cd into your src directory and use bunbzip2 to uncompress the cc65-snapshot-sources file. (bunzip2 cc65-snapshot-sources-2.11.9.yyyymmdd.tar.bz2).
  7. Then use tar to untar it (tar -xvf cc65-snapshot-sources-2.11.9.yyyymmdd.tar)
  8. Next cd into the cc65-snapshot-sources-2.11.9.yyymmdd directory.
  9. Run “make -f make/gcc.mak”
  10. Sitback and watch the action. It will take a while as it will build the complier tools and all the platform libraries.
  11. cd back one level “cd ..”. Then “unzip cc65-snapshot-doc-2.11.9.yyyymmdd-1.zip”
  12. Copy C:\cygwin\src\cc65-snapshot-doc-2.11.9.yyyymmdd\doc to C:\cygwin\src\cc65-snapshot-sources-2.11.9.yyymmdd\doc
  13. next cd back into cc65-snapshot-sources-2.11.9.yyymmdd directory.
  14. Edit gcc.mak in the make directory so that the line with “INSTALL = make/install-sh” is commented out and insert a line like this “INSTALL = install”
    #INSTALL = make/install-sh
    INSTALL = install
  15. Once it’s complete run “make -f make/gcc.mak install”. This will install the binaries, libraries, help  and include files into the right place in the cygwin directory structure.
  16. Update your cygwin.bat file and add these statements before the bash command
    • SET CC65_INC=/usr/lib/cc65/include
    • SET CC65_LIB=/usr/lib/cc65/lib
    • SET LD65_LIB=/lib/cc65/lib
    • SET LD65_OBJ=/lib/cc65/lib
  17. Goto Test driving the Compiler article

Part 3 – Downloading/installing CC65 for cygwin

  • If you decided to download the prebuilt binaries, libaries and include files then follow these steps
  • Download the following files to a temp dir (suggest c:\cygwin\tmp)- cc65-win32-2.11.0-1.zip, cc65-doc-2.11.0-1.zip, cc65-apple2-2.11.0-1.zip and cc65-apple2enh-2.11.0-1.zip
  • Unzip them from the bash shell
  • mkdir
    • mkdir /src
    • mkdir /lib/cc65
    • mkdir /usr/share/cc65
  • Copy
    • cp -pr /tmp/cc65-win32-2.11.0-1/bin /
    • cp -pr /tmp/cc65-win32-2.11.0-1/include /lib/cc65
    • cp -pr /tmp/cc65-win32-2.11.0-1/asminc /lib/cc65
    • cp -pr /tmp/cc65-doc-2.11.0-1/doc /usr/share/cc65
    • cp -pr /tmp/cc65-doc-2.11.0-1/samples /src
    • cp -pr /tmp/c65-apple2-2.11.0-1/* /lib/cc65
    • cp-pr /tmp/cc65-apple2enh-2.11.0-1/* /lib/cc65
  • Update your cygwin.bat file and add these statements before the bash command
    • SET CC65_INC=/usr/lib/cc65/include
    • SET CC65_LIB=/usr/lib/cc65/lib
    • SET LD65_LIB=/lib/cc65/lib
    • SET LD65_OBJ=/lib/cc65/lib
  • Goto Test driving the Compiler article.