diff --git a/.github/workflows/mac_compilation.yml b/.github/workflows/mac_compilation.yml new file mode 100644 index 0000000..5ec9d43 --- /dev/null +++ b/.github/workflows/mac_compilation.yml @@ -0,0 +1,63 @@ +name: Publish coco lib for mac + +on: + push: + branches: + - '**' + +jobs: + build_mac_images: + runs-on: macos-latest + + strategy: + matrix: + profile: [ "ios_armv7", "ios_armv8", "ios_x86", "ios_x86_64", "macos_x86_64" ] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Configure + run: | + brew install cmake + brew install autoconf + brew install automake + brew install libtool + brew install cmocka + brew install pkg-config + brew install conan@1 + + - name: Conan overwrite + run: | + echo "Overwriting conan to conan@1" + brew link --overwrite conan@1 + + - name: Copy pofiles to conan + run: | + conan profile new --detect default + cp toolchains/apple/profiles/* $HOME/.conan/profiles + + - name: Add elear conan server + run: | + conan remote add conan_server http://conan.elear.solutions + cat $HOME/.conan/remotes.json + + - name: Determine variant + run: | + release_version="master" + + - name: Determine version + run: | + echo "package_name=$(grep -e "name.=." ./conanfile.py | awk -F\" '{print $2}')" >> $GITHUB_ENV + echo "package_version=$(grep -e "version.=." ./conanfile.py | awk -F\" '{print $2}')" >> $GITHUB_ENV + + - name: Conan build & upload + env: + CONAN_LOGIN_USERNAME: "jenkins" + CONAN_PASSWORD: "tuXAC399nZ4wp6s81urg" + package_username: "jenkins" + run: | + conan install . jenkins/master -if=build -r=conan_server --profile=${{ matrix.profile }} + conan build . -bf=build + conan export-pkg . jenkins/master -bf=build -f + conan upload $package_name/$package_version@jenkins/master --all -r=conan_server --confirm diff --git a/toolchains/README.md b/toolchains/README.md new file mode 100644 index 0000000..f714025 --- /dev/null +++ b/toolchains/README.md @@ -0,0 +1,29 @@ +## Toolchains and use cases + +- Apple toolchain is for iOS (arm, arm64, x86, x86_64) & macOS (x86_64) +- Android toolchain is for Android (arm, arm64, x86, x86_64) +- Linux toolchain is for general purpose linux machines (alpine & ubuntu) +- Goke toolchain is for building cameras +- OpenWrt toolchain is for gateways + +## Apple toolchain info + +- Apple toolchains are not actually toolchains +- The profiles provided are meant to be copied to ```$HOME/.conan/profiles``` folder +- Depending on the necessity, appropriate profile must be used + +## Building +- Some toolchains need additional files to be added which are available to download [here](https://drive.google.com/drive/folders/1V0Ol2-PnoEkpx0Z7W4DyQtb5CKidXbL3) +- For building android toolchain, download the ```android-ndk-r25c-linux.tar.gz``` and place it in the ```android``` folder +- For building goke toolchain, download the ```toolchain_goke_armv6.tar.gz``` and place it in the ```linux/goke``` folder +- For building openwrt toolchain, download the ```toolchain_openwrt_mips.tar.gz``` and place it in the ```linux/openwrt``` folder +- Docker command for building the toolchains: ```docker build . -t docker-reg.elear.solutions/dev/tools/:``` +- Docker command for pushing to docker registry: ```docker push docker-reg.elear.solutions/dev/tools/:``` + +toolchain | toolchain name +----------|-------------- +android | toolchain_android +ubuntu | toolchain_ubuntu +alpine | toolchain_alpine +goke | toolchain_goke_armv6 +openwrt | toolchain_openwrt_mips diff --git a/toolchains/android/Dockerfile b/toolchains/android/Dockerfile new file mode 100644 index 0000000..469bcc7 --- /dev/null +++ b/toolchains/android/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:22.04 + +ADD android-ndk-r25c-linux.tar.gz /opt/ + +RUN apt update && \ + apt install -y \ + make \ + cmake \ + autoconf \ + automake \ + libtool \ + curl \ + python3 \ + pkg-config \ + ncurses-dev \ + texinfo \ + ca-certificates-java \ + openjdk-8-jdk \ + git + +RUN curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py && \ + python3 /tmp/get-pip.py && \ + pip3 install conan==1.60.1 + +RUN conan remote add conan_server http://conan.elear.solutions + +COPY ./profiles/ /root/.conan/profiles/ + +ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/ +ENV ANDROID_NDK /opt/android-ndk-r25c/ +ENV CONAN_DEFAULT_PROFILE_PATH /root/.conan/profiles/android_armv8 diff --git a/toolchains/android/profiles/android_armv7 b/toolchains/android/profiles/android_armv7 new file mode 100644 index 0000000..c657091 --- /dev/null +++ b/toolchains/android/profiles/android_armv7 @@ -0,0 +1,10 @@ +include(android_base) + +[settings] +os=Android +os.api_level=19 +arch=armv7 + +[env] +CC=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi19-clang +CXX=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi19-clang++ diff --git a/toolchains/android/profiles/android_armv8 b/toolchains/android/profiles/android_armv8 new file mode 100644 index 0000000..84af675 --- /dev/null +++ b/toolchains/android/profiles/android_armv8 @@ -0,0 +1,10 @@ +include(android_base) + +[settings] +os=Android +os.api_level=21 +arch=armv8 + +[env] +CC=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang +CXX=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang++ diff --git a/toolchains/android/profiles/android_base b/toolchains/android/profiles/android_base new file mode 100644 index 0000000..6d34aca --- /dev/null +++ b/toolchains/android/profiles/android_base @@ -0,0 +1,15 @@ +[settings] +compiler=clang +compiler.version=14 +compiler.libcxx=c++_shared +build_type=Release + +[env] +CONAN_CMAKE_FIND_ROOT_PATH=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/sysroot +AR=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar +AS=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-as +RANLIB=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib +LD=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/ld +STRIP=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip +CFLAGS=--sysroot=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/sysroot +CXXFLAGS=--sysroot=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/sysroot diff --git a/toolchains/android/profiles/android_x86 b/toolchains/android/profiles/android_x86 new file mode 100644 index 0000000..f05dfde --- /dev/null +++ b/toolchains/android/profiles/android_x86 @@ -0,0 +1,10 @@ +include(android_base) + +[settings] +os=Android +os.api_level=19 +arch=x86 + +[env] +CC=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android19-clang +CXX=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android19-clang++ diff --git a/toolchains/android/profiles/android_x86_64 b/toolchains/android/profiles/android_x86_64 new file mode 100644 index 0000000..601f189 --- /dev/null +++ b/toolchains/android/profiles/android_x86_64 @@ -0,0 +1,10 @@ +include(android_base) + +[settings] +os=Android +os.api_level=21 +arch=x86_64 + +[env] +CC=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang +CXX=/opt/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang++ diff --git a/toolchains/apple/profiles/ios_armv7 b/toolchains/apple/profiles/ios_armv7 new file mode 100644 index 0000000..e519113 --- /dev/null +++ b/toolchains/apple/profiles/ios_armv7 @@ -0,0 +1,6 @@ +include(macos_x86_64) + +[settings] +os=iOS +os.version=10.0 +arch=armv7 diff --git a/toolchains/apple/profiles/ios_armv8 b/toolchains/apple/profiles/ios_armv8 new file mode 100644 index 0000000..975d297 --- /dev/null +++ b/toolchains/apple/profiles/ios_armv8 @@ -0,0 +1,6 @@ +include(macos_x86_64) + +[settings] +os=iOS +os.version=10.0 +arch=armv8 diff --git a/toolchains/apple/profiles/ios_x86 b/toolchains/apple/profiles/ios_x86 new file mode 100644 index 0000000..339280d --- /dev/null +++ b/toolchains/apple/profiles/ios_x86 @@ -0,0 +1,6 @@ +include(macos_x86_64) + +[settings] +os=iOS +os.version=10.0 +arch=x86 diff --git a/toolchains/apple/profiles/ios_x86_64 b/toolchains/apple/profiles/ios_x86_64 new file mode 100644 index 0000000..8046062 --- /dev/null +++ b/toolchains/apple/profiles/ios_x86_64 @@ -0,0 +1,6 @@ +include(macos_x86_64) + +[settings] +os=iOS +os.version=10.0 +arch=x86_64 diff --git a/toolchains/apple/profiles/macos_x86_64 b/toolchains/apple/profiles/macos_x86_64 new file mode 100644 index 0000000..406bf7c --- /dev/null +++ b/toolchains/apple/profiles/macos_x86_64 @@ -0,0 +1,7 @@ +include(default) + +[build_requires] +darwin-toolchain/1.0.8@theodelrieu/stable + +[settings] +arch=x86_64 diff --git a/toolchains/linux/alpine/Dockerfile b/toolchains/linux/alpine/Dockerfile new file mode 100644 index 0000000..9d89bcf --- /dev/null +++ b/toolchains/linux/alpine/Dockerfile @@ -0,0 +1,39 @@ +FROM alpine:3.9 + +RUN apk update && \ + apk add --no-cache \ + binutils \ + make \ + cmake \ + libgcc \ + musl-dev \ + gcc \ + g++ \ + autoconf \ + automake \ + libtool \ + linux-headers \ + lua \ + lua-dev \ + openssl \ + curl \ + python3 \ + pkgconfig \ + ncurses-dev \ + texinfo \ + postgresql-dev \ + git \ + curl-dev \ + openssl-dev \ + zlib-dev + +RUN curl https://bootstrap.pypa.io/pip/3.6/get-pip.py -o /tmp/get-pip.py && \ + python3 /tmp/get-pip.py && \ + pip3 install conan==1.60.1 + +RUN conan remote add conan_server http://conan.elear.solutions && \ + conan profile new --detect default + +COPY ./profiles/ /root/.conan/profiles/ + +ENV CONAN_DEFAULT_PROFILE_PATH /root/.conan/profiles/alpine_x86_64 diff --git a/toolchains/linux/alpine/profiles/alpine_x86_64 b/toolchains/linux/alpine/profiles/alpine_x86_64 new file mode 100644 index 0000000..5ce2fff --- /dev/null +++ b/toolchains/linux/alpine/profiles/alpine_x86_64 @@ -0,0 +1,5 @@ +include(default) + +[settings] +os=Linux +arch=x86_64 diff --git a/toolchains/linux/goke/Dockerfile b/toolchains/linux/goke/Dockerfile new file mode 100644 index 0000000..27d02b3 --- /dev/null +++ b/toolchains/linux/goke/Dockerfile @@ -0,0 +1,40 @@ +FROM ubuntu:22.04 + +ADD toolchain_goke_armv6.tar.gz /opt/ + +RUN apt update && \ + apt install -y \ + build-essential \ + make \ + cmake \ + autoconf \ + automake \ + libtool \ + curl \ + python3 \ + pkg-config \ + ncurses-dev \ + texinfo \ + upx \ + git + +RUN dpkg --add-architecture i386 + +RUN apt update && \ + apt install -y \ + libc6:i386 \ + libncurses5:i386 \ + libstdc++6:i386 \ + zlib1g:i386 + +RUN curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py && \ + python3 /tmp/get-pip.py && \ + pip3 install conan==1.60.1 + +RUN conan remote add conan_server http://conan.elear.solutions && \ + conan profile new --detect default + +COPY ./profiles/ /root/.conan/profiles/ + +ENV COCO_BIT_ALIGNMENT 14 +ENV CONAN_DEFAULT_PROFILE_PATH /root/.conan/profiles/goke_armv6 diff --git a/toolchains/linux/goke/profiles/goke_armv6 b/toolchains/linux/goke/profiles/goke_armv6 new file mode 100644 index 0000000..8bcde6e --- /dev/null +++ b/toolchains/linux/goke/profiles/goke_armv6 @@ -0,0 +1,20 @@ +[settings] +os=Linux +arch=armv6 +compiler=gcc +compiler.version=4.6 +compiler.libcxx=libstdc++ +build_type=Release + +[env] +CONAN_CMAKE_FIND_ROOT_PATH=/opt/toolchain_goke_armv6/4.6.1/usr/arm-goke-linux-uclibcgnueabi/sysroot/ +AR=/opt/toolchain_goke_armv6/4.6.1/usr/bin/arm-goke-linux-uclibcgnueabi-ar +AS=/opt/toolchain_goke_armv6/4.6.1/usr/bin/arm-goke-linux-uclibcgnueabi-as +RANLIB=/opt/toolchain_goke_armv6/4.6.1/usr/bin/arm-goke-linux-uclibcgnueabi-ranlib +CC=/opt/toolchain_goke_armv6/4.6.1/usr/bin/arm-goke-linux-uclibcgnueabi-gcc +CXX=/opt/toolchain_goke_armv6/4.6.1/usr/bin/arm-goke-linux-uclibcgnueabi-g++ +LD=/opt/toolchain_goke_armv6/4.6.1/usr/bin/arm-goke-linux-uclibcgnueabi-ld +STRIP=/opt/toolchain_goke_armv6/4.6.1/usr/bin/arm-goke-linux-uclibcgnueabi-strip +CFLAGS=--sysroot=/opt/toolchain_goke_armv6/4.6.1/usr/arm-goke-linux-uclibcgnueabi/sysroot -I/opt/toolchain_goke_armv6/4.6.1/usr/arm-goke-linux-uclibcgnueabi/include -L/usr/local/lib -I/usr/local/include +CXXFLAGS=--sysroot=/opt/toolchain_goke_armv6/4.6.1/usr/arm-goke-linux-uclibcgnueabi/sysroot -I/opt/toolchain_goke_armv6/4.6.1/usr/arm-goke-linux-uclibcgnueabi/include -L/usr/local/lib -I/usr/local/include +LDFLAGS=-L/opt/toolchain_goke_armv6/4.6.1/usr/arm-goke-linux-uclibcgnueabi/sysroot/usr/lib diff --git a/toolchains/linux/openwrt/Dockerfile b/toolchains/linux/openwrt/Dockerfile new file mode 100644 index 0000000..6ff10e4 --- /dev/null +++ b/toolchains/linux/openwrt/Dockerfile @@ -0,0 +1,32 @@ +FROM debian:11.7 + +ADD toolchain_openwrt_mips.tar.gz /opt/ + +RUN apt update && \ + apt install -y \ + build-essential \ + make \ + cmake \ + autoconf \ + automake \ + libtool \ + curl \ + python3 \ + python3-distutils \ + pkg-config \ + ncurses-dev \ + texinfo \ + upx \ + git + +RUN curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py && \ + python3 /tmp/get-pip.py && \ + pip3 install conan==1.60.1 + +RUN conan remote add conan_server http://conan.elear.solutions && \ + conan profile new --detect default + +COPY ./profiles/ /root/.conan/profiles/ + +ENV COCO_BIT_ALIGNMENT 13 +ENV CONAN_DEFAULT_PROFILE_PATH /root/.conan/profiles/openwrt_mips diff --git a/toolchains/linux/openwrt/profiles/openwrt_mips b/toolchains/linux/openwrt/profiles/openwrt_mips new file mode 100644 index 0000000..5ada284 --- /dev/null +++ b/toolchains/linux/openwrt/profiles/openwrt_mips @@ -0,0 +1,19 @@ +[settings] +os=Linux +arch=mips +compiler=gcc +compiler.version=4.8 +compiler.libcxx=libstdc++ +build_type=Release + +[env] +AR=/opt/OpenWrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-ar +AS=/opt/OpenWrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-as +RANLIB=/opt/OpenWrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-ranlib +LD=/opt/OpenWrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-ld +STRIP=/opt/OpenWrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-strip +CC=/opt/OpenWrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc +CXX=/opt/OpenWrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-g++ +CFLAGS=-I/opt/OpenWrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2 +CXXFLAGS=-I/opt/OpenWrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2 +LDFLAGS=-L/opt/OpenWrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/lib diff --git a/toolchains/linux/ubuntu/Dockerfile b/toolchains/linux/ubuntu/Dockerfile new file mode 100644 index 0000000..ef25862 --- /dev/null +++ b/toolchains/linux/ubuntu/Dockerfile @@ -0,0 +1,34 @@ +FROM ubuntu:22.04 + +RUN apt update && \ + apt install -y \ + build-essential \ + make \ + cmake \ + autoconf \ + automake \ + libtool \ + curl \ + python3 \ + pkg-config \ + ncurses-dev \ + texinfo \ + ca-certificates-java \ + openjdk-8-jdk \ + libpq-dev \ + git \ + libcurl4-openssl-dev \ + libssl-dev \ + zlib1g-dev + +RUN curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py && \ + python3 /tmp/get-pip.py && \ + pip3 install conan==1.60.1 + +RUN conan remote add conan_server http://conan.elear.solutions && \ + conan profile new --detect default + +COPY ./profiles/ /root/.conan/profiles/ + +ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/ +ENV CONAN_DEFAULT_PROFILE_PATH /root/.conan/profiles/ubuntu_x86_64 diff --git a/toolchains/linux/ubuntu/profiles/ubuntu_x86_64 b/toolchains/linux/ubuntu/profiles/ubuntu_x86_64 new file mode 100644 index 0000000..5ce2fff --- /dev/null +++ b/toolchains/linux/ubuntu/profiles/ubuntu_x86_64 @@ -0,0 +1,5 @@ +include(default) + +[settings] +os=Linux +arch=x86_64