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:
|
files:
|
||||||
exclude:
|
exclude:
|
||||||
- etc
|
- etc
|
||||||
- lib/udev
|
- usr/[a-km-rt-zA-Z]* # * except lib, local, share
|
||||||
- opt/libc/usr/share
|
- usr/lib/*/libasound.so.* # using our own ALSA can cause issues, and the API is pretty stable anyway
|
||||||
- usr/[a-km-rt-zA-Z]*
|
- usr/lib/*.a # produced by library compilation
|
||||||
- usr/lib/*/libasound.so.*
|
- usr/lib/cmake # produced by library compilation
|
||||||
- usr/lib/*.a
|
- usr/lib/pkgconfig # produced by library compilation
|
||||||
- usr/lib/cmake
|
- usr/s[a-gi-zA-Z]* # s* except share
|
||||||
- usr/lib/pkgconfig
|
- usr/share/[a-hj-ln-zA-Z]* # * except icons, metainfo
|
||||||
- usr/s[a-gi-zA-Z]*
|
- usr/share/i[a-bd-zA-Z]* # i* except icons
|
||||||
- usr/share/[a-hj-ln-zA-Z]*
|
- usr/share/m[a-df-zA-Z]* # m* except metainfo
|
||||||
- usr/share/i[a-bd-zA-Z]*
|
- usr/share/metainfo/*.metainfo.xml # metainfo for libraries
|
||||||
- usr/share/m[a-df-zA-Z]*
|
|
||||||
- usr/share/metainfo/*.metainfo.xml
|
|
||||||
- var
|
- var
|
||||||
AppImage:
|
AppImage:
|
||||||
arch: !ENV '${arch_appimage}'
|
arch: !ENV '${arch_appimage}'
|
||||||
file_name: '-n' # nasty hack to disable metainfo validation
|
file_name: !ENV '${appimage_path}'
|
||||||
|
|||||||
40
.ci/build.sh
40
.ci/build.sh
@@ -136,6 +136,7 @@ package_name=
|
|||||||
arch=
|
arch=
|
||||||
tarball_name=
|
tarball_name=
|
||||||
skip_archive=0
|
skip_archive=0
|
||||||
|
dep_report=0
|
||||||
strip=0
|
strip=0
|
||||||
cmake_flags=
|
cmake_flags=
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
@@ -154,6 +155,11 @@ do
|
|||||||
skip_archive=1
|
skip_archive=1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-p)
|
||||||
|
shift
|
||||||
|
dep_report=1
|
||||||
|
;;
|
||||||
|
|
||||||
-s)
|
-s)
|
||||||
shift
|
shift
|
||||||
tarball_name="$1"
|
tarball_name="$1"
|
||||||
@@ -166,6 +172,9 @@ do
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
# Consume remaining arguments as CMake flags.
|
||||||
|
while [ $# -gt 0 ]
|
||||||
|
do
|
||||||
if echo $1 | grep -q " "
|
if echo $1 | grep -q " "
|
||||||
then
|
then
|
||||||
cmake_flag="\"$1\""
|
cmake_flag="\"$1\""
|
||||||
@@ -179,6 +188,7 @@ do
|
|||||||
cmake_flags="$cmake_flags $cmake_flag"
|
cmake_flags="$cmake_flags $cmake_flag"
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
|
done
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -609,6 +619,7 @@ else
|
|||||||
|
|
||||||
# Establish general dependencies.
|
# Establish general dependencies.
|
||||||
pkgs="cmake ninja-build pkg-config git wget p7zip-full extra-cmake-modules wayland-protocols tar gzip file appstream"
|
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" ]
|
if [ "$(dpkg --print-architecture)" = "$arch_deb" ]
|
||||||
then
|
then
|
||||||
pkgs="$pkgs build-essential"
|
pkgs="$pkgs build-essential"
|
||||||
@@ -957,7 +968,7 @@ else
|
|||||||
sdl_ss=ON
|
sdl_ss=ON
|
||||||
fi
|
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
|
sdl_ui=OFF
|
||||||
grep -qiE "^QT:BOOL=ON" build/CMakeCache.txt || sdl_ui=ON
|
grep -qiE "^QT:BOOL=ON" build/CMakeCache.txt || sdl_ui=ON
|
||||||
|
|
||||||
@@ -1088,7 +1099,7 @@ else
|
|||||||
|
|
||||||
# Generate modified AppImage metadata to suit build requirements.
|
# Generate modified AppImage metadata to suit build requirements.
|
||||||
cat << EOF > AppImageBuilder-generated.yml
|
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.
|
# overwritten if edited. Please edit .ci/AppImageBuilder.yml instead.
|
||||||
EOF
|
EOF
|
||||||
while IFS= read line
|
while IFS= read line
|
||||||
@@ -1096,7 +1107,7 @@ EOF
|
|||||||
# Skip blank or comment lines.
|
# Skip blank or comment lines.
|
||||||
echo "$line" | grep -qE '^(#|$)' && continue
|
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(.+)')
|
condition=$(echo "$line" | grep -oP '# if \K(.+)')
|
||||||
if [ -n "$condition" ]
|
if [ -n "$condition" ]
|
||||||
then
|
then
|
||||||
@@ -1109,7 +1120,7 @@ EOF
|
|||||||
done < .ci/AppImageBuilder.yml
|
done < .ci/AppImageBuilder.yml
|
||||||
|
|
||||||
# Download appimage-builder if necessary.
|
# 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")"
|
appimage_builder_binary="$cache_dir/$(basename "$appimage_builder_url")"
|
||||||
if [ ! -e "$appimage_builder_binary" ]
|
if [ ! -e "$appimage_builder_binary" ]
|
||||||
then
|
then
|
||||||
@@ -1125,18 +1136,23 @@ EOF
|
|||||||
ln -s "$cache_dir/appimage-builder-cache" appimage-builder-cache
|
ln -s "$cache_dir/appimage-builder-cache" appimage-builder-cache
|
||||||
|
|
||||||
# Run appimage-builder in extract-and-run mode for Docker compatibility.
|
# 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" \
|
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=$?
|
status=$?
|
||||||
|
|
||||||
# Rename AppImage to the final name if the build succeeded.
|
# Remove appimage-builder binary on failure, just in case it's corrupted.
|
||||||
if [ $status -eq 0 ]
|
[ $status -ne 0 ] && rm -f "$appimage_builder_binary"
|
||||||
|
|
||||||
|
# Generate library dependency report if requested.
|
||||||
|
if [ $dep_report -ne 0 ]
|
||||||
then
|
then
|
||||||
mv "$project-"*".AppImage" "$cwd/$package_name.AppImage"
|
echo '[-] Library dependency report:'
|
||||||
status=$?
|
|
||||||
else
|
# Run lddtree with AppImage lib directories included in the search path.
|
||||||
# Remove appimage-builder binary just in case it's corrupted.
|
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' ':') \
|
||||||
rm -f "$appimage_builder_binary"
|
lddtree "archive_tmp/usr/local/bin/$project" 2>&1 | tee depreport.txt
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user