diff --git a/addons/export.sh b/addons/export.sh index 2a4e1636ac..d41ce21737 100644 --- a/addons/export.sh +++ b/addons/export.sh @@ -2,3 +2,4 @@ export $1="$2" if [[ "${CI}" == "true" ]]; then echo "::set-output name=$1::$2" fi +echo "export $1=\"$2\"" >> ${SCRIPTROOT}/.env diff --git a/addons/run.sh b/addons/run.sh index 01dead8bdb..66e6adafe8 100644 --- a/addons/run.sh +++ b/addons/run.sh @@ -3,5 +3,7 @@ for file in ${SCRIPTROOT}/scripts/*.sh; do echo "================================================================================" echo ">> ${file}" echo "================================================================================" - . ${file} + . ${SCRIPTROOT}/.env + ${file} + if [[ $? -ne 0 ]]; then exit 1; fi done diff --git a/scripts/00-mingw.sh b/scripts/00-mingw.sh index 5528d8b85f..90101641b7 100644 --- a/scripts/00-mingw.sh +++ b/scripts/00-mingw.sh @@ -7,13 +7,13 @@ GCC_SYSROOT="`${BUILD_PREFIX}-gcc -print-sysroot`" mingw_clone() { if [ ! -d /tmp/mingw ]; then git clone -b "${MINGW_VERSION}" --depth 1 "${REPOSITORY}" /tmp/mingw - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi else pushd /tmp/mingw > /dev/null git fetch --all - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi git reset --hard "${MINGW_VERSION}" - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi popd > /dev/null fi } @@ -36,15 +36,15 @@ mingw_build_crt() { --enable-lib64 ) ./configure ${mingw_configure[@]} - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi # Build MinGW make -j`nproc` - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi # Install MinGW sudo make install - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi popd > /dev/null } @@ -67,15 +67,15 @@ mingw_build_headers() { --enable-idl ) ./configure ${mingw_configure[@]} - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi # Build MinGW make -j`nproc` - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi # Install MinGW sudo make install - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi popd > /dev/null } @@ -98,22 +98,22 @@ mingw_build_library_winpthreads() { --with-pic ) ./configure ${mingw_configure[@]} - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi # Build MinGW make -j`nproc` - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi # Install MinGW sudo make install - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi popd > /dev/null } mingw_build_libraries() { mingw_build_library_winpthreads - if [[ $? -ne 0 ]]; then exit 1; fi + if [[ $? -ne 0 ]]; then return 1; fi } mingw_build() { @@ -125,17 +125,17 @@ mingw_build() { unset LDFLAGS unset PKG_CONFIG_LIBDIR - mingw_build_crt - if [[ $? -ne 0 ]]; then exit 1; fi - mingw_build_headers - if [[ $? -ne 0 ]]; then exit 1; fi - mingw_build_libraries - if [[ $? -ne 0 ]]; then exit 1; fi + #mingw_build_crt + #if [[ $? -ne 0 ]]; then return 1; fi + #mingw_build_headers + #if [[ $? -ne 0 ]]; then return 1; fi + #mingw_build_libraries + #if [[ $? -ne 0 ]]; then return 1; fi popd > /dev/null } -#mingw_clone +mingw_clone if [[ $? -ne 0 ]]; then exit 1; fi -#mingw_build +mingw_build if [[ $? -ne 0 ]]; then exit 1; fi diff --git a/scripts/30-amd-amf.sh b/scripts/30-amd-amf.sh index 5c43e503cb..113f33c08b 100644 --- a/scripts/30-amd-amf.sh +++ b/scripts/30-amd-amf.sh @@ -2,13 +2,18 @@ REPOSITORY="https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git" function amd_amf() { if [[ ${VERSION_MAJOR} -lt 4 ]]; then - exit 0 + return 0 fi git clone --depth 1 --branch "${AMDAMF_VERSION}" "${REPOSITORY}" /tmp/amd-amf + if [[ $? -ne 0 ]]; then return 1; fi pushd /tmp/amd-amf > /dev/null + if [[ $? -ne 0 ]]; then return 1; fi sudo cp -R amf/public/include/ /usr/${BUILD_PREFIX}/include/AMF + if [[ $? -ne 0 ]]; then return 1; fi popd > /dev/null + if [[ $? -ne 0 ]]; then return 1; fi } amd_amf +if [[ $? -ne 0 ]]; then exit 1; fi diff --git a/scripts/30-nvidia-nvenc.sh b/scripts/30-nvidia-nvenc.sh index 7ba8d49e46..51a4f1640c 100644 --- a/scripts/30-nvidia-nvenc.sh +++ b/scripts/30-nvidia-nvenc.sh @@ -2,14 +2,20 @@ REPOSITORY="https://git.videolan.org/git/ffmpeg/nv-codec-headers.git" function nvidia_nvenc() { if [[ ${VERSION_MAJOR} -lt 3 ]]; then - exit 0 + return 0 fi git clone --depth 1 --branch "${NVIDIANVENC_VERSION}" "${REPOSITORY}" /tmp/nvidia-nvenc + if [[ $? -ne 0 ]]; then return 1; fi pushd "/tmp/nvidia-nvenc" > /dev/null + if [[ $? -ne 0 ]]; then return 1; fi make PREFIX=/usr/${BUILD_PREFIX} + if [[ $? -ne 0 ]]; then return 1; fi sudo make PREFIX=/usr/${BUILD_PREFIX} install + if [[ $? -ne 0 ]]; then return 1; fi popd > /dev/null + if [[ $? -ne 0 ]]; then return 1; fi } nvidia_nvenc +if [[ $? -ne 0 ]]; then exit 1; fi diff --git a/scripts/40-zlib.sh b/scripts/40-zlib.sh index ff50db382b..aece396c50 100644 --- a/scripts/40-zlib.sh +++ b/scripts/40-zlib.sh @@ -1,8 +1,13 @@ function install_zlib() { curl -L -o "/tmp/zlib.zip" "https://github.com/Xaymar/zlib-ng/releases/download/${ZLIB_VERSION}/zlib-ng-${BUILD_BITS}.zip" + if [[ $? -ne 0 ]]; then return 1; fi 7z x -o/tmp/zlib/ "/tmp/zlib.zip" + if [[ $? -ne 0 ]]; then return 1; fi sudo cp -a /tmp/zlib/. /usr/${BUILD_PREFIX}/ + if [[ $? -ne 0 ]]; then return 1; fi cp -a /tmp/zlib/bin/*.dll ./distrib/bin/ + if [[ $? -ne 0 ]]; then return 1; fi } install_zlib +if [[ $? -ne 0 ]]; then exit 1; fi diff --git a/scripts/50-aom.sh b/scripts/50-aom.sh index f930e7a26e..3b1f2bd0e4 100644 --- a/scripts/50-aom.sh +++ b/scripts/50-aom.sh @@ -1,14 +1,21 @@ function install_aom() { if [[ ${VERSION_MAJOR} -lt 4 ]]; then - exit 0 + return 0 fi curl -L -o "/tmp/aom.7z" "https://github.com/Xaymar/aom/releases/download/${AOM_VERSION}/aom-windows-${BUILD_BITS}-shared.7z" + if [[ $? -ne 0 ]]; then return 1; fi 7z x -o/tmp/aom "/tmp/aom.7z" + if [[ $? -ne 0 ]]; then return 1; fi sed -i -E "s/^prefix=.*$/prefix=\/usr\/${BUILD_PREFIX}/g" /tmp/aom/lib/pkgconfig/aom.pc + if [[ $? -ne 0 ]]; then return 1; fi cp /tmp/aom/lib/pkgconfig/aom.pc /tmp/aom/lib/pkgconfig/libaom.pc + if [[ $? -ne 0 ]]; then return 1; fi sudo cp -a /tmp/aom/. /usr/${BUILD_PREFIX}/ + if [[ $? -ne 0 ]]; then return 1; fi cp -a /tmp/aom/bin/*.dll ./distrib/bin/ + if [[ $? -ne 0 ]]; then return 1; fi } install_aom +if [[ $? -ne 0 ]]; then exit 1; fi diff --git a/scripts/50-libx264.sh b/scripts/50-libx264.sh index 7d8f83ab9f..0feb3fa5a0 100644 --- a/scripts/50-libx264.sh +++ b/scripts/50-libx264.sh @@ -1,15 +1,20 @@ function install_libx264() { if [[ ${VERSION_MAJOR} -lt 1 ]]; then - exit 0 + return 0 fi if [[ "${LICENSE}" != "GPL" ]]; then - exit 0 + return 0 fi curl -L -o "/tmp/x264.zip" "https://github.com/Xaymar/x264/releases/download/${X264_VERSION}/x264-${BUILD_BITS}-shared-GPLv2.zip" + if [[ $? -ne 0 ]]; then return 1; fi 7z x -o/tmp/x264/ "/tmp/x264.zip" + if [[ $? -ne 0 ]]; then return 1; fi sudo cp -a /tmp/x264/. /usr/${BUILD_PREFIX}/ + if [[ $? -ne 0 ]]; then return 1; fi cp -a /tmp/x264/bin/*.dll ./distrib/bin/ + if [[ $? -ne 0 ]]; then return 1; fi } install_libx264 +if [[ $? -ne 0 ]]; then exit 1; fi diff --git a/scripts/99-ffmpeg.sh b/scripts/99-ffmpeg.sh index ee45b43004..5c7adbc27d 100644 --- a/scripts/99-ffmpeg.sh +++ b/scripts/99-ffmpeg.sh @@ -1,25 +1,34 @@ -export PKG_CONFIG_PATH=/usr/${BUILD_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH} +function install_ffmpeg() { + export PKG_CONFIG_PATH=/usr/${BUILD_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH} -# Configure FFmpeg -./configure \ - --arch="${BUILD_ARCH}" \ - --target-os="${BUILD_TARGET}" \ - --cross-prefix="${BUILD_PREFIX}-" \ - --prefix="${PWD}/distrib" \ - --bindir="${PWD}/distrib/bin" \ - --libdir="${PWD}/distrib/lib" \ - --shlibdir="${PWD}/distrib/bin" \ - --pkg-config=pkg-config \ - --extra-cflags=-O3 --extra-cflags=-mmmx --extra-cflags=-msse --extra-cflags=-msse2 --extra-cflags=-msse3 --extra-cflags=-mssse3 \ - --extra-cflags=-msse4.1 --extra-cflags=-msse4.2 --extra-cflags=-mavx --extra-cflags=-maes --extra-cflags=-mpclmul \ - --pkg-config=pkg-config \ - ${BUILD_FLAGS} + # Configure FFmpeg + ./configure \ + --arch="${BUILD_ARCH}" \ + --target-os="${BUILD_TARGET}" \ + --cross-prefix="${BUILD_PREFIX}-" \ + --prefix="${PWD}/distrib" \ + --bindir="${PWD}/distrib/bin" \ + --libdir="${PWD}/distrib/lib" \ + --shlibdir="${PWD}/distrib/bin" \ + --pkg-config=pkg-config \ + --extra-cflags=-O3 --extra-cflags=-mmmx --extra-cflags=-msse --extra-cflags=-msse2 --extra-cflags=-msse3 --extra-cflags=-mssse3 \ + --extra-cflags=-msse4.1 --extra-cflags=-msse4.2 --extra-cflags=-mavx --extra-cflags=-maes --extra-cflags=-mpclmul \ + --pkg-config=pkg-config \ + ${BUILD_FLAGS} + if [[ $? -ne 0 ]]; then return 1; fi -# Compile FFmpeg -make -j$((`nproc` * 2)) + # Compile FFmpeg + make -j$((`nproc` * 2)) + if [[ $? -ne 0 ]]; then return 1; fi -# Install FFmpeg -sudo make install + # Install FFmpeg + sudo make install + if [[ $? -ne 0 ]]; then return 1; fi -# Move .lib files which are in the wrong place. -mv ./distrib/bin/*.lib ./distrib/lib/ + # Move .lib files which are in the wrong place. + mv ./distrib/bin/*.lib ./distrib/lib/ + if [[ $? -ne 0 ]]; then return 1; fi +} + +install_ffmpeg +if [[ $? -ne 0 ]]; then exit 1; fi