Skip to content

Commit 9200584

Browse files
committed
Minor changes to ubuntu build
Minor changes to ubuntu build Signed-off-by: Milosz Linkiewicz <[email protected]>
1 parent 7bfa08e commit 9200584

File tree

4 files changed

+133
-77
lines changed

4 files changed

+133
-77
lines changed

.github/workflows/build-baremetal-ubuntu.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,16 @@ jobs:
8787
working-directory: "${BUILD_DIR}/ffmpeg"
8888
run: |
8989
./configure \
90+
--disable-debug \
91+
--disable-doc \
9092
--enable-libipp \
91-
--extra-cflags=-fopenmp \
92-
--extra-ldflags=-fopenmp \
93+
--enable-static \
9394
--enable-gpl \
9495
--enable-libx264 \
9596
--enable-libx265 \
9697
--extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \
98+
--extra-cflags='-fopenmp -I/opt/intel/oneapi/ipp/latest/include/ipp/' \
99+
--extra-ldflags='-fopenmp -L/opt/intel/oneapi/ipp/latest/lib' \
97100
--enable-cross-compile \
98101
--prefix="${PREFIX}" && \
99102
make clean && \

.github/workflows/codeql.yml

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ on:
99
- cron: '15 0 * * *'
1010

1111
env:
12+
TZ: "Europe/Warsaw"
1213
BUILD_TYPE: "Release"
13-
PREFIX_DIR: /usr/local
1414
DEBIAN_FRONTEND: "noninteractive"
15+
FFMPEG_COMMIT_ID: "n6.1.1"
16+
BUILD_DIR: "${{ github.workspace }}/build"
17+
PREFIX: "${{ github.workspace }}/_install"
18+
19+
defaults:
20+
run:
21+
shell: bash
1522

1623
permissions:
1724
contents: read
@@ -32,9 +39,6 @@ jobs:
3239
permissions:
3340
actions: read
3441
security-events: write
35-
defaults:
36-
run:
37-
shell: bash
3842
steps:
3943
- name: 'Harden Runner'
4044
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
@@ -44,30 +48,52 @@ jobs:
4448
- name: 'Checkout repository'
4549
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
4650

47-
- name: 'Get RAISR prerequisites and set-up git'
51+
- name: 'Install OS level dependencies'
52+
run: |
53+
set -exo pipefail && \
54+
mkdir -p "${PREFIX}" "${BUILD_DIR}/ffmpeg" && \
55+
sudo apt-get update --fix-missing && \
56+
sudo apt-get full-upgrade -y && \
57+
sudo apt-get install --no-install-recommends -y \
58+
build-essential \
59+
ca-certificates \
60+
cmake \
61+
diffutils \
62+
gpg \
63+
libx264-dev \
64+
libx265-dev \
65+
llvm \
66+
m4 \
67+
meson \
68+
nasm \
69+
ocl-icd-opencl-dev \
70+
opencl-headers \
71+
zlib1g-dev \
72+
make curl git sudo tar unzip wget yasm && \
73+
74+
- name: 'Install Intel OneAPI APT repository'
4875
run: |
49-
sudo apt update -y
50-
sudo apt install -y sudo git wget curl pkg-config bash tar zip unzip make
51-
mkdir -p "${{ github.workspace }}/build"
52-
git config --global user.email "[email protected]"
53-
git config --global user.name "Your Name"
76+
set -exo pipefail && \
77+
curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg && \
78+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/intel-oneAPI.list && \
79+
sudo apt-get update --fix-missing && \
80+
sudo apt-get install --no-install-recommends -y intel-oneapi-ipp-devel-2022.0
5481
55-
- name: 'Build RAISR prerequisites and install'
56-
working-directory: "${{ github.workspace }}/build"
82+
- name: 'Download and patch ffmpeg repository'
5783
run: |
58-
"${{ github.workspace }}/scripts/01_pull_resources.sh"
59-
"${{ github.workspace }}/scripts/02_install_prerequisites.sh" "${{ github.workspace }}/build/raisr.tar.gz"
84+
set -eo pipefail && \
85+
curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | tar -zx --strip-components=1 -C "${BUILD_DIR}/ffmpeg"
86+
patch -d "${BUILD_DIR}/ffmpeg" -p1 -i <(cat "${{ github.workspace }}/ffmpeg/"*.patch)
87+
cp "${{ github.workspace }}/ffmpeg/vf_raisr"*.c "${BUILD_DIR}/ffmpeg/libavfilter"
6088
6189
- name: 'Initialize CodeQL action'
6290
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
6391
with:
6492
languages: "c-cpp"
6593
config-file: "${{ github.workspace }}/.github/codeql/codeql-config.yml"
6694

67-
- name: 'Build RAISR source library'
68-
working-directory: "${{ github.workspace }}/build"
69-
run: |
70-
"${{ github.workspace }}/scripts/03_build_raisr_ffmpeg.sh" "${{ github.workspace }}/build/raisr/Video-Super-Resolution-Library"
95+
- name: 'Build RAISR from source code'
96+
run: '${{ github.workspace }}/build.sh -DENABLE_RAISR_OPENCL=ON'
7197

7298
- name: 'Perform CodeQL Analysis'
7399
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11

build.sh

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@
77
set -ex -o pipefail
88

99
SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")"
10+
REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}")"
11+
1012
. "${SCRIPT_DIR}/scripts/common.sh"
1113
nproc="${nproc:-$(nproc)}"
1214

15+
# Env variable BUILD_TYPE can be one off: RelWithDebInfo, Release, Debug
16+
BUILD_TYPE="${BUILD_TYPE:-Release}"
17+
1318
# Helpful when copying and pasting functions and debuging.
1419
if printf '%s' "$0" | grep -q '\.sh'; then
1520
IN_SCRIPT=true
1621
fi
1722

18-
19-
20-
cd_safe() {
23+
function cd_safe() {
2124
if (cd "$1"); then
2225
cd "$1"
2326
else
@@ -28,60 +31,68 @@ cd_safe() {
2831
}
2932

3033
# Usage: build [test]
31-
build() (
32-
build_type=Release
33-
log_info "Create folder: build, build type: $build_type"
34-
mkdir -p build > /dev/null 2>&1
35-
cd_safe build
36-
37-
for file in *; do
38-
rm -rf "$file"
39-
done
34+
function build()
35+
(
36+
log_info "Create folder: build, build type: ${BUILD_TYPE}"
37+
38+
if [[ -d "${REPOSITORY_DIR:?}/build" ]]; then
39+
rm -rf "${REPOSITORY_DIR:?}/build/"*
40+
fi
41+
42+
mkdir -p "${REPOSITORY_DIR}/build" > /dev/null 2>&1
4043

41-
cmake .. -DCMAKE_BUILD_TYPE="$build_type" $CMAKE_EXTRA_FLAGS "$@"
44+
cmake -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" "${CMAKE_EXTRA_FLAGS}" -B "${REPOSITORY_DIR}/build" -S "${REPOSITORY_DIR}" "$@"
4245
#cmake .. -DCMAKE_BUILD_TYPE="RelWithDebInfo" $CMAKE_EXTRA_FLAGS "$@"
4346

44-
if [ -f Makefile ]; then
45-
make -j "${nproc}"
46-
make install -j "${nproc}"
47+
if [ -f "${REPOSITORY_DIR}/build/Makefile" ]; then
48+
make -j"${nproc}" -C "${REPOSITORY_DIR}/build"
49+
as_root make install -j"${nproc}" -C "${REPOSITORY_DIR}/build"
4750
fi
48-
49-
cd ..
5051
)
5152

53+
function check_executable()
54+
{
55+
print_exec=(printf '\0')
56+
if [[ "$#" -ge "2" ]]; then
57+
if [[ "${1}" == "-p" ]]; then
58+
print_exec=(printf '%s\n')
59+
fi
60+
shift
61+
fi
5262

53-
check_executable() (
54-
print_exec=false
55-
while true; do
56-
case "$1" in
57-
-p) print_exec=true && shift ;;
58-
*) break ;;
59-
esac
60-
done
61-
[ -n "$1" ] && command_to_check="$1" || return 1
62-
shift
63-
if [ -e "$command_to_check" ]; then
64-
$print_exec && printf '%s\n' "$command_to_check"
65-
return 0
63+
if [[ "$#" -ge "1" ]]; then
64+
command_to_check="${1}" && shift
65+
else
66+
log_error "Wrong number of parameters passed to check_executable()."
67+
return 1
68+
fi
69+
70+
if [ -e "${command_to_check}" ]; then
71+
"${print_exec[@]}" "${command_to_check}"
72+
return 0
6673
fi
67-
for d in "$@" $(printf '%s ' "$PATH" | tr ':' ' '); do
68-
if [ -e "$d/$command_to_check" ]; then
69-
$print_exec && printf '%s\n' "$d/$command_to_check"
70-
return 0
71-
fi
74+
75+
for pt in "$@" $(echo "${PATH}" | tr ':' ' '); do
76+
if [ -e "${pt}/${command_to_check}" ]; then
77+
"${print_exec[@]}" "${pt}/${command_to_check}"
78+
return 0
79+
fi
7280
done
81+
7382
return 127
74-
)
83+
}
84+
7585
if check_executable icpx; then
7686
CXX=$(check_executable -p icpx)
7787
elif check_executable clang++; then
7888
CXX=$(check_executable -p clang++)
7989
elif check_executable g++; then
8090
CXX=$(check_executable -p g++)
8191
else
82-
die "No suitable cpp compiler found in path" \
83-
"Please either install one or set it via cxx=*"
92+
log_error "No suitable cpp compiler found in path."
93+
log_error "Please either install one or set it via cxx=*"
94+
die "[Exiting due to error.]"
8495
fi
85-
export CXX
8696

97+
export CXX
8798
build "$@"

docker/Flex/Dockerfile.ubuntu22.04

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
# se Ubuntu 22.04 with Intel IPP
77
ARG IMAGE_CACHE_REGISTRY=docker.io
8-
ARG IMAGE_NAME=intel/oneapi-basekit:2023.2.1-devel-ubuntu22.04
8+
ARG IMAGE_NAME=library/ubuntu:22.04@sha256:adbb90115a21969d2fe6fa7f9af4253e16d45f8d4c1e930182610c4731962658
9+
# ARG IMAGE_NAME=intel/oneapi-basekit:2023.2.1-devel-ubuntu22.04
910
FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build
1011

1112
ARG SVT_AV1_VER=v2.1.2
@@ -37,22 +38,34 @@ ENV TZ="Europe/Warsaw"
3738
# Update apt and install dependances
3839
SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"]
3940
WORKDIR ${PREFIX}
40-
RUN rm /etc/apt/sources.list.d/oneAPI.list && \
41+
RUN rm -f /etc/apt/sources.list.d/oneAPI.list && \
4142
apt-get update --fix-missing && \
4243
apt-get full-upgrade -y && \
4344
apt-get install --no-install-recommends -y \
45+
autoconf \
46+
automake \
47+
build-essential \
4448
ca-certificates \
45-
automake libdrm-dev libtool libx11-dev libxext-dev libxfixes-dev libwayland-dev \
49+
clang \
4650
cmake \
47-
curl \
48-
libx265-dev \
49-
libx264-dev \
50-
zlib1g-dev \
51-
nasm \
52-
opencl-headers \
51+
diffutils \
52+
g++ \
53+
gcc gcc-multilib gpg \
54+
libdrm-dev libtool libx11-dev libxext-dev libxfixes-dev \
55+
libwayland-dev libpciaccess-dev libx264-dev libx265-dev \
56+
llvm m4 meson nasm \
5357
ocl-icd-opencl-dev \
54-
libpciaccess-dev \
55-
yasm && \
58+
opencl-headers \
59+
pkg-config \
60+
python3-pyelftools \
61+
systemtap-sdt-dev \
62+
ubuntu-drivers-common \
63+
zlib1g-dev \
64+
make curl git sudo tar unzip wget yasm && \
65+
curl -fsSL "https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB" | gpg --dearmor > "/usr/share/keyrings/oneapi-archive-keyring.gpg" && \
66+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > "/etc/apt/sources.list.d/intel-oneAPI.list" && \
67+
apt-get update --fix-missing && \
68+
apt-get install --no-install-recommends -y intel-oneapi-ipp-devel-2022.0 && \
5669
apt-get clean && \
5770
rm -rf /var/lib/apt/lists/*
5871

@@ -117,19 +130,23 @@ RUN curl -Lf "${FFMPEG_REPO}" | \
117130

118131
# Configure and build ffmpeg
119132
WORKDIR ${DL_PREFIX}/ffmpeg
133+
# RUN ./configure --disable-shared \
120134
RUN ./configure \
135+
--disable-debug \
136+
--disable-doc \
137+
--enable-static \
121138
--enable-libipp \
122-
--extra-cflags=-fopenmp \
123-
--extra-ldflags=-fopenmp \
124139
--enable-gpl \
125140
--enable-libx264 \
126141
--enable-libx265 \
127-
--extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \
128-
--enable-cross-compile \
129142
--enable-opencl \
130143
--enable-vaapi \
131144
--enable-libsvtav1 \
132145
--enable-libvpx \
146+
--extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \
147+
--extra-cflags='-fopenmp -I/opt/intel/oneapi/ipp/latest/include/ipp/' \
148+
--extra-ldflags='-fopenmp -L/opt/intel/oneapi/ipp/latest/lib' \
149+
--enable-cross-compile \
133150
--prefix="${PREFIX}" && \
134151
make clean && \
135152
make -j"$(nproc)" && \
@@ -191,7 +208,7 @@ RUN apt-get update --fix-missing && \
191208
apt-get install --no-install-recommends -y \
192209
intel-opencl-icd \
193210
intel-level-zero-gpu \
194-
intel-oneapi-ipp && \
211+
intel-oneapi-ipp-2022.0 && \
195212
apt-get clean && \
196213
rm -rf /var/lib/apt/lists/* && \
197214
ln -s /usr/bin/ffmpeg /opt/raisrfolder/ffmpeg && \
@@ -200,7 +217,6 @@ RUN apt-get update --fix-missing && \
200217
curl -Lf http://nginx.org/download/nginx-1.24.0.tar.gz | tar xz --strip-components=1 -C "/opt/nginx" && \
201218
ldconfig
202219

203-
204220
# Install ngnix and run ffmpeg to verify that the raisr filter is supported
205221
WORKDIR /opt/nginx
206222
RUN ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module && \

0 commit comments

Comments
 (0)