|
| 1 | +name: Cross compile for Windows |
| 2 | +on: |
| 3 | + - push |
| 4 | + - pull_request |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + name: build |
| 8 | + runs-on: ubuntu-latest |
| 9 | + permissions: |
| 10 | + id-token: write |
| 11 | + contents: write |
| 12 | + attestations: write |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Set up MinGW |
| 18 | + run: | |
| 19 | + sudo apt update |
| 20 | + sudo apt install -y gcc-mingw-w64-i686-win32 |
| 21 | +
|
| 22 | + - name: Load Pidgin from cache |
| 23 | + id: pidgin-cache |
| 24 | + uses: actions/cache@v4 |
| 25 | + with: |
| 26 | + path: pidgin |
| 27 | + key: pidgin-2.10.11 |
| 28 | + |
| 29 | + - name: Download Pidgin |
| 30 | + if: steps.pidgin-cache.outputs.cache-hit != 'true' |
| 31 | + run: | |
| 32 | + curl --http1.1 -L https://sourceforge.net/projects/pidgin/files/Pidgin/2.10.11/pidgin-2.10.11.tar.bz2/download -o pidgin.tar.bz2 |
| 33 | + tar -xf pidgin.tar.bz2 |
| 34 | + mv pidgin-2.10.11 pidgin |
| 35 | + curl --http1.1 -L https://sourceforge.net/projects/pidgin/files/Pidgin/2.10.11/pidgin-2.10.11-win32-bin.zip/download -o pidgin-win32bin.zip |
| 36 | + unzip pidgin-win32bin.zip |
| 37 | + cp pidgin-2.10.11-win32bin/libpurple.dll pidgin/libpurple/ |
| 38 | + |
| 39 | + - name: Load Win32 deps from cache |
| 40 | + id: win32-cache |
| 41 | + uses: actions/cache@v4 |
| 42 | + with: |
| 43 | + path: win32-dev |
| 44 | + key: win32-cache |
| 45 | + |
| 46 | + - name: Setup WinPidgin build |
| 47 | + if: steps.win32-cache.outputs.cache-hit != 'true' |
| 48 | + run: | |
| 49 | + mkdir -p win32-dev |
| 50 | + curl --http1.1 -L https://download.gnome.org/binaries/win32/glib/2.28/glib-dev_2.28.8-1_win32.zip -o glib-dev.zip |
| 51 | + unzip glib-dev.zip -d win32-dev/glib-2.28.8 |
| 52 | + curl --http1.1 -L https://download.gnome.org/binaries/win32/dependencies/gettext-runtime-dev_0.18.1.1-2_win32.zip -o gettext-runtime.zip |
| 53 | + unzip gettext-runtime.zip -d win32-dev/glib-2.28.8 |
| 54 | + curl --http1.1 -L https://download.gnome.org/binaries/win32/dependencies/zlib-dev_1.2.5-2_win32.zip -o zlib-dev.zip |
| 55 | + unzip zlib-dev.zip -d win32-dev/glib-2.28.8 |
| 56 | + cd win32-dev |
| 57 | + curl --http1.1 -L https://github.com/jgeboski/purple-facebook/releases/download/downloads/json-glib-0.14.tar.gz -o json-glib.tar.gz |
| 58 | + tar -xf json-glib.tar.gz |
| 59 | + rm json-glib.tar.gz |
| 60 | + cd .. |
| 61 | + ls win32-dev/ |
| 62 | + |
| 63 | + - name: libdiscount build |
| 64 | + run: | |
| 65 | + cd win32-dev |
| 66 | + curl --http1.1 -L https://github.com/Orc/discount/archive/refs/tags/2.2.1.tar.gz -o discount.tar.gz |
| 67 | + tar -xf discount.tar.gz |
| 68 | + rm discount.tar.gz |
| 69 | + cd discount-* |
| 70 | + ./configure.sh |
| 71 | + export CC=i686-w64-mingw32-gcc |
| 72 | + echo "#ifndef __AC_MARKDOWN_D" > config.h |
| 73 | + echo "#define __AC_MARKDOWN_D 1" >> config.h |
| 74 | + echo "#define OS_CYGWIN_NT 1" >> config.h |
| 75 | + echo "#define THEME_CF 1" >> config.h |
| 76 | + echo "#define while(x) while( (x) != 0 )" >> config.h |
| 77 | + echo "#define if(x) if( (x) != 0 )" >> config.h |
| 78 | + echo "#define DWORD unsigned long" >> config.h |
| 79 | + echo "#define WORD unsigned short" >> config.h |
| 80 | + echo "#define BYTE unsigned char" >> config.h |
| 81 | + echo "#define HAVE_STDLIB_H 1" >> config.h |
| 82 | + echo "#define HAVE_SRAND 1" >> config.h |
| 83 | + echo "#define INITRNG(x) srand((unsigned int)x)" >> config.h |
| 84 | + echo "#define HAVE_BZERO 1" >> config.h |
| 85 | + echo "#define HAVE_RAND 1" >> config.h |
| 86 | + echo "#define COINTOSS() (rand()&1)" >> config.h |
| 87 | + echo "#define HAVE_STRCASECMP 1" >> config.h |
| 88 | + echo "#define HAVE_STRNCASECMP 1" >> config.h |
| 89 | + echo "#define HAVE_GETCWD 1" >> config.h |
| 90 | + echo "#define TABSTOP 4" >> config.h |
| 91 | + echo "#define HAVE_MALLOC_H 1" >> config.h |
| 92 | + echo "#define PATH_FIND \"/usr/bin/find\"" >> config.h |
| 93 | + echo "#define PATH_SED \"/usr/bin/sed\"" >> config.h |
| 94 | + echo "#endif/* __AC_MARKDOWN_D */" >> config.h |
| 95 | + make libmarkdown |
| 96 | + rm libmarkdown.a |
| 97 | + i686-w64-mingw32-ar crv libmarkdown.a *.o |
| 98 | + i686-w64-mingw32-ranlib libmarkdown.a |
| 99 | +
|
| 100 | + - name: make |
| 101 | + run: | |
| 102 | + export WIN32_CC=i686-w64-mingw32-gcc |
| 103 | + export WIN32_DEV_TOP=win32-dev |
| 104 | + export PIDGIN_TREE_TOP=pidgin |
| 105 | + export OS=Windows_NT |
| 106 | + make librocketchat.dll |
| 107 | +
|
| 108 | + - name: archive |
| 109 | + if: ${{ !env.ACT }} |
| 110 | + uses: actions/upload-artifact@v4 |
| 111 | + with: |
| 112 | + name: plugin |
| 113 | + path: lib*.dll |
| 114 | + |
| 115 | + - name: release |
| 116 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !env.ACT |
| 117 | + uses: ncipollo/release-action@v1 |
| 118 | + with: |
| 119 | + artifacts: lib*.dll |
| 120 | + tag: nightly-${{ github.sha }} |
| 121 | + name: Nightly ${{ github.sha }} |
| 122 | + allowUpdates: true |
| 123 | + makeLatest: true |
| 124 | + |
| 125 | + - name: attest |
| 126 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !env.ACT |
| 127 | + uses: actions/attest-build-provenance@v1 |
| 128 | + with: |
| 129 | + subject-path: lib*.dll |
0 commit comments