Skip to content

Commit 10be570

Browse files
authored
New build.sh script for the HyperHDR build process (#904)
1 parent 082a80a commit 10be570

15 files changed

+229
-86
lines changed

Diff for: .github/workflows/push-master.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88
USE_CACHE: ${{ vars.USE_CACHE && vars.USE_CACHE || true }}
99
RESET_CACHE: ${{ vars.RESET_CACHE && vars.RESET_CACHE || false }}
1010
USE_CODEQL: ${{ vars.USE_CODEQL && vars.USE_CODEQL || false }}
11-
BUILD_ARCHIVES: ${{ startsWith(github.event.ref, 'refs/tags') && 1 || 0 }}
11+
BUILD_ARCHIVES: ${{ startsWith(github.event.ref, 'refs/tags') && true || false }}
1212

1313
jobs:
1414

@@ -92,7 +92,7 @@ jobs:
9292
- name: Check default version
9393
if: matrix.linuxVersion != 'bullseye'
9494
run: |
95-
echo "USE_STANDARD_INSTALLER_NAME=ON" >> $GITHUB_ENV
95+
echo "USE_STANDARD_INSTALLER_NAME=true" >> $GITHUB_ENV
9696
9797
- name: Build packages
9898
env:
@@ -104,7 +104,7 @@ jobs:
104104
RESET_CACHE: ${{ env.RESET_CACHE }}
105105
shell: bash
106106
run: |
107-
./.ci/ci_build.sh
107+
./build.sh
108108
109109
# Upload artifacts (only on tagged commit)
110110
- name: Upload artifacts
@@ -187,7 +187,7 @@ jobs:
187187
USE_CCACHE: ${{ env.USE_CACHE }}
188188
RESET_CACHE: ${{ env.RESET_CACHE }}
189189
shell: bash
190-
run: ./.ci/ci_build.sh
190+
run: ./build.sh
191191

192192
# Upload artifacts (only on tagged commit)
193193
- name: Upload artifacts
@@ -280,7 +280,7 @@ jobs:
280280
USE_CCACHE: ${{ env.USE_CACHE }}
281281
shell: bash
282282
run: |
283-
./.ci/ci_build.sh
283+
./build.sh
284284
285285
# Upload artifacts (only on tagged commit)
286286
- name: Upload artifacts

Diff for: .github/workflows/upload-to-github-pages.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ jobs:
9292
PLATFORM: ${{ matrix.platform }}
9393
USE_CCACHE: ${{ env.USE_CACHE }}
9494
RESET_CACHE: ${{ env.RESET_CACHE }}
95-
USE_STANDARD_INSTALLER_NAME: 'ON'
95+
USE_STANDARD_INSTALLER_NAME: true
9696
shell: bash
9797
run: |
98-
./.ci/ci_build.sh
98+
./build.sh
9999
100100
# deploy the package
101101
- name: Get destination path

Diff for: .gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
*.swp
22
/*.user
3-
/build*
43
.DS_Store
54
CMakeFiles/
65
__/
@@ -18,6 +17,9 @@ CMakeCache.txt
1817
.directory
1918
*.pyc
2019
compile_commands.json
20+
.ccache/
21+
deploy/
22+
build/
2123

2224
# Autogenerated by flatbuffers
2325
include/flatbuffers/parser/hyperhdr_reply_generated.h

Diff for: CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ if (UNIX AND NOT APPLE)
583583
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
584584
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
585585
list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
586+
list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/../lib/external")
586587
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
587588
endif ()
588589

Diff for: .ci/ci_build.sh renamed to build.sh

+81-14
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,103 @@
11
#!/bin/bash
22

3+
print_manual()
4+
{
5+
EscChar="\033"
6+
ColorReset="${EscChar}[m"
7+
RedColor="${EscChar}[31;1m"
8+
GreenColor="${EscChar}[32;1m"
9+
YellowColor="${EscChar}[33;1m"
10+
YellowColor2="${EscChar}[33m"
11+
BlueColor="${EscChar}[34;1m"
12+
CyanColor="${EscChar}[36;1m"
13+
14+
printf "\n${GreenColor}Required environmental options:${ColorReset}"
15+
printf "\n${YellowColor}PLATFORM${ColorReset} - one of the supported targets: osx|windows|linux|rpi"
16+
printf "\n${YellowColor}DOCKER_TAG${ColorReset} | ${YellowColor}DOCKER_IMAGE${ColorReset} - both are required only for linux|rpi platforms:"
17+
18+
printf "\n Debian => ${YellowColor2}bullseye${ColorReset} | ${YellowColor2}x86_64${ColorReset}"
19+
printf "\n Debian => ${YellowColor2}bullseye${ColorReset} | ${YellowColor2}arm-32bit-armv6l${ColorReset}"
20+
printf "\n Debian => ${YellowColor2}bullseye${ColorReset} | ${YellowColor2}arm-64bit-aarch64${ColorReset}"
21+
printf "\n Debian => ${YellowColor2}bookworm${ColorReset} | ${YellowColor2}x86_64${ColorReset}"
22+
printf "\n Debian => ${YellowColor2}bookworm${ColorReset} | ${YellowColor2}arm-32bit-armv6l${ColorReset}"
23+
printf "\n Debian => ${YellowColor2}bookworm${ColorReset} | ${YellowColor2}arm-64bit-aarch64${ColorReset}"
24+
printf "\n Ubuntu => ${YellowColor2}jammy${ColorReset} | ${YellowColor2}x86_64${ColorReset}"
25+
printf "\n Ubuntu => ${YellowColor2}noble${ColorReset} | ${YellowColor2}x86_64${ColorReset}"
26+
printf "\n Fedora => ${YellowColor2}Fedora_40${ColorReset} | ${YellowColor2}x86_64${ColorReset}"
27+
printf "\n ArchLinux => ${YellowColor2}ArchLinux${ColorReset} | ${YellowColor2}x86_64${ColorReset}"
28+
29+
printf "\n\n${GreenColor}Optional environmental options:${ColorReset}"
30+
printf "\n${CyanColor}BUILD_TYPE${ColorReset} - Release|Debug, default is Release version"
31+
printf "\n${CyanColor}BUILD_ARCHIVES${ColorReset} - false|true, cpack will build ZIP package"
32+
printf "\n${CyanColor}USE_STANDARD_INSTALLER_NAME${ColorReset} - false|true, use standard Linux package naming"
33+
printf "\n${CyanColor}USE_CCACHE${ColorReset} - false|true, use ccache if available"
34+
printf "\n${CyanColor}RESET_CACHE${ColorReset} - false|true, reset ccache storage"
35+
printf "\n\n${GreenColor}Example of usage:${ColorReset}\n${YellowColor}PLATFORM=linux DOCKER_TAG=bullseye DOCKER_IMAGE=arm-64bit-aarch64 ./build.sh${ColorReset}"
36+
printf "\nInstallers from Docker builds will be ready in the ${RedColor}deploy${ColorReset} folder"
37+
printf "\n\n"
38+
exit 0
39+
}
40+
41+
if [[ "$PLATFORM" == "" || ( ("$PLATFORM" == "linux" || "$PLATFORM" == "rpi") && ( "$DOCKER_IMAGE" = "" || "$DOCKER_TAG" = "" ) ) ]]; then
42+
print_manual
43+
fi
44+
345
# detect CI
446
if [ "$SYSTEM_COLLECTIONID" != "" ]; then
547
# Azure Pipelines
648
echo "Azure detected"
749
CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')"
850
CI_BUILD_DIR="$BUILD_SOURCESDIRECTORY"
951
CI_TYPE="azure"
10-
elif [ "$HOME" != "" ]; then
52+
elif [ "$GITHUB_ACTIONS" != "" ]; then
1153
# GitHub Actions
1254
echo "Github Actions detected"
1355
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
1456
CI_BUILD_DIR="$GITHUB_WORKSPACE"
1557
CI_TYPE="github_action"
1658
else
1759
# for executing in non ci environment
60+
echo "Local system build detected"
1861
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
1962
CI_TYPE="other"
63+
CI_BUILD_DIR="$PWD"
2064
fi
2165

66+
# set environment variables if not exists
67+
[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="Release"
68+
[ -z "${USE_STANDARD_INSTALLER_NAME}" ] && USE_STANDARD_INSTALLER_NAME=false
69+
[ -z "${USE_CCACHE}" ] && USE_CCACHE=true
70+
[ -z "${RESET_CACHE}" ] && RESET_CACHE=false
71+
[ -z "${BUILD_ARCHIVES}" ] && BUILD_ARCHIVES=true
72+
73+
74+
printf "\nPLATFORM = %s" ${PLATFORM}
75+
printf "\nDOCKER_TAG = %s" ${DOCKER_TAG}
76+
printf "\nDOCKER_IMAGE = %s" ${DOCKER_IMAGE}
77+
printf "\nBUILD_TYPE = %s" ${BUILD_TYPE}
78+
printf "\nBUILD_ARCHIVES = %s" ${BUILD_ARCHIVES}
79+
printf "\nUSE_STANDARD_INSTALLER_NAME = %s" ${USE_STANDARD_INSTALLER_NAME}
80+
printf "\nUSE_CCACHE = %s" ${USE_CCACHE}
81+
printf "\nRESET_CACHE = %s" ${RESET_CACHE}
82+
printf "\n"
83+
2284
if [ ${BUILD_ARCHIVES} = true ]; then
2385
echo "Build the package archive"
24-
IS_ARCHIVE_SKIPPED=" -DDO_NOT_BUILD_ARCHIVES=OFF"
86+
ARCHIVE_OPTION=" -DBUILD_ARCHIVES=ON"
2587
else
2688
echo "Do not build the package archive"
27-
IS_ARCHIVE_SKIPPED=" -DDO_NOT_BUILD_ARCHIVES=ON"
89+
ARCHIVE_OPTION=" -DBUILD_ARCHIVES=OFF"
2890
fi
2991

30-
# set environment variables if not exists (debug)
31-
[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="Release"
32-
33-
[ -z "${USE_STANDARD_INSTALLER_NAME}" ] && USE_STANDARD_INSTALLER_NAME="OFF"
92+
if [ ${USE_STANDARD_INSTALLER_NAME} = true ]; then
93+
echo "Use standard naming"
94+
ARCHIVE_OPTION=" ${ARCHIVE_OPTION} -DUSE_STANDARD_INSTALLER_NAME=ON"
95+
else
96+
echo "Do not use standard naming"
97+
ARCHIVE_OPTION=" ${ARCHIVE_OPTION} -DUSE_STANDARD_INSTALLER_NAME=OFF"
98+
fi
3499

35-
echo "Platform: ${PLATFORM}, build type: ${BUILD_TYPE}, CI_NAME: $CI_NAME, docker image: ${DOCKER_IMAGE}, docker type: ${DOCKER_TAG}, is archive enabled: ${IS_ARCHIVE_SKIPPED}, use ccache: ${USE_CCACHE}, reset ccache: ${RESET_CACHE}"
100+
echo "Platform: ${PLATFORM}, build type: ${BUILD_TYPE}, CI_NAME: $CI_NAME, docker image: ${DOCKER_IMAGE}, docker type: ${DOCKER_TAG}, archive options: ${ARCHIVE_OPTION}, use ccache: ${USE_CCACHE}, reset ccache: ${RESET_CACHE}"
36101

37102
# clear ccache if neccesery
38103
if [ ${RESET_CACHE} = true ]; then
@@ -77,10 +142,10 @@ elif [[ $CI_NAME == *"mingw64_nt"* || "$CI_NAME" == 'windows_nt' ]]; then
77142

78143
if [ ${USE_CCACHE} = true ]; then
79144
echo "Using ccache"
80-
BUILD_OPTION="${IS_ARCHIVE_SKIPPED}"
145+
BUILD_OPTION="${ARCHIVE_OPTION}"
81146
else
82147
echo "Not using ccache"
83-
BUILD_OPTION="-DUSE_CCACHE_CACHING=OFF ${IS_ARCHIVE_SKIPPED}"
148+
BUILD_OPTION="-DUSE_CCACHE_CACHING=OFF ${ARCHIVE_OPTION}"
84149
fi
85150

86151
if [[ $CI_TYPE == "github_action" ]]; then
@@ -115,12 +180,12 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
115180

116181
if [ ${USE_CCACHE} = true ]; then
117182
echo "Using ccache"
118-
BUILD_OPTION="${IS_ARCHIVE_SKIPPED}"
183+
BUILD_OPTION="${ARCHIVE_OPTION}"
119184
cache_env="export CCACHE_DIR=/.ccache && ccache -z"
120185
ls -a .ccache
121186
else
122187
echo "Not using ccache"
123-
BUILD_OPTION="-DUSE_CCACHE_CACHING=OFF ${IS_ARCHIVE_SKIPPED}"
188+
BUILD_OPTION="-DUSE_CCACHE_CACHING=OFF ${ARCHIVE_OPTION}"
124189
cache_env="true"
125190
fi
126191

@@ -129,9 +194,11 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
129194
if [[ "$DOCKER_TAG" == "ArchLinux" ]]; then
130195
echo "Arch Linux detected"
131196
cp cmake/linux/arch/* .
132-
executeCommand="makepkg"
133197
chmod -R a+rw ${CI_BUILD_DIR}/deploy
134198
versionFile=`cat version`
199+
executeCommand="echo \"GLIBC version: \$(ldd --version | head -1 | sed 's/[^0-9]*\([.0-9]*\)$/\1/')\""
200+
executeCommand=${executeCommand}" && sed -i \"s/{GLIBC_VERSION}/\$(ldd --version | head -1 | sed 's/[^0-9]*\([.0-9]*\)$/\1/')/\" PKGBUILD && makepkg"
201+
echo ${executeCommand}
135202
sed -i "s/{VERSION}/${versionFile}/" PKGBUILD
136203
if [ ${USE_CCACHE} = true ]; then
137204
sed -i "s/{BUILD_OPTION}/${BUILD_OPTION} -DUSE_PRECOMPILED_HEADERS=OFF/" PKGBUILD
@@ -150,7 +217,7 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
150217
-v "${CI_BUILD_DIR}/deploy:/deploy" \
151218
-v "${CI_BUILD_DIR}:/source:ro" \
152219
$REGISTRY_URL:$DOCKER_TAG \
153-
/bin/bash -c "${cache_env} && cd / && mkdir -p hyperhdr && cp -r source/. /hyperhdr &&
220+
/bin/bash -c "${cache_env} && cd / && mkdir -p hyperhdr && cp -rf /source/. /hyperhdr &&
154221
cd /hyperhdr && mkdir build && (${executeCommand}) &&
155222
(cp /hyperhdr/build/bin/h* /deploy/ 2>/dev/null || : ) &&
156223
(cp /hyperhdr/build/Hyper* /deploy/ 2>/dev/null || : ) &&

Diff for: cmake/installers.cmake

+52-14
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,27 @@ macro(DeployUnix TARGET)
239239
install(FILES ${webserver-resources-path} DESTINATION "share/hyperhdr/lib" COMPONENT "HyperHDR" )
240240
endif()
241241

242-
# Copy SMARTX11 lib
243-
if (TARGET smartX11)
244-
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:smartX11> DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
242+
# Copy SMART-X11 lib
243+
if (TARGET smart-x11)
244+
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:smart-x11> DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
245245
endif()
246246

247-
# Copy SMARTPIPEWIRE lib
248-
if (TARGET smartPipewire)
249-
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:smartPipewire> DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
247+
# Copy SMART-PIPEWIRE lib
248+
if (TARGET smart-pipewire)
249+
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:smart-pipewire> DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
250250
endif()
251251

252+
# Copy UTILS-IMAGE lib
253+
if (TARGET utils-image)
254+
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:utils-image> DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
255+
endif()
256+
257+
# Copy UTILS-XZ lib
258+
if (TARGET utils-image)
259+
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:utils-xz> DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
260+
endif()
261+
262+
252263
#OpenSSL
253264
find_package(OpenSSL)
254265
if(OPENSSL_FOUND)
@@ -329,7 +340,7 @@ macro(DeployUnix TARGET)
329340
endif()
330341

331342
# Create a qt.conf file in 'share/hyperhdr/bin' to override hard-coded search paths in Qt plugins
332-
file(WRITE "${CMAKE_BINARY_DIR}/qt.conf" "[Paths]\nPlugins=../lib/\n")
343+
file(WRITE "${CMAKE_BINARY_DIR}/qt.conf" "[Paths]\nPlugins=../lib/plugins/\n")
333344
install(
334345
FILES "${CMAKE_BINARY_DIR}/qt.conf"
335346
DESTINATION "share/hyperhdr/bin"
@@ -400,6 +411,20 @@ macro(DeployUnix TARGET)
400411
"libblkid"
401412
"libbrotlicommon"
402413
"libbrotlidec"
414+
"libffi"
415+
"libgio-2"
416+
"libgmodule-2"
417+
"libgobject-2"
418+
"libidn2"
419+
"libnghttp"
420+
"libsystemd"
421+
"libpsl"
422+
"libunistring"
423+
"libssh"
424+
"libselinux"
425+
"libevent-2"
426+
"libldap"
427+
"libutils"
403428
)
404429

405430
#message(STATUS "Collecting Dependencies for target file: ${TARGET_FILE}")
@@ -429,7 +454,7 @@ macro(DeployUnix TARGET)
429454
endforeach()
430455
endif()
431456

432-
# Copy Qt plugins to 'share/hyperhdr/lib'
457+
# Copy Qt plugins to 'share/hyperhdr/lib/plugins'
433458
foreach(PLUGIN "tls")
434459
#message(WARNING "Collecting Dependencies for QT plugin folder: ${PLUGIN}")
435460
if(EXISTS ${QT_PLUGINS_DIR}/${PLUGIN})
@@ -443,7 +468,7 @@ macro(DeployUnix TARGET)
443468
list(APPEND DEPENDENCIES ${QT_DEPENDENCIES})
444469

445470
file(INSTALL
446-
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib/${PLUGIN}"
471+
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib/plugins/${PLUGIN}"
447472
TYPE SHARED_LIBRARY
448473
FILES ${file}
449474
)
@@ -471,17 +496,30 @@ macro(DeployUnix TARGET)
471496
gp_append_unique(PREREQUISITE_LIBS ${resolved_file})
472497
get_filename_component(file_canonical ${resolved_file} REALPATH)
473498
gp_append_unique(PREREQUISITE_LIBS ${file_canonical})
474-
#message(STATUS "Basic check added: ${resolved_file}")
499+
#message("Basic check added: ${resolved_file} (${resolved})")
475500
endif()
476501
endforeach()
477502

478-
# Copy dependencies to 'share/hyperhdr/lib'
503+
# Copy dependencies to 'share/hyperhdr/lib/external'
479504
foreach(PREREQUISITE_LIB ${PREREQUISITE_LIBS})
480-
message("Installing: " ${PREREQUISITE_LIB})
505+
set(FILE_TO_INSTALL ${PREREQUISITE_LIB})
506+
string(FIND ${PREREQUISITE_LIB} "libproxy" libproxyindex)
507+
string(FIND ${PREREQUISITE_LIB} "libpxbackend" libpxbackendindex)
508+
if((NOT IS_SYMLINK ${PREREQUISITE_LIB}) AND (${libproxyindex} GREATER -1 OR ${libpxbackendindex} GREATER -1))
509+
get_filename_component(pathingFilename ${PREREQUISITE_LIB} NAME)
510+
set(FILE_TO_INSTALL "${CMAKE_BINARY_DIR}/${pathingFilename}")
511+
message("Patching RPATH: ${FILE_TO_INSTALL}")
512+
file(COPY_FILE ${PREREQUISITE_LIB} ${FILE_TO_INSTALL} )
513+
execute_process (
514+
COMMAND bash -c "chrpath -d ${FILE_TO_INSTALL}"
515+
OUTPUT_VARIABLE outputResult
516+
)
517+
endif()
518+
message("Installing: " ${FILE_TO_INSTALL})
481519
file(
482520
INSTALL
483-
FILES ${PREREQUISITE_LIB}
484-
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib"
521+
FILES ${FILE_TO_INSTALL}
522+
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hyperhdr/lib/external"
485523
TYPE SHARED_LIBRARY
486524
)
487525
endforeach()

0 commit comments

Comments
 (0)