Jenkins: Update AppImage generation flow to appimage-builder v1.1.0, and add lib dependency report feature to build script
This commit is contained in:
@@ -72,19 +72,17 @@ AppDir:
|
||||
files:
|
||||
exclude:
|
||||
- etc
|
||||
- lib/udev
|
||||
- opt/libc/usr/share
|
||||
- usr/[a-km-rt-zA-Z]*
|
||||
- usr/lib/*/libasound.so.*
|
||||
- usr/lib/*.a
|
||||
- usr/lib/cmake
|
||||
- usr/lib/pkgconfig
|
||||
- usr/s[a-gi-zA-Z]*
|
||||
- usr/share/[a-hj-ln-zA-Z]*
|
||||
- usr/share/i[a-bd-zA-Z]*
|
||||
- usr/share/m[a-df-zA-Z]*
|
||||
- usr/share/metainfo/*.metainfo.xml
|
||||
- usr/[a-km-rt-zA-Z]* # * except lib, local, share
|
||||
- usr/lib/*/libasound.so.* # using our own ALSA can cause issues, and the API is pretty stable anyway
|
||||
- usr/lib/*.a # produced by library compilation
|
||||
- usr/lib/cmake # produced by library compilation
|
||||
- usr/lib/pkgconfig # produced by library compilation
|
||||
- usr/s[a-gi-zA-Z]* # s* except share
|
||||
- usr/share/[a-hj-ln-zA-Z]* # * except icons, metainfo
|
||||
- usr/share/i[a-bd-zA-Z]* # i* except icons
|
||||
- usr/share/m[a-df-zA-Z]* # m* except metainfo
|
||||
- usr/share/metainfo/*.metainfo.xml # metainfo for libraries
|
||||
- var
|
||||
AppImage:
|
||||
arch: !ENV '${arch_appimage}'
|
||||
file_name: '-n' # nasty hack to disable metainfo validation
|
||||
file_name: !ENV '${appimage_path}'
|
||||
|
66
.ci/build.sh
66
.ci/build.sh
@@ -136,6 +136,7 @@ package_name=
|
||||
arch=
|
||||
tarball_name=
|
||||
skip_archive=0
|
||||
dep_report=0
|
||||
strip=0
|
||||
cmake_flags=
|
||||
while [ $# -gt 0 ]
|
||||
@@ -154,6 +155,11 @@ do
|
||||
skip_archive=1
|
||||
;;
|
||||
|
||||
-p)
|
||||
shift
|
||||
dep_report=1
|
||||
;;
|
||||
|
||||
-s)
|
||||
shift
|
||||
tarball_name="$1"
|
||||
@@ -166,19 +172,23 @@ do
|
||||
;;
|
||||
|
||||
*)
|
||||
if echo $1 | grep -q " "
|
||||
then
|
||||
cmake_flag="\"$1\""
|
||||
else
|
||||
cmake_flag="$1"
|
||||
fi
|
||||
if [ -z "$cmake_flags" ]
|
||||
then
|
||||
cmake_flags="$cmake_flag"
|
||||
else
|
||||
cmake_flags="$cmake_flags $cmake_flag"
|
||||
fi
|
||||
shift
|
||||
# Consume remaining arguments as CMake flags.
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
if echo $1 | grep -q " "
|
||||
then
|
||||
cmake_flag="\"$1\""
|
||||
else
|
||||
cmake_flag="$1"
|
||||
fi
|
||||
if [ -z "$cmake_flags" ]
|
||||
then
|
||||
cmake_flags="$cmake_flag"
|
||||
else
|
||||
cmake_flags="$cmake_flags $cmake_flag"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -609,6 +619,7 @@ else
|
||||
|
||||
# Establish general dependencies.
|
||||
pkgs="cmake ninja-build pkg-config git wget p7zip-full extra-cmake-modules wayland-protocols tar gzip file appstream"
|
||||
[ $dep_report -ne 0 ] && pkgs="$pkgs pax-utils"
|
||||
if [ "$(dpkg --print-architecture)" = "$arch_deb" ]
|
||||
then
|
||||
pkgs="$pkgs build-essential"
|
||||
@@ -957,7 +968,7 @@ else
|
||||
sdl_ss=ON
|
||||
fi
|
||||
|
||||
# Build SDL2 with video systems (and some dependencies) only if the SDL interface is used.
|
||||
# Build SDL2 with video systems (and dependencies) only if the SDL interface is used.
|
||||
sdl_ui=OFF
|
||||
grep -qiE "^QT:BOOL=ON" build/CMakeCache.txt || sdl_ui=ON
|
||||
|
||||
@@ -1088,7 +1099,7 @@ else
|
||||
|
||||
# Generate modified AppImage metadata to suit build requirements.
|
||||
cat << EOF > AppImageBuilder-generated.yml
|
||||
# This file is generated automatically by .ci/build.sh and will be
|
||||
# This file is automatically generated by .ci/build.sh and will be
|
||||
# overwritten if edited. Please edit .ci/AppImageBuilder.yml instead.
|
||||
EOF
|
||||
while IFS= read line
|
||||
@@ -1096,7 +1107,7 @@ EOF
|
||||
# Skip blank or comment lines.
|
||||
echo "$line" | grep -qE '^(#|$)' && continue
|
||||
|
||||
# Parse "# if OPTION VALUE" condition lines.
|
||||
# Parse "# if OPTION:TYPE=VALUE" CMake condition lines.
|
||||
condition=$(echo "$line" | grep -oP '# if \K(.+)')
|
||||
if [ -n "$condition" ]
|
||||
then
|
||||
@@ -1109,7 +1120,7 @@ EOF
|
||||
done < .ci/AppImageBuilder.yml
|
||||
|
||||
# Download appimage-builder if necessary.
|
||||
appimage_builder_url="https://github.com/AppImageCrafters/appimage-builder/releases/download/v0.9.2/appimage-builder-0.9.2-35e3eab-x86_64.AppImage"
|
||||
appimage_builder_url="https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-$(uname -m).AppImage"
|
||||
appimage_builder_binary="$cache_dir/$(basename "$appimage_builder_url")"
|
||||
if [ ! -e "$appimage_builder_binary" ]
|
||||
then
|
||||
@@ -1125,18 +1136,23 @@ EOF
|
||||
ln -s "$cache_dir/appimage-builder-cache" appimage-builder-cache
|
||||
|
||||
# Run appimage-builder in extract-and-run mode for Docker compatibility.
|
||||
# --appdir is a workaround for https://github.com/AppImageCrafters/appimage-builder/issues/270
|
||||
project="$project" project_id="$project_id" project_version="$project_version" project_icon="$project_icon" arch_deb="$arch_deb" \
|
||||
arch_appimage="$arch_appimage" APPIMAGE_EXTRACT_AND_RUN=1 ./appimage-builder.AppImage --recipe AppImageBuilder-generated.yml
|
||||
arch_appimage="$arch_appimage" appimage_path="$cwd/$package_name.AppImage" APPIMAGE_EXTRACT_AND_RUN=1 ./appimage-builder.AppImage \
|
||||
--recipe AppImageBuilder-generated.yml --appdir "$(grep -oP '^\s+path: \K(.+)' AppImageBuilder-generated.yml)"
|
||||
status=$?
|
||||
|
||||
# Rename AppImage to the final name if the build succeeded.
|
||||
if [ $status -eq 0 ]
|
||||
# Remove appimage-builder binary on failure, just in case it's corrupted.
|
||||
[ $status -ne 0 ] && rm -f "$appimage_builder_binary"
|
||||
|
||||
# Generate library dependency report if requested.
|
||||
if [ $dep_report -ne 0 ]
|
||||
then
|
||||
mv "$project-"*".AppImage" "$cwd/$package_name.AppImage"
|
||||
status=$?
|
||||
else
|
||||
# Remove appimage-builder binary just in case it's corrupted.
|
||||
rm -f "$appimage_builder_binary"
|
||||
echo '[-] Library dependency report:'
|
||||
|
||||
# Run lddtree with AppImage lib directories included in the search path.
|
||||
LD_LIBRARY_PATH=$(find "$(pwd)/archive_tmp" -type d -name lib -o -name lib64 | while read dir; do find "$dir" -type d; done | tr '\n' ':') \
|
||||
lddtree "archive_tmp/usr/local/bin/$project" 2>&1 | tee depreport.txt
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user