From 7387589f6d46c7a162c74ef2680a8e933f6be7b3 Mon Sep 17 00:00:00 2001 From: Jeroen Koekkoek Date: Thu, 15 Sep 2022 18:16:31 +0200 Subject: [PATCH 1/2] Remove recipes for unused CI services Address sanitizer options kindly provided by @noloader have been migrated to .github/workflows/testsuite.yml. --- .github/workflows/testsuite.yml | 4 + .gitlab-ci.yml | 6 - .travis.yml | 291 ----------------------------- README-Travis.md | 274 --------------------------- contrib/android/15-android.conf | 37 ---- contrib/android/bootstrap_ldns.sh | 55 ------ contrib/android/install_ndk.sh | 60 ------ contrib/android/install_openssl.sh | 44 ----- contrib/android/install_tools.sh | 26 --- contrib/android/setenv_android.sh | 203 -------------------- contrib/ios/15-ios.conf | 41 ---- contrib/ios/bootstrap_ldns.sh | 55 ------ contrib/ios/install_openssl.sh | 52 ------ contrib/ios/install_tools.sh | 9 - contrib/ios/openssl.patch | 48 ----- contrib/ios/setenv_ios.sh | 274 --------------------------- makedist.sh | 2 +- 17 files changed, 5 insertions(+), 1476 deletions(-) delete mode 100644 .gitlab-ci.yml delete mode 100644 .travis.yml delete mode 100644 README-Travis.md delete mode 100644 contrib/android/15-android.conf delete mode 100755 contrib/android/bootstrap_ldns.sh delete mode 100755 contrib/android/install_ndk.sh delete mode 100755 contrib/android/install_openssl.sh delete mode 100755 contrib/android/install_tools.sh delete mode 100755 contrib/android/setenv_android.sh delete mode 100644 contrib/ios/15-ios.conf delete mode 100755 contrib/ios/bootstrap_ldns.sh delete mode 100755 contrib/ios/install_openssl.sh delete mode 100755 contrib/ios/install_tools.sh delete mode 100644 contrib/ios/openssl.patch delete mode 100755 contrib/ios/setenv_ios.sh diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index 69594e9ab..9b5e7dd79 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -17,6 +17,8 @@ jobs: - run: libtoolize -ci - run: autoreconf -fi - run: ./configure + env: + CFLAGS: -g2 -O0 -fsanitize=address,undefined -fno-sanitize-recover - run: make test mac: @@ -33,6 +35,8 @@ jobs: # macOS’s system OpenSSL (LibreSSL, actually) isn’t meant for linking, # and Homebrew’s# OpenSSL isn’t CI-friendly. So build without OpenSSL. - run: ./configure --without-ssl --disable-sha2 --disable-gost --disable-ecdsa --disable-dane + env: + CFLAGS: -g2 -O0 -fsanitize=address,undefined -fno-sanitize-recover # As of now the test suite requires OpenSSL, so no tests. # cf. https://github.com/NLnetLabs/ldns/issues/162 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 15092db7f..000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,6 +0,0 @@ -before_script: - - git submodule update --init - -tpkg-tests: - script: - - test/test_ci.sh ldns-team@nlnetlabs.nl diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a3b3d394e..000000000 --- a/.travis.yml +++ /dev/null @@ -1,291 +0,0 @@ -language: c - -git: - depth: 5 - -addons: - apt: - packages: - - libssl-dev - - python - - valgrind - - lcov - - doxygen - - graphviz - - indent - homebrew: - packages: - - openssl - - doxygen - - findent - update: true - -jobs: - include: - - os: linux - name: GCC on Linux, Amd64 - compiler: gcc - arch: amd64 - env: VALGRIND=true ANALYSIS=true COVERAGE=true DOXYGEN=true - - os: linux - name: Clang on Linux, Amd64 - compiler: clang - arch: amd64 - env: VALGRIND=true ANALYSIS=true COVERAGE=true DOXYGEN=true - - os: osx - name: Clang on OS X, Amd64 - compiler: clang - arch: amd64 - env: VALGRIND=true ANALYSIS=true COVERAGE=true DOXYGEN=true - - os: linux - name: UBsan, GCC on Linux, Amd64 - compiler: gcc - arch: amd64 - dist: bionic - env: UBSAN=true - - os: linux - name: UBsan, Clang on Linux, Amd64 - compiler: clang - arch: amd64 - dist: bionic - env: UBSAN=true - - os: linux - name: Asan, GCC on Linux, Amd64 - compiler: gcc - arch: amd64 - dist: bionic - env: ASAN=true - - os: linux - name: Asan, Clang on Linux, Amd64 - compiler: clang - arch: amd64 - dist: bionic - env: ASAN=true - - os: linux - name: GCC on Linux, Aarch64 - compiler: gcc - arch: arm64 - dist: bionic - env: VALGRIND=true ANALYSIS=true COVERAGE=true DOXYGEN=true - - os: linux - name: Clang on Linux, Aarch64 - compiler: clang - arch: arm64 - dist: bionic - env: VALGRIND=true ANALYSIS=true COVERAGE=true DOXYGEN=true - - os: linux - name: GCC on Linux, PowerPC64 - compiler: gcc - arch: ppc64le - dist: bionic - env: VALGRIND=true ANALYSIS=true COVERAGE=true DOXYGEN=true - - os: linux - name: Clang on Linux, PowerPC64 - compiler: clang - arch: ppc64le - dist: bionic - env: VALGRIND=true ANALYSIS=true COVERAGE=true DOXYGEN=true - - os: linux - name: GCC on Linux, s390x - compiler: gcc - arch: s390x - dist: bionic - env: VALGRIND=true ANALYSIS=true COVERAGE=true DOXYGEN=true - - os: linux - name: Clang on Linux, s390x - compiler: clang - arch: s390x - dist: bionic - env: VALGRIND=true ANALYSIS=true COVERAGE=true DOXYGEN=true - - os: osx - osx_image: xcode10.1 - name: iPhoneOS, armv7, iOS - arch: amd64 - env: - - IOS=yes - - AUTOTOOLS_HOST=armv7-apple-ios - - OPENSSL_HOST=ios-cross - - IOS_CPU=armv7s - - IOS_SDK=iPhoneOS - - IOS_PREFIX="$HOME/$IOS_SDK-$IOS_CPU" - - os: osx - osx_image: xcode10.1 - name: iPhoneOS, arm64, iOS - arch: amd64 - env: - - IOS=yes - - AUTOTOOLS_HOST=aarch64-apple-ios - - OPENSSL_HOST=ios64-cross - - IOS_CPU=arm64 - - IOS_SDK=iPhoneOS - - IOS_PREFIX="$HOME/$IOS_SDK-$IOS_CPU" - - os: osx - osx_image: xcode10.1 - name: AppleTVOS, arm64, iOS - arch: amd64 - env: - - IOS=yes - - AUTOTOOLS_HOST=aarch64-apple-ios - - OPENSSL_HOST=ios64-cross - - IOS_CPU=arm64 - - IOS_SDK=AppleTVOS - - IOS_PREFIX="$HOME/$IOS_SDK-$IOS_CPU" - - os: osx - osx_image: xcode10.1 - name: WatchOS, armv7, iOS - arch: amd64 - env: - - IOS=yes - - AUTOTOOLS_HOST=armv7-apple-ios - - OPENSSL_HOST=ios-cross - - IOS_CPU=armv7k - - IOS_SDK=WatchOS - - IOS_PREFIX="$HOME/$IOS_SDK-$IOS_CPU" - - os: osx - osx_image: xcode10.1 - name: iPhoneSimulator, i386, OS X - arch: amd64 - env: - - IOS=yes - - AUTOTOOLS_HOST=i386-apple-ios - - OPENSSL_HOST=iphoneos-cross - - IOS_CPU=i386 - - IOS_SDK=iPhoneSimulator - - IOS_PREFIX="$HOME/$IOS_SDK-$IOS_CPU" - - os: osx - osx_image: xcode10.1 - name: iPhoneSimulator, x86_64, OS X - arch: amd64 - env: - - IOS=yes - - AUTOTOOLS_HOST=x86_64-apple-ios - - OPENSSL_HOST=iphoneos-cross - - IOS_CPU=x86_64 - - IOS_SDK=iPhoneSimulator - - IOS_PREFIX="$HOME/$IOS_SDK-$IOS_CPU" - - os: osx - osx_image: xcode10.1 - name: AppleTVSimulator, x86_64, OS X - arch: amd64 - env: - - IOS=yes - - AUTOTOOLS_HOST=x86_64-apple-ios - - OPENSSL_HOST=iphoneos-cross - - IOS_CPU=x86_64 - - IOS_SDK=AppleTVSimulator - - IOS_PREFIX="$HOME/$IOS_SDK-$IOS_CPU" - - os: osx - osx_image: xcode10.1 - name: WatchSimulator, i386, OS X - arch: amd64 - env: - - IOS=yes - - AUTOTOOLS_HOST=i386-apple-ios - - OPENSSL_HOST=iphoneos-cross - - IOS_CPU=i386 - - IOS_SDK=WatchSimulator - - IOS_PREFIX="$HOME/$IOS_SDK-$IOS_CPU" - - os: linux - name: Android armv7a, Linux, Amd64 - compiler: clang - arch: amd64 - dist: bionic - env: - - ANDROID=yes - - AUTOTOOLS_HOST=armv7a-linux-androideabi - - OPENSSL_HOST=android-arm - - ANDROID_CPU=armv7a - - ANDROID_API=23 - - ANDROID_PREFIX="$HOME/android$ANDROID_API-$ANDROID_CPU" - - ANDROID_SDK_ROOT="$HOME/android-sdk" - - ANDROID_NDK_ROOT="$HOME/android-ndk" - - os: linux - name: Android aarch64, Linux, Amd64 - compiler: clang - arch: amd64 - dist: bionic - env: - - ANDROID=yes - - AUTOTOOLS_HOST=aarch64-linux-android - - OPENSSL_HOST=android-arm64 - - ANDROID_CPU=aarch64 - - ANDROID_API=23 - - ANDROID_PREFIX="$HOME/android$ANDROID_API-$ANDROID_CPU" - - ANDROID_SDK_ROOT="$HOME/android-sdk" - - ANDROID_NDK_ROOT="$HOME/android-ndk" - - os: linux - name: Android x86, Linux, Amd64 - compiler: clang - arch: amd64 - dist: bionic - env: - - ANDROID=yes - - AUTOTOOLS_HOST=i686-linux-android - - OPENSSL_HOST=android-x86 - - ANDROID_CPU=x86 - - ANDROID_API=23 - - ANDROID_PREFIX="$HOME/android$ANDROID_API-$ANDROID_CPU" - - ANDROID_SDK_ROOT="$HOME/android-sdk" - - ANDROID_NDK_ROOT="$HOME/android-ndk" - - os: linux - name: Android x86_64, Linux, Amd64 - compiler: clang - arch: amd64 - dist: bionic - env: - - ANDROID=yes - - AUTOTOOLS_HOST=x86_64-linux-android - - OPENSSL_HOST=android-x86_64 - - ANDROID_CPU=x86_64 - - ANDROID_API=23 - - ANDROID_PREFIX="$HOME/android$ANDROID_API-$ANDROID_CPU" - - ANDROID_SDK_ROOT="$HOME/android-sdk" - - ANDROID_NDK_ROOT="$HOME/android-ndk" - -before_script: - - | - if [ "$ANDROID" = "yes" ]; then - ./contrib/android/install_tools.sh - elif [ "$IOS" = "yes" ]; then - ./contrib/ios/install_tools.sh - fi - -script: - - | - if [ "$UBSAN" = "true" ]; then - export CFLAGS="-DNDEBUG -g2 -O3 -fsanitize=undefined -fno-sanitize-recover" - ./test/test_ci.sh - elif [ "$ASAN" = "true" ]; then - export CFLAGS="-DNDEBUG -g2 -O3 -fsanitize=address" - ./test/test_ci.sh - elif [ "$IOS" = "yes" ]; then - export AUTOTOOLS_BUILD="$(./config.guess)" - export PKG_CONFIG_PATH="$IOS_PREFIX/lib/pkgconfig" - source ./contrib/ios/setenv_ios.sh - ./contrib/ios/install_openssl.sh - ./contrib/ios/bootstrap_ldns.sh - ./configure \ - --build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" \ - --prefix="$IOS_PREFIX" \ - --with-ssl="$IOS_PREFIX" --disable-gost \ - --with-drill --with-examples - make -j 2 - make install - elif [ "$ANDROID" = "yes" ]; then - export AUTOTOOLS_BUILD="$(./config.guess)" - export PKG_CONFIG_PATH="$ANDROID_PREFIX/lib/pkgconfig" - ./contrib/android/install_ndk.sh - source ./contrib/android/setenv_android.sh - ./contrib/android/install_openssl.sh - ./contrib/android/bootstrap_ldns.sh - ./configure \ - --build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" \ - --prefix="$ANDROID_PREFIX" \ - --with-ssl="$ANDROID_PREFIX" --disable-gost \ - --with-drill --with-examples - make -j 2 - make install - else - # Default case for most tests - ./test/test_ci.sh - fi diff --git a/README-Travis.md b/README-Travis.md deleted file mode 100644 index faa534353..000000000 --- a/README-Travis.md +++ /dev/null @@ -1,274 +0,0 @@ -# Travis Testing - -LDNS 1.7.1 and above leverage Travis CI to increase coverage of compilers and platforms. Compilers include Clang and GCC; while platforms include Android, iOS, Linux, and OS X on AMD64, Aarch64, PowerPC and s390x hardware. - -Android is tested on armv7a, aarch64, x86 and x86_64. The Android recipes build and install OpenSSL, and then builds LDNS. The testing is tailored for Android NDK-r19 and above, and includes NDK-r20 and NDK-r21. Mips and Mips64 are not tested because they are no longer supported under current NDKs. - -iOS is tested for iPhoneOS, WatchOS, AppleTVOS, iPhoneSimulator, AppleTVSimulator and WatchSimulator. The testing uses Xcode 10 on OS X 10.13. - -The LDNS Travis configuration file `.travis.yml` does not use top-level keys like `os:` and `compiler:` so there is no matrix expansion. Instead LDNS specifies the exact job to run under the `jobs:` and `include:` keys. - -## Typical recipe - -A typical recipe tests Clang and GCC on various hardware. The hardware includes AMD64, Aarch64, PowerPC and s390x. PowerPC is a little-endian platform, and s390x is a big-endian platform. There are pairs of recipes that are similar to the following. - -``` -- os: linux - name: GCC on Linux, Aarch64 - compiler: gcc - arch: arm64 - dist: bionic -- os: linux - name: Clang on Linux, Aarch64 - compiler: clang - arch: arm64 - dist: bionic -``` - -OS X provides a single recipe to test Clang. GCC is not tested because GCC is an alias for Clang. - -## Sanitizer builds - -Two sanitizer builds are tested using Clang and GCC, for a total of four builds. The first sanitizer is Undefined Behavior sanitizer (UBsan), and the second is Address sanitizer (Asan). The sanitizers are only run on AMD64 hardware. Note the environment includes `UBSAN=yes` or `ASAN=yes` for the sanitizer builds. - -The recipes are similar to the following. - -``` -- os: linux - name: UBsan, GCC on Linux, Amd64 - compiler: gcc - arch: amd64 - dist: bionic - env: UBSAN=yes -- os: linux - name: UBsan, Clang on Linux, Amd64 - compiler: clang - arch: amd64 - dist: bionic - env: UBSAN=yes -``` - -When the Travis script encounters a sanitizer it uses different `CFLAGS` and configuration string. - -``` -if [ "$UBSAN" = "yes" ]; then - export CFLAGS="-DNDEBUG -g2 -O3 -fsanitize=undefined -fno-sanitize-recover" - bash test/test_ci.sh -elif [ "$ASAN" = "yes" ]; then - export CFLAGS="-DNDEBUG -g2 -O3 -fsanitize=address" - bash test/test_ci.sh -... -``` - -## Android builds - -Travis tests Android builds for the armv7a, aarch64, x86 and x86_64 architectures. The builds are trickier than other builds for several reasons. The testing requires installation of the Android NDK and SDK, it requires a cross-compile, and requires OpenSSL prerequisites. The Android cross-compiles also require care to set the Autotools triplet, the OpenSSL triplet, the toolchain path, the tool variables, and the sysroot. The discussion below detail the steps of the Android recipes. - -### Android job - -The first step sets environmental variables for the cross-compile using the Travis job. A typical job with variables is shown below. - -``` -- os: linux - name: Android armv7a, Linux, Amd64 - compiler: clang - arch: amd64 - dist: bionic - env: - - ANDROID=yes - - AUTOTOOLS_HOST=armv7a-linux-androideabi - - OPENSSL_HOST=android-arm - - ANDROID_CPU=armv7a - - ANDROID_API=23 - - ANDROID_PREFIX="$HOME/android$ANDROID_API-$ANDROID_CPU" - - ANDROID_SDK_ROOT="$HOME/android-sdk" - - ANDROID_NDK_ROOT="$HOME/android-ndk" -``` - -### ANDROID_NDK_ROOT - -The second step for Android is to set the environmental variables `ANDROID_NDK_ROOT` and `ANDROID_SDK_ROOT`. This is an important step because the NDK and SDK use the variables internally to locate their own tools. Also see [Recommended NDK Directory?](https://groups.google.com/forum/#!topic/android-ndk/qZjhOaynHXc) on the android-ndk mailing list. (Many folks miss this step, or use incorrect variables like `ANDROID_NDK_HOME` or `ANDROID_SDK_HOME`). - -If you are working from a developer machine you probably already have the necessary tools installed. You should ensure `ANDROID_NDK_ROOT` and `ANDROID_SDK_ROOT` are set properly. - -### Tool installation - -The second step installs tools needed for OpenSSL, Expat and LDNS. This step is handled in by the script `contrib/android/install_tools.sh`. The tools include curl, tar, zip, unzip and java. - -``` -before_script: - - | - if [ "$ANDROID" = "yes" ]; then - ./contrib/android/install_tools.sh - elif [ "$IOS" = "yes" ]; then - ./contrib/ios/install_tools.sh - fi -``` - -### NDK installation - -The third step installs the NDK and SDK. This step is handled in by the script `contrib/android/install_ndk.sh`. The script uses `ANDROID_NDK_ROOT` and `ANDROID_SDK_ROOT` to place the NDK and SDK in the `$HOME` directory. - -If you are working from a developer machine you probably already have a NDK and SDK installed. - -### Android environment - -The fourth step sets the Android cross-compile environment using the script `contrib/android/setenv_android.sh`. The script is `sourced` so the variables in the script are available to the calling shell. The script sets variables like `CC`, `CXX`, `AS` and `AR`; sets `CFLAGS` and `CXXFLAGS`; sets a `sysroot` so Android headers and libraries are found; and adds the path to the toolchain to `PATH`. - -`contrib/android/setenv_android.sh` knows which toolchain and architecture to select by inspecting environmental variables set by Travis for the job. In particular, the variables `ANDROID_CPU` and `ANDROID_API` tell `contrib/android/setenv_android.sh` which tools and libraries to select. - -The `contrib/android/setenv_android.sh` script specifies the tools in a `case` statement like the following. There is a case for each of the architectures armv7a, aarch64, x86 and x86_64. - -``` -armv8a|aarch64|arm64|arm64-v8a) - CC="aarch64-linux-android$ANDROID_API-clang" - CXX="aarch64-linux-android$ANDROID_API-clang++" - LD="aarch64-linux-android-ld" - AS="aarch64-linux-android-as" - AR="aarch64-linux-android-ar" - RANLIB="aarch64-linux-android-ranlib" - STRIP="aarch64-linux-android-strip" - - CFLAGS="-funwind-tables -fexceptions" - CXXFLAGS="-funwind-tables -fexceptions -frtti" -``` - -### OpenSSL - -The fifth step builds OpenSSL. OpenSSL is built for iOS using the scripts `contrib/android/install_openssl.sh`. The script downloads, configures and installs the latest release version of the OpenSSL libraries. OpenSSL is configured with `--prefix="$ANDROID_PREFIX"` so the headers are placed in `$ANDROID_PREFIX/include` directory, and the libraries are placed in the `$ANDROID_PREFIX/lib` directory. - -`ANDROID_PREFIX` is the value `$HOME/android$ANDROID_API-$ANDROID_CPU`. The libraries will be installed in `$HOME/android23-armv7a`, `$HOME/android23-aarch64`, etc. For Autotools projects, the appropriate `PKG_CONFIG_PATH` is exported. - -`PKG_CONFIG_PATH` is an important variable. It is the userland equivalent to sysroot, and allows Autotools to find non-system headers and libraries for an architecture. Typical `PKG_CONFIG_PATH` are `$HOME/android23-armv7a/lib/pkgconfig` and `$HOME/android23-aarch64/lib/pkgconfig`. - -OpenSSL also uses a custom configuration file called `15-android.conf`. It is a copy of the OpenSSL's project file and located at `contrib/android/15-android.conf`. The LDNS version is copied to the OpenSSL source files after unpacking the OpenSSL distribution. The LDNS version has legacy NDK support removed and some other fixes, like `ANDROID_NDK_ROOT` awareness. The changes mean LDNS's `15-android.conf` will only work with LDNS, with NDK-r19 and above, and a properly set environment. - -OpenSSL is configured with `no-engine`. If you want to include OpenSSL engines then edit `contrib/android/install_openssl.sh` and remove the config option. - -### Android build - -Finally, once OpenSSL are built, then the Travis script configures and builds LDNS. The recipe looks as follows. - -``` -elif [ "$ANDROID" = "yes" ]; then - export AUTOTOOLS_BUILD="$(./config.guess)" - export PKG_CONFIG_PATH="$ANDROID_PREFIX/lib/pkgconfig" - ./contrib/android/install_ndk.sh - source ./contrib/android/setenv_android.sh - ./contrib/android/install_openssl.sh - ./contrib/android/bootstrap_ldns.sh - ./configure \ - --build="$AUTOTOOLS_BUILD" \ - --host="$AUTOTOOLS_HOST" \ - --prefix="$ANDROID_PREFIX" \ - --with-ssl="$ANDROID_PREFIX" \ - --disable-gost \ - --with-drill --with-examples - make -j 2 - make install -``` - -Travis only smoke tests an Android build using a compile, link and install. The self tests are not run. TODO: figure out how to fire up an emulator, push the tests to the device and run them. - -### Android flags - -`contrib/android/setenv_android.sh` uses specific flags for `CFLAGS` and `CXXFLAGS`. They are taken from `ndk-build`, so we consider them the official flag set. It is important to use the same flags across projects to avoid subtle problems due to mixing and matching different flags. - -`CXXFLAGS` includes `-fexceptions` and `-frtti` because exceptions and runtime type info are disabled by default. `CFLAGS` include `-funwind-tables` and `-fexceptions` to ensure C++ exceptions pass through C code, if needed. Also see `docs/CPLUSPLUS-SUPPORT.html` in the NDK docs. - -To inspect the flags used by `ndk-build` for a platform clone ASOP's [ndk-samples](https://github.com/android/ndk-samples/tree/master/hello-jni) and build the `hello-jni` project. Use the `V=1` flag to see the full compiler output from `ndk-build`. - -## iOS builds - -Travis tests iOS builds for the armv7a, armv7s and aarch64 architectures for iPhoneOS, AppleTVOS and WatchOS. iPhoneOS is tested using both 32-bit builds (iPhones) and 64-bit builds (iPads). Travis also tests compiles against the simulators. The builds are trickier than other builds for several reasons. The testing requires a cross-compile, and requires OpenSSL prerequisites. The iOS cross-compiles also require care to set the Autotools triplet, the OpenSSL triplet, the toolchain path, the tool variables, and the sysroot. The discussion below detail the steps of the iOS recipes. - -### iOS job - -The first step sets environmental variables for the cross-compile using the Travis job. A typical job with variables is shown below. - -``` -- os: osx - osx_image: xcode10 - name: Apple iPhone on iOS, armv7 - compiler: clang - env: - - IOS=yes - - AUTOTOOLS_HOST=armv7-apple-ios - - OPENSSL_HOST=ios-cross - - IOS_SDK=iPhoneOS - - IOS_CPU=armv7s - - IOS_PREFIX="$HOME/$IOS_SDK-$IOS_CPU" -``` - -### Tool installation - -The second step installs tools needed for OpenSSL, Expat and LDNS. This step is handled in by the script `contrib/ios/install_tools.sh`. The tools include autotools, curl and perl. The installation happens at the `before_script:` stage of Travis. - -``` -before_script: - - | - if [ "$ANDROID" = "yes" ]; then - ./contrib/android/install_tools.sh - elif [ "$IOS" = "yes" ]; then - ./contrib/ios/install_tools.sh - fi -``` - -### iOS environment - -The third step sets the iOS cross-compile environment using the script `contrib/ios/setenv_ios.sh`. The script is `sourced` so the variables in the script are available to the calling shell. The script sets variables like `CC`, `CXX`, `AS` and `AR`; sets `CFLAGS` and `CXXFLAGS`; sets a `sysroot` so iOS headers and libraries are found; and adds the path to the toolchain to `PATH`. - -`contrib/ios/setenv_ios.sh` knows which toolchain and architecture to select by inspecting environmental variables set by Travis for the job. In particular, the variables `IOS_SDK` and `IOS_CPU` tell `contrib/ios/setenv_ios.sh` which tools and libraries to select. - -The `contrib/ios/setenv_ios.sh` script specifies the tools to use during the cross-compile. For Apple SDKs, the tool names are the same as a desktop. There are no special prefixes for the mobile tools. - -``` -CPP=cpp -CC=clang -CXX=clang++ -LD=ld -AS=as -AR=ar -RANLIB=ranlib -STRIP=strip -``` - -If you are working from a developer machine you probably already have the necessary tools installed. - -### OpenSSL - -The fourth step builds OpenSSL. OpenSSL is built for iOS using the scripts `contrib/ios/install_openssl.sh`. The script downloads, configures and installs the latest release version of the OpenSSL libraries. OpenSSL is configured with `--prefix="$IOS_PREFIX"` so the headers are placed in `$IOS_PREFIX/include` directory, and the libraries are placed in the `$IOS_PREFIX/lib` directory. - -`IOS_PREFIX` is the value `$HOME/$IOS_SDK-$IOS_CPU`. The scheme handles both iOS SDKs and cpu architectures so the pair receives a unique installation directory. The libraries will be installed in `$HOME/iPhoneOS-armv7s`, `$HOME/iPhoneOS-arm64`, `$HOME/iPhoneSimulator-i386`, etc. For Autotools projects, the appropriate `PKG_CONFIG_PATH` is exported. - -`PKG_CONFIG_PATH` is an important variable. It is the userland equivalent to sysroot, and allows Autotools to find non-system headers and libraries for an architecture. Typical `PKG_CONFIG_PATH` are `$HOME/iPhoneOS-armv7s/lib/pkgconfig` and `$HOME/iPhoneOS-arm64/lib/pkgconfig`. - -OpenSSL also uses a custom configuration file called `15-ios.conf`. It is a copy of the OpenSSL's project file and located at `contrib/ios/15-ios.conf`. The LDNS version is copied to the OpenSSL source files after unpacking the OpenSSL distribution. The changes mean LDNS's `15-ios.conf` will only work with LDNS and a properly set environment. - -OpenSSL is configured with `no-engine`. Engines require dynamic loading so engines are disabled permanently in `15-ios.conf`. - -### iOS build - -Finally, once OpenSSL are built, then the Travis script configures and builds LDNS. The full recipe looks as follows. - -``` -elif [ "$IOS" = "yes" ]; then - export AUTOTOOLS_BUILD="$(./config.guess)" - export PKG_CONFIG_PATH="$IOS_PREFIX/lib/pkgconfig" - source ./contrib/ios/setenv_ios.sh - ./contrib/ios/install_openssl.sh - ./contrib/ios/bootstrap_ldns.sh - ./configure \ - --build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" \ - --prefix="$IOS_PREFIX" \ - --with-ssl="$IOS_PREFIX" --disable-gost \ - --with-drill --with-examples - make -j 2 - make install -``` - -Travis only smoke tests an iOS build using a compile, link and install. The self tests are not run. TODO: figure out how to fire up an simulator, push the tests to the device and run them. - -### iOS flags - -`contrib/ios/setenv_ios.sh` uses specific flags for `CFLAGS` and `CXXFLAGS`. They are taken from Xcode, so we consider them the official flag set. It is important to use the same flags across projects to avoid subtle problems due to mixing and matching different flags. diff --git a/contrib/android/15-android.conf b/contrib/android/15-android.conf deleted file mode 100644 index e1fc91e70..000000000 --- a/contrib/android/15-android.conf +++ /dev/null @@ -1,37 +0,0 @@ -#### Android... -# -# Heavily hacked 15-android.conf based on OpenSSL's config file of the same name. -# This 15-android.conf avoids compiler errors using NDK-r20. This 15-android.conf -# requires an environment set (sourced) using setenv-android.sh. - -my %targets = ( - "android" => { - inherit_from => [ "linux-generic32" ], - template => 1, - bin_cflags => add("-fPIE"), - bin_lflags => add("-pie"), - enable => [ ], - }, - - "android-arm" => { - inherit_from => [ "android", asm("armv4_asm") ], - bn_ops => [ "BN_LLONG", "RC4_CHAR" ], - }, - "android-arm64" => { - inherit_from => [ "android", asm("aarch64_asm") ], - bn_ops => [ "SIXTY_FOUR_BIT_LONG", "RC4_CHAR" ], - perlasm_scheme => "linux64", - }, - - "android-x86" => { - inherit_from => [ "android", asm("x86_asm") ], - cflags => add(picker(release => "-fomit-frame-pointer")), - bn_ops => [ "BN_LLONG", "RC4_INT" ], - perlasm_scheme => "android", - }, - "android-x86_64" => { - inherit_from => [ "android", asm("x86_64_asm") ], - bn_ops => [ "SIXTY_FOUR_BIT_LONG", "RC4_INT" ], - perlasm_scheme => "elf", - }, -); diff --git a/contrib/android/bootstrap_ldns.sh b/contrib/android/bootstrap_ldns.sh deleted file mode 100755 index 7e423030c..000000000 --- a/contrib/android/bootstrap_ldns.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -if ! git submodule update --init; then - echo "Failed to init submodule" - exit 1 -fi - -echo "AUTOTOOLS_BUILD: $AUTOTOOLS_BUILD" -echo "AUTOTOOLS_HOST: $AUTOTOOLS_HOST" - -# libtool complains about our updated config.guess and config.sub. -# Remove them to get through bootstrap. Re-add them after libtoolize. - -echo "Running libtoolize" -if [ -n "$(command -v glibtoolize)" ]; then - rm -f config.guess config.sub - if ! glibtoolize -ci ; then - echo "Failed to libtoolize (glibtoolize)" - exit 1 - fi -elif [ -n "$(command -v libtoolize)" ]; then - rm -f config.guess config.sub - if ! libtoolize -ci ; then - echo "Failed to libtoolize (libtoolize)" - exit 1 - fi -else - echo "Failed to find a libtool" - exit 1 -fi - -echo "Updating config.guess" -if ! wget -q -O config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'; then - echo "Failed to download config.guess" -fi - -echo "Updating config.sub" -if ! wget -q -O config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'; then - echo "Failed to download config.sub" -fi - -echo "Fixing config permissions" -chmod a+x config.guess config.sub -if [ -n "$(command -v xattr 2>/dev/null)" ]; then - xattr -d com.apple.quarantine config.guess 2>/dev/null - xattr -d com.apple.quarantine config.sub 2>/dev/null -fi - -echo "Running autoreconf" -if ! autoreconf -fi ; then - echo "Failed to autoreconf" - exit 1 -fi - -exit 0 diff --git a/contrib/android/install_ndk.sh b/contrib/android/install_ndk.sh deleted file mode 100755 index 90e453153..000000000 --- a/contrib/android/install_ndk.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash - -if [ -z "$ANDROID_SDK_ROOT" ]; then - echo "ERROR: ANDROID_SDK_ROOT is not set. Please set it." - echo "SDK root is $ANDROID_SDK_ROOT" - exit 1 -fi - -if [ -z "$ANDROID_NDK_ROOT" ]; then - echo "ERROR: ANDROID_NDK_ROOT is not set. Please set it." - echo "NDK root is $ANDROID_NDK_ROOT" - exit 1 -fi - -echo "Using ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT" -echo "Using ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT" - -echo "Downloading SDK" -if ! curl -L -k -s -o "$HOME/android-sdk.zip" https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip; -then - echo "Failed to download SDK" - exit 1 -fi - -echo "Downloading NDK" -if ! curl -L -k -s -o "$HOME/android-ndk.zip" https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip; -then - echo "Failed to download NDK" - exit 1 -fi - -echo "Unpacking SDK to $ANDROID_SDK_ROOT" -if ! unzip -qq "$HOME/android-sdk.zip" -d "$ANDROID_SDK_ROOT"; -then - echo "Failed to unpack SDK" - exit 1 -fi - -echo "Unpacking NDK to $ANDROID_NDK_ROOT" -if ! unzip -qq "$HOME/android-ndk.zip" -d "$HOME"; -then - echo "Failed to unpack NDK" - exit 1 -fi - -if ! mv "$HOME/android-ndk-r20b" "$ANDROID_NDK_ROOT"; -then - echo "Failed to move $HOME/android-ndk-r20b to $ANDROID_NDK_ROOT" - exit 1 -fi - -rm -f "$HOME/android-sdk.zip" -rm -f "$HOME/android-ndk.zip" - -# https://stackoverflow.com/a/47028911/608639 -touch "$ANDROID_SDK_ROOT/repositories.cfg" - -echo "Finished installing SDK and NDK" - -exit 0 diff --git a/contrib/android/install_openssl.sh b/contrib/android/install_openssl.sh deleted file mode 100755 index e4fb87266..000000000 --- a/contrib/android/install_openssl.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -echo "Downloading OpenSSL" -if ! curl -L -k -s -o openssl-1.1.1d.tar.gz https://www.openssl.org/source/openssl-1.1.1d.tar.gz; -then - echo "Failed to download OpenSSL" - exit 1 -fi - -echo "Unpacking OpenSSL" -rm -rf ./openssl-1.1.1d -if ! tar -xf openssl-1.1.1d.tar.gz; -then - echo "Failed to unpack OpenSSL" - exit 1 -fi - -cd openssl-1.1.1d || exit 1 - -if ! cp ../contrib/android/15-android.conf Configurations/; then - echo "Failed to copy OpenSSL Android config" - exit 1 -fi - -echo "Configuring OpenSSL" -if ! ./Configure "$OPENSSL_HOST" no-comp no-asm no-hw no-engine shared \ - --prefix="$ANDROID_PREFIX" --openssldir="$ANDROID_PREFIX"; then - echo "Failed to configure OpenSSL" - exit 1 -fi - -echo "Building OpenSSL" -if ! make; then - echo "Failed to build OpenSSL" - exit 1 -fi - -echo "Installing OpenSSL" -if ! make install_sw; then - echo "Failed to install OpenSSL" - exit 1 -fi - -exit 0 diff --git a/contrib/android/install_tools.sh b/contrib/android/install_tools.sh deleted file mode 100755 index 45aff601e..000000000 --- a/contrib/android/install_tools.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# This step should install tools needed for all packages - OpenSSL and LDNS -echo "Updating tools" -sudo apt-get -qq update -sudo apt-get -qq install --no-install-recommends curl wget tar zip unzip patch perl openjdk-8-jdk autoconf automake libtool pkg-config - -# Android builds run config.guess early to determine BUILD and HOST. We need to add config.guess -# and config.sub now. Later, bootstrap_ldns.sh will handle the complete bootstrap of LDNS. - -echo "Adding config.guess" -if ! wget -q -O config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'; then - echo "Failed to download config.guess" -fi - -echo "Adding config.sub" -if ! wget -q -O config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'; then - echo "Failed to download config.sub" -fi - -echo "Fixing config permissions" -chmod a+x config.guess config.sub -if [ -n "$(command -v xattr 2>/dev/null)" ]; then - xattr -d com.apple.quarantine config.guess 2>/dev/null - xattr -d com.apple.quarantine config.sub 2>/dev/null -fi diff --git a/contrib/android/setenv_android.sh b/contrib/android/setenv_android.sh deleted file mode 100755 index f45acb0f7..000000000 --- a/contrib/android/setenv_android.sh +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env bash - -# ==================================================================== -# Sets the cross compile environment for Android -# -# Based upon OpenSSL's setenv-android.sh by TH, JW, and SM. -# Heavily modified by JWW for Crypto++. -# Updated by Skycoder42 for current recommendations for Android. -# Modified by JWW for LDNS. -# ==================================================================== - -######################################### -##### Some validation ##### -######################################### - -if [ -z "$ANDROID_API" ]; then - echo "ANDROID_API is not set. Please set it" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 -fi - -if [ -z "$ANDROID_CPU" ]; then - echo "ANDROID_CPU is not set. Please set it" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 -fi - -if [ ! -d "$ANDROID_NDK_ROOT" ]; then - echo "ERROR: ANDROID_NDK_ROOT is not a valid path. Please set it." - echo "NDK root is $ANDROID_NDK_ROOT" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# cryptest-android.sh may run this script without sourcing. -if [ "$0" = "${BASH_SOURCE[0]}" ]; then - echo "setenv-android.sh is usually sourced, but not this time." -fi - -##################################################################### - -# Need to set THIS_HOST to darwin-x86_64, linux-x86_64, -# windows, or windows-x86_64 - -if [[ "$(uname -s | grep -i -c darwin)" -ne 0 ]]; then - THIS_HOST=darwin-x86_64 -elif [[ "$(uname -s | grep -i -c linux)" -ne 0 ]]; then - THIS_HOST=linux-x86_64 -else - echo "ERROR: Unknown host" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$THIS_HOST/bin" -ANDROID_SYSROOT="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$THIS_HOST/sysroot" - -# Error checking -if [ ! -d "$ANDROID_TOOLCHAIN" ]; then - echo "ERROR: ANDROID_TOOLCHAIN is not a valid path. Please set it." - echo "Path is $ANDROID_TOOLCHAIN" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -d "$ANDROID_SYSROOT" ]; then - echo "ERROR: ANDROID_SYSROOT is not a valid path. Please set it." - echo "Path is $ANDROID_SYSROOT" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -##################################################################### - -THE_ARCH=$(tr '[:upper:]' '[:lower:]' <<< "$ANDROID_CPU") - -# https://developer.android.com/ndk/guides/abis.html -case "$THE_ARCH" in - armv7*|armeabi*) - CC="armv7a-linux-androideabi$ANDROID_API-clang" - CXX="armv7a-linux-androideabi$ANDROID_API-clang++" - LD="arm-linux-androideabi-ld" - AS="arm-linux-androideabi-as" - AR="arm-linux-androideabi-ar" - RANLIB="arm-linux-androideabi-ranlib" - STRIP="arm-linux-androideabi-strip" - - CFLAGS="-march=armv7-a -mthumb -mfloat-abi=softfp -funwind-tables -fexceptions" - CXXFLAGS="-march=armv7-a -mthumb -mfloat-abi=softfp -funwind-tables -fexceptions -frtti" - ;; - - armv8*|aarch64|arm64) - CC="aarch64-linux-android$ANDROID_API-clang" - CXX="aarch64-linux-android$ANDROID_API-clang++" - LD="aarch64-linux-android-ld" - AS="aarch64-linux-android-as" - AR="aarch64-linux-android-ar" - RANLIB="aarch64-linux-android-ranlib" - STRIP="aarch64-linux-android-strip" - - CFLAGS="-funwind-tables -fexceptions" - CXXFLAGS="-funwind-tables -fexceptions -frtti" - ;; - - x86) - CC="i686-linux-android$ANDROID_API-clang" - CXX="i686-linux-android$ANDROID_API-clang++" - LD="i686-linux-android-ld" - AS="i686-linux-android-as" - AR="i686-linux-android-ar" - RANLIB="i686-linux-android-ranlib" - STRIP="i686-linux-android-strip" - - CFLAGS="-mtune=intel -mssse3 -mfpmath=sse -funwind-tables -fexceptions" - CXXFLAGS="-mtune=intel -mssse3 -mfpmath=sse -funwind-tables -fexceptions -frtti" - ;; - - x86_64|x64) - CC="x86_64-linux-android$ANDROID_API-clang" - CXX="x86_64-linux-android$ANDROID_API-clang++" - LD="x86_64-linux-android-ld" - AS="x86_64-linux-android-as" - AR="x86_64-linux-android-ar" - RANLIB="x86_64-linux-android-ranlib" - STRIP="x86_64-linux-android-strip" - - CFLAGS="-march=x86-64 -msse4.2 -mpopcnt -mtune=intel -funwind-tables -fexceptions" - CXXFLAGS="-march=x86-64 -msse4.2 -mpopcnt -mtune=intel -funwind-tables -fexceptions -frtti" - ;; - - *) - echo "ERROR: Unknown architecture $ANDROID_CPU" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 - ;; -esac - -##################################################################### - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$CC" ]; then - echo "ERROR: Failed to find Android clang. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$CXX" ]; then - echo "ERROR: Failed to find Android clang++. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$RANLIB" ]; then - echo "ERROR: Failed to find Android ranlib. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$AR" ]; then - echo "ERROR: Failed to find Android ar. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$AS" ]; then - echo "ERROR: Failed to find Android as. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$LD" ]; then - echo "ERROR: Failed to find Android ld. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -##################################################################### - -LENGTH=${#ANDROID_TOOLCHAIN} -SUBSTR=${PATH:0:$LENGTH} -if [ "$SUBSTR" != "$ANDROID_TOOLCHAIN" ]; then - export PATH="$ANDROID_TOOLCHAIN:$PATH" -fi - -##################################################################### - -export CPP CC CXX LD AS AR RANLIB STRIP -export ANDROID_SYSROOT="$AOSP_SYSROOT" -export CPPFLAGS="-D__ANDROID_API__=$ANDROID_API" -export CFLAGS="$CFLAGS --sysroot=$AOSP_SYSROOT" -export CXXFLAGS="$CXXFLAGS -stdlib=libc++ --sysroot=$AOSP_SYSROOT" - -##################################################################### - -echo "ANDROID_TOOLCHAIN: $ANDROID_TOOLCHAIN" - -echo "CPP: $(command -v "$CPP")" -echo "CC: $(command -v "$CC")" -echo "CXX: $(command -v "$CXX")" -echo "LD: $(command -v "$LD")" -echo "AS: $(command -v "$AS")" -echo "AR: $(command -v "$AR")" - -echo "ANDROID_SYSROOT: $ANDROID_SYSROOT" - -echo "CPPFLAGS: $CPPFLAGS" -echo "CFLAGS: $CFLAGS" -echo "CXXFLAGS: $CXXFLAGS" - -[ "$0" = "${BASH_SOURCE[0]}" ] && exit 0 || return 0 diff --git a/contrib/ios/15-ios.conf b/contrib/ios/15-ios.conf deleted file mode 100644 index 364ed6ebf..000000000 --- a/contrib/ios/15-ios.conf +++ /dev/null @@ -1,41 +0,0 @@ -#### iPhoneOS/iOS -# -# It takes recent enough Xcode to use following two targets. It shouldn't -# be a problem by now, but if they don't work, original targets below -# that depend on manual definition of environment variables should still -# work... -# -my %targets = ( - "ios-common" => { - template => 1, - inherit_from => [ "darwin-common" ], - sys_id => "iOS", - disable => [ "engine", "async" ], - }, - "ios-xcrun" => { - inherit_from => [ "ios-common", asm("armv4_asm") ], - bn_ops => [ "BN_LLONG", "RC4_CHAR" ], - perlasm_scheme => "ios32", - }, - "ios64-xcrun" => { - inherit_from => [ "ios-common", asm("aarch64_asm") ], - bn_ops => [ "SIXTY_FOUR_BIT_LONG", "RC4_CHAR" ], - perlasm_scheme => "ios64", - }, - "iossimulator-xcrun" => { - inherit_from => [ "ios-common" ], - }, - - "iphoneos-cross" => { - inherit_from => [ "ios-common" ], - cflags => add("-Wall -fno-common"), - }, - "ios-cross" => { - inherit_from => [ "ios-xcrun" ], - cflags => add("-Wall -fno-common"), - }, - "ios64-cross" => { - inherit_from => [ "ios64-xcrun" ], - cflags => add("-Wall -fno-common"), - }, -); diff --git a/contrib/ios/bootstrap_ldns.sh b/contrib/ios/bootstrap_ldns.sh deleted file mode 100755 index 7e423030c..000000000 --- a/contrib/ios/bootstrap_ldns.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -if ! git submodule update --init; then - echo "Failed to init submodule" - exit 1 -fi - -echo "AUTOTOOLS_BUILD: $AUTOTOOLS_BUILD" -echo "AUTOTOOLS_HOST: $AUTOTOOLS_HOST" - -# libtool complains about our updated config.guess and config.sub. -# Remove them to get through bootstrap. Re-add them after libtoolize. - -echo "Running libtoolize" -if [ -n "$(command -v glibtoolize)" ]; then - rm -f config.guess config.sub - if ! glibtoolize -ci ; then - echo "Failed to libtoolize (glibtoolize)" - exit 1 - fi -elif [ -n "$(command -v libtoolize)" ]; then - rm -f config.guess config.sub - if ! libtoolize -ci ; then - echo "Failed to libtoolize (libtoolize)" - exit 1 - fi -else - echo "Failed to find a libtool" - exit 1 -fi - -echo "Updating config.guess" -if ! wget -q -O config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'; then - echo "Failed to download config.guess" -fi - -echo "Updating config.sub" -if ! wget -q -O config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'; then - echo "Failed to download config.sub" -fi - -echo "Fixing config permissions" -chmod a+x config.guess config.sub -if [ -n "$(command -v xattr 2>/dev/null)" ]; then - xattr -d com.apple.quarantine config.guess 2>/dev/null - xattr -d com.apple.quarantine config.sub 2>/dev/null -fi - -echo "Running autoreconf" -if ! autoreconf -fi ; then - echo "Failed to autoreconf" - exit 1 -fi - -exit 0 diff --git a/contrib/ios/install_openssl.sh b/contrib/ios/install_openssl.sh deleted file mode 100755 index fc5af4d47..000000000 --- a/contrib/ios/install_openssl.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -echo "Downloading OpenSSL" -if ! curl -L -k -s -o openssl-1.1.1d.tar.gz https://www.openssl.org/source/openssl-1.1.1d.tar.gz; -then - echo "Failed to download OpenSSL" - exit 1 -fi - -echo "Unpacking OpenSSL" -rm -rf ./openssl-1.1.1d -if ! tar -xf openssl-1.1.1d.tar.gz; -then - echo "Failed to unpack OpenSSL" - exit 1 -fi - -cd openssl-1.1.1d || exit 1 - -if ! cp ../contrib/ios/15-ios.conf Configurations/; then - echo "Failed to copy OpenSSL ios config" - exit 1 -fi - -# ocsp.c:947:23: error: 'fork' is unavailable: not available on tvOS -# ocsp.c:978:23: error: 'fork' is unavailable: not available on watchOS -# Also see https://github.com/openssl/openssl/issues/7607. -if ! patch -u -p0 < ../contrib/ios/openssl.patch; then - echo "Failed to patch OpenSSL" - exit 1 -fi - -echo "Configuring OpenSSL" -if ! ./Configure "$OPENSSL_HOST" -DNO_FORK no-comp no-asm no-hw no-engine no-tests no-unit-test \ - --prefix="$IOS_PREFIX" --openssldir="$IOS_PREFIX"; then - echo "Failed to configure OpenSSL" - exit 1 -fi - -echo "Building OpenSSL" -if ! make; then - echo "Failed to build OpenSSL" - exit 1 -fi - -echo "Installing OpenSSL" -if ! make install_sw; then - echo "Failed to install OpenSSL" - exit 1 -fi - -exit 0 diff --git a/contrib/ios/install_tools.sh b/contrib/ios/install_tools.sh deleted file mode 100755 index 796833d83..000000000 --- a/contrib/ios/install_tools.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# This step should install tools needed for all packages - OpenSSL and LDNS -# When running on Travis, Homebrew fails in unusual ways, hence '|| true'. -# https://travis-ci.community/t/homebrew-fails-because-an-automake-update-is-an-error/7831/3 -echo "Updating tools" -brew update 1>/dev/null || true -echo "Installing tools" -brew install autoconf automake libtool pkg-config curl perl 1>/dev/null || true diff --git a/contrib/ios/openssl.patch b/contrib/ios/openssl.patch deleted file mode 100644 index 58cef232c..000000000 --- a/contrib/ios/openssl.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- apps/speed.c -+++ apps/speed.c -@@ -99,6 +99,13 @@ - #endif - #include - -+/* fork() breaks AppleTVOS, WatchOS, AppleTVSimulator and WatchSimulator */ -+/* Users should configure with -DNO_FORK */ -+#if defined(NO_FORK) -+# undef HAVE_FORK -+# define HAVE_FORK 0 -+#endif -+ - #ifndef HAVE_FORK - # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_VXWORKS) - # define HAVE_FORK 0 -@@ -110,6 +117,7 @@ - #if HAVE_FORK - # undef NO_FORK - #else -+# undef NO_FORK - # define NO_FORK - #endif - ---- apps/ocsp.c -+++ apps/ocsp.c -@@ -36,6 +36,13 @@ - # include - # include - -+/* fork() breaks AppleTVOS, WatchOS, AppleTVSimulator and WatchSimulator */ -+/* Users should configure with -DNO_FORK */ -+#if defined(NO_FORK) -+# undef HAVE_FORK -+# define HAVE_FORK 0 -+#endif -+ - #ifndef HAVE_FORK - # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) - # define HAVE_FORK 0 -@@ -47,6 +54,7 @@ - #if HAVE_FORK - # undef NO_FORK - #else -+# undef NO_FORK - # define NO_FORK - #endif - diff --git a/contrib/ios/setenv_ios.sh b/contrib/ios/setenv_ios.sh deleted file mode 100755 index 8f49f328d..000000000 --- a/contrib/ios/setenv_ios.sh +++ /dev/null @@ -1,274 +0,0 @@ -#!/usr/bin/env bash - -# ==================================================================== -# Sets the cross compile environment for Xcode/iOS -# -# Based upon OpenSSL's setenv-ios.sh by TH, JW, and SM. -# Heavily modified by JWW for Crypto++. -# Modified by JWW for LDNS. -# ==================================================================== - -######################################### -##### Some validation ##### -######################################### - -# In the past we could mostly infer arch or cpu from the SDK (and -# mostly vice-versa). Nowadays we need it set for us because Apple -# platforms can be either 32-bit or 64-bit. - -if [ -z "$IOS_SDK" ]; then - echo "IOS_SDK is not set. Please set it" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 -fi - -if [ -z "$IOS_CPU" ]; then - echo "IOS_CPU is not set. Please set it" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 -fi - -# cryptest-ios.sh may run this script without sourcing. -if [ "$0" = "${BASH_SOURCE[0]}" ]; then - echo "setenv-ios.sh is usually sourced, but not this time." -fi - -######################################### -##### Small Fixups, if needed ##### -######################################### - -if [[ "$IOS_SDK" == "iPhone" ]]; then - IOS_SDK=iPhoneOS -fi - -if [[ "$IOS_SDK" == "iPhoneOSSimulator" ]]; then - IOS_SDK=iPhoneSimulator -fi - -if [[ "$IOS_SDK" == "TV" || "$IOS_SDK" == "AppleTV" ]]; then - IOS_SDK=AppleTVOS -fi - -if [[ "$IOS_SDK" == "Watch" || "$IOS_SDK" == "AppleWatch" ]]; then - IOS_SDK=WatchOS -fi - -if [[ "$IOS_CPU" == "aarch64" || "$IOS_CPU" == "armv8"* ]] ; then - IOS_CPU=arm64 -fi - -######################################## -##### Environment ##### -######################################## - -# The flags below were tested with Xcode 8 on Travis. If -# you use downlevel versions of Xcode, then you can push -# xxx-version-min=n lower. For example, Xcode 6 can use -# -miphoneos-version-min=5. - -# iPhones can be either 32-bit or 64-bit -if [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "armv7"* ]]; then - MIN_VER=-miphoneos-version-min=6 -elif [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "arm64" ]]; then - MIN_VER=-miphoneos-version-min=6 - -# Fixups for convenience -elif [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "i386" ]]; then - IOS_SDK=iPhoneSimulator - # MIN_VER=-miphoneos-version-min=6 - MIN_VER=-miphonesimulator-version-min=6 -elif [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "x86_64" ]]; then - IOS_SDK=iPhoneSimulator - # MIN_VER=-miphoneos-version-min=6 - MIN_VER=-miphonesimulator-version-min=6 - -# Simulator builds -elif [[ "$IOS_SDK" == "iPhoneSimulator" && "$IOS_CPU" == "i386" ]]; then - MIN_VER=-miphonesimulator-version-min=6 -elif [[ "$IOS_SDK" == "iPhoneSimulator" && "$IOS_CPU" == "x86_64" ]]; then - MIN_VER=-miphonesimulator-version-min=6 - -# Apple TV can be 32-bit Intel (1st gen), 32-bit ARM (2nd, 3rd gen) or 64-bit ARM (4th gen) -elif [[ "$IOS_SDK" == "AppleTVOS" && "$IOS_CPU" == "i386" ]]; then - MIN_VER=-mappletvos-version-min=6 -elif [[ "$IOS_SDK" == "AppleTVOS" && "$IOS_CPU" == "armv7"* ]]; then - MIN_VER=-mappletvos-version-min=6 -elif [[ "$IOS_SDK" == "AppleTVOS" && "$IOS_CPU" == "arm64" ]]; then - MIN_VER=-mappletvos-version-min=6 - -# Simulator builds -elif [[ "$IOS_SDK" == "AppleTVSimulator" && "$IOS_CPU" == "i386" ]]; then - MIN_VER=-mappletvsimulator-version-min=6 -elif [[ "$IOS_SDK" == "AppleTVSimulator" && "$IOS_CPU" == "x86_64" ]]; then - MIN_VER=-mappletvsimulator-version-min=6 - -# Watch can be either 32-bit or 64-bit ARM. TODO: figure out which -# -mwatchos-version-min=n is needed for arm64. 9 is not enough. -elif [[ "$IOS_SDK" == "WatchOS" && "$IOS_CPU" == "armv7"* ]]; then - MIN_VER=-mwatchos-version-min=6 -elif [[ "$IOS_SDK" == "WatchOS" && "$IOS_CPU" == "arm64" ]]; then - MIN_VER=-mwatchos-version-min=10 - -# Simulator builds. TODO: figure out which -watchos-version-min=n -# is needed for arm64. 6 compiles and links, but is it correct? -elif [[ "$IOS_SDK" == "WatchSimulator" && "$IOS_CPU" == "i386" ]]; then - MIN_VER=-mwatchsimulator-version-min=6 -elif [[ "$IOS_SDK" == "WatchSimulator" && "$IOS_CPU" == "x86_64" ]]; then - MIN_VER=-mwatchsimulator-version-min=6 - -# And the final catch-all -else - echo "IOS_SDK and IOS_CPU are not valid. Please fix them" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 -fi - -##################################################################### - -# Xcode 6 and below cannot handle -miphonesimulator-version-min -# Fix it so the simulator will compile as expected. This trick -# may work on other SDKs, but it was not tested. - -if [ -n "$(command -v xcodebuild 2>/dev/null)" ]; then - # Output of xcodebuild is similar to "Xcode 6.2". The first cut gets - # the dotted decimal value. The second cut gets the major version. - XCODE_VERSION=$(xcodebuild -version 2>/dev/null | head -n 1 | cut -f2 -d" " | cut -f1 -d".") - if [ -z "$XCODE_VERSION" ]; then XCODE_VERSION=100; fi - - if [ "$XCODE_VERSION" -le 6 ]; then - MIN_VER="${MIN_VER//iphonesimulator/iphoneos}" - fi -fi - -##################################################################### - -# Allow a user override? I think we should be doing this. The use case is, -# move /Applications/Xcode somewhere else for a side-by-side installation. -if [ -z "${XCODE_DEVELOPER-}" ]; then - XCODE_DEVELOPER=$(xcode-select -print-path 2>/dev/null) -fi - -if [ ! -d "$XCODE_DEVELOPER" ]; then - echo "ERROR: unable to find XCODE_DEVELOPER directory." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# XCODE_DEVELOPER_SDK is the SDK location. -XCODE_DEVELOPER_SDK="$XCODE_DEVELOPER/Platforms/$IOS_SDK.platform" - -if [ ! -d "$XCODE_DEVELOPER_SDK" ]; then - echo "ERROR: unable to find XCODE_DEVELOPER_SDK directory." - echo " Is the SDK supported by Xcode and installed?" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# XCODE_TOOLCHAIN is the location of the actual compiler tools. -if [ -d "$XCODE_DEVELOPER/Toolchains/XcodeDefault.xctoolchain/usr/bin/" ]; then - XCODE_TOOLCHAIN="$XCODE_DEVELOPER/Toolchains/XcodeDefault.xctoolchain/usr/bin/" -elif [ -d "$XCODE_DEVELOPER_SDK/Developer/usr/bin/" ]; then - XCODE_TOOLCHAIN="$XCODE_DEVELOPER_SDK/Developer/usr/bin/" -fi - -if [ -z "$XCODE_TOOLCHAIN" ] || [ ! -d "$XCODE_TOOLCHAIN" ]; then - echo "ERROR: unable to find Xcode cross-compiler tools." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# XCODE_SDK is the SDK name/version being used - adjust the list as appropriate. -# For example, remove 4.3, 6.2, and 6.1 if they are not installed. We go back to -# the 1.0 SDKs because Apple WatchOS uses low numbers, like 2.0 and 2.1. -XCODE_SDK= -for i in $(seq -f "%.1f" 30.0 -0.1 1.0) -do - if [ -d "$XCODE_DEVELOPER_SDK/Developer/SDKs/$IOS_SDK$i.sdk" ]; then - XCODE_SDK="$IOS_SDK$i.sdk" - break - fi -done - -# Error checking -if [ -z "$XCODE_SDK" ]; then - echo "ERROR: unable to find a SDK." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -IOS_SYSROOT="$XCODE_DEVELOPER_SDK/Developer/SDKs/$XCODE_SDK" - -if [ -z "$IOS_SYSROOT" ] || [ ! -d "$IOS_SYSROOT" ]; then - echo "ERROR: unable to find IOS_SYSROOT directory." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -##################################################################### - -# We want to set AR=libtool and ARFLAGS="-static -o", -# but I am not sure Autotools can handle it. -CPP=cpp; CC=clang; CXX=clang++; LD=ld -AS=as; AR=ar; RANLIB=ranlib; STRIP=strip - -# Error checking -if [ ! -e "$XCODE_TOOLCHAIN/$CC" ]; then - echo "ERROR: Failed to find iOS clang. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$XCODE_TOOLCHAIN/$CXX" ]; then - echo "ERROR: Failed to find iOS clang++. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$XCODE_TOOLCHAIN/$RANLIB" ]; then - echo "ERROR: Failed to find iOS ranlib. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$XCODE_TOOLCHAIN/$AR" ]; then - echo "ERROR: Failed to find iOS ar. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$XCODE_TOOLCHAIN/$AS" ]; then - echo "ERROR: Failed to find iOS as. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$XCODE_TOOLCHAIN/$LD" ]; then - echo "ERROR: Failed to find iOS ld. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -##################################################################### - -LENGTH=${#XCODE_TOOLCHAIN} -SUBSTR=${PATH:0:$LENGTH} -if [ "$SUBSTR" != "$XCODE_TOOLCHAIN" ]; then - export PATH="$XCODE_TOOLCHAIN":"$PATH" -fi - -##################################################################### - -export CPP CC CXX LD AS AR RANLIB STRIP -export IOS_SYSROOT -export CFLAGS="-arch $IOS_CPU $MIN_VER --sysroot=$IOS_SYSROOT" -export CXXFLAGS="-arch $IOS_CPU $MIN_VER -stdlib-libc++ --sysroot=$IOS_SYSROOT" - -##################################################################### - -echo "XCODE_TOOLCHAIN: $XCODE_TOOLCHAIN" - -echo "CPP: $(command -v "$CPP")" -echo "CC: $(command -v "$CC")" -echo "CXX: $(command -v "$CXX")" -echo "LD: $(command -v "$LD")" -echo "AS: $(command -v "$AS")" -echo "AR: $(command -v "$AR")" - -echo "IOS_SYSROOT: $IOS_SYSROOT" - -echo "CPPFLAGS: $CPPFLAGS" -echo "CFLAGS: $CFLAGS" -echo "CXXFLAGS: $CXXFLAGS" - -[ "$0" = "${BASH_SOURCE[0]}" ] && exit 0 || return 0 diff --git a/makedist.sh b/makedist.sh index b84a78f1e..716b993a0 100755 --- a/makedist.sh +++ b/makedist.sh @@ -155,7 +155,7 @@ rm -r autom4te* || error_cleanup "Failed to remove autoconf cache directory." # custom removes find . -name .c-mode-rc.el -exec rm {} \; find . -name .cvsignore -exec rm {} \; -rm -f .gitignore .gitmodules contrib/DNS-LDNS/.git .travis.yml .gitlab-ci.yml +rm -f .gitignore .gitmodules contrib/DNS-LDNS/.git rm -rf .git .github rm -rf lua rm -rf masterdont From 175164103c43ace2b96727ee3a3bb57ce6e0ff92 Mon Sep 17 00:00:00 2001 From: Jeroen Koekkoek Date: Thu, 15 Sep 2022 18:17:49 +0200 Subject: [PATCH 2/2] Fix cleanup target in Makefile --- Makefile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 6cffefa70..be1679e3c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -150,7 +150,8 @@ setup-builddir: # builddir/ is used by 60-compile-builddir putdown-builddir: - rm -f include/ldns lib config.h + rm -rf include/ldns + rm -f lib config.h test ! -d include || rmdir include || : if test -d examples -a ! -f examples/README; then rmdir examples || : ; fi if test -d drill -a ! -f drill/README ; then rmdir drill || : ; fi