Building curl for amiga

Curl is a tool for internet communication and supports many protocols. Most important is probably HTTPS so a web server can be connected. If you read this article (what you obviously do) you know what you want to do with it. This article explains how to cross compile it for AmigaOS 3.

Besides downloading curl from Aminet you may want to compile the most current version and this article explains how to do that.

Docker

If you are familiar with Docker the easiest option would be to download this Dockerfile. Google will help you how to use this file to build a container. In this container you will find a compiled curl ready to use. The Dockerfile could also help you if you want to setup your PC to compile curl, e.g. in case the instructions below are not precise enough for you.

Note that, as described below, the latest known revision of curl will be compiled. If you want the newest just remove the “git checkout” from the Dockerfile.

Furthermore, AmiSSL download on Aminet only works if the version is still available as the file name contains the version number. Thus, you may want to change the AmiSSL download link in the Dockerfile if the download fails.

Cross-Compilation

We will cross compile it using Linux or macOS including AmiSSL so you can use HTTPS. First we have to prepare our cross compiler. Here we use GCC 6 that you can download on GitHub from user bebbo. He explains how to compile it for Windows, Linux and macOS and also provides binaries so I assume you have successfully installed it. When you compile it from source you also have all tools installed that we will need here. I assume here that it is installed in its default path /opt/amiga.

Next, download and extract AmiSSL 4.9. Copy AmiSSL-4.9/AmiSSL/Developer/lib/AmigaOS3/libamisslauto.a to /opt/amiga/lib. Copy the content of AmiSSL-4.9/AmiSSL/Developer/include to /opt/amiga/include.

We also need zlib. Like before, copy lib_68k/nofpu/include to /opt/amiga/include and lib_68k/nofpu/lib/libz.a to /opt/amiga/libs.

Now we clone my fork of curl. You can also clone the most recent version of curl but there is no guarantee that this will still work in future.

git clone https://github.com/curl/curl.git

Now change to your checkout.

cd curl

If one day the compilation fails you can go back to a version where I can say that it will work:

git checkout ac54b10933749d4c17d9568532ff2f1ed64c119a

Create files for configuration and configure it.

./buildconf && PKG_CONFIG=true ./configure --host=m68k-amigaos --disable-shared --disable-ipv6 --disable-ntlm-wb --prefix=/opt/amiga --disable-netrc --with-amissl --disable-threaded-resolver CFLAGS="-mcrt=clib2" LIBS="-lnet -lm -lc -lunix -mcrt=clib2"

Here <path> is the path where you extracted AmiSSL. We set PKG_CONFIG to just true which is a shell command that never fails. Otherwise configure would search for the pkg-config command, cannot find a version for cross compiling and just uses the one from your OS which gives wrong results for cross compiling.

We also have to disable some stuff that cannot be compiled for Amiga and specify that we want to compile with clib2. You can find more information about clib2 in the GitHub repo.

Now compile it.

make

That wasn’t hard, right? If you have issues you may want to write a comment here.

If you want to develop your own software using libcurl you can find the libcurl.a in your curl checkout folder lib/.libs/.

There is also a precompiled version including a simple example for compiling a https client in curl-7.40.0.lha on Aminet. If you want to see more examples, in your checkout from above you can find the folder docs/examples. Enter that directory (cd) and just type make. All examples should build without errors but not all will run as we disabled some features of curl.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.