Skip to content

Commit

Permalink
s390 CI cross build
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Jan 15, 2024
1 parent 9f3a56c commit 26e635e
Show file tree
Hide file tree
Showing 2 changed files with 309 additions and 0 deletions.
194 changes: 194 additions & 0 deletions .circleci/cmake-s390x
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
#!/bin/bash

# set -eu

sudo apt-get update && \
sudo DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
cmake nasm yasm


FFMPEG_VERSION="n6.1"
OPUS_VERSION="v1.4"
SODIUM_VERSION="1.0.19"
VPX_VERSION="v1.13.1"
_X264_VERSION_="baee400fa9ced6f5481a728138fed6e867b0ff7f"

# ---------------------------------------------------------------------------------
FFMPEG_FILENAME="$FFMPEG_VERSION.tar.gz"
rm -f "ffmpeg"*.tar.*
wget $WGET_OPTIONS "https://github.com/FFmpeg/FFmpeg/archive/refs/tags/$FFMPEG_FILENAME" -O "ffmpeg_""$FFMPEG_FILENAME"
tar -xf "ffmpeg_""$FFMPEG_FILENAME"
rm -f "ffmpeg"*.tar.*
cd *mpeg*/

./configure --arch="s390" \
--enable-gpl \
--prefix="$_INST_" \
--target-os="linux" \
--cross-prefix="$CROSS_COMPILE" \
--disable-asm \
--disable-swscale \
--disable-network \
--disable-everything \
--disable-debug \
--disable-shared \
--disable-programs \
--disable-protocols \
--disable-doc \
--disable-sdl2 \
--disable-avfilter \
--disable-filters \
--disable-iconv \
--disable-network \
--disable-muxers \
--disable-postproc \
--disable-swresample \
--disable-swscale-alpha \
--disable-dwt \
--disable-lsp \
--disable-faan \
--disable-vaapi \
--disable-vdpau \
--disable-zlib \
--disable-xlib \
--disable-bzlib \
--disable-lzma \
--disable-encoders \
--disable-decoders \
--disable-demuxers \
--disable-parsers \
--disable-bsfs \
--disable-libxcb \
--disable-libxcb-shm \
--enable-parser=h264 \
--enable-decoder=h264 || exit 1

make -j$(nproc) || exit 1
make install

cd ..
# ---------------------------------------------------------------------------------



# ---------------------------------------------------------------------------------
OPUS_FILENAME="$OPUS_VERSION.tar.gz"
rm -f "opus"*.tar.gz
wget $WGET_OPTIONS "https://github.com/xiph/opus/archive/refs/tags/$OPUS_FILENAME" -O "opus_""$OPUS_FILENAME"
tar -xf "opus_""$OPUS_FILENAME"
rm -f "opus"*.tar.gz
cd opus*/

echo '#!/bin/bash
export PACKAGE_VERSION="'"$OPUS_VERSION"'"' > package_version
chmod a+rx package_version

./autogen.sh

./configure --host="$CROSS_TRIPLE" \
--prefix="$_INST_" \
--disable-shared \
--enable-static \
--disable-soname-versions \
--disable-extra-programs \
--disable-doc || exit 1

make -j$(nproc) || exit 1
make install

cd ..
# ---------------------------------------------------------------------------------


# ---------------------------------------------------------------------------------
SODIUM_FILENAME="libsodium-$SODIUM_VERSION.tar.gz"
rm -f libsodium-*.tar.gz
wget $WGET_OPTIONS "https://download.libsodium.org/libsodium/releases/$SODIUM_FILENAME" -O "$SODIUM_FILENAME"
tar -xf "$SODIUM_FILENAME"
cd libsodium*/

./configure --host="$CROSS_TRIPLE" \
--prefix="$_INST_" \
--disable-shared \
--enable-static \
--with-pic || exit 1

make -j$(nproc) || exit 1
make install
cd ..
# ---------------------------------------------------------------------------------


# ---------------------------------------------------------------------------------
VPX_FILENAME="$VPX_VERSION.tar.gz"

rm -f *.tar.gz
wget $WGET_OPTIONS "https://github.com/webmproject/libvpx/archive/refs/tags/""$VPX_VERSION"".tar.gz" -O "$VPX_FILENAME"
tar -xf "$VPX_FILENAME"
cd libvpx*/

./configure --target=generic-gnu \
--prefix="$_INST_" \
--disable-shared \
--size-limit=16384x16384 \
--enable-onthefly-bitpacking \
--enable-runtime-cpu-detect \
--enable-realtime-only \
--enable-multi-res-encoding \
--enable-temporal-denoising \
--enable-static \
--disable-examples \
--disable-tools \
--disable-docs \
--disable-unit-tests || exit 1

make -j$(nproc) || exit 1
make install
cd ..
# ---------------------------------------------------------------------------------





# ---------------------------------------------------------------------------------
git clone https://code.videolan.org/videolan/x264.git
cd x264/

git checkout "$_X264_VERSION_"

./configure --host="$CROSS_TRIPLE" \
--disable-asm \
--prefix="$_INST_" \
--disable-opencl \
--enable-static \
--disable-avs \
--disable-cli \
--enable-pic || exit

make -j$(nproc) || exit 1
make install
cd ..
# ---------------------------------------------------------------------------------


ls -al /lib/
ls -al /usr/local/lib/pkgconfig/

autoreconf -fi

./configure --host="$CROSS_TRIPLE" \
CFLAGS="-DTOX_CAPABILITIES_ACTIVE -L/lib/" \
LDFLAGS="-L/lib/" \
--prefix="$_INST_" \
--disable-soname-versions \
--disable-shared \
--disable-testing \
--disable-rt || exit 1

make -j$(nproc) || exit 1
make install

make check || echo "NO ERR"

115 changes: 115 additions & 0 deletions .github/workflows/ci_s390.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: s390 build

on:
# push:
# paths-ignore:
# - 'README.md'
# - 'CHANGELOG.md'
pull_request:
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
workflow_dispatch:
inputs:
version:
description: dummy
default: dummy

jobs:

build-s390:
name: s390 Build
runs-on: ubuntu-22.04
if: |
true
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- name: install deps
run: |
sudo apt-get update && \
sudo DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
ca-certificates qemu-system-s390x qemu-user-static \
qemu-utils binfmt-support libc6-s390x-cross libatomic1-s390x-cross
- name: enable s390 emu
run: |
sudo modprobe binfmt_misc || echo "NO ERR"
sudo update-binfmts --enable || echo "NO ERR"
- name: check binfmt_misc
run: |
lsmod | grep binfmt_misc || echo "NO ERR"
ls -al /proc/sys/fs/binfmt_misc/ || echo "NO ERR"
cat /proc/sys/fs/binfmt_misc/qemu-s390x || echo "NO ERR"
ls -al /usr/libexec/qemu-binfmt/s390x-binfmt-P || echo "NO ERR"
- name: make script dockcross/linux-s390x
run: docker run --rm dockcross/linux-s390x > ./dockcross-linux-s390x; chmod +x ./dockcross-linux-s390x

- name: test
run: ./dockcross-linux-s390x bash -c 'ls -al;id;pwd;hostname;uname -a'

- name: build deps
run: |
./dockcross-linux-s390x bash -c './.circleci/cmake-s390x'
- name: find output
run: |
find . -name libtoxcore.a
find . -name 'libtoxcore.so*' || echo "NO ERR"
find . -name friend_connection_test
- name: run single test
run: |
sudo cp -av /usr/s390x-linux-gnu/lib/ld64.so.1 /lib/ld64.so.1
export LD_LIBRARY_PATH=/usr/s390x-linux-gnu/lib
file ./build/friend_connection_test
./build/announce_test
./build/conference_av_test
./build/conference_double_invite_test
./build/conference_invite_merge_test
./build/conference_peer_nick_test
./build/conference_simple_test
./build/conference_test
./build/conference_two_test
./build/crypto_test
./build/encryptsave_test
./build/file_saving_test
./build/file_transfer_test
./build/forwarding_test
./build/friend_connection_test
./build/friend_request_test
./build/group_state_test
./build/invalid_tcp_proxy_test
./build/invalid_udp_proxy_test
./build/lan_discovery_test
./build/lossless_packet_test
./build/lossy_packet_test
./build/network_test
./build/onion_test
./build/overflow_recvq_test
./build/overflow_sendq_test
./build/reconnect_test
./build/save_compatibility_test
./build/save_friend_test
./build/send_message_test
./build/set_name_test
./build/set_status_message_test
./build/TCP_test
./build/tox_dispatch_test
./build/tox_events_test
./build/tox_many_tcp_test
./build/tox_many_test
./build/tox_strncasecmp_test
./build/typing_test
./build/version_test
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: s390_bins
path: ./build/*_test

0 comments on commit 26e635e

Please sign in to comment.