|
| 1 | +name: cross compile for OpenBSD on Ubuntu |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + openbsd-release-version: [7.4] |
| 15 | + |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + env: |
| 19 | + CC: clang --target=amd64-unknown-openbsd --sysroot=${{ github.workspace }}/amd64-unknown-openbsd-sysroot |
| 20 | + CFLAGS: -I${{ github.workspace }}/amd64-unknown-openbsd-3rdroot/include -v -fPIC |
| 21 | + LDFLAGS: -L${{ github.workspace }}/amd64-unknown-openbsd-3rdroot/lib -Wl,-v |
| 22 | + PKG_CONFIG_PATH: ${{ github.workspace }}/amd64-unknown-openbsd-3rdroot/lib/pkgconfig |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + repository: universal-ctags/ctags |
| 28 | + |
| 29 | + - run: sudo apt-get -y update |
| 30 | + - run: sudo apt-get -y install clang cmake make automake autoconf pkg-config curl file |
| 31 | + |
| 32 | + - run: install -d amd64-unknown-openbsd-sysroot |
| 33 | + - run: install -d amd64-unknown-openbsd-3rdroot |
| 34 | + |
| 35 | + - name: install amd64-unknown-openbsd-sysroot |
| 36 | + run: | |
| 37 | + major="$(printf '%s\n' ${{ matrix.openbsd-release-version }} | cut -d. -f1)" |
| 38 | + minor="$(printf '%s\n' ${{ matrix.openbsd-release-version }} | cut -d. -f2)" |
| 39 | +
|
| 40 | + for item in base comp |
| 41 | + do |
| 42 | + FILENAME="$item$major$minor.tgz" |
| 43 | + curl -LO "https://cdn.openbsd.org/pub/OpenBSD/${{ matrix.openbsd-release-version }}/amd64/$FILENAME" |
| 44 | + tar vxf "$FILENAME" -C amd64-unknown-openbsd-sysroot |
| 45 | + done |
| 46 | +
|
| 47 | + - name: build zlib |
| 48 | + run: | |
| 49 | + install -d src/zlib |
| 50 | + cd src/zlib |
| 51 | + curl -L -o src.tar.gz https://zlib.net/fossils/zlib-1.3.tar.gz |
| 52 | + tar vxf src.tar.gz --strip-components=1 |
| 53 | + sed -i 's|/share/pkgconfig|/lib/pkgconfig|' CMakeLists.txt |
| 54 | + cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF |
| 55 | + cmake --build build.d |
| 56 | + cmake --install build.d |
| 57 | +
|
| 58 | + - name: build libiconv |
| 59 | + run: | |
| 60 | + install -d src/libiconv |
| 61 | + cd src/libiconv |
| 62 | + curl -L -o src.tar.gz https://ftp.gnu.org/gnu/libiconv/libiconv-1.17.tar.gz |
| 63 | + tar vxf src.tar.gz --strip-components=1 |
| 64 | + ./configure --host=amd64-unknown-openbsd --prefix=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot --enable-extra-encodings --enable-static --disable-shared |
| 65 | + make V=1 |
| 66 | + make install |
| 67 | +
|
| 68 | + - name: build libxml2 |
| 69 | + run: | |
| 70 | + install -d src/libxml2 |
| 71 | + cd src/libxml2 |
| 72 | + curl -L -o src.tar.gz https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.6.tar.xz |
| 73 | + tar vxf src.tar.gz --strip-components=1 |
| 74 | + ./configure --host=amd64-unknown-openbsd --prefix=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot --with-zlib --without-lzma --without-python --without-readline --without-coverage --enable-ipv6 --enable-static --disable-shared LIBS=-liconv |
| 75 | + make V=1 |
| 76 | + make install |
| 77 | + cd ${{ github.workspace }}/amd64-unknown-openbsd-3rdroot/lib/pkgconfig |
| 78 | + sed -i '/^Requires: /d' libxml-2.0.pc |
| 79 | + printf 'Requires: zlib\n' >> libxml-2.0.pc |
| 80 | +
|
| 81 | + - name: build libyaml |
| 82 | + run: | |
| 83 | + install -d src/libyaml |
| 84 | + cd src/libyaml |
| 85 | + curl -L -o src.tar.gz https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz |
| 86 | + tar vxf src.tar.gz --strip-components=1 |
| 87 | + ./configure --host=amd64-unknown-openbsd --prefix=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot |
| 88 | + make V=1 |
| 89 | + make install |
| 90 | +
|
| 91 | + - name: build jansson |
| 92 | + run: | |
| 93 | + install -d src/jansson |
| 94 | + cd src/jansson |
| 95 | + curl -L -o src.tar.gz https://github.com/akheron/jansson/releases/download/v2.14/jansson-2.14.tar.gz |
| 96 | + tar vxf src.tar.gz --strip-components=1 |
| 97 | + cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF -DJANSSON_BUILD_SHARED_LIBS=OFF -DJANSSON_BUILD_DOCS=OFF -DJANSSON_COVERAGE=OFF -DJANSSON_EXAMPLES=OFF -DJANSSON_WITHOUT_TESTS=ON |
| 98 | + cmake --build build.d |
| 99 | + cmake --install build.d |
| 100 | +
|
| 101 | + - name: build libpcre2 |
| 102 | + run: | |
| 103 | + install -d src/libpcre2 |
| 104 | + cd src/libpcre2 |
| 105 | + curl -L -o src.tar.gz https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2 |
| 106 | + tar vxf src.tar.gz --strip-components=1 |
| 107 | + cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF -DJANSSON_BUILD_SHARED_LIBS=OFF -DCMAKE_C_STANDARD=99 -DCMAKE_C_STANDARD_REQUIRED=ON -DPCRE2_BUILD_PCRE2_8=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_BUILD_PCRE2GREP=OFF -DPCRE2_BUILD_TESTS=OFF -DPCRE2_SUPPORT_VALGRIND=OFF -DPCRE2_SUPPORT_UNICODE=ON |
| 108 | + cmake --build build.d |
| 109 | + cmake --install build.d |
| 110 | +
|
| 111 | + - run: rm ${{ github.workspace }}/amd64-unknown-openbsd-3rdroot/lib/lib*.so |
| 112 | + |
| 113 | + - run: ./autogen.sh |
| 114 | + - run: | |
| 115 | + ./configure --host=amd64-unknown-openbsd --prefix=${{ github.workspace }}/uctags-openbsd-amd64 || { |
| 116 | + cat config.log |
| 117 | + exit 1 |
| 118 | + } |
| 119 | + - run: cat config.log |
| 120 | + - run: make V=1 |
| 121 | + - run: make install |
| 122 | + |
| 123 | + - run: readelf -h ctags |
| 124 | + - run: readelf -d ctags |
| 125 | + - run: file ctags | grep OpenBSD |
0 commit comments