Skip to content

Commit

Permalink
onevpl-cpu: Add package
Browse files Browse the repository at this point in the history
  • Loading branch information
Biswa96 committed Nov 3, 2022
1 parent 359c76b commit 167f429
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 0 deletions.
39 changes: 39 additions & 0 deletions mingw-w64-onevpl-cpu/0001-disable-mingw-workaround.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--- a/cpu/ext/ffmpeg-codecs/CMakeLists.txt
+++ b/cpu/ext/ffmpeg-codecs/CMakeLists.txt
@@ -107,7 +107,7 @@
endif()

# Get Mingw info, common to all cases if OS is Windows
-if(WIN32)
+if(MSVC)
if(NOT DEFINED ENV{MSYS_ROOT})
message(STATUS "MSYS_ROOT not defined, assuming C:/tools/msys64")
set(MSYS_ROOT C:/tools/msys64)
@@ -153,7 +153,7 @@
# Add AVC encoder libs
target_link_libraries(${TARGET} INTERFACE ${H264_ENC_LIB})

-if(WIN32)
+if(MSVC)
# openH264 lib dependencies
if(BUILD_OPENH264)
findmingwlib(STDCPP_LIB ${MINGW_PATH} lib/gcc/${gcc_name}/${gcc_version}
--- a/script/bootstrap.py
+++ b/script/bootstrap.py
@@ -414,7 +414,7 @@
#pylint: disable=too-many-arguments,too-many-branches,too-many-statements,too-many-locals
def bootstrap(clean, h264_ip, build_mode, proj_dir, arch, validation):
"""Bootstrap install"""
- if os.name == 'nt':
+ if os.name == 'nt' and 'MSC' in sys.version:
#pylint: disable=global-statement
global GIT_ENV
mingw_path = make_mingw_path(arch)
@@ -484,6 +484,7 @@
'-c',
'user.email=bootstrap@localhost',
'commit',
+ '-q',
'-m',
'Import',
xenv=GIT_ENV)
15 changes: 15 additions & 0 deletions mingw-w64-onevpl-cpu/0002-bootstrap-fix-ffmpeg-command.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- a/script/bootstrap.py
+++ b/script/bootstrap.py
@@ -711,8 +711,12 @@
def ffmpeg_configure_opts(install_dir, arch, validation):
"""configure options for ffmpeg build"""
posix_install_dir = to_posix_path(install_dir)
+ cc = os.getenv('CC')
+ cxx = os.getenv('CXX')
result = [
f'--prefix={posix_install_dir}',
+ f'--cc={cc}',
+ f'--cxx={cxx}',
'--enable-static',
'--disable-shared',
'--enable-pic',
24 changes: 24 additions & 0 deletions mingw-w64-onevpl-cpu/0003-cmake-remove-unknown-options.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--- a/cmake/CompileOptions.cmake
+++ b/cmake/CompileOptions.cmake
@@ -49,21 +49,12 @@
add_compile_options("-Wall")
add_compile_options("-Wformat")
add_compile_options("-Wformat-security")
- add_compile_options("-Werror=format-security")
add_definitions("-D_FORTIFY_SOURCE=2")

- # only when warning as error option is enabled in CI test
- if(ENABLE_WARNING_AS_ERROR)
- add_compile_options("-Werror")
- endif()
-
if(LINUX) # Linux only
add_compile_options("-fstack-protector-strong")
set(CMAKE_CXX_FLAGS "-z relro -z now -z noexecstack")
elseif(WIN32) # mingw in Windows only
add_compile_options("-fPIC")
- add_compile_options("-shared")
- # Windows verion of "-z noexecstack"
- add_compile_options("-fno-set-stack-executable")
endif()
endif()
10 changes: 10 additions & 0 deletions mingw-w64-onevpl-cpu/0004-cmake-add-bcrypt-lib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/cpu/ext/ffmpeg-codecs/CMakeLists.txt
+++ b/cpu/ext/ffmpeg-codecs/CMakeLists.txt
@@ -86,6 +86,7 @@
${DAV1D_LIB}
Threads::Threads)
endif()
+ target_link_libraries(${TARGET} INTERFACE bcrypt)
else()
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
target_link_libraries(
76 changes: 76 additions & 0 deletions mingw-w64-onevpl-cpu/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Maintainer: Biswapriyo Nath <[email protected]>

_realname=onevpl-cpu
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2022.2.4
pkgrel=1
pkgdesc='oneVPL runtime implementation for CPU (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64')
url='https://www.somepackage.org/'
license=('spdx:MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-python"
"${MINGW_PACKAGE_PREFIX}-meson"
"${MINGW_PACKAGE_PREFIX}-nasm"
"${MINGW_PACKAGE_PREFIX}-ninja"
"${MINGW_PACKAGE_PREFIX}-onevpl"
'git')
source=("https://github.com/oneapi-src/oneVPL-cpu/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz"
0001-disable-mingw-workaround.patch
0002-bootstrap-fix-ffmpeg-command.patch
0003-cmake-remove-unknown-options.patch
0004-cmake-add-bcrypt-lib.patch)
sha256sums=('5a236a0c366db38d8d2e64e2df2e42f355b8a46175e78977f9f150d2d5bce81c'
'e805e850b4827fe15c77a006207183f25aae1cdffb25856988100a8be834ce65'
'1f495f6a5cee0ff6b8265288697a535cd08f6b0f113f2c560e7835f6044ec601'
'c337ee9c8c86f3479d382c854f4fc7a88cf9bcf2e6d928ce679cba2f468a7596'
'bd9c18382ae029b4b5b36dd8efc0735a2be3320c3a535429369276ba412cf15d')

prepare() {
cd "${srcdir}"/${_realname}-${pkgver}

patch -p1 -i "${srcdir}"/0001-disable-mingw-workaround.patch
patch -p1 -i "${srcdir}"/0002-bootstrap-fix-ffmpeg-command.patch
patch -p1 -i "${srcdir}"/0003-cmake-remove-unknown-options.patch

# https://github.com/oneapi-src/oneVPL-cpu/pull/41
patch -p1 -i "${srcdir}"/0004-cmake-add-bcrypt-lib.patch
}

build() {
local -x PKG_CONFIG_LIBDIR="${srcdir}/deps-install/lib"
local -x VPL_CPU_DEPS_BUILD_DIR="${srcdir}/deps-build"
local -x VPL_BUILD_DEPENDENCIES="${srcdir}/deps-install"

"oneVPL-cpu-${pkgver}/script/bootstrap" gpl

mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

declare -a extra_config
if check_option "debug" "n"; then
extra_config+=("-DCMAKE_BUILD_TYPE=Release")
else
extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
fi

MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
"${MINGW_PREFIX}"/bin/cmake.exe \
-GNinja \
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
-DCMAKE_PREFIX_PATH="${srcdir}/deps-install" \
-DBUILD_GPL_X264=ON \
-DBUILD_TESTS=OFF \
-DONEAPI_INSTALL_LICENSEDIR="share/licenses/${_realname}" \
"${extra_config[@]}" \
../${_realname}-${pkgver}

"${MINGW_PREFIX}"/bin/cmake.exe --build .
}

package() {
cd "${srcdir}/build-${MSYSTEM}"
DESTDIR="${pkgdir}" "${MINGW_PREFIX}"/bin/cmake.exe --install .
}

0 comments on commit 167f429

Please sign in to comment.