Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Jan 15, 2024
1 parent 8c337ab commit 4e068fd
Show file tree
Hide file tree
Showing 2 changed files with 295 additions and 0 deletions.
230 changes: 230 additions & 0 deletions .circleci/cmake-mips
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
#!/bin/bash

# set -eu

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

echo "_INST_="$(pwd)
export _INST_=$(pwd)

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*/

#ARCH_LIST="
# aarch64
# alpha
# arm
# avr32
# avr32_ap
# avr32_uc
# bfin
# ia64
# m68k
# mips
# mips64
# parisc
# ppc
# ppc64
# s390
# sh4
# sparc
# sparc64
# tilegx
# tilepro
# tomi
# x86
# x86_32
# x86_64
#"

export ARCH2="$ARCH"

if [ "$ARCH""x" == "arm64" ]; then
export ARCH2="aarch64"
fi

./configure --arch="$ARCH2" \
--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/
ls -al ${_INST_}/lib/

autoreconf -fi

./configure --host="$CROSS_TRIPLE" \
CFLAGS="-DTOX_CAPABILITIES_ACTIVE -L${_INST_}/lib/ -I${_INST_}/include" \
LDFLAGS="-L${_INST_}/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"

65 changes: 65 additions & 0 deletions .github/workflows/ci_mips.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: mips 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-mips:
name: mips 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-mips qemu-user-static \
qemu-utils binfmt-support libc6-mips-cross libatomic1-mips-cross
- name: enable mips 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"
- name: make script dockcross/linux-mips
run: docker run --rm dockcross/linux-mips > ./dockcross-linux-mips; chmod +x ./dockcross-linux-mips

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

- name: build deps
run: |
./dockcross-linux-mips bash -c './.circleci/cmake-mips'
- name: find output
run: |
find . -name libtoxcore.a
find . -name 'libtoxcore.so*' || echo "NO ERR"
find . -name friend_connection_test
file ./lib/libtoxcore.a || echo "NO ERR"
file ./build/friend_connection_test || echo "NO ERR"

0 comments on commit 4e068fd

Please sign in to comment.