diff --git a/.ci/AppImageBuilder.yml b/.ci/AppImageBuilder.yml index be2a7f1c1..05a7b8fcb 100644 --- a/.ci/AppImageBuilder.yml +++ b/.ci/AppImageBuilder.yml @@ -72,19 +72,22 @@ 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/[!ls]* # * 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[!h]* # s* except share + - usr/share/[!aim]* # * except applications, icons, metainfo + - usr/share/a[!p]* # a* except applications + - usr/share/ap[!p]* # ap* except applications + - usr/share/app[!l]* # app* except applications + - usr/share/i[!c]* # i* except icons + - usr/share/icons/[!h]* # * except hicolor + - usr/share/icons/h[!i]* # h* except hicolor + - usr/share/m[!e]* # 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}' diff --git a/.ci/build.sh b/.ci/build.sh index 320451a83..58d5e50c7 100644 --- a/.ci/build.sh +++ b/.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 @@ -545,8 +555,8 @@ then # Switch into the correct architecture if required. case $arch in - x86_64*) arch_mac="i386";; - *) arch_mac="$arch";; + x86_64*) arch_mac="i386"; arch_cmd="x86_64";; + *) arch_mac="$arch"; arch_cmd="$arch";; esac if [ "$(arch)" != "$arch" -a "$(arch)" != "$arch_mac" ] then @@ -556,7 +566,7 @@ then args= [ $strip -ne 0 ] && args="-t $args" [ $skip_archive -ne 0 ] && args="-n $args" - arch -"$arch" zsh -lc 'exec "'"$0"'" -b "'"$package_name"'" "'"$arch"'" '"$args""$cmake_flags" + arch -"$arch_cmd" zsh -lc 'exec "'"$0"'" -b "'"$package_name"'" "'"$arch"'" '"$args""$cmake_flags" exit $? fi echo [-] Using architecture [$(arch)] @@ -589,7 +599,21 @@ then sudo sed -i -e 's/-no-feature-vulkan/-feature-vulkan/g' "$qt5_portfile" sudo sed -i -e 's/configure.env-append MAKE=/configure.env-append VULKAN_SDK=${prefix} MAKE=/g' "$qt5_portfile" fi - sudo "$macports/bin/port" install $(cat .ci/dependencies_macports.txt) + while : + do + # Attempt to install dependencies. + sudo "$macports/bin/port" install $(cat .ci/dependencies_macports.txt) 2>&1 | tee macports.log + + # Stop if no port version activation errors were found. + stuck_dep=$(grep " cannot be built while another version of " macports.log | cut -d" " -f2) + [ -z $stuck_dep ] && break + + # Deactivate the stuck dependency and try again. + sudo "$macports/bin/port" -f deactivate $stuck_dep + done + + # Remove MacPorts error detection log. + rm -f macports.log # Save build tag to skip this later. Doing it here (once everything is # in place) is important to avoid potential issues with retried builds. @@ -609,6 +633,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 +982,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 @@ -1024,11 +1049,18 @@ else metainfo_base=archive_tmp/usr/share/metainfo mkdir -p "$metainfo_base" cp -p "src/unix/assets/$project_id."*".xml" "$metainfo_base/$project_id.appdata.xml" + applications_base=archive_tmp/usr/share/applications + mkdir -p "$applications_base" + cp -p "src/unix/assets/$project_id.desktop" "$applications_base/" # Archive icons. - icon_base=archive_tmp/usr/share/icons - mkdir -p "$icon_base" - cp -rp src/unix/assets/[0-9]*x[0-9]* "$icon_base/" + icon_base=archive_tmp/usr/share/icons/hicolor + for icon_size in src/unix/assets/[0-9]*x[0-9]* + do + icon_dir="$icon_base/$(basename "$icon_size")" + mkdir -p "$icon_dir" + cp -rp "$icon_size" "$icon_dir/apps" + done project_icon=$(ls "$icon_base/"[0-9]*x[0-9]*/* | head -1 | grep -oP '/\K([^/]+)(?=\.[^\.]+$)') # Archive executable, while also stripping it if requested. @@ -1088,7 +1120,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 +1128,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 +1141,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 +1157,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 diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index 63efbed50..023f94d5b 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -2410,6 +2410,7 @@ machine_amstrad_init(const machine_t *model, int type) if (mouse_type == MOUSE_TYPE_INTERNAL) { /* Tell mouse driver about our internal mouse. */ mouse_reset(); + mouse_set_buttons(2); mouse_set_poll(ms_poll, ams); } diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index 1d53a588e..2271035b8 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -426,6 +426,7 @@ m24_kbd_init(m24_kbd_t *kbd) /* Tell mouse driver about our internal mouse. */ mouse_reset(); + mouse_set_buttons(2); mouse_set_poll(ms_poll, kbd); keyboard_set_table(scancode_xt); diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index 7308f8f91..bea1af22f 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -491,7 +491,7 @@ void MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type) { menu = cdromMenus[index]; children = menu->children(); imageHistoryUpdatePos = dynamic_cast(children[cdromImageHistoryPos[slot]]); - fi = mhm.getImageForSlot(index, slot, type); + fi.setFile(mhm.getImageForSlot(index, slot, type)); menu_icon = fi.isDir() ? QApplication::style()->standardIcon(QStyle::SP_DirIcon) : ProgSettings::loadIcon("/cdrom.ico"); imageHistoryUpdatePos->setIcon(menu_icon); break; @@ -501,7 +501,7 @@ void MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type) { menu = floppyMenus[index]; children = menu->children(); imageHistoryUpdatePos = dynamic_cast(children[floppyImageHistoryPos[slot]]); - fi = mhm.getImageForSlot(index, slot, type); + fi.setFile(mhm.getImageForSlot(index, slot, type)); break; default: pclog("History not yet implemented for media type %s\n", qPrintable(mhm.mediaTypeToString(type)));