diff --git a/.github/workflows/non-native.yml b/.github/workflows/non-native.yml index 6aca90bbdc..c6ba80c703 100644 --- a/.github/workflows/non-native.yml +++ b/.github/workflows/non-native.yml @@ -185,6 +185,119 @@ jobs: make -C bld examples fi + amiga: + name: "AmigaOS, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} gcc AmiSSL m68k" + runs-on: ubuntu-latest + timeout-minutes: 5 + env: + MAKEFLAGS: -j 5 + MATRIX_BUILD: '${{ matrix.build }}' + AMISSL_VERSION: 5.27 + AMISSL_SHA256: 5003bef8c5930354d16b0ce7196d71b2811891c42fad38a9238c5ce4098ad42a + TOOLCHAIN_VERSION: 6.5.0 + TOOLCHAIN_SHA256: 381e227c9ef552f073771d6f851cfdf873b574f3cf5db7c1c0107ea5d7146edc + strategy: + matrix: + build: [autotools, cmake] + fail-fast: false + steps: + - name: 'cache compiler' + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + id: cache-compiler + with: + path: ~/opt/amiga + key: ${{ runner.os }}-amigaos-${{ env.TOOLCHAIN_VERSION }}-${{ env.AMISSL_VERSION }}-amd64 + + - name: 'install compiler' + if: ${{ !steps.cache-compiler.outputs.cache-hit }} + run: | + cd ~ + curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 3 --retry-connrefused \ + https://franke.ms/download/amiga-gcc.tgz --output pkg.bin + sha256sum pkg.bin | tee /dev/stderr | grep -qwF -- "${TOOLCHAIN_SHA256}" && tar -xf pkg.bin && rm -f pkg.bin + cd opt/amiga + curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 --retry-connrefused \ + --location --proto-redir =https "https://github.com/jens-maus/amissl/releases/download/${AMISSL_VERSION}/AmiSSL-${AMISSL_VERSION}-SDK.lha" --output pkg.bin + sha256sum pkg.bin | tee /dev/stderr | grep -qwF -- "${AMISSL_SHA256}" && 7z x -bd -y pkg.bin && rm -f pkg.bin + + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: 'configure' + run: | + ln -s ~/opt/amiga /opt + if [ "${MATRIX_BUILD}" = 'cmake' ]; then + cmake -B bld -G Ninja \ + -DAMIGA=1 \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DCMAKE_SYSTEM_PROCESSOR=m68k \ + -DCMAKE_C_COMPILER_TARGET=m68k-unknown-amigaos \ + -DCMAKE_C_COMPILER=/opt/amiga/bin/m68k-amigaos-gcc \ + -DCMAKE_C_FLAGS='-O0 -msoft-float -mcrt=clib2' \ + -DCMAKE_UNITY_BUILD=ON \ + -DCURL_WERROR=ON \ + -DCURL_USE_LIBPSL=OFF \ + -DAMISSL_INCLUDE_DIR=/opt/amiga/AmiSSL/Developer/include \ + -DAMISSL_STUBS_LIBRARY=/opt/amiga/AmiSSL/Developer/lib/AmigaOS3/libamisslstubs.a \ + -DAMISSL_AUTO_LIBRARY=/opt/amiga/AmiSSL/Developer/lib/AmigaOS3/libamisslauto.a + else + autoreconf -fi + mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \ + --disable-dependency-tracking --enable-option-checking=fatal \ + CC=/opt/amiga/bin/m68k-amigaos-gcc \ + AR=/opt/amiga/bin/m68k-amigaos-ar \ + RANLIB=/opt/amiga/bin/m68k-amigaos-ranlib \ + --host=m68k-amigaos \ + --disable-shared \ + --without-libpsl \ + --with-amissl \ + LDFLAGS=-L/opt/amiga/AmiSSL/Developer/lib/AmigaOS3 \ + CPPFLAGS=-I/opt/amiga/AmiSSL/Developer/include \ + CFLAGS='-O0 -msoft-float -mcrt=clib2' \ + LIBS='-lnet -lm -latomic' + fi + + - name: 'configure log' + if: ${{ !cancelled() }} + run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true + + - name: 'curl_config.h' + run: | + echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::' + grep -F '#define' bld/lib/curl_config.h | sort || true + + - name: 'build' + run: | + if [ "${MATRIX_BUILD}" = 'cmake' ]; then + cmake --build bld + else + make -C bld + fi + + - name: 'curl info' + run: | + find . -type f \( -name curl -o -name '*.a' \) -print0 | xargs -0 file -- + find . -type f \( -name curl -o -name '*.a' \) -print0 | xargs -0 stat -c '%10s bytes: %n' -- + + - name: 'build tests' + if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time + run: | + if [ "${MATRIX_BUILD}" = 'cmake' ]; then + cmake --build bld --target testdeps + else + make -C bld -C tests + fi + + - name: 'build examples' + if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time + run: | + if [ "${MATRIX_BUILD}" = 'cmake' ]; then + cmake --build bld --target curl-examples-build + else + make -C bld examples + fi + android: name: "Android ${{ matrix.platform }}, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.name }} arm64" runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index b3d0e72116..f17a2b6810 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -681,6 +681,7 @@ elseif(AMIGA) set(OPENSSL_CRYPTO_LIBRARY "${AMISSL_AUTO_LIBRARY}") set(CURL_USE_OPENSSL ON) set(CURL_CA_FALLBACK ON CACHE BOOL "") + list(PREPEND CURL_NETWORK_AND_TIME_LIBS "${AMISSL_STUBS_LIBRARY}" "${AMISSL_AUTO_LIBRARY}") endif() elseif(NOT WIN32 AND NOT APPLE) check_library_exists("socket" "connect" "" HAVE_LIBSOCKET) diff --git a/src/tool_setup.h b/src/tool_setup.h index 7a5f597bbb..7e77c114f1 100644 --- a/src/tool_setup.h +++ b/src/tool_setup.h @@ -102,6 +102,8 @@ int toolx_ftruncate_win32(int fd, curl_off_t where); #elif defined(__DJGPP__) int toolx_ftruncate_djgpp(int fd, curl_off_t where); #define toolx_ftruncate toolx_ftruncate_djgpp +#elif defined(__AMIGA__) +#define toolx_ftruncate(f, o) ftruncate(f, (off_t)(o)) #else #define toolx_ftruncate ftruncate #endif diff --git a/tests/libtest/cli_ftp_upload.c b/tests/libtest/cli_ftp_upload.c index df7ea57795..7e05807b5c 100644 --- a/tests/libtest/cli_ftp_upload.c +++ b/tests/libtest/cli_ftp_upload.c @@ -71,7 +71,7 @@ static CURLcode test_cli_ftp_upload(const char *URL) CURL *curl_handle; int running_handles = 0; int max_fd = -1; - struct timeval timeout = { 1, 0 }; + struct timeval timeout; fd_set fdread; fd_set fdwrite; fd_set fdexcep; @@ -82,6 +82,9 @@ static CURLcode test_cli_ftp_upload(const char *URL) CURLcode result = CURLE_FAILED_INIT; curl_off_t uploadsize = -1; + timeout.tv_sec = 1; + timeout.tv_usec = 0; + (void)URL; while((ch = cgetopt(test_argc, test_argv, "r:")) != -1) { switch(ch) { diff --git a/tests/libtest/lib1960.c b/tests/libtest/lib1960.c index 2ce9a7540d..ae1f989840 100644 --- a/tests/libtest/lib1960.c +++ b/tests/libtest/lib1960.c @@ -63,7 +63,7 @@ static int sockopt_cb(void *clientp, } #ifdef __AMIGA__ -#define my_inet_pton(x, y, z) inet_pton(x, (unsigned char *)y, z) +#define my_inet_pton(x, y, z) inet_pton(x, (unsigned char *)CURL_UNCONST(y), z) #else #define my_inet_pton(x, y, z) inet_pton(x, y, z) #endif diff --git a/tests/server/dnsd.c b/tests/server/dnsd.c index a2241291fd..179703c407 100644 --- a/tests/server/dnsd.c +++ b/tests/server/dnsd.c @@ -23,6 +23,8 @@ ***************************************************************************/ #include "first.h" +#ifndef __AMIGA__ + static int dnsd_wrotepidfile = 0; static int dnsd_wroteportfile = 0; @@ -30,10 +32,6 @@ static int dnsd_wroteportfile = 0; #include #endif -#ifdef __AMIGA__ -#error building dnsd on AMIGA os is unsupported -#endif - static uint16_t get16bit(const unsigned char **pkt, size_t *size) { const unsigned char *p = *pkt; @@ -1063,3 +1061,12 @@ dnsd_cleanup: logmsg("========> dnsd quits"); return result; } +#else +static int test_dnsd(int argc, const char **argv) +{ + (void)argc; + (void)argv; + fprintf(stderr, "dnsd on AmigaOS is unsupported\n"); + return 1; +} +#endif