From 952d8d965456e789c2fe02a52f97370320b2d06f Mon Sep 17 00:00:00 2001 From: tobtoht Date: Wed, 21 Dec 2022 16:15:22 +0100 Subject: [PATCH] Bootstrappable builds (WIP) [2] --- .dockerignore | 4 - .gitignore | 1 + CMakeLists.txt | 159 +- HACKING.md | 15 +- Makefile | 110 - cmake/Deploy.cmake | 29 - cmake/FindZlib.cmake | 21 - contrib/AppImage/AppRun | 3 - contrib/AppImage/build-appimage.sh | 43 + contrib/AppImage/gst-plugin-scanner.sh | 17 - contrib/QTBUG-92199-fix.patch | 46 - contrib/build-appimage-arm64.sh | 79 - contrib/build-appimage.sh | 62 - contrib/build-deps/Dockerfile.linux-builddeps | 61 - contrib/build-deps/get-packages.sh | 25 - contrib/build-deps/verify-packages.sh | 37 - contrib/depends/Makefile | 27 +- contrib/depends/config.guess | 662 +- contrib/depends/config.site.in | 154 - contrib/depends/config.sub | 2841 +++--- contrib/depends/hosts/darwin.mk | 1 + contrib/depends/hosts/default.mk | 3 +- contrib/depends/packages/appimage_runtime.mk | 24 + contrib/depends/packages/boost.mk | 8 +- contrib/depends/packages/expat.mk | 3 +- contrib/depends/packages/graphviz.mk | 30 - contrib/depends/packages/gtest.mk | 39 - contrib/depends/packages/libICE.mk | 23 - contrib/depends/packages/libSM.mk | 23 - contrib/depends/packages/libappimage.mk | 25 + contrib/depends/packages/libarchive.mk | 26 + contrib/depends/packages/libfuse.mk | 18 + contrib/depends/packages/libgcrypt.mk | 7 +- contrib/depends/packages/libiconv.mk | 12 +- contrib/depends/packages/liblzma.mk | 24 + contrib/depends/packages/libsquashfuse.mk | 45 + contrib/depends/packages/libusb.mk | 3 +- contrib/depends/packages/native_ds_store.mk | 2 +- contrib/depends/packages/native_expat.mk | 32 + .../{fontconfig.mk => native_fontconfig.mk} | 6 +- .../{freetype.mk => native_freetype.mk} | 12 +- .../packages/{libXau.mk => native_libXau.mk} | 8 +- .../packages/{libxcb.mk => native_libxcb.mk} | 6 +- .../{libxcb_util.mk => native_libxcb_util.mk} | 4 +- ...l_image.mk => native_libxcb_util_image.mk} | 4 +- ...ysyms.mk => native_libxcb_util_keysyms.mk} | 4 +- ...render.mk => native_libxcb_util_render.mk} | 4 +- ...cb_util_wm.mk => native_libxcb_util_wm.mk} | 4 +- ...libxkbcommon.mk => native_libxkbcommon.mk} | 6 +- contrib/depends/packages/native_qmake.mk | 60 - contrib/depends/packages/native_qt.mk | 218 + .../{xcb_proto.mk => native_xcb_proto.mk} | 2 +- .../packages/{xproto.mk => native_xproto.mk} | 8 +- contrib/depends/packages/ncurses.mk | 64 - contrib/depends/packages/openssl.mk | 10 +- contrib/depends/packages/packages.mk | 24 +- contrib/depends/packages/qrencode.mk | 10 +- contrib/depends/packages/qt.mk | 240 +- contrib/depends/packages/readline.mk | 29 - contrib/depends/packages/sodium.mk | 7 +- contrib/depends/packages/tor-win.mk | 13 - .../packages/{tor-macos.mk => tor_darwin.mk} | 10 +- .../depends/packages/{tor.mk => tor_linux.mk} | 2 +- contrib/depends/packages/tor_mingw32.mk | 10 + contrib/depends/packages/unbound.mk | 3 - contrib/depends/packages/zlib.mk | 8 +- .../patches/appimage_runtime/CMakeLists.txt | 135 + .../depends/patches/appimage_runtime/notify.c | 78 + .../patches/appimage_runtime/runtime.c | 946 ++ .../libappimage/no-unneeded-deps.patch | 163 + .../patches/libsquashfuse/squashfuse.patch | 57 + .../patches/libsquashfuse/squashfuse_dlopen.c | 11 + .../patches/libsquashfuse/squashfuse_dlopen.h | 262 + .../libsquashfuse/squashfuse_dlopen.patch | 640 ++ .../gperf_header_regen.patch | 0 .../remove_pthread_stubs.patch | 0 contrib/depends/patches/native_qmake/qt.pro | 19 - .../patches/native_qt/QTBUG-92199-fix.patch | 59 + .../patches/native_qt/dont_hardcode_pwd.patch | 25 + .../fast_fixed_dtoa_no_optimize.patch | 20 + .../fix_rcc_determinism.patch | 0 .../native_qt/guix_cross_lib_path.patch | 17 + .../depends/patches/native_qt/mac-qmake.conf | 22 + .../patches/native_qt/no-renameat2.patch | 42 + .../depends/patches/native_qt/no-statx.patch | 56 + .../{native_qmake => native_qt}/no-xlib.patch | 43 +- .../native_qt/no_pthread_cond_clockwait.patch | 174 + .../qtbase-moc-ignore-gcc-macro.patch | 17 + .../native_qt/rcc_hardcode_timestamp.patch | 24 + .../patches/native_qt/root_CMakeLists.txt | 51 + contrib/depends/patches/ncurses/fallback.c | 6621 ------------ contrib/depends/patches/qt/MacToolchain.cmake | 25 + .../depends/patches/qt/QTBUG-92199-fix.patch | 59 + .../depends/patches/qt/WindowsToolchain.cmake | 15 + .../qt/___isOSVersionAtLeast_hack.patch | 151 + .../patches/qt/dont_capitalize_wmf_libs.patch | 33 + .../patches/qt/dont_hardcode_pwd.patch | 12 +- .../patches/qt/dont_hardcode_x86_64.patch | 119 - .../patches/qt/duplicate_lcqpafonts.patch | 104 - .../qt/fast_fixed_dtoa_no_optimize.patch | 4 +- .../patches/qt/fix_android_jni_static.patch | 18 - .../qt/fix_include_capitalization.patch | 159 + .../patches/qt/fix_limits_header.patch | 33 - .../patches/qt/fix_montery_include.patch | 21 - .../depends/patches/qt/fix_no_printer.patch | 19 - .../depends/patches/qt/fix_qt_pkgconfig.patch | 11 - .../patches/qt/guix_cross_lib_path.patch | 2 +- .../depends/patches/qt/missing-include.patch | 24 + .../patches/qt/no-__builtin_available.patch | 26 + contrib/depends/patches/qt/no-ffmpeg.patch | 8973 +++++++++++++++++ contrib/depends/patches/qt/no-renameat2.patch | 42 + contrib/depends/patches/qt/no-statx.patch | 56 + contrib/depends/patches/qt/no-xlib.patch | 31 +- .../qt/no_pthread_cond_clockwait.patch | 174 + .../patches/qt/no_wraprt_on_apple.patch | 27 + contrib/depends/patches/qt/qt.pro | 18 - .../qt/qtbase-moc-ignore-gcc-macro.patch | 2 +- contrib/depends/patches/qt/qttools_src.pro | 6 - .../patches/qt/rcc_hardcode_timestamp.patch | 2 +- .../depends/patches/qt/root_CMakeLists.txt | 51 + .../patches/qt/use_android_ndk23.patch | 13 - .../depends/patches/qt/windows_func_fix.patch | 48 + contrib/depends/patches/sodium/ac.patch | 110 + .../depends/patches/sodium/fix-arm64.patch | 25 + ...a27b04c5822cb88a69677382a0f053367143.patch | 22 - contrib/depends/toolchain.cmake.in | 23 +- contrib/guix/README.md | 34 +- contrib/guix/guix-build | 20 +- contrib/guix/libexec/build.sh | 197 +- contrib/guix/libexec/prelude.bash | 3 +- contrib/guix/manifest.scm | 116 +- .../elfsteem-value-error-python-39.patch | 13 - .../patches/gcc-10-remap-guix-store.patch | 25 + .../guix/patches/glibc-2.24-guix-prefix.patch | 25 + .../guix/patches/glibc-2.27-guix-prefix.patch | 25 + .../patches/lief-fix-ppc64-nx-default.patch | 29 + .../nsis-disable-installer-reloc.patch | 30 + contrib/installers/windows/setup.nsi.in | 121 + .../macdeploy/Info.plist.in | 48 +- contrib/macdeploy/README.md | 112 + contrib/macdeploy/background.tiff | Bin 0 -> 18464 bytes contrib/macdeploy/detached-sig-create.sh | 31 + contrib/macdeploy/gen-sdk | 116 + contrib/macdeploy/macdeployqtplus | 597 ++ contrib/monero-seed/CMakeLists.txt | 50 - contrib/monero-seed/src/main.cpp | 106 - .../patches/polyseed/force-static-mingw.patch | 23 - contrib/patches/polyseed/no_shared.patch | 42 - src/CMakeLists.txt | 99 +- src/SendWidget.cpp | 4 +- src/cli.cpp | 138 - src/cli.h | 35 - src/main.cpp | 47 - .../monero_seed}/LICENSE.txt | 0 .../monero-seed => src/monero_seed}/README.md | 63 +- .../src => src/monero_seed}/argon2/argon2.c | 0 .../src => src/monero_seed}/argon2/argon2.h | 0 .../monero_seed}/argon2/blake2/blake2-impl.h | 0 .../monero_seed}/argon2/blake2/blake2.h | 0 .../monero_seed}/argon2/blake2/blake2b.c | 0 .../argon2/blake2/blamka-round-ref.h | 0 .../src => src/monero_seed}/argon2/core.c | 0 .../src => src/monero_seed}/argon2/core.h | 0 .../src => src/monero_seed}/argon2/ref.c | 0 .../src => src/monero_seed}/galois_field.cpp | 0 .../monero_seed/galois_field.hpp | 0 .../src => src/monero_seed}/gf_elem.cpp | 0 .../include => src}/monero_seed/gf_elem.hpp | 0 .../src => src/monero_seed}/gf_poly.cpp | 0 .../include => src}/monero_seed/gf_poly.hpp | 0 .../src => src/monero_seed}/monero_seed.cpp | 0 .../monero_seed/monero_seed.hpp | 0 .../src => src/monero_seed}/pbkdf2.c | 0 .../src => src/monero_seed}/pbkdf2.h | 0 .../monero_seed}/reed_solomon_code.cpp | 0 .../monero_seed/reed_solomon_code.hpp | 0 .../src => src/monero_seed}/secure_random.cpp | 0 .../monero_seed/secure_random.hpp | 0 .../monero_seed}/sha256/hash_impl.h | 0 .../src => src/monero_seed}/wordlist.cpp | 0 .../include => src}/monero_seed/wordlist.hpp | 0 src/qrcode_scanner_qt6/CMakeLists.txt | 3 + src/qrcode_scanner_qt6/QrCodeScanDialog.cpp | 29 + src/qrcode_scanner_qt6/QrCodeScanDialog.h | 32 + src/qrcode_scanner_qt6/QrCodeScanDialog.ui | 75 + src/utils/RestoreHeightLookup.h | 2 +- src/utils/brute.cpp | 125 - src/utils/brute.h | 50 - utils/build_macos.sh | 25 - 189 files changed, 16849 insertions(+), 11101 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Makefile delete mode 100644 cmake/Deploy.cmake delete mode 100644 cmake/FindZlib.cmake create mode 100755 contrib/AppImage/build-appimage.sh delete mode 100644 contrib/AppImage/gst-plugin-scanner.sh delete mode 100644 contrib/QTBUG-92199-fix.patch delete mode 100755 contrib/build-appimage-arm64.sh delete mode 100755 contrib/build-appimage.sh delete mode 100644 contrib/build-deps/Dockerfile.linux-builddeps delete mode 100644 contrib/build-deps/get-packages.sh delete mode 100644 contrib/build-deps/verify-packages.sh delete mode 100644 contrib/depends/config.site.in create mode 100644 contrib/depends/packages/appimage_runtime.mk delete mode 100644 contrib/depends/packages/graphviz.mk delete mode 100644 contrib/depends/packages/gtest.mk delete mode 100644 contrib/depends/packages/libICE.mk delete mode 100644 contrib/depends/packages/libSM.mk create mode 100644 contrib/depends/packages/libappimage.mk create mode 100644 contrib/depends/packages/libarchive.mk create mode 100644 contrib/depends/packages/libfuse.mk create mode 100644 contrib/depends/packages/liblzma.mk create mode 100644 contrib/depends/packages/libsquashfuse.mk create mode 100644 contrib/depends/packages/native_expat.mk rename contrib/depends/packages/{fontconfig.mk => native_fontconfig.mk} (85%) rename contrib/depends/packages/{freetype.mk => native_freetype.mk} (63%) rename contrib/depends/packages/{libXau.mk => native_libXau.mk} (84%) rename contrib/depends/packages/{libxcb.mk => native_libxcb.mk} (91%) rename contrib/depends/packages/{libxcb_util.mk => native_libxcb_util.mk} (92%) rename contrib/depends/packages/{libxcb_util_image.mk => native_libxcb_util_image.mk} (89%) rename contrib/depends/packages/{libxcb_util_keysyms.mk => native_libxcb_util_keysyms.mk} (90%) rename contrib/depends/packages/{libxcb_util_render.mk => native_libxcb_util_render.mk} (91%) rename contrib/depends/packages/{libxcb_util_wm.mk => native_libxcb_util_wm.mk} (92%) rename contrib/depends/packages/{libxkbcommon.mk => native_libxkbcommon.mk} (88%) delete mode 100644 contrib/depends/packages/native_qmake.mk create mode 100644 contrib/depends/packages/native_qt.mk rename contrib/depends/packages/{xcb_proto.mk => native_xcb_proto.mk} (95%) rename contrib/depends/packages/{xproto.mk => native_xproto.mk} (67%) delete mode 100644 contrib/depends/packages/ncurses.mk delete mode 100644 contrib/depends/packages/readline.mk delete mode 100644 contrib/depends/packages/tor-win.mk rename contrib/depends/packages/{tor-macos.mk => tor_darwin.mk} (72%) rename contrib/depends/packages/{tor.mk => tor_linux.mk} (98%) create mode 100644 contrib/depends/packages/tor_mingw32.mk create mode 100644 contrib/depends/patches/appimage_runtime/CMakeLists.txt create mode 100644 contrib/depends/patches/appimage_runtime/notify.c create mode 100644 contrib/depends/patches/appimage_runtime/runtime.c create mode 100644 contrib/depends/patches/libappimage/no-unneeded-deps.patch create mode 100644 contrib/depends/patches/libsquashfuse/squashfuse.patch create mode 100644 contrib/depends/patches/libsquashfuse/squashfuse_dlopen.c create mode 100644 contrib/depends/patches/libsquashfuse/squashfuse_dlopen.h create mode 100644 contrib/depends/patches/libsquashfuse/squashfuse_dlopen.patch rename contrib/depends/patches/{fontconfig => native_fontconfig}/gperf_header_regen.patch (100%) rename contrib/depends/patches/{libxcb => native_libxcb}/remove_pthread_stubs.patch (100%) delete mode 100644 contrib/depends/patches/native_qmake/qt.pro create mode 100644 contrib/depends/patches/native_qt/QTBUG-92199-fix.patch create mode 100644 contrib/depends/patches/native_qt/dont_hardcode_pwd.patch create mode 100644 contrib/depends/patches/native_qt/fast_fixed_dtoa_no_optimize.patch rename contrib/depends/patches/{qt => native_qt}/fix_rcc_determinism.patch (100%) create mode 100644 contrib/depends/patches/native_qt/guix_cross_lib_path.patch create mode 100644 contrib/depends/patches/native_qt/mac-qmake.conf create mode 100644 contrib/depends/patches/native_qt/no-renameat2.patch create mode 100644 contrib/depends/patches/native_qt/no-statx.patch rename contrib/depends/patches/{native_qmake => native_qt}/no-xlib.patch (67%) create mode 100644 contrib/depends/patches/native_qt/no_pthread_cond_clockwait.patch create mode 100644 contrib/depends/patches/native_qt/qtbase-moc-ignore-gcc-macro.patch create mode 100644 contrib/depends/patches/native_qt/rcc_hardcode_timestamp.patch create mode 100644 contrib/depends/patches/native_qt/root_CMakeLists.txt delete mode 100644 contrib/depends/patches/ncurses/fallback.c create mode 100644 contrib/depends/patches/qt/MacToolchain.cmake create mode 100644 contrib/depends/patches/qt/QTBUG-92199-fix.patch create mode 100644 contrib/depends/patches/qt/WindowsToolchain.cmake create mode 100644 contrib/depends/patches/qt/___isOSVersionAtLeast_hack.patch create mode 100644 contrib/depends/patches/qt/dont_capitalize_wmf_libs.patch delete mode 100644 contrib/depends/patches/qt/dont_hardcode_x86_64.patch delete mode 100644 contrib/depends/patches/qt/duplicate_lcqpafonts.patch delete mode 100644 contrib/depends/patches/qt/fix_android_jni_static.patch create mode 100644 contrib/depends/patches/qt/fix_include_capitalization.patch delete mode 100644 contrib/depends/patches/qt/fix_limits_header.patch delete mode 100644 contrib/depends/patches/qt/fix_montery_include.patch delete mode 100644 contrib/depends/patches/qt/fix_no_printer.patch delete mode 100644 contrib/depends/patches/qt/fix_qt_pkgconfig.patch create mode 100644 contrib/depends/patches/qt/missing-include.patch create mode 100644 contrib/depends/patches/qt/no-__builtin_available.patch create mode 100644 contrib/depends/patches/qt/no-ffmpeg.patch create mode 100644 contrib/depends/patches/qt/no-renameat2.patch create mode 100644 contrib/depends/patches/qt/no-statx.patch create mode 100644 contrib/depends/patches/qt/no_pthread_cond_clockwait.patch create mode 100644 contrib/depends/patches/qt/no_wraprt_on_apple.patch delete mode 100644 contrib/depends/patches/qt/qt.pro delete mode 100644 contrib/depends/patches/qt/qttools_src.pro create mode 100644 contrib/depends/patches/qt/root_CMakeLists.txt delete mode 100644 contrib/depends/patches/qt/use_android_ndk23.patch create mode 100644 contrib/depends/patches/qt/windows_func_fix.patch create mode 100644 contrib/depends/patches/sodium/ac.patch create mode 100644 contrib/depends/patches/sodium/fix-arm64.patch delete mode 100644 contrib/depends/patches/zeromq/06aba27b04c5822cb88a69677382a0f053367143.patch delete mode 100644 contrib/guix/patches/elfsteem-value-error-python-39.patch create mode 100644 contrib/guix/patches/gcc-10-remap-guix-store.patch create mode 100644 contrib/guix/patches/glibc-2.24-guix-prefix.patch create mode 100644 contrib/guix/patches/glibc-2.27-guix-prefix.patch create mode 100644 contrib/guix/patches/lief-fix-ppc64-nx-default.patch create mode 100644 contrib/guix/patches/nsis-disable-installer-reloc.patch create mode 100644 contrib/installers/windows/setup.nsi.in rename utils/Info.plist => contrib/macdeploy/Info.plist.in (69%) create mode 100644 contrib/macdeploy/README.md create mode 100644 contrib/macdeploy/background.tiff create mode 100755 contrib/macdeploy/detached-sig-create.sh create mode 100755 contrib/macdeploy/gen-sdk create mode 100755 contrib/macdeploy/macdeployqtplus delete mode 100644 contrib/monero-seed/CMakeLists.txt delete mode 100644 contrib/monero-seed/src/main.cpp delete mode 100644 contrib/patches/polyseed/force-static-mingw.patch delete mode 100644 contrib/patches/polyseed/no_shared.patch delete mode 100644 src/cli.cpp delete mode 100644 src/cli.h rename {contrib/monero-seed => src/monero_seed}/LICENSE.txt (100%) rename {contrib/monero-seed => src/monero_seed}/README.md (63%) rename {contrib/monero-seed/src => src/monero_seed}/argon2/argon2.c (100%) rename {contrib/monero-seed/src => src/monero_seed}/argon2/argon2.h (100%) rename {contrib/monero-seed/src => src/monero_seed}/argon2/blake2/blake2-impl.h (100%) rename {contrib/monero-seed/src => src/monero_seed}/argon2/blake2/blake2.h (100%) rename {contrib/monero-seed/src => src/monero_seed}/argon2/blake2/blake2b.c (100%) rename {contrib/monero-seed/src => src/monero_seed}/argon2/blake2/blamka-round-ref.h (100%) rename {contrib/monero-seed/src => src/monero_seed}/argon2/core.c (100%) rename {contrib/monero-seed/src => src/monero_seed}/argon2/core.h (100%) rename {contrib/monero-seed/src => src/monero_seed}/argon2/ref.c (100%) rename {contrib/monero-seed/src => src/monero_seed}/galois_field.cpp (100%) rename {contrib/monero-seed/include => src}/monero_seed/galois_field.hpp (100%) rename {contrib/monero-seed/src => src/monero_seed}/gf_elem.cpp (100%) rename {contrib/monero-seed/include => src}/monero_seed/gf_elem.hpp (100%) rename {contrib/monero-seed/src => src/monero_seed}/gf_poly.cpp (100%) rename {contrib/monero-seed/include => src}/monero_seed/gf_poly.hpp (100%) rename {contrib/monero-seed/src => src/monero_seed}/monero_seed.cpp (100%) rename {contrib/monero-seed/include => src}/monero_seed/monero_seed.hpp (100%) rename {contrib/monero-seed/src => src/monero_seed}/pbkdf2.c (100%) rename {contrib/monero-seed/src => src/monero_seed}/pbkdf2.h (100%) rename {contrib/monero-seed/src => src/monero_seed}/reed_solomon_code.cpp (100%) rename {contrib/monero-seed/include => src}/monero_seed/reed_solomon_code.hpp (100%) rename {contrib/monero-seed/src => src/monero_seed}/secure_random.cpp (100%) rename {contrib/monero-seed/include => src}/monero_seed/secure_random.hpp (100%) rename {contrib/monero-seed/src => src/monero_seed}/sha256/hash_impl.h (100%) rename {contrib/monero-seed/src => src/monero_seed}/wordlist.cpp (100%) rename {contrib/monero-seed/include => src}/monero_seed/wordlist.hpp (100%) create mode 100644 src/qrcode_scanner_qt6/CMakeLists.txt create mode 100644 src/qrcode_scanner_qt6/QrCodeScanDialog.cpp create mode 100644 src/qrcode_scanner_qt6/QrCodeScanDialog.h create mode 100644 src/qrcode_scanner_qt6/QrCodeScanDialog.ui delete mode 100644 src/utils/brute.cpp delete mode 100644 src/utils/brute.h delete mode 100644 utils/build_macos.sh diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 716755e..0000000 --- a/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!contrib/build-deps/verify-packages.sh -!contrib/QTBUG-92199-fix.patch -!contrib/patches/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 97fbf2c..4a17b62 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ feather.AppDir/* src/assets/tor/* !src/assets/tor/.gitkeep guix-build-* +contrib/installers/windows/setup.nsi \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 57da17e..4df48ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,29 +1,32 @@ -cmake_minimum_required(VERSION 3.20) -project(feather) +cmake_minimum_required(VERSION 3.18) -message(STATUS "Initiating compile using CMake ${CMAKE_VERSION}") +project(feather + VERSION "2.1.2" + DESCRIPTION "A free Monero desktop wallet" + LANGUAGES CXX C ASM +) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(VERSION_MAJOR "2") -set(VERSION_MINOR "1") -set(VERSION_REVISION "2") -set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}") - -set ( CMAKE_CXX_FLAGS "-no-pie" ) -#target_compile_options(feather PRIVATE -no-pie) - -option(STATIC "Link libraries statically, requires static Qt") +set(PACKAGE_NAME ${PROJECT_NAME}) +set(PACKAGE_BUGREPORT "https://github.com/feather-wallet/feather/issues") +set(PACKAGE_URL "https://featherwallet.org/") +set(COPYRIGHT_YEAR "2022") +set(COPYRIGHT_HOLDERS "The Monero Project") +# Configurable options +option(STATIC "Link libraries statically, requires static Qt" OFF) option(SELF_CONTAINED "Disable when building Feather for packages" OFF) option(LOCALMONERO "Include LocalMonero module" ON) option(XMRIG "Include XMRig module" ON) -option(TOR_DIR "Path to Tor binary to embed inside Feather" OFF) +option(TOR_DIR "Directory containing Tor binaries to embed inside Feather" OFF) option(CHECK_UPDATES "Enable checking for application updates" OFF) option(PLATFORM_INSTALLER "Built-in updater fetches installer (windows-only)" OFF) option(USE_DEVICE_TREZOR "Trezor support compilation" ON) option(DONATE_BEG "Prompt donation window every once in a while" ON) + + option(WITH_SCANNER "Enable webcam QR scanner" OFF) list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake") @@ -37,14 +40,14 @@ if(DEBUG) set(CMAKE_VERBOSE_MAKEFILE ON) endif() -set(BUILD_GUI_DEPS ON) -option(ARCH "Target architecture" "native") -set(BUILD_64 ON) -set(USE_SINGLE_BUILDDIR ON) - check_include_file(sys/prctl.h HAVE_SYS_PRCTL_H) check_symbol_exists(prctl "sys/prctl.h" HAVE_PRCTL) +# Monero configuration +set(BUILD_GUI_DEPS ON) +set(BUILD_64 ON) +set(USE_SINGLE_BUILDDIR ON) + if(STATIC) message(STATUS "Initiating static build, turning on manual submodules") set(MANUAL_SUBMODULES 1) @@ -53,16 +56,19 @@ if(STATIC) set(Boost_USE_STATIC_RUNTIME ON) endif() -add_subdirectory(monero) +include(CMakePackageConfigHelpers) +include(VersionFeather) + +#### Dependencies +# Monero +add_subdirectory(monero EXCLUDE_FROM_ALL) set_property(TARGET wallet_merged PROPERTY FOLDER "monero") get_directory_property(ARCH_WIDTH DIRECTORY "monero" DEFINITION ARCH_WIDTH) get_directory_property(UNBOUND_LIBRARY DIRECTORY "monero" DEFINITION UNBOUND_LIBRARY) get_directory_property(DEVICE_TREZOR_READY DIRECTORY "monero" DEFINITION DEVICE_TREZOR_READY) get_directory_property(TREZOR_DEP_LIBS DIRECTORY "monero" DEFINITION TREZOR_DEP_LIBS) -include(CMakePackageConfigHelpers) -include(VersionFeather) - +# Easylogging include_directories(${EASYLOGGING_INCLUDE}) link_directories(${EASYLOGGING_LIBRARY_DIRS}) @@ -73,18 +79,15 @@ message(STATUS "libsodium: libraries at ${SODIUM_LIBRARY}") # QrEncode find_package(QREncode REQUIRED) -# Qr scanner +# ZBAR find_package(ZBAR REQUIRED) message(STATUS "libzbar: include dir at ${ZBAR_INCLUDE_DIR}") message(STATUS "libzbar: libraries at ${ZBAR_LIBRARIES}") -# Tevador 14 word Monero seed -add_subdirectory(contrib/monero-seed) - -# Polyseed 16 word mnemonic seeds +# Polyseed find_package(Polyseed REQUIRED) if(Polyseed_SUBMODULE) - add_subdirectory(src/third-party/polyseed) + add_subdirectory(src/third-party/polyseed EXCLUDE_FROM_ALL) endif() # libzip @@ -122,17 +125,6 @@ if(UNIX AND NOT APPLE) # https://github.com/monero-project/monero-gui/issues/3142#issuecomment-705940446 set(CMAKE_SKIP_RPATH ON) endif() - -# find_package(X11 REQUIRED) -# message(STATUS "X11_FOUND = ${X11_FOUND}") -# message(STATUS "X11_INCLUDE_DIR = ${X11_INCLUDE_DIR}") -# message(STATUS "X11_LIBRARIES = ${X11_LIBRARIES}") -# include_directories(${X11_INCLUDE_DIR}) -# link_directories(${X11_LIBRARIES}) - if(STATIC) - find_library(XCB_LIBRARY xcb) - message(STATUS "Found xcb library: ${XCB_LIBRARY}") - endif() endif() include(TorQrcGenerator) @@ -163,19 +155,6 @@ else() message(STATUS "Skipping Tor inclusion because -DTOR_DIR=Off") endif() -if(MINGW) - string(REGEX MATCH "^[^/]:/[^/]*" msys2_install_path "${CMAKE_C_COMPILER}") - message(STATUS "MSYS location: ${msys2_install_path}") - set(CMAKE_INCLUDE_PATH "${msys2_install_path}/mingw${ARCH_WIDTH}/include") - # This is necessary because otherwise CMake will make Boost libraries -lfoo - # rather than a full path. Unfortunately, this makes the shared libraries get - # linked due to a bug in CMake which misses putting -static flags around the - # -lfoo arguments. - set(DEFLIB ${msys2_install_path}/mingw${ARCH_WIDTH}/lib) - list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_DIRECTORIES ${DEFLIB}) - list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES ${DEFLIB}) -endif() - message(STATUS "Using Boost include dir at ${Boost_INCLUDE_DIRS}") message(STATUS "Using Boost libraries at ${Boost_LIBRARIES}") @@ -183,11 +162,6 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) if(MINGW) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj") set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi;crypt32;bcrypt) -# if(DEPENDS) -# set(ICU_LIBRARIES iconv) -# else() -# set(ICU_LIBRARIES icuio icuin icuuc icudt icutu iconv) -# endif() elseif(APPLE) set(EXTRA_LIBRARIES "-framework AppKit") elseif(OPENBSD) @@ -208,13 +182,7 @@ list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS}) if(APPLE) cmake_policy(SET CMP0042 NEW) -endif() - -if (APPLE AND NOT IOS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -std=c++11") -endif() - -if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0") endif() @@ -237,7 +205,7 @@ if (NOT OPENBSD AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE add_c_flag_if_supported(-fcf-protection=full C_SECURITY_FLAGS) add_cxx_flag_if_supported(-fcf-protection=full CXX_SECURITY_FLAGS) endif() -if (NOT WIN32 AND NOT OPENBSD) +if (NOT WIN32 AND NOT OPENBSD AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") add_c_flag_if_supported(-fstack-clash-protection C_SECURITY_FLAGS) add_cxx_flag_if_supported(-fstack-clash-protection CXX_SECURITY_FLAGS) endif() @@ -254,10 +222,10 @@ if (APPLE) add_linker_flag_if_supported(-Wl,-dead_strip LD_SECURITY_FLAGS) add_linker_flag_if_supported(-Wl,-dead_strip_dylibs LD_SECURITY_FLAGS) endif() -#if (NOT APPLE AND NOT (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU")) -# # Windows binaries die on startup with PIE when compiled with GCC -# add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS) -#endif() +if (NOT APPLE AND NOT (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU")) + # Windows binaries die on startup with PIE when compiled with GCC + add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS) +endif() add_linker_flag_if_supported(-Wl,-z,relro LD_SECURITY_FLAGS) add_linker_flag_if_supported(-Wl,-z,now LD_SECURITY_FLAGS) add_linker_flag_if_supported(-Wl,-z,noexecstack noexecstack_SUPPORTED) @@ -276,6 +244,14 @@ if (WIN32) add_linker_flag_if_supported(-Wl,--high-entropy-va LD_SECURITY_FLAGS) endif() +if(STATIC) +# add_linker_flag_if_supported(-static-libgcc STATIC_FLAGS) +# add_linker_flag_if_supported(-static-libstdc++ STATIC_FLAGS) + if(MINGW) + add_linker_flag_if_supported(-static STATIC_FLAGS) + endif() +endif() + add_c_flag_if_supported(-fPIC C_SECURITY_FLAGS) add_cxx_flag_if_supported(-fPIC CXX_SECURITY_FLAGS) @@ -288,3 +264,48 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CXX_SECURITY_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${STATIC_FLAGS}") add_subdirectory(src) + +configure_file("${CMAKE_SOURCE_DIR}/contrib/installers/windows/setup.nsi.in" "${CMAKE_SOURCE_DIR}/contrib/installers/windows/setup.nsi" @ONLY) + +if(APPLE AND CMAKE_CROSSCOMPILING) + set(macos_app "feather.app") + configure_file(contrib/macdeploy/background.tiff contrib/macdeploy/background.tiff COPYONLY) + configure_file(contrib/macdeploy/Info.plist.in ${macos_app}/Contents/Info.plist @ONLY) + configure_file(src/assets/images/appicons/appicon.icns ${macos_app}/Contents/Resources/appicon.icns COPYONLY) + + set(xorrisofs_options) + if(DEFINED ENV{SOURCE_DATE_EPOCH}) + set(xorrisofs_options -volume_date all_file_dates =$ENV{SOURCE_DATE_EPOCH}) + endif() + add_custom_target(deploy + COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --config "$" --prefix "${CMAKE_BINARY_DIR}/release" --strip + COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_BINARY_DIR}/${macos_app}/Contents/MacOS" + COMMAND "${CMAKE_COMMAND}" -E rename "${CMAKE_BINARY_DIR}/bin/$" "${CMAKE_BINARY_DIR}/${macos_app}/Contents/MacOS/feather" + COMMAND PYTHONPATH=${PYTHONPATH} INSTALL_NAME_TOOL=${CMAKE_INSTALL_NAME_TOOL} OTOOL=${OTOOL} STRIP=${CMAKE_STRIP} ${CMAKE_SOURCE_DIR}/contrib/macdeploy/macdeployqtplus ${macos_app} ${PACKAGE_NAME} + COMMAND xorrisofs -D -l -V "${PACKAGE_NAME}" -no-pad -r -dir-mode 0755 -o ${PACKAGE_NAME}.dmg ${CMAKE_BINARY_DIR}/dist -- ${xorrisofs_options} + VERBATIM + ) +endif() + +SET(CPACK_GENERATOR "DEB") +SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "tobtoht") #required +INCLUDE(CPack) + +message("\n") +message("Configure summary") +message("=================") + +if(CMAKE_CROSSCOMPILING) + set(cross_status "TRUE, for ${CMAKE_SYSTEM_NAME}, ${CMAKE_SYSTEM_PROCESSOR}") +else() + set(cross_status "FALSE") +endif() +message("Cross compiling ....................... ${cross_status}") +get_directory_property(definitions COMPILE_DEFINITIONS) +message("Preprocessor defined macros ........... ${definitions}") +message("C compiler ............................ ${CMAKE_C_COMPILER}") +message("CFLAGS ................................ ${CMAKE_C_FLAGS}") +message("C++ compiler .......................... ${CMAKE_CXX_COMPILER}") +message("CXXFLAGS .............................. ${CMAKE_CXX_FLAGS}") +message("LDFLAGS for executables ............... ${CMAKE_EXE_LINKER_FLAGS}") +message("\n") diff --git a/HACKING.md b/HACKING.md index 3f3ce5a..d708a8c 100644 --- a/HACKING.md +++ b/HACKING.md @@ -16,7 +16,7 @@ https://www.qt.io/download (under open-source). #### Arch Linux ```bash -pacman -S git cmake base-devel ccache unbound boost qrencode zbar qt6-base qt6-svg qt6-websockets libzip hidapi protobuf +pacman -S git cmake base-devel ccache unbound boost qrencode zbar qt6-base qt6-svg qt6-websockets qt6-multimedia libzip hidapi protobuf ``` #### Ubuntu 22.04 @@ -77,9 +77,8 @@ We recommend using Jetbrains Clion for Feather development. It integrates nicely debugger. To pass CMake flags to CLion, go to `File->Settings->Build->CMake`, set Build Type to `Debug` and set your -preferred CMake options/definitions. Add `-DARCH=x86-64` to the CMake options. If you installed Qt using the online -installer you may have to add `-DCMAKE_PREFIX_PATH=/path/to/qt/installation` in the CMake options. More CMake options -are documented below. +preferred CMake options. If you installed Qt using the online installer you may have to add +`-DCMAKE_PREFIX_PATH=/path/to/qt/installation` in the CMake options. More CMake options are documented below. Run CMake (`View -> Tool Windows -> CMake`). Click on the 🔃 (`Reload CMake Project`) button. @@ -95,8 +94,12 @@ After the target is configured, `Run -> Run 'feather'` or press Shift + F10 to b To build Feather without an IDE: -- Linux: `make release` -- macOS: `make mac-release` +```bash +mkdir build && \ +cd build && \ +cmake .. && \ +cmake --build . -j $(nproc) +``` ### CMake diff --git a/Makefile b/Makefile deleted file mode 100644 index 5c6f247..0000000 --- a/Makefile +++ /dev/null @@ -1,110 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-FileCopyrightText: 2020-2022 The Monero Project - -CMAKEFLAGS = \ - -DTOR_DIR=$(or ${TOR_DIR}, Off) \ - -DTOR_VERSION=$(or ${TOR_VERSION}, Off) \ - -DCHECK_UPDATES=$(or ${CHECK_UPDATES}, Off) \ - -DWITH_SCANNER=$(or ${WITH_SCANNER}, Off) \ - -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH}, Off) - -guix: - mkdir -p build/$(target)/release && \ - cd build/$(target)/release && \ - cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ - -DCMAKE_PREFIX_PATH=/gnu/store \ - -DCMAKE_PREFIX_PATH=$(CURDIR)/contrib/depends/$(target) \ - -DCMAKE_PREFIX_PATH=$(CURDIR)/contrib/depends/$(target)/native/bin \ - -DCMAKE_TOOLCHAIN_FILE=/feather/contrib/depends/$(target)/share/toolchain.cmake ../../.. \ - $(CMAKEFLAGS) && \ - $(MAKE) - -release: - mkdir -p build/release && \ - cd build/release && \ - cmake \ - -DARCH=x86-64 \ - -D BUILD_TAG="linux-x64" \ - -D CMAKE_BUILD_TYPE=Release \ - $(CMAKEFLAGS) \ - ../.. && \ - $(MAKE) - -release-static: - mkdir -p build/release && \ - cd build/release && \ - cmake \ - -DARCH=x86-64 \ - -D BUILD_TAG="linux-x64" \ - -D CMAKE_BUILD_TYPE=Release \ - -D STATIC=On \ - $(CMAKEFLAGS) \ - ../.. && \ - $(MAKE) - -release-static-linux-arm64: - mkdir -p build/release && \ - cd build/release && \ - cmake \ - -D ARCH="armv8-a" \ - -D BUILD_TAG="linux-armv8" \ - -D CMAKE_BUILD_TYPE=Release \ - -D STATIC=On \ - $(CMAKEFLAGS) \ - ../.. && \ - $(MAKE) - -release-static-linux-arm64-rpi: - mkdir -p build/release && \ - cd build/release && \ - cmake \ - -D ARCH="armv8-a" \ - -D NO_AES=On \ - -D BUILD_TAG="linux-armv8-noaes" \ - -D CMAKE_BUILD_TYPE=Release \ - -D STATIC=On \ - $(CMAKEFLAGS) \ - ../.. && \ - $(MAKE) - -release-static-windows: - mkdir -p build/$(target)/release && \ - cd build/$(target)/release && \ - cmake \ - -DARCH=x86-64 \ - -D BUILD_TAG=$(tag) \ - -D CMAKE_BUILD_TYPE=Release \ - -D STATIC=ON \ - -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake \ - $(CMAKEFLAGS) \ - ../../.. && \ - $(MAKE) - -release-static-windows-installer: - mkdir -p build/$(target)/release && \ - cd build/$(target)/release && \ - cmake \ - -D PLATFORM_INSTALLER=On \ - -DARCH=x86-64 \ - -D BUILD_TAG=$(tag) \ - -D CMAKE_BUILD_TYPE=Release \ - -D STATIC=ON \ - -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake \ - $(CMAKEFLAGS) \ - -D TOR_DIR=Off \ - -D TOR_VERSION=Off \ - ../../.. && \ - $(MAKE) - -mac-release: - mkdir -p build && \ - cd build && \ - cmake \ - -DARCH=native \ - -D BUILD_TAG="mac-x64" \ - -D CMAKE_BUILD_TYPE=Release \ - -D STATIC=Off \ - $(CMAKEFLAGS) \ - .. && \ - $(MAKE) && \ - $(MAKE) deploy diff --git a/cmake/Deploy.cmake b/cmake/Deploy.cmake deleted file mode 100644 index 55992b0..0000000 --- a/cmake/Deploy.cmake +++ /dev/null @@ -1,29 +0,0 @@ -if(APPLE OR (WIN32 AND NOT STATIC)) - add_custom_target(deploy) - get_target_property(_qmake_executable Qt::qmake IMPORTED_LOCATION) - get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) - - if(APPLE AND NOT IOS) - find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}") - MESSAGE(INFO "MACDEPLOY ${MACDEPLOYQT_EXECUTABLE}") - add_custom_command(TARGET deploy - POST_BUILD - COMMAND "${MACDEPLOYQT_EXECUTABLE}" "$/../.." -always-overwrite - COMMENT "Running macdeployqt..." - ) - - # workaround for a Qt bug that requires manually adding libqsvg.dylib to bundle - find_file(_qt_svg_dylib "libqsvg.dylib" PATHS "${CMAKE_PREFIX_PATH}/plugins/imageformats" NO_DEFAULT_PATH) - if(_qt_svg_dylib) - add_custom_command(TARGET deploy - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${_qt_svg_dylib} $/../PlugIns/imageformats/ - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtGui.framework/Versions/5/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $/../PlugIns/imageformats/libqsvg.dylib - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $/../PlugIns/imageformats/libqsvg.dylib - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtSvg.framework/Versions/5/QtSvg" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $/../PlugIns/imageformats/libqsvg.dylib - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtCore.framework/Versions/5/QtCore" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $/../PlugIns/imageformats/libqsvg.dylib - COMMENT "Copying libqsvg.dylib, running install_name_tool" - ) - endif() - endif() -endif() \ No newline at end of file diff --git a/cmake/FindZlib.cmake b/cmake/FindZlib.cmake deleted file mode 100644 index 0f52f64..0000000 --- a/cmake/FindZlib.cmake +++ /dev/null @@ -1,21 +0,0 @@ -find_package(PkgConfig) - -if(PkgConfig_FOUND) - pkg_check_modules(PC_ZLIB QUIET ZLIB) - if(PC_ZLIB_FOUND) - set(ZLIB_DEFINITIONS ${PC_ZLIB_CFLAGS_OTHER}) - find_library(ZLIB_LIBRARIES NAMES ZLIB HINTS ${PC_ZLIB_LIBDIR} ${PC_ZLIB_LIBRARY_DIRS}) - find_path(ZLIB_INCLUDE_DIR Decoder.h HINTS ${PC_ZLIB_INCLUDEDIR} ${PC_ZLIB_INCLUDE_DIRS}) - endif() -endif() - -if(NOT ZLIB_INCLUDE_DIR) - find_path(ZLIB_H_PATH ZLIB.h) - if(ZLIB_H_PATH) - set(ZLIB_INCLUDE_DIR "${ZLIB_H_PATH}") - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIR) -message(STATUS "Found ZLIB libraries ${ZLIB_LIBRARIES}") diff --git a/contrib/AppImage/AppRun b/contrib/AppImage/AppRun index def250b..dc50855 100644 --- a/contrib/AppImage/AppRun +++ b/contrib/AppImage/AppRun @@ -3,9 +3,6 @@ HERE="$(dirname "$(readlink -f "${0}")")" echo $HERE -export GST_PLUGIN_SCANNER=$(readlink -f $(dirname "$0")/usr/lib/gst-plugin-scanner) -export GST_PLUGIN_SYSTEM_PATH=$(readlink -f $(dirname "$0")/usr/lib) # Tails 5.8 sets QT_QPA_PLATFORM to wayland which breaks our app export QT_QPA_PLATFORM=xcb - ${APPDIR}/usr/bin/feather $* diff --git a/contrib/AppImage/build-appimage.sh b/contrib/AppImage/build-appimage.sh new file mode 100755 index 0000000..fba19cd --- /dev/null +++ b/contrib/AppImage/build-appimage.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -e +unset SOURCE_DATE_EPOCH + +APPDIR="$PWD/feather.AppDir" + +mkdir -p "$APPDIR" +mkdir -p "$APPDIR/usr/share/applications/" +mkdir -p "$APPDIR/usr/bin" +mkdir -p "$APPDIR/usr/lib" +mkdir -p "$APPDIR/usr/plugins" + +cp "src/assets/feather.desktop" "$APPDIR/usr/share/applications/feather.desktop" +cp "src/assets/images/appicons/64x64.png" "$APPDIR/feather.png" +cp "build/bin/feather" "$APPDIR/usr/bin/feather" +chmod +x "$APPDIR/usr/bin/feather" + +export LD_LIBRARY_PATH=/feather/contrib/depends/x86_64-linux-gnu/lib/:/gnu/store:/gnu/store/yk91cxchassi5ykxsyd4vci32vncgjkf-gcc-cross-x86_64-linux-gnu-10.3.0-lib/x86_64-linux-gnu/lib + +# fuck you linuxdeployqt +mkdir -p "$APPDIR/usr/share/doc/libc6" +touch "$APPDIR/usr/share/doc/libc6/copyright" + +linuxdeployqt feather.AppDir/usr/share/applications/feather.desktop -verbose=2 -bundle-non-qt-libs -unsupported-allow-new-glibc + +rm "$APPDIR/AppRun" +cp "contrib/AppImage/AppRun" "$APPDIR/" +chmod +x "$APPDIR/AppRun" + +find feather.AppDir/ -exec touch -h -a -m -t 202101010100.00 {} \; + +# Manually create AppImage (reproducibly) + +mksquashfs feather.AppDir feather.squashfs -info -root-owned -no-xattrs -noappend -fstime 0 +# mksquashfs writes a timestamp to the header +printf '\x00\x00\x00\x00' | dd conv=notrunc of=feather.squashfs bs=1 seek=$((0x8)) + +rm -f feather.AppImage +## Don't hardcode this +cat /feather/contrib/depends/x86_64-linux-gnu/runtime-x86_64 >> feather.AppImage +cat feather.squashfs >> feather.AppImage +chmod a+x feather.AppImage diff --git a/contrib/AppImage/gst-plugin-scanner.sh b/contrib/AppImage/gst-plugin-scanner.sh deleted file mode 100644 index 4fbc252..0000000 --- a/contrib/AppImage/gst-plugin-scanner.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Wrapper to launch gst-plugin-scanner inside the AppImage. - -HERE="$(dirname "$(readlink -f "${0}")")" -export PATH="${HERE}:${PATH}" - -binary=$(find "$HERE" -name "gst-plugin-scanner-x86_64" | head -n 1) -LD_LINUX=$(find "$HERE/../../../" -name 'ld-*.so.*' | head -n 1) -if [ -e "$LD_LINUX" ] ; then - case $line in - "ld-linux"*) exec "${LD_LINUX}" --inhibit-cache "${binary}" "$@" ;; - *) exec "${LD_LINUX}" "${binary}" "$@" ;; - esac -else - exec "${binary}" "$@" -fi \ No newline at end of file diff --git a/contrib/QTBUG-92199-fix.patch b/contrib/QTBUG-92199-fix.patch deleted file mode 100644 index 6be407a..0000000 --- a/contrib/QTBUG-92199-fix.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp -index 2ab9756f8d..a9d6ecd51a 100644 ---- a/src/widgets/styles/qstylesheetstyle.cpp -+++ b/src/widgets/styles/qstylesheetstyle.cpp -@@ -1465,7 +1465,6 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q - p->setBrush(cg, w->foregroundRole(), pal->foreground); - p->setBrush(cg, QPalette::WindowText, pal->foreground); - p->setBrush(cg, QPalette::Text, pal->foreground); -- p->setBrush(cg, QPalette::PlaceholderText, pal->foreground); - } - if (pal->selectionBackground.style() != Qt::NoBrush) - p->setBrush(cg, QPalette::Highlight, pal->selectionBackground); -diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp -index 26868a763c..82527849b0 100644 ---- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp -+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp -@@ -126,7 +126,6 @@ private slots: - void QTBUG15910_crashNullWidget(); - void QTBUG36933_brokenPseudoClassLookup(); - void styleSheetChangeBeforePolish(); -- void placeholderColor(); - //at the end because it mess with the style. - void widgetStyle(); - void appStyle(); -@@ -2230,21 +2229,6 @@ void tst_QStyleSheetStyle::highdpiImages() - QHighDpiScaling::updateHighDpiScaling(); // reset to normal - } - --void tst_QStyleSheetStyle::placeholderColor() --{ -- const QColor red(Qt::red); -- qApp->setStyleSheet("* { color: red; }"); -- QLineEdit le1; -- QLineEdit le2; -- le2.setEnabled(false); -- le1.ensurePolished(); -- QCOMPARE(le1.palette().placeholderText(), red); -- le2.ensurePolished(); -- QCOMPARE(le2.palette().placeholderText(), red); -- le2.setEnabled(true); -- QCOMPARE(le2.palette().placeholderText(), red); --} -- - QTEST_MAIN(tst_QStyleSheetStyle) - #include "tst_qstylesheetstyle.moc" - diff --git a/contrib/build-appimage-arm64.sh b/contrib/build-appimage-arm64.sh deleted file mode 100755 index e30eeaa..0000000 --- a/contrib/build-appimage-arm64.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -# TODO: Merge with build-appimage.sh - -set -e -unset SOURCE_DATE_EPOCH - -# Temporary workaround for linuxdeployqt issue on arm64 -if [ "$(uname -m)" = "aarch64" ]; then - pushd / - apt update - apt install -y qt5-default - git clone https://github.com/probonopd/linuxdeployqt.git - cd linuxdeployqt - git reset --hard b4697483c98120007019c3456914cfd1dba58384 - qmake - make -j$THREADS - make install - rm -rf $(pwd) - popd -fi - -APPDIR="$PWD/feather.AppDir" -rm -rf $APPDIR -mkdir -p "$APPDIR" -mkdir -p "$APPDIR/usr/share/applications/" -mkdir -p "$APPDIR/usr/bin" -mkdir -p "$APPDIR/usr/lib" -mkdir -p "$APPDIR/usr/plugins" - -cp "$PWD/../src/assets/feather.desktop" "$APPDIR/usr/share/applications/feather.desktop" -cp "$PWD/../src/assets/images/appicons/64x64.png" "$APPDIR/feather.png" -cp "$PWD/release/bin/feather" "$APPDIR/usr/bin/feather" -chmod +x "$APPDIR/usr/bin/feather" - -export LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu/:/usr/local/lib/$LD_LIBRARY_PATH -linuxdeployqt feather.AppDir/usr/share/applications/feather.desktop -verbose=2 -bundle-non-qt-libs - -pushd feather.AppDir/usr/plugins -ln -s ../lib/ gstreamer -popd - -GST_PLUGINS=("libgstcamerabin.so libgstcoreelements.so libgstvolume.so libgstapp.so libgstvideoconvert.so - libgstvideoscale.so libgstvideo4linux2.so libgstencoding.so libgstmultifile.so libgstmatroska.so - libgstvpx.so libgstjpegformat.so libgstjpeg.so libgstautodetect.so libgstaudiotestsrc.so - libgstvorbis.so libgstaudiorate.so libgstaudioconvert.so libgstaudioresample.so libgstvideocrop.so") - -for plugin in ${GST_PLUGINS[*]}; do - cp /usr/lib/aarch64-linux-gnu/gstreamer-1.0/$plugin feather.AppDir/usr/plugins/gstreamer/ - - # linuxdeployqt doesn't set RUNPATH on libs that are only loaded at runtime - patchelf --set-rpath "\$ORIGIN" feather.AppDir/usr/plugins/gstreamer/$plugin -done - -cp /usr/lib/aarch64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner feather.AppDir/usr/plugins/gstreamer/ - -# Need second deploy for gstreamer dependencies -linuxdeployqt feather.AppDir/usr/share/applications/feather.desktop -verbose=2 -bundle-non-qt-libs - -rm "$APPDIR/AppRun" -cp "$PWD/../contrib/AppImage/AppRun" "$APPDIR/" -chmod +x "$APPDIR/AppRun" - -find feather.AppDir/ -exec touch -h -a -m -t 202101010100.00 {} \; - -# Manually create AppImage (reproducibly) - -# download runtime -wget -nc https://github.com/AppImage/AppImageKit/releases/download/13/runtime-aarch64 -echo "d2624ce8cc2c64ef76ba986166ad67f07110cdbf85112ace4f91611bc634c96a runtime-aarch64" | sha256sum -c - -mksquashfs feather.AppDir feather.squashfs -info -root-owned -no-xattrs -noappend -fstime 0 -# mksquashfs writes a timestamp to the header -printf '\x00\x00\x00\x00' | dd conv=notrunc of=feather.squashfs bs=1 seek=$((0x8)) - -rm -f feather.AppImage -cat runtime-aarch64 >> feather.AppImage -cat feather.squashfs >> feather.AppImage -chmod a+x feather.AppImage diff --git a/contrib/build-appimage.sh b/contrib/build-appimage.sh deleted file mode 100755 index 2b7035b..0000000 --- a/contrib/build-appimage.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -set -e -unset SOURCE_DATE_EPOCH - -APPDIR="$PWD/feather.AppDir" -rm -rf $APPDIR -mkdir -p "$APPDIR" -mkdir -p "$APPDIR/usr/share/applications/" -mkdir -p "$APPDIR/usr/bin" -mkdir -p "$APPDIR/usr/lib" -mkdir -p "$APPDIR/usr/plugins" - -cp "$PWD/../src/assets/feather.desktop" "$APPDIR/usr/share/applications/feather.desktop" -cp "$PWD/../src/assets/images/appicons/64x64.png" "$APPDIR/feather.png" -cp "$PWD/release/bin/feather" "$APPDIR/usr/bin/feather" -chmod +x "$APPDIR/usr/bin/feather" - -export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu/:/usr/local/lib/$LD_LIBRARY_PATH -linuxdeployqt feather.AppDir/usr/share/applications/feather.desktop -verbose=2 -bundle-non-qt-libs - -pushd feather.AppDir/usr/plugins -ln -s ../lib/ gstreamer -popd - -GST_PLUGINS=("libgstcamerabin.so libgstcoreelements.so libgstvolume.so libgstapp.so libgstvideoconvert.so - libgstvideoscale.so libgstvideo4linux2.so libgstencoding.so libgstmultifile.so libgstmatroska.so - libgstvpx.so libgstjpegformat.so libgstjpeg.so libgstautodetect.so libgstaudiotestsrc.so - libgstvorbis.so libgstaudiorate.so libgstaudioconvert.so libgstaudioresample.so libgstvideocrop.so") - -for plugin in ${GST_PLUGINS[*]}; do - cp /usr/lib/x86_64-linux-gnu/gstreamer-1.0/$plugin feather.AppDir/usr/plugins/gstreamer/ - - # linuxdeployqt doesn't set RUNPATH on libs that are only loaded at runtime - patchelf --set-rpath "\$ORIGIN" feather.AppDir/usr/plugins/gstreamer/$plugin -done - -cp /usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner feather.AppDir/usr/plugins/gstreamer/ - -# Need second deploy for gstreamer dependencies -linuxdeployqt feather.AppDir/usr/share/applications/feather.desktop -verbose=2 -bundle-non-qt-libs - -rm "$APPDIR/AppRun" -cp "$PWD/../contrib/AppImage/AppRun" "$APPDIR/" -chmod +x "$APPDIR/AppRun" - -find feather.AppDir/ -exec touch -h -a -m -t 202101010100.00 {} \; - -# Manually create AppImage (reproducibly) - -# download runtime -wget -nc https://github.com/AppImage/AppImageKit/releases/download/13/runtime-x86_64 -echo "328e0d745c5c6817048c27bc3e8314871703f8f47ffa81a37cb06cd95a94b323 runtime-x86_64" | sha256sum -c - -mksquashfs feather.AppDir feather.squashfs -info -root-owned -no-xattrs -noappend -fstime 0 -# mksquashfs writes a timestamp to the header -printf '\x00\x00\x00\x00' | dd conv=notrunc of=feather.squashfs bs=1 seek=$((0x8)) - -rm -f feather.AppImage -cat runtime-x86_64 >> feather.AppImage -cat feather.squashfs >> feather.AppImage -chmod a+x feather.AppImage diff --git a/contrib/build-deps/Dockerfile.linux-builddeps b/contrib/build-deps/Dockerfile.linux-builddeps deleted file mode 100644 index f32105d..0000000 --- a/contrib/build-deps/Dockerfile.linux-builddeps +++ /dev/null @@ -1,61 +0,0 @@ -FROM ubuntu:18.04 - -ENV DEBIAN_FRONTEND=noninteractive - -WORKDIR /deps - -RUN sed -i '/bionic-backports/d' /etc/apt/sources.list - -RUN apt-get update && \ - apt-get install -y wget xz-utils nano gpg xz-utils ca-certificates - -COPY get-packages.sh . -RUN bash get-packages.sh - -RUN apt-get install -y --no-install-recommends --no-install-suggests --reinstall --download-only \ -# build tools - software-properties-common python3 build-essential automake libtool-bin git \ -# ninja - unzip \ -# GStreamer plugins - libjpeg-dev libvpx-dev libvorbis-dev \ -# fontconfig - autopoint gettext gperf libpng-dev \ -# libxkbcommon - bison \ -# Qt 5.15 -# https://doc.qt.io/qt-5/linux-requirements.html - libx11-dev \ - libx11-xcb-dev \ - libxext-dev \ - libxfixes-dev \ - libxi-dev \ - libxrender-dev \ - libxcb1-dev \ - libxcb-keysyms1-dev \ - libxcb-image0-dev \ - libxcb-icccm4-dev \ - libxcb-xfixes0-dev \ - libxcb-render-util0-dev \ - libxcb-xinerama0-dev \ - libxcb-randr0-dev \ - libxcb-sync-dev \ - libxkbcommon-dev \ - libxkbcommon-x11-dev \ - xutils-dev \ - libxcb-util-dev \ - libxcb-xinput-dev \ -# libwallet -# libudev.so is included in AppImage - libudev1 libudev-dev \ -# GStreamer - gstreamer1.0-plugins-good \ - libgstreamer1.0-dev \ - libgstreamer-plugins-base1.0-dev \ -# git dependency - libpsl5 - -# Verify packages -RUN ln -s /var/cache/apt/archives /archives -COPY verify-packages.sh . -RUN bash verify-packages.sh \ No newline at end of file diff --git a/contrib/build-deps/get-packages.sh b/contrib/build-deps/get-packages.sh deleted file mode 100644 index 03635c4..0000000 --- a/contrib/build-deps/get-packages.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -base_uri="http://archive.ubuntu.com/ubuntu/dists" -arch="amd64" -if [ "$(uname -m)" = "aarch64" ]; then - base_uri="http://ports.ubuntu.com/ubuntu-ports/dists" - arch="arm64" -fi - -for target in bionic bionic-updates bionic-security -do - mkdir "$target" - pushd "$target" - target_uri="$base_uri/$target/" - wget "$target_uri/Release" - wget "$target_uri/Release.gpg" - for repo in main multiverse restricted universe - do - mkdir "$repo" - pushd "$repo" - wget "$target_uri/$repo/binary-$arch/Packages.xz" - popd - done - popd -done \ No newline at end of file diff --git a/contrib/build-deps/verify-packages.sh b/contrib/build-deps/verify-packages.sh deleted file mode 100644 index 81872aa..0000000 --- a/contrib/build-deps/verify-packages.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -set -e - -arch="amd64" -if [ "$(uname -m)" = "aarch64" ]; then - arch="arm64" -fi - -cd /deps -for target in bionic bionic-updates bionic-security -do - pushd "$target" - - # Verify Releases - gpg --no-default-keyring --keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg --verify Release.gpg Release - - for repo in main multiverse restricted universe - do - pushd "$repo" - - # Verify Packages.xz - sha256=`cat ../Release | grep "$repo/binary-$arch/Packages.xz" | tail -n 1 | awk '{print $1}'` - echo "$sha256 Packages.xz" | sha256sum -c - - xz -d -c Packages.xz >> ../../Packages-all - popd - done - popd -done - -# Verify individual .deb files -cd /archives -for deb in *.deb; do - file_name=`echo $deb | sed 's/[0-9]*%3a//g'` # --download-only uses this version format sometimes, not sure what that is all about - sha256=`sed -n "/\/${file_name}$"'/{:start /SHA256: /!{N;b start};//p}' /deps/Packages-all | tail -n 1 | awk '{print $2}'` - echo "$sha256 $deb" | sha256sum -c -done \ No newline at end of file diff --git a/contrib/depends/Makefile b/contrib/depends/Makefile index 9dcac43..283a304 100644 --- a/contrib/depends/Makefile +++ b/contrib/depends/Makefile @@ -32,7 +32,7 @@ SOURCES_PATH ?= $(BASEDIR)/sources WORK_PATH = $(BASEDIR)/work BASE_CACHE ?= $(BASEDIR)/built SDK_PATH ?= $(BASEDIR)/SDKs -FALLBACK_DOWNLOAD_PATH ?= https://downloads.getmonero.org/depends-sources +FALLBACK_DOWNLOAD_PATH ?= BUILD = $(shell ./config.guess) HOST ?= $(BUILD) @@ -178,7 +178,6 @@ build-only-$(1)_$(3): CMAKE_SHARED_BOOL = $(if $(findstring shared,$(3)),ON,OFF) toolchain_path=$($($(host_arch)_$(host_os)_native_toolchain)_prefixbin) -final_build_id_long+=$(shell $(build_SHA256SUM) config.site.in) final_build_id_long+=$(shell $(build_SHA256SUM) toolchain.cmake.in) final_build_id+=$(shell echo -n "$(final_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)) $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages) @@ -213,26 +212,6 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages) # Minor note: it is also okay to refer to tools by their absolute path even if # we expect them to be available in $PATH at all times, more specificity does # not hurt. -$(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id) - @mkdir -p $(@D) - sed -e 's|@HOST@|$(host)|' \ - -e 's|@CC@|$(toolchain_path)$(host_CC)|' \ - -e 's|@CXX@|$(toolchain_path)$(host_CXX)|' \ - -e 's|@AR@|$(toolchain_path)$(host_AR)|' \ - -e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \ - -e 's|@NM@|$(toolchain_path)$(host_NM)|' \ - -e 's|@STRIP@|$(toolchain_path)$(host_STRIP)|' \ - -e 's|@build_os@|$(build_os)|' \ - -e 's|@host_os@|$(host_os)|' \ - -e 's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \ - -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \ - -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \ - -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \ - -e 's|@allow_host_packages@|$(ALLOW_HOST_PACKAGES)|' \ - -e 's|@debug@|$(DEBUG)|' \ - $< > $@ - touch $@ - $(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(final_build_id) @mkdir -p $(@D) sed -e 's|@HOST@|$(host)|' \ @@ -242,6 +221,8 @@ $(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_ -e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \ -e 's|@NM@|$(toolchain_path)$(host_NM)|' \ -e 's|@STRIP@|$(toolchain_path)$(host_STRIP)|' \ + -e 's|@CMAKE_INSTALL_NAME_TOOL@|$(host_INSTALL_NAME_TOOL)|' \ + -e 's|@OTOOL@|$(host_OTOOL)|' \ -e 's|@build_os@|$(build_os)|' \ -e 's|@host_os@|$(host_os)|' \ -e 's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \ @@ -255,6 +236,8 @@ $(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_ -e 's|@depends@|$(host_cmake)|' \ -e 's|@prefix@|$($(host_arch)_$(host_os)_prefix)|'\ -e 's|@arch@|$(host_arch)|'\ + -e 's|@guix_ldflags@|$(guix_ldflags)|'\ + -e 's|@tor_version@|$(tor_$(host_os)_version)|'\ $< > $@ touch $@ diff --git a/contrib/depends/config.guess b/contrib/depends/config.guess index dc0a6b2..f50dcdb 100755 --- a/contrib/depends/config.guess +++ b/contrib/depends/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2021 Free Software Foundation, Inc. +# Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2021-05-24' +timestamp='2018-02-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -27,12 +27,12 @@ timestamp='2021-05-24' # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . -me=$(echo "$0" | sed -e 's,.*/,,') +me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2021 Free Software Foundation, Inc. +Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -84,6 +84,8 @@ if test $# != 0; then exit 1 fi +trap 'exit 1' 1 2 15 + # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a @@ -94,89 +96,73 @@ fi # Portable tmp directory creation inspired by the Autoconf team. -tmp= -# shellcheck disable=SC2172 -trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 - -set_cc_for_build() { - # prevent multiple calls if $tmp is already set - test "$tmp" && return 0 - : "${TMPDIR=/tmp}" - # shellcheck disable=SC2039 - { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } - dummy=$tmp/dummy - case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in - ,,) echo "int x;" > "$dummy.c" - for driver in cc gcc c89 c99 ; do - if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$driver" - break - fi - done - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; - esac -} +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > "$dummy.c" ; + for c in cc gcc c89 c99 ; do + if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if test -f /.attbin/uname ; then +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi -UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown -UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown -UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown -UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case $UNAME_SYSTEM in +case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) - LIBC=unknown + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu - set_cc_for_build + eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #elif defined(__GLIBC__) - LIBC=gnu #else - #include - /* First heuristic to detect musl libc. */ - #ifdef __DEFINED_va_list - LIBC=musl - #endif + LIBC=gnu #endif EOF - eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')" + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" - # Second heuristic to detect musl libc. - if [ "$LIBC" = unknown ] && - command -v ldd >/dev/null && - ldd --version 2>&1 | grep -q ^musl; then - LIBC=musl - fi - - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - if [ "$LIBC" = unknown ]; then - LIBC=gnu + # If ldd exists, use it to detect musl libc. + if command -v ldd >/dev/null && \ + ldd --version 2>&1 | grep -q ^musl + then + LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. -case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in +case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -188,32 +174,32 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \ - /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ - /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ - echo unknown)) - case $UNAME_MACHINE_ARCH in - aarch64eb) machine=aarch64_be-unknown ;; + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + "/sbin/$sysctl" 2>/dev/null || \ + "/usr/sbin/$sysctl" 2>/dev/null || \ + echo unknown)` + case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) - arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,') - endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p') + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. - case $UNAME_MACHINE_ARCH in + case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - set_cc_for_build + eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -229,10 +215,10 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in ;; esac # Determine ABI tags. - case $UNAME_MACHINE_ARCH in + case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr") + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release @@ -240,33 +226,29 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case $UNAME_VERSION in + case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) - release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi-}" + echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) - UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//') + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//') + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; - *:SecBSD:*:*) - UNAME_MACHINE_ARCH=$(arch | sed 's/SecBSD.//') - echo "$UNAME_MACHINE_ARCH"-unknown-secbsd"$UNAME_RELEASE" - exit ;; *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//') + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) @@ -278,9 +260,6 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; - *:OS108:*:*) - echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" - exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; @@ -290,32 +269,27 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; - *:Twizzler:*:*) - echo "$UNAME_MACHINE"-unknown-twizzler - exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; + echo mips-dec-osf1 + exit ;; alpha:OSF1:*:*) - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - trap '' 0 case $UNAME_RELEASE in *4.0) - UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}') + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}') + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1) - case $ALPHA_CPU_TYPE in + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") @@ -352,8 +326,11 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)" - exit ;; + echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; @@ -383,7 +360,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "$( (/bin/universe) 2>/dev/null)" = att ; then + if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd @@ -396,28 +373,28 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case $(/usr/bin/uname -p) in + case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" + echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" + echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - set_cc_for_build + eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if test "$CC_FOR_BUILD" != no_compiler_found; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null @@ -425,30 +402,30 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in SUN_ARCH=x86_64 fi fi - echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) - case $(/usr/bin/arch -k) in + case "`/usr/bin/arch -k`" in Series*|S4*) - UNAME_RELEASE=$(uname -v) + UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')" + echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) - UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case $(/bin/arch) in + case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; @@ -505,7 +482,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) - set_cc_for_build + eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ @@ -528,8 +505,8 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && - dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') && - SYSTEM_NAME=$("$dummy" "$dummyarg") && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; @@ -556,11 +533,11 @@ EOF exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=$(/usr/bin/uname -p) - if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then - if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ - test "$TARGET_BINARY_INTERFACE"x = x + if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ + [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else @@ -584,17 +561,17 @@ EOF echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) - echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')" + echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX ' + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) - if test -x /usr/bin/oslevel ; then - IBM_REV=$(/usr/bin/oslevel) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi @@ -602,7 +579,7 @@ EOF exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - set_cc_for_build + eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include @@ -614,7 +591,7 @@ EOF exit(0); } EOF - if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else @@ -627,15 +604,15 @@ EOF fi exit ;; *:AIX:*:[4567]) - IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }') + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi - if test -x /usr/bin/lslpp ; then - IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/) + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi @@ -663,27 +640,27 @@ EOF echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') - case $UNAME_MACHINE in + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - if test -x /usr/bin/getconf; then - sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null) - sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null) - case $sc_cpu_version in + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case $sc_kernel_bits in + case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi - if test "$HP_ARCH" = ""; then - set_cc_for_build + if [ "$HP_ARCH" = "" ]; then + eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE @@ -717,13 +694,13 @@ EOF exit (0); } EOF - (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy") + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if test "$HP_ARCH" = hppa2.0w + if [ "$HP_ARCH" = hppa2.0w ] then - set_cc_for_build + eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -745,11 +722,11 @@ EOF echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) - HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) - set_cc_for_build + eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include int @@ -775,7 +752,7 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; @@ -795,7 +772,7 @@ EOF echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) - if test -x /usr/sbin/sysversion ; then + if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 @@ -844,14 +821,14 @@ EOF echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz) - FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') - FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/') + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') - FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/') + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -863,26 +840,15 @@ EOF *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; - arm:FreeBSD:*:*) - UNAME_PROCESSOR=$(uname -p) - set_cc_for_build - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi - else - echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf - fi - exit ;; *:FreeBSD:*:*) - UNAME_PROCESSOR=$(/usr/bin/uname -p) - case $UNAME_PROCESSOR in + UNAME_PROCESSOR=`/usr/bin/uname -p` + case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" + echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin @@ -900,7 +866,7 @@ EOF echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) - case $UNAME_MACHINE in + case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; @@ -915,21 +881,21 @@ EOF echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-pc-cygwin + echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system - echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')" + echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC" + echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; - *:Minix:*:*) - echo "$UNAME_MACHINE"-unknown-minix + i*86:Minix:*:*) + echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" @@ -939,7 +905,7 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) - case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; @@ -952,11 +918,11 @@ EOF if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; - arc:Linux:*:* | arceb:Linux:*:* | arc64:Linux:*:*) + arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) - set_cc_for_build + eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then @@ -998,9 +964,6 @@ EOF k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; - loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; @@ -1008,51 +971,23 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) - set_cc_for_build - IS_GLIBC=0 - test x"${LIBC}" = xgnu && IS_GLIBC=1 + eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU - #undef mips - #undef mipsel - #undef mips64 - #undef mips64el - #if ${IS_GLIBC} && defined(_ABI64) - LIBCABI=gnuabi64 - #else - #if ${IS_GLIBC} && defined(_ABIN32) - LIBCABI=gnuabin32 - #else - LIBCABI=${LIBC} - #endif - #endif - - #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 - CPU=mipsisa64r6 - #else - #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 - CPU=mipsisa32r6 - #else - #if defined(__mips64) - CPU=mips64 - #else - CPU=mips - #endif - #endif - #endif - + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - MIPS_ENDIAN=el + CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - MIPS_ENDIAN= + CPU=${UNAME_MACHINE} #else - MIPS_ENDIAN= + CPU= #endif #endif EOF - eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')" - test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" + test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" @@ -1071,7 +1006,7 @@ EOF exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level - case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; @@ -1089,7 +1024,7 @@ EOF ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; - riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) @@ -1111,17 +1046,11 @@ EOF echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) - set_cc_for_build - LIBCABI=$LIBC - if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_X32 >/dev/null - then - LIBCABI="$LIBC"x32 - fi + if objdump -f /bin/sh | grep -q elf32-x86-64; then + echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 + else + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" fi - echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" @@ -1161,7 +1090,7 @@ EOF echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) - UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//') + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else @@ -1170,19 +1099,19 @@ EOF exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. - case $(/bin/uname -X | grep "^Machine") in + case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" + echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then - UNAME_REL=$(sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //')) + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 @@ -1232,7 +1161,7 @@ EOF 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ - && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ @@ -1243,7 +1172,7 @@ EOF NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ - && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ @@ -1276,7 +1205,7 @@ EOF exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=$( (uname -p) 2>/dev/null) + UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv @@ -1310,7 +1239,7 @@ EOF echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if test -d /usr/nec; then + if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" @@ -1358,48 +1287,44 @@ EOF *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; - arm64:Darwin:*:*) - echo aarch64-apple-darwin"$UNAME_RELEASE" - exit ;; *:Darwin:*:*) - UNAME_PROCESSOR=$(uname -p) - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - if command -v xcode-select > /dev/null 2> /dev/null && \ - ! xcode-select --print-path > /dev/null 2> /dev/null ; then - # Avoid executing cc if there is no toolchain installed as - # cc will be a stub that puts up a graphical alert - # prompting the user to install developer tools. - CC_FOR_BUILD=no_compiler_found - else - set_cc_for_build + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + eval "$set_cc_for_build" + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc fi - if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc + if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi fi elif test "$UNAME_PROCESSOR" = i386 ; then - # uname -m returns i386 or x86_64 - UNAME_PROCESSOR=$UNAME_MACHINE + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=$(uname -p) + UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc @@ -1437,9 +1362,9 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "${cputype-}" = 386; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 - elif test "x${cputype-}" != x; then + else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 @@ -1466,11 +1391,11 @@ EOF echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" + echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) - UNAME_MACHINE=$( (uname -p) 2>/dev/null) - case $UNAME_MACHINE in + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; @@ -1479,13 +1404,13 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')" + echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; - *:AROS:*:*) - echo "$UNAME_MACHINE"-unknown-aros + i*86:AROS:*:*) + echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx @@ -1493,151 +1418,11 @@ EOF amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; - *:Unleashed:*:*) - echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" - exit ;; esac -# No uname command or uname output not recognized. -set_cc_for_build -cat > "$dummy.c" < -#include -#endif -#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) -#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) -#include -#if defined(_SIZE_T_) || defined(SIGLOST) -#include -#endif -#endif -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null); - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); -#endif - -#if defined (vax) -#if !defined (ultrix) -#include -#if defined (BSD) -#if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -#else -#if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -#else - printf ("vax-dec-bsd\n"); exit (0); -#endif -#endif -#else - printf ("vax-dec-bsd\n"); exit (0); -#endif -#else -#if defined(_SIZE_T_) || defined(SIGLOST) - struct utsname un; - uname (&un); - printf ("vax-dec-ultrix%s\n", un.release); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif -#endif -#endif -#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) -#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) -#if defined(_SIZE_T_) || defined(SIGLOST) - struct utsname *un; - uname (&un); - printf ("mips-dec-ultrix%s\n", un.release); exit (0); -#else - printf ("mips-dec-ultrix\n"); exit (0); -#endif -#endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. -test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } - echo "$0: unable to guess system type" >&2 -case $UNAME_MACHINE:$UNAME_SYSTEM in +case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown) -uname -r = $( (uname -r) 2>/dev/null || echo unknown) -uname -s = $( (uname -s) 2>/dev/null || echo unknown) -uname -v = $( (uname -v) 2>/dev/null || echo unknown) +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` -/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null) -/bin/uname -X = $( (/bin/uname -X) 2>/dev/null) +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` -hostinfo = $( (hostinfo) 2>/dev/null) -/bin/universe = $( (/bin/universe) 2>/dev/null) -/usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null) -/bin/arch = $( (/bin/arch) 2>/dev/null) -/usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null) -/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null) +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF -fi exit 1 # Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/contrib/depends/config.site.in b/contrib/depends/config.site.in deleted file mode 100644 index 03dabee..0000000 --- a/contrib/depends/config.site.in +++ /dev/null @@ -1,154 +0,0 @@ -# shellcheck shell=sh disable=SC2034 # Many variables set will be used in - # ./configure but shellcheck doesn't know - # that, hence: disable=SC2034 - -true # Dummy command because shellcheck treats all directives before first - # command as file-wide, and we only want to disable for one line. - # - # See: https://github.com/koalaman/shellcheck/wiki/Directive - -# shellcheck disable=SC2154 -depends_prefix="$(cd "$(dirname "$ac_site_file")/.." && pwd)" - -cross_compiling=maybe -host_alias="@HOST@" -ac_tool_prefix="${host_alias}-" - -if test -z "$with_boost"; then - with_boost="$depends_prefix" -fi -if test -z "$with_qt_plugindir"; then - with_qt_plugindir="${depends_prefix}/plugins" -fi -if test -z "$with_qt_translationdir"; then - with_qt_translationdir="${depends_prefix}/translations" -fi -if test -z "$with_qt_bindir" && test -z "@no_qt@"; then - with_qt_bindir="${depends_prefix}/native/bin" -fi -if test -z "$with_mpgen" && test -n "@multiprocess@"; then - with_mpgen="${depends_prefix}/native" -fi - -if test -z "$with_qrencode" && test -n "@no_qr@"; then - with_qrencode=no -fi - -if test -z "$enable_wallet" && test -n "@no_wallet@"; then - enable_wallet=no -fi - -if test -z "$with_bdb" && test -n "@no_bdb@"; then - with_bdb=no -fi - -if test -z "$with_sqlite" && test -n "@no_sqlite@"; then - with_sqlite=no -fi - -if test -z "$enable_multiprocess" && test -n "@multiprocess@"; then - enable_multiprocess=yes -fi - -if test -z "$with_miniupnpc" && test -n "@no_upnp@"; then - with_miniupnpc=no -fi - -if test -z "$with_natpmp" && test -n "@no_natpmp@"; then - with_natpmp=no -fi - -if test -z "$with_gui" && test -n "@no_qt@"; then - with_gui=no -fi - -if test -n "@debug@" && test -z "@no_qt@" && test "$with_gui" != "no"; then - with_gui=qt5_debug -fi - -if test -z "$enable_zmq" && test -n "@no_zmq@"; then - enable_zmq=no -fi - -if test -z "$enable_usdt" && test -n "@no_usdt@"; then - enable_usdt=no -fi - -if test "@host_os@" = darwin; then - BREW=no -fi - -PKG_CONFIG="$(which pkg-config) --static" - -# These two need to remain exported because pkg-config does not see them -# otherwise. That means they must be unexported at the end of configure.ac to -# avoid ruining the cache. Sigh. -export PKG_CONFIG_PATH="${depends_prefix}/share/pkgconfig:${depends_prefix}/lib/pkgconfig" -if test -z "@allow_host_packages@"; then - export PKG_CONFIG_LIBDIR="${depends_prefix}/lib/pkgconfig" -fi - -CPPFLAGS="-I${depends_prefix}/include/ ${CPPFLAGS}" -LDFLAGS="-L${depends_prefix}/lib ${LDFLAGS}" - -if test -n "@CC@" -a -z "${CC}"; then - CC="@CC@" -fi -if test -n "@CXX@" -a -z "${CXX}"; then - CXX="@CXX@" -fi -PYTHONPATH="${depends_prefix}/native/lib/python3/dist-packages${PYTHONPATH:+${PATH_SEPARATOR}}${PYTHONPATH}" - -if test -n "@AR@"; then - AR="@AR@" - ac_cv_path_ac_pt_AR="${AR}" -fi - -if test -n "@RANLIB@"; then - RANLIB="@RANLIB@" - ac_cv_path_ac_pt_RANLIB="${RANLIB}" -fi - -if test -n "@NM@"; then - NM="@NM@" - ac_cv_path_ac_pt_NM="${NM}" -fi - -if test -n "@STRIP@"; then - STRIP="@STRIP@" - ac_cv_path_ac_pt_STRIP="${STRIP}" -fi - -if test "@host_os@" = darwin; then - if test -n "@OTOOL@"; then - OTOOL="@OTOOL@" - ac_cv_path_ac_pt_OTOOL="${OTOOL}" - fi - - if test -n "@INSTALL_NAME_TOOL@"; then - INSTALL_NAME_TOOL="@INSTALL_NAME_TOOL@" - ac_cv_path_ac_pt_INSTALL_NAME_TOOL="${INSTALL_NAME_TOOL}" - fi - - if test -n "@DSYMUTIL@"; then - DSYMUTIL="@DSYMUTIL@" - ac_cv_path_ac_pt_DSYMUTIL="${DSYMUTIL}" - fi -fi - -if test -n "@debug@"; then - enable_reduce_exports=no -fi - -if test -n "@CFLAGS@"; then - CFLAGS="@CFLAGS@ ${CFLAGS}" -fi -if test -n "@CXXFLAGS@"; then - CXXFLAGS="@CXXFLAGS@ ${CXXFLAGS}" -fi -if test -n "@CPPFLAGS@"; then - CPPFLAGS="@CPPFLAGS@ ${CPPFLAGS}" -fi -if test -n "@LDFLAGS@"; then - LDFLAGS="@LDFLAGS@ ${LDFLAGS}" -fi diff --git a/contrib/depends/config.sub b/contrib/depends/config.sub index 7384e91..1d8e98b 100755 --- a/contrib/depends/config.sub +++ b/contrib/depends/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2021 Free Software Foundation, Inc. +# Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2021-04-30' +timestamp='2018-02-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ timestamp='2021-04-30' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -50,7 +50,7 @@ timestamp='2021-04-30' # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -me=$(echo "$0" | sed -e 's,.*/,,') +me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS @@ -67,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2021 Free Software Foundation, Inc. +Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -89,7 +89,7 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - echo "$me: invalid option $1$help" >&2 + echo "$me: invalid option $1$help" exit 1 ;; *local*) @@ -110,1173 +110,1223 @@ case $# in exit 1;; esac -# Split fields of configuration type -# shellcheck disable=SC2162 -IFS="-" read field1 field2 field3 field4 <&2 - exit 1 +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. ;; - *-*-*-*) - basic_machine=$field1-$field2 - basic_os=$field3-$field4 + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 ;; - *-*-*) - # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two - # parts - maybe_os=$field2-$field3 - case $maybe_os in - nto-qnx* | linux-* | uclinux-uclibc* \ - | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ - | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova*) - basic_machine=$field1 - basic_os=$maybe_os - ;; - android-linux) - basic_machine=$field1-unknown - basic_os=linux-android - ;; - *) - basic_machine=$field1-$field2 - basic_os=$field3 - ;; - esac + -bluegene*) + os=-cnk ;; - *-*) - # A lone config we happen to match not fitting any pattern - case $field1-$field2 in - decstation-3100) - basic_machine=mips-dec - basic_os= - ;; - *-*) - # Second component is usually, but not always the OS - case $field2 in - # Prevent following clause from handling this valid os - sun*os*) - basic_machine=$field1 - basic_os=$field2 - ;; - # Manufacturers - dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ - | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ - | unicom* | ibm* | next | hp | isi* | apollo | altos* \ - | convergent* | ncr* | news | 32* | 3600* | 3100* \ - | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ - | ultra | tti* | harris | dolphin | highlevel | gould \ - | cbm | ns | masscomp | apple | axis | knuth | cray \ - | microblaze* | sim | cisco \ - | oki | wec | wrs | winbond) - basic_machine=$field1-$field2 - basic_os= - ;; - *) - basic_machine=$field1 - basic_os=$field2 - ;; - esac - ;; - esac + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 ;; - *) - # Convert single-component short-hands not valid as part of - # multi-component configurations. - case $field1 in - 386bsd) - basic_machine=i386-pc - basic_os=bsd - ;; - a29khif) - basic_machine=a29k-amd - basic_os=udi - ;; - adobe68k) - basic_machine=m68010-adobe - basic_os=scout - ;; - alliant) - basic_machine=fx80-alliant - basic_os= - ;; - altos | altos3068) - basic_machine=m68k-altos - basic_os= - ;; - am29k) - basic_machine=a29k-none - basic_os=bsd - ;; - amdahl) - basic_machine=580-amdahl - basic_os=sysv - ;; - amiga) - basic_machine=m68k-unknown - basic_os= - ;; - amigaos | amigados) - basic_machine=m68k-unknown - basic_os=amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - basic_os=sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - basic_os=sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - basic_os=bsd - ;; - aros) - basic_machine=i386-pc - basic_os=aros - ;; - aux) - basic_machine=m68k-apple - basic_os=aux - ;; - balance) - basic_machine=ns32k-sequent - basic_os=dynix - ;; - blackfin) - basic_machine=bfin-unknown - basic_os=linux - ;; - cegcc) - basic_machine=arm-unknown - basic_os=cegcc - ;; - convex-c1) - basic_machine=c1-convex - basic_os=bsd - ;; - convex-c2) - basic_machine=c2-convex - basic_os=bsd - ;; - convex-c32) - basic_machine=c32-convex - basic_os=bsd - ;; - convex-c34) - basic_machine=c34-convex - basic_os=bsd - ;; - convex-c38) - basic_machine=c38-convex - basic_os=bsd - ;; - cray) - basic_machine=j90-cray - basic_os=unicos - ;; - crds | unos) - basic_machine=m68k-crds - basic_os= - ;; - da30) - basic_machine=m68k-da30 - basic_os= - ;; - decstation | pmax | pmin | dec3100 | decstatn) - basic_machine=mips-dec - basic_os= - ;; - delta88) - basic_machine=m88k-motorola - basic_os=sysv3 - ;; - dicos) - basic_machine=i686-pc - basic_os=dicos - ;; - djgpp) - basic_machine=i586-pc - basic_os=msdosdjgpp - ;; - ebmon29k) - basic_machine=a29k-amd - basic_os=ebmon - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - basic_os=ose - ;; - gmicro) - basic_machine=tron-gmicro - basic_os=sysv - ;; - go32) - basic_machine=i386-pc - basic_os=go32 - ;; - h8300hms) - basic_machine=h8300-hitachi - basic_os=hms - ;; - h8300xray) - basic_machine=h8300-hitachi - basic_os=xray - ;; - h8500hms) - basic_machine=h8500-hitachi - basic_os=hms - ;; - harris) - basic_machine=m88k-harris - basic_os=sysv3 - ;; - hp300 | hp300hpux) - basic_machine=m68k-hp - basic_os=hpux - ;; - hp300bsd) - basic_machine=m68k-hp - basic_os=bsd - ;; - hppaosf) - basic_machine=hppa1.1-hp - basic_os=osf - ;; - hppro) - basic_machine=hppa1.1-hp - basic_os=proelf - ;; - i386mach) - basic_machine=i386-mach - basic_os=mach - ;; - isi68 | isi) - basic_machine=m68k-isi - basic_os=sysv - ;; - m68knommu) - basic_machine=m68k-unknown - basic_os=linux - ;; - magnum | m3230) - basic_machine=mips-mips - basic_os=sysv - ;; - merlin) - basic_machine=ns32k-utek - basic_os=sysv - ;; - mingw64) - basic_machine=x86_64-pc - basic_os=mingw64 - ;; - mingw32) - basic_machine=i686-pc - basic_os=mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - basic_os=mingw32ce - ;; - monitor) - basic_machine=m68k-rom68k - basic_os=coff - ;; - morphos) - basic_machine=powerpc-unknown - basic_os=morphos - ;; - moxiebox) - basic_machine=moxie-unknown - basic_os=moxiebox - ;; - msdos) - basic_machine=i386-pc - basic_os=msdos - ;; - msys) - basic_machine=i686-pc - basic_os=msys - ;; - mvs) - basic_machine=i370-ibm - basic_os=mvs - ;; - nacl) - basic_machine=le32-unknown - basic_os=nacl - ;; - ncr3000) - basic_machine=i486-ncr - basic_os=sysv4 - ;; - netbsd386) - basic_machine=i386-pc - basic_os=netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - basic_os=linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - basic_os=newsos - ;; - news1000) - basic_machine=m68030-sony - basic_os=newsos - ;; - necv70) - basic_machine=v70-nec - basic_os=sysv - ;; - nh3000) - basic_machine=m68k-harris - basic_os=cxux - ;; - nh[45]000) - basic_machine=m88k-harris - basic_os=cxux - ;; - nindy960) - basic_machine=i960-intel - basic_os=nindy - ;; - mon960) - basic_machine=i960-intel - basic_os=mon960 - ;; - nonstopux) - basic_machine=mips-compaq - basic_os=nonstopux - ;; - os400) - basic_machine=powerpc-ibm - basic_os=os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - basic_os=ose - ;; - os68k) - basic_machine=m68k-none - basic_os=os68k - ;; - paragon) - basic_machine=i860-intel - basic_os=osf - ;; - parisc) - basic_machine=hppa-unknown - basic_os=linux - ;; - psp) - basic_machine=mipsallegrexel-sony - basic_os=psp - ;; - pw32) - basic_machine=i586-unknown - basic_os=pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - basic_os=rdos - ;; - rdos32) - basic_machine=i386-pc - basic_os=rdos - ;; - rom68k) - basic_machine=m68k-rom68k - basic_os=coff - ;; - sa29200) - basic_machine=a29k-amd - basic_os=udi - ;; - sei) - basic_machine=mips-sei - basic_os=seiux - ;; - sequent) - basic_machine=i386-sequent - basic_os= - ;; - sps7) - basic_machine=m68k-bull - basic_os=sysv2 - ;; - st2000) - basic_machine=m68k-tandem - basic_os= - ;; - stratus) - basic_machine=i860-stratus - basic_os=sysv4 - ;; - sun2) - basic_machine=m68000-sun - basic_os= - ;; - sun2os3) - basic_machine=m68000-sun - basic_os=sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - basic_os=sunos4 - ;; - sun3) - basic_machine=m68k-sun - basic_os= - ;; - sun3os3) - basic_machine=m68k-sun - basic_os=sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - basic_os=sunos4 - ;; - sun4) - basic_machine=sparc-sun - basic_os= - ;; - sun4os3) - basic_machine=sparc-sun - basic_os=sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - basic_os=sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - basic_os=solaris2 - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - basic_os= - ;; - sv1) - basic_machine=sv1-cray - basic_os=unicos - ;; - symmetry) - basic_machine=i386-sequent - basic_os=dynix - ;; - t3e) - basic_machine=alphaev5-cray - basic_os=unicos - ;; - t90) - basic_machine=t90-cray - basic_os=unicos - ;; - toad1) - basic_machine=pdp10-xkl - basic_os=tops20 - ;; - tpf) - basic_machine=s390x-ibm - basic_os=tpf - ;; - udi29k) - basic_machine=a29k-amd - basic_os=udi - ;; - ultra3) - basic_machine=a29k-nyu - basic_os=sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - basic_os=none - ;; - vaxv) - basic_machine=vax-dec - basic_os=sysv - ;; - vms) - basic_machine=vax-dec - basic_os=vms - ;; - vsta) - basic_machine=i386-pc - basic_os=vsta - ;; - vxworks960) - basic_machine=i960-wrs - basic_os=vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - basic_os=vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - basic_os=vxworks - ;; - xbox) - basic_machine=i686-pc - basic_os=mingw32 - ;; - ymp) - basic_machine=ymp-cray - basic_os=unicos - ;; - *) - basic_machine=$1 - basic_os= - ;; - esac + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint ;; esac -# Decode 1-component or ad-hoc basic machines +# Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in - # Here we handle the default manufacturer of certain CPU types. It is in - # some cases the only manufacturer, in others, it is the most popular. - w89k) - cpu=hppa1.1 - vendor=winbond + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | ba \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ + | open8 | or1k | or1knd | or32 \ + | pdp10 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ + | pyramid \ + | riscv32 | riscv64 \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ + | wasm32 \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown ;; - op50n) - cpu=hppa1.1 - vendor=oki + c54x) + basic_machine=tic54x-unknown ;; - op60c) - cpu=hppa1.1 - vendor=oki + c55x) + basic_machine=tic55x-unknown ;; - ibm*) - cpu=i370 - vendor=ibm - ;; - orion105) - cpu=clipper - vendor=highlevel - ;; - mac | mpw | mac-mpw) - cpu=m68k - vendor=apple - ;; - pmac | pmac-mpw) - cpu=powerpc - vendor=apple - ;; - - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - cpu=m68000 - vendor=att - ;; - 3b*) - cpu=we32k - vendor=att - ;; - bluegene*) - cpu=powerpc - vendor=ibm - basic_os=cnk - ;; - decsystem10* | dec10*) - cpu=pdp10 - vendor=dec - basic_os=tops10 - ;; - decsystem20* | dec20*) - cpu=pdp10 - vendor=dec - basic_os=tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - cpu=m68k - vendor=motorola - ;; - dpx2*) - cpu=m68k - vendor=bull - basic_os=sysv3 - ;; - encore | umax | mmax) - cpu=ns32k - vendor=encore - ;; - elxsi) - cpu=elxsi - vendor=elxsi - basic_os=${basic_os:-bsd} - ;; - fx2800) - cpu=i860 - vendor=alliant - ;; - genix) - cpu=ns32k - vendor=ns - ;; - h3050r* | hiux*) - cpu=hppa1.1 - vendor=hitachi - basic_os=hiuxwe2 - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - cpu=m68000 - vendor=hp - ;; - hp9k3[2-9][0-9]) - cpu=m68k - vendor=hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - cpu=hppa1.1 - vendor=hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - i*86v32) - cpu=$(echo "$1" | sed -e 's/86.*/86/') - vendor=pc - basic_os=sysv32 - ;; - i*86v4*) - cpu=$(echo "$1" | sed -e 's/86.*/86/') - vendor=pc - basic_os=sysv4 - ;; - i*86v) - cpu=$(echo "$1" | sed -e 's/86.*/86/') - vendor=pc - basic_os=sysv - ;; - i*86sol2) - cpu=$(echo "$1" | sed -e 's/86.*/86/') - vendor=pc - basic_os=solaris2 - ;; - j90 | j90-cray) - cpu=j90 - vendor=cray - basic_os=${basic_os:-unicos} - ;; - iris | iris4d) - cpu=mips - vendor=sgi - case $basic_os in - irix*) - ;; - *) - basic_os=irix4 - ;; - esac - ;; - miniframe) - cpu=m68000 - vendor=convergent - ;; - *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) - cpu=m68k - vendor=atari - basic_os=mint - ;; - news-3600 | risc-news) - cpu=mips - vendor=sony - basic_os=newsos - ;; - next | m*-next) - cpu=m68k - vendor=next - case $basic_os in - openstep*) - ;; - nextstep*) - ;; - ns2*) - basic_os=nextstep2 - ;; - *) - basic_os=nextstep3 - ;; - esac - ;; - np1) - cpu=np1 - vendor=gould - ;; - op50n-* | op60c-*) - cpu=hppa1.1 - vendor=oki - basic_os=proelf - ;; - pa-hitachi) - cpu=hppa1.1 - vendor=hitachi - basic_os=hiuxwe2 - ;; - pbd) - cpu=sparc - vendor=tti - ;; - pbb) - cpu=m68k - vendor=tti - ;; - pc532) - cpu=ns32k - vendor=pc532 - ;; - pn) - cpu=pn - vendor=gould - ;; - power) - cpu=power - vendor=ibm - ;; - ps2) - cpu=i386 - vendor=ibm - ;; - rm[46]00) - cpu=mips - vendor=siemens - ;; - rtpc | rtpc-*) - cpu=romp - vendor=ibm - ;; - sde) - cpu=mipsisa32 - vendor=sde - basic_os=${basic_os:-elf} - ;; - simso-wrs) - cpu=sparclite - vendor=wrs - basic_os=vxworks - ;; - tower | tower-32) - cpu=m68k - vendor=ncr - ;; - vpp*|vx|vx-*) - cpu=f301 - vendor=fujitsu - ;; - w65) - cpu=w65 - vendor=wdc - ;; - w89k-*) - cpu=hppa1.1 - vendor=winbond - basic_os=proelf - ;; - none) - cpu=none - vendor=none + c6x) + basic_machine=tic6x-unknown ;; leon|leon[3-9]) - cpu=sparc - vendor=$basic_machine + basic_machine=sparc-$basic_machine ;; - leon-*|leon[3-9]-*) - cpu=sparc - vendor=$(echo "$basic_machine" | sed 's/-.*//') + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) + ;; + ms1) + basic_machine=mt-unknown ;; - *-*) - # shellcheck disable=SC2162 - IFS="-" read cpu vendor <&2 + exit 1 ;; - # These rules are duplicated from below for sake of the special case above; - # i.e. things that normalized to x86 arches should also default to "pc" - pc98) - cpu=i386 - vendor=pc + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | ba-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | e2k-* | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | or1k*-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ + | pyramid-* \ + | riscv32-* | riscv64-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | visium-* \ + | wasm32-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) ;; - x64 | amd64) - cpu=x86_64 - vendor=pc + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown ;; - # Recognize the basic CPU types without company name. - *) - cpu=$basic_machine - vendor=unknown + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-pc + os=-bsd ;; -esac - -unset -v basic_machine - -# Decode basic machines in the full and proper CPU-Company form. -case $cpu-$vendor in - # Here we handle the default manufacturer of certain CPU types in canonical form. It is in - # some cases the only manufacturer, in others, it is the most popular. - craynv-unknown) - vendor=cray - basic_os=${basic_os:-unicosmp} + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att ;; - c90-unknown | c90-cray) - vendor=cray - basic_os=${Basic_os:-unicos} + 3b*) + basic_machine=we32k-att ;; - fx80-unknown) - vendor=alliant + a29khif) + basic_machine=a29k-amd + os=-udi ;; - romp-unknown) - vendor=ibm + abacus) + basic_machine=abacus-unknown ;; - mmix-unknown) - vendor=knuth + adobe68k) + basic_machine=m68010-adobe + os=-scout ;; - microblaze-unknown | microblazeel-unknown) - vendor=xilinx + alliant | fx80) + basic_machine=fx80-alliant ;; - rs6000-unknown) - vendor=ibm + altos | altos3068) + basic_machine=m68k-altos ;; - vax-unknown) - vendor=dec + am29k) + basic_machine=a29k-none + os=-bsd ;; - pdp11-unknown) - vendor=dec + amd64) + basic_machine=x86_64-pc ;; - we32k-unknown) - vendor=att - ;; - cydra-unknown) - vendor=cydrome - ;; - i370-ibm*) - vendor=ibm - ;; - orion-unknown) - vendor=highlevel - ;; - xps-unknown | xps100-unknown) - cpu=xps100 - vendor=honeywell - ;; - - # Here we normalize CPU types with a missing or matching vendor - dpx20-unknown | dpx20-bull) - cpu=rs6000 - vendor=bull - basic_os=${basic_os:-bosx} - ;; - - # Here we normalize CPU types irrespective of the vendor amd64-*) - cpu=x86_64 + basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + asmjs) + basic_machine=asmjs-unknown + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux ;; blackfin-*) - cpu=bfin - basic_os=linux + basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk ;; c54x-*) - cpu=tic54x + basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) - cpu=tic55x + basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) - cpu=tic6x + basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2*) + basic_machine=m68k-bull + os=-sysv3 + ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" ;; e500v[12]-*) - cpu=powerpc - basic_os=${basic_os}"spe" + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=$os"spe" ;; - mips3*-*) - cpu=mips64 + ebmon29k) + basic_machine=a29k-amd + os=-ebmon ;; - ms1-*) - cpu=mt + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux ;; m68knommu-*) - cpu=m68k - basic_os=linux + basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux ;; - m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) - cpu=s12z + magnum | m3230) + basic_machine=mips-mips + os=-sysv ;; - openrisc-*) - cpu=or32 + merlin) + basic_machine=ns32k-utek + os=-sysv ;; - parisc-*) - cpu=hppa - basic_os=linux + microblaze*) + basic_machine=microblaze-xilinx ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - cpu=i586 + mingw64) + basic_machine=x86_64-pc + os=-mingw64 ;; - pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*) - cpu=i686 + mingw32) + basic_machine=i686-pc + os=-mingw32 ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - cpu=i686 + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce ;; - pentium4-*) - cpu=i786 + miniframe) + basic_machine=m68000-convergent ;; - pc98-*) - cpu=i386 + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint ;; - ppc-* | ppcbe-*) - cpu=powerpc + mips3*-*) + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; - ppcle-* | powerpclittle-*) - cpu=powerpcle + mips3*) + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; - ppc64-*) - cpu=powerpc64 + monitor) + basic_machine=m68k-rom68k + os=-coff ;; - ppc64le-* | powerpc64little-*) - cpu=powerpc64le + morphos) + basic_machine=powerpc-unknown + os=-morphos ;; - sb1-*) - cpu=mipsisa64sb1 + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox ;; - sb1el-*) - cpu=mipsisa64sb1el + msdos) + basic_machine=i386-pc + os=-msdos ;; - sh5e[lb]-*) - cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/') + ms1-*) + basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; - spur-*) - cpu=spur + msys) + basic_machine=i686-pc + os=-msys ;; - strongarm-* | thumb-*) - cpu=arm + mvs) + basic_machine=i370-ibm + os=-mvs ;; - tx39-*) - cpu=mipstx39 + nacl) + basic_machine=le32-unknown + os=-nacl ;; - tx39el-*) - cpu=mipstx39el + ncr3000) + basic_machine=i486-ncr + os=-sysv4 ;; - x64-*) - cpu=x86_64 + netbsd386) + basic_machine=i386-unknown + os=-netbsd ;; - xscale-* | xscalee[bl]-*) - cpu=$(echo "$cpu" | sed 's/^xscale/arm/') + netwinder) + basic_machine=armv4l-rebel + os=-linux ;; - arm64-*) - cpu=aarch64 + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos ;; - - # Recognize the canonical CPU Types that limit and/or modify the - # company names they are paired with. - cr16-*) - basic_os=${basic_os:-elf} + news1000) + basic_machine=m68030-sony + os=-newsos ;; - crisv32-* | etraxfs*-*) - cpu=crisv32 - vendor=axis + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos ;; - cris-* | etrax*-*) - cpu=cris - vendor=axis + necv70) + basic_machine=v70-nec + os=-sysv ;; - crx-*) - basic_os=${basic_os:-elf} + next | m*-next) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould ;; neo-tandem) - cpu=neo - vendor=tandem + basic_machine=neo-tandem ;; nse-tandem) - cpu=nse - vendor=tandem + basic_machine=nse-tandem ;; nsr-tandem) - cpu=nsr - vendor=tandem + basic_machine=nsr-tandem ;; nsv-tandem) - cpu=nsv - vendor=tandem + basic_machine=nsv-tandem ;; nsx-tandem) - cpu=nsx - vendor=tandem + basic_machine=nsx-tandem ;; - mipsallegrexel-sony) - cpu=mipsallegrexel - vendor=sony + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf ;; - tile*-*) - basic_os=${basic_os:-linux-gnu} + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + x64) + basic_machine=x86_64-pc + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + none) + basic_machine=none-none + os=-none ;; +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; *) - # Recognize the canonical CPU types that are allowed with any - # company name. - case $cpu in - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | abacus \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ - | alphapca5[67] | alpha64pca5[67] \ - | am33_2.0 \ - | amdgcn \ - | arc | arceb | arc64 \ - | arm | arm[lb]e | arme[lb] | armv* \ - | avr | avr32 \ - | asmjs \ - | ba \ - | be32 | be64 \ - | bfin | bpf | bs2000 \ - | c[123]* | c30 | [cjt]90 | c4x \ - | c8051 | clipper | craynv | csky | cydra \ - | d10v | d30v | dlx | dsp16xx \ - | e2k | elxsi | epiphany \ - | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ - | h8300 | h8500 \ - | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i*86 | i860 | i960 | ia16 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | loongarch32 | loongarch64 | loongarchx32 \ - | m32c | m32r | m32rle \ - | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ - | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ - | m88110 | m88k | maxq | mb | mcore | mep | metag \ - | microblaze | microblazeel \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64eb | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r3 | mipsisa32r3el \ - | mipsisa32r5 | mipsisa32r5el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r3 | mipsisa64r3el \ - | mipsisa64r5 | mipsisa64r5el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mmix \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nfp \ - | nios | nios2 | nios2eb | nios2el \ - | none | np1 | ns16k | ns32k | nvptx \ - | open8 \ - | or1k* \ - | or32 \ - | orion \ - | picochip \ - | pdp10 | pdp11 | pj | pjl | pn | power \ - | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ - | pru \ - | pyramid \ - | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ - | rl78 | romp | rs6000 | rx \ - | s390 | s390x \ - | score \ - | sh | shl \ - | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ - | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ - | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ - | spu \ - | tahoe \ - | thumbv7* \ - | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ - | tron \ - | ubicom32 \ - | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ - | vax \ - | visium \ - | w65 \ - | wasm32 | wasm64 \ - | we32k \ - | x86 | x86_64 | xc16x | xgate | xps100 \ - | xstormy16 | xtensa* \ - | ymp \ - | z8k | z80) - ;; - - *) - echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 - exit 1 - ;; - esac + echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 + exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. -case $vendor in - digital*) - vendor=dec +case $basic_machine in + *-digital*) + basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; - commodore*) - vendor=cbm + *-commodore*) + basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; @@ -1284,213 +1334,203 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if test x$basic_os != x +if [ x"$os" != x"" ] then - -# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just -# set os. -case $basic_os in - gnu/linux*) - kernel=linux - os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') - ;; - os2-emx) - kernel=os2 - os=$(echo $basic_os | sed -e 's|os2-emx|emx|') - ;; - nto-qnx*) - kernel=nto - os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') - ;; - *-*) - # shellcheck disable=SC2162 - IFS="-" read kernel os <&2 + exit 1 ;; esac - else # Here we handle the default operating systems that come with various machines. @@ -1503,361 +1543,258 @@ else # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. -kernel= -case $cpu-$vendor in +case $basic_machine in score-*) - os=elf + os=-elf ;; spu-*) - os=elf + os=-elf ;; *-acorn) - os=riscix1.2 + os=-riscix1.2 ;; arm*-rebel) - kernel=linux - os=gnu + os=-linux ;; arm*-semi) - os=aout + os=-aout ;; c4x-* | tic4x-*) - os=coff + os=-coff ;; c8051-*) - os=elf - ;; - clipper-intergraph) - os=clix + os=-elf ;; hexagon-*) - os=elf + os=-elf ;; tic54x-*) - os=coff + os=-coff ;; tic55x-*) - os=coff + os=-coff ;; tic6x-*) - os=coff + os=-coff ;; # This must come before the *-dec entry. pdp10-*) - os=tops20 + os=-tops20 ;; pdp11-*) - os=none + os=-none ;; *-dec | vax-*) - os=ultrix4.2 + os=-ultrix4.2 ;; m68*-apollo) - os=domain + os=-domain ;; i386-sun) - os=sunos4.0.2 + os=-sunos4.0.2 ;; m68000-sun) - os=sunos3 + os=-sunos3 ;; m68*-cisco) - os=aout + os=-aout ;; mep-*) - os=elf + os=-elf ;; mips*-cisco) - os=elf + os=-elf ;; mips*-*) - os=elf + os=-elf ;; or32-*) - os=coff + os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. - os=sysv3 + os=-sysv3 ;; sparc-* | *-sun) - os=sunos4.1.1 + os=-sunos4.1.1 ;; pru-*) - os=elf + os=-elf ;; *-be) - os=beos + os=-beos ;; *-ibm) - os=aix + os=-aix ;; *-knuth) - os=mmixware + os=-mmixware ;; *-wec) - os=proelf + os=-proelf ;; *-winbond) - os=proelf + os=-proelf ;; *-oki) - os=proelf + os=-proelf ;; *-hp) - os=hpux + os=-hpux ;; *-hitachi) - os=hiux + os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=sysv + os=-sysv ;; *-cbm) - os=amigaos + os=-amigaos ;; *-dg) - os=dgux + os=-dgux ;; *-dolphin) - os=sysv3 + os=-sysv3 ;; m68k-ccur) - os=rtu + os=-rtu ;; m88k-omron*) - os=luna + os=-luna ;; *-next) - os=nextstep + os=-nextstep ;; *-sequent) - os=ptx + os=-ptx ;; *-crds) - os=unos + os=-unos ;; *-ns) - os=genix + os=-genix ;; i370-*) - os=mvs + os=-mvs ;; *-gould) - os=sysv + os=-sysv ;; *-highlevel) - os=bsd + os=-bsd ;; *-encore) - os=bsd + os=-bsd ;; *-sgi) - os=irix + os=-irix ;; *-siemens) - os=sysv4 + os=-sysv4 ;; *-masscomp) - os=rtu + os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) - os=uxpv + os=-uxpv ;; *-rom68k) - os=coff + os=-coff ;; *-*bug) - os=coff + os=-coff ;; *-apple) - os=macos + os=-macos ;; *-atari*) - os=mint - ;; - *-wrs) - os=vxworks + os=-mint ;; *) - os=none + os=-none ;; esac - fi -# Now, validate our (potentially fixed-up) OS. -case $os in - # Sometimes we do "kernel-libc", so those need to count as OSes. - musl* | newlib* | uclibc*) - ;; - # Likewise for "kernel-abi" - eabi* | gnueabi*) - ;; - # VxWorks passes extra cpu info in the 4th filed. - simlinux | simwindows | spe) - ;; - # Now accept the basic system types. - # The portable systems comes first. - # Each alternative MUST end in a * to match a version number. - gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ - | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ - | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ - | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ - | hiux* | abug | nacl* | netware* | windows* \ - | os9* | macos* | osx* | ios* \ - | mpw* | magic* | mmixware* | mon960* | lnews* \ - | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ - | aos* | aros* | cloudabi* | sortix* | twizzler* \ - | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ - | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ - | mirbsd* | netbsd* | dicos* | openedition* | ose* \ - | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ - | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ - | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ - | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ - | udi* | lites* | ieee* | go32* | aux* | hcos* \ - | chorusrdb* | cegcc* | glidix* | serenity* \ - | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ - | midipix* | mingw32* | mingw64* | mint* \ - | uxpv* | beos* | mpeix* | udk* | moxiebox* \ - | interix* | uwin* | mks* | rhapsody* | darwin* \ - | openstep* | oskit* | conix* | pw32* | nonstopux* \ - | storm-chaos* | tops10* | tenex* | tops20* | its* \ - | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ - | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ - | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ - | skyos* | haiku* | rdos* | toppers* | drops* | es* \ - | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ - | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ - | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) - ;; - # This one is extra strict with allowed versions - sco3.2v2 | sco3.2v[4-9]* | sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - ;; - none) - ;; - *) - echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 - exit 1 - ;; -esac - -# As a final step for OS-related things, validate the OS-kernel combination -# (given a valid OS), if there is a kernel. -case $kernel-$os in - linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) - ;; - uclinux-uclibc* ) - ;; - -dietlibc* | -newlib* | -musl* | -uclibc* ) - # These are just libc implementations, not actual OSes, and thus - # require a kernel. - echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 - exit 1 - ;; - kfreebsd*-gnu* | kopensolaris*-gnu*) - ;; - vxworks-simlinux | vxworks-simwindows | vxworks-spe) - ;; - nto-qnx*) - ;; - os2-emx) - ;; - *-eabi* | *-gnueabi*) - ;; - -*) - # Blank kernel with real OS is always fine. - ;; - *-*) - echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 - exit 1 - ;; -esac - # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. -case $vendor in - unknown) - case $cpu-$os in - *-riscix*) +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) vendor=acorn ;; - *-sunos*) + -sunos*) vendor=sun ;; - *-cnk* | *-aix*) + -cnk*|-aix*) vendor=ibm ;; - *-beos*) + -beos*) vendor=be ;; - *-hpux*) + -hpux*) vendor=hp ;; - *-mpeix*) + -mpeix*) vendor=hp ;; - *-hiux*) + -hiux*) vendor=hitachi ;; - *-unos*) + -unos*) vendor=crds ;; - *-dgux*) + -dgux*) vendor=dg ;; - *-luna*) + -luna*) vendor=omron ;; - *-genix*) + -genix*) vendor=ns ;; - *-clix*) - vendor=intergraph - ;; - *-mvs* | *-opened*) + -mvs* | -opened*) vendor=ibm ;; - *-os400*) + -os400*) vendor=ibm ;; - s390-* | s390x-*) - vendor=ibm - ;; - *-ptx*) + -ptx*) vendor=sequent ;; - *-tpf*) + -tpf*) vendor=ibm ;; - *-vxsim* | *-vxworks* | *-windiss*) + -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; - *-aux*) + -aux*) vendor=apple ;; - *-hms*) + -hms*) vendor=hitachi ;; - *-mpw* | *-macos*) + -mpw* | -macos*) vendor=apple ;; - *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; - *-vos*) + -vos*) vendor=stratus ;; esac + basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac -echo "$cpu-$vendor-${kernel:+$kernel-}$os" +echo "$basic_machine$os" exit # Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk index bf9b762..9415abc 100644 --- a/contrib/depends/hosts/darwin.mk +++ b/contrib/depends/hosts/darwin.mk @@ -111,6 +111,7 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \ darwin_CFLAGS=-pipe darwin_CXXFLAGS=$(darwin_CFLAGS) +darwin_ARFLAGS=cr darwin_release_CFLAGS=-O2 darwin_release_CXXFLAGS=$(darwin_release_CFLAGS) diff --git a/contrib/depends/hosts/default.mk b/contrib/depends/hosts/default.mk index b6f45c4..caed1cb 100644 --- a/contrib/depends/hosts/default.mk +++ b/contrib/depends/hosts/default.mk @@ -11,6 +11,7 @@ default_host_LIBTOOL = $(host_toolchain)libtool default_host_INSTALL_NAME_TOOL = $(host_toolchain)install_name_tool default_host_OTOOL = $(host_toolchain)otool default_host_NM = $(host_toolchain)nm +default_host_OBJCOPY = $(host_toolchain)objcopy define add_host_tool_func ifneq ($(filter $(origin $1),undefined default),) @@ -35,5 +36,5 @@ host_$1 = $$($(host_arch)_$(host_os)_$1) host_$(release_type)_$1 = $$($(host_arch)_$(host_os)_$(release_type)_$1) endef -$(foreach tool,CC CXX AR RANLIB STRIP NM LIBTOOL OTOOL INSTALL_NAME_TOOL DSYMUTIL,$(eval $(call add_host_tool_func,$(tool)))) +$(foreach tool,CC CXX AR RANLIB STRIP LIBTOOL NM OBJCOPY OTOOL INSTALL_NAME_TOOL DSYMUTIL,$(eval $(call add_host_tool_func,$(tool)))) $(foreach flags,CFLAGS CXXFLAGS ARFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags)))) diff --git a/contrib/depends/packages/appimage_runtime.mk b/contrib/depends/packages/appimage_runtime.mk new file mode 100644 index 0000000..7ad05df --- /dev/null +++ b/contrib/depends/packages/appimage_runtime.mk @@ -0,0 +1,24 @@ +# TODO: we're not actually using the sources downloaded here. Perhaps host patches in a github repo. +package=appimage_runtime +$(package)_version=13 +$(package)_download_path=https://github.com/AppImage/AppImageKit/archive/refs/tags/ +$(package)_file_name=$($(package)_version).tar.gz +$(package)_sha256_hash=51b837c78dd99ecc1cf3dd283f4a98a1be665b01457da0edc1ff736d12974b1a +$(package)_dependencies=native_cmake libsquashfuse libappimage liblzma +$(package)_patches=CMakeLists.txt runtime.c notify.c + +define $(package)_preprocess_cmds + cp -v $($(package)_patch_dir)/* . +endef + +define $(package)_config_cmds + $($(package)_cmake) -DCMAKE_INSTALL_PREFIX=$(host_prefix) . +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + cp -a runtime $($(package)_staging_prefix_dir)/runtime-x86_64 +endef diff --git a/contrib/depends/packages/boost.mk b/contrib/depends/packages/boost.mk index 77fdf3a..e77e278 100644 --- a/contrib/depends/packages/boost.mk +++ b/contrib/depends/packages/boost.mk @@ -1,8 +1,8 @@ package=boost -$(package)_version=1_64_0 -$(package)_download_path=https://downloads.sourceforge.net/project/boost/boost/1.64.0/ +$(package)_version=1_68_0 +$(package)_download_path=https://downloads.sourceforge.net/project/boost/boost/1.68.0/ $(package)_file_name=$(package)_$($(package)_version).tar.bz2 -$(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332 +$(package)_sha256_hash=7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7 $(package)_dependencies=libiconv $(package)_patches=fix_aroptions.patch fix_arm_arch.patch fix_coalesce.patch @@ -23,7 +23,7 @@ $(package)_archiver_$(host_os)=$($(package)_ar) $(package)_toolset_darwin=darwin $(package)_archiver_darwin=$($(package)_libtool) $(package)_config_libraries=chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization,locale -$(package)_cxxflags=-std=c++11 +$(package)_cxxflags=-std=c++17 $(package)_cxxflags_linux=-fPIC $(package)_cxxflags_freebsd=-fPIC endef diff --git a/contrib/depends/packages/expat.mk b/contrib/depends/packages/expat.mk index a57f6f9..ef888cb 100644 --- a/contrib/depends/packages/expat.mk +++ b/contrib/depends/packages/expat.mk @@ -10,8 +10,7 @@ $(package)_sha256_hash=f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df47 define $(package)_set_vars $(package)_config_opts=--disable-shared --without-docbook --without-tests --without-examples $(package)_config_opts += --disable-dependency-tracking --enable-option-checking - $(package)_config_opts += --without-xmlwf - $(package)_config_opts_linux=--with-pic + $(package)_config_opts += --without-xmlwf --with-pic $(package)_cppflags += -D_DEFAULT_SOURCE endef diff --git a/contrib/depends/packages/graphviz.mk b/contrib/depends/packages/graphviz.mk deleted file mode 100644 index 1c4bc1b..0000000 --- a/contrib/depends/packages/graphviz.mk +++ /dev/null @@ -1,30 +0,0 @@ -package=graphviz -$(package)_version=2.40.1 -$(package)_download_path=www.graphviz.org/pub/graphviz/stable/SOURCES/ -$(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=ca5218fade0204d59947126c38439f432853543b0818d9d728c589dfe7f3a421 - -define $(package)_preprocess_cmds - ./autogen.sh -endef - -define $(package)_set_vars - $(package)_config_opts=--disable-shared --enable-multibye --without-purify --without-curses - $(package)_config_opts_release=--disable-debug-mode - $(package)_config_opts_linux=--with-pic -endef - -define $(package)_config_cmds - $($(package)_autoconf) -endef - -define $(package)_build_cmds - $(MAKE) -endef - -define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) install -endef - -define $(package)_postprocess_cmds -endef diff --git a/contrib/depends/packages/gtest.mk b/contrib/depends/packages/gtest.mk deleted file mode 100644 index 1208d7c..0000000 --- a/contrib/depends/packages/gtest.mk +++ /dev/null @@ -1,39 +0,0 @@ -package=gtest -$(package)_version=1.8.1 -$(package)_download_path=https://github.com/google/googletest/archive/ -$(package)_download_file=release-$($(package)_version).tar.gz -$(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c -$(package)_cxxflags=-std=c++11 -$(package)_cxxflags_linux=-fPIC - -define $(package)_config_cmds - cd googletest && \ - CC="$(host_prefix)/native/bin/$($(package)_cc)" \ - CXX="$(host_prefix)/native/bin/$($(package)_cxx)" \ - AR="$(host_prefix)/native/bin/$($(package)_ar)" \ - RANLIB="$(host_prefix)/native/bin/$($(package)_ranlib)" \ - LIBTOOL="$(host_prefix)/native/bin/$($(package)_libtool)" \ - CXXFLAGS="$($(package)_cxxflags)" \ - CCFLAGS="$($(package)_ccflags)" \ - CPPFLAGS="$($(package)_cppflags)" \ - CFLAGS="$($(package)_cflags) $($(package)_cppflags)" \ - LDLAGS="$($(package)_ldflags)" \ - cmake -DCMAKE_INSTALL_PREFIX=$(build_prefix) \ - -DTOOLCHAIN_PREFIX=$(host_toolchain) \ - -DCMAKE_AR="$(host_prefix)/native/bin/$($(package)_ar)" \ - -DCMAKE_RANLIB="$(host_prefix)/native/bin/$($(package)_ranlib)" \ - -DCMAKE_CXX_FLAGS_DEBUG=ON -endef -# -DCMAKE_TOOLCHAIN_FILE=$(HOST)/share/toolchain.cmake - -define $(package)_build_cmds - cd googletest && CC="$(host_prefix)/native/bin/$($(package)_cc)" $(MAKE) -endef - -define $(package)_stage_cmds - mkdir $($(package)_staging_prefix_dir)/lib $($(package)_staging_prefix_dir)/include &&\ - cp googletest/libgtest.a $($(package)_staging_prefix_dir)/lib/ &&\ - cp googletest/libgtest_main.a $($(package)_staging_prefix_dir)/lib/ &&\ - cp -a googletest/include/* $($(package)_staging_prefix_dir)/include/ -endef diff --git a/contrib/depends/packages/libICE.mk b/contrib/depends/packages/libICE.mk deleted file mode 100644 index a897d9a..0000000 --- a/contrib/depends/packages/libICE.mk +++ /dev/null @@ -1,23 +0,0 @@ -package=libICE -$(package)_version=1.0.9 -$(package)_download_path=https://xorg.freedesktop.org/releases/individual/lib/ -$(package)_file_name=$(package)-$($(package)_version).tar.bz2 -$(package)_sha256_hash=8f7032f2c1c64352b5423f6b48a8ebdc339cc63064af34d66a6c9aa79759e202 -$(package)_dependencies=xtrans xproto - -define $(package)_set_vars - $(package)_config_opts=--disable-static --disable-docs --disable-specs --without-xsltproc - $(package)_config_opts_linux=--with-pic -endef - -define $(package)_config_cmds - $($(package)_autoconf) -endef - -define $(package)_build_cmds - $(MAKE) -endef - -define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) install -endef diff --git a/contrib/depends/packages/libSM.mk b/contrib/depends/packages/libSM.mk deleted file mode 100644 index 83fcd4c..0000000 --- a/contrib/depends/packages/libSM.mk +++ /dev/null @@ -1,23 +0,0 @@ -package=libSM -$(package)_version=1.2.2 -$(package)_download_path=https://xorg.freedesktop.org/releases/individual/lib/ -$(package)_file_name=$(package)-$($(package)_version).tar.bz2 -$(package)_sha256_hash=0baca8c9f5d934450a70896c4ad38d06475521255ca63b717a6510fdb6e287bd -$(package)_dependencies=xtrans xproto libICE - -define $(package)_set_vars - $(package)_config_opts=--without-libuuid --without-xsltproc --disable-docs --disable-static - $(package)_config_opts_linux=--with-pic -endef - -define $(package)_config_cmds - $($(package)_autoconf) -endef - -define $(package)_build_cmds - $(MAKE) -endef - -define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) install -endef diff --git a/contrib/depends/packages/libappimage.mk b/contrib/depends/packages/libappimage.mk new file mode 100644 index 0000000..14beef6 --- /dev/null +++ b/contrib/depends/packages/libappimage.mk @@ -0,0 +1,25 @@ +package=libappimage +$(package)_version=v0.1.x-legacy +$(package)_download_path=https://github.com/AppImageCommunity/libappimage/archive/refs/heads/ +$(package)_file_name=$($(package)_version).tar.gz +$(package)_sha256_hash=fef3962bfb75f986f24c530a6230e95b8c79e46da3dd581543f1b615d45e7389 +$(package)_dependencies=native_cmake liblzma libfuse libarchive +$(package)_patches=no-unneeded-deps.patch + +define $(package)_preprocess_cmds + patch -p1 < $($(package)_patch_dir)/no-unneeded-deps.patch +endef + +define $(package)_config_cmds + $($(package)_cmake) -DCMAKE_INSTALL_PREFIX=$(host_prefix) -DCMAKE_C_COMPILER= -DUSE_SYSTEM_XZ=ON -DUSE_SYSTEM_SQUASHFUSE=ON -DUSE_SYSTEM_LIBARCHIVE=ON -DBUILD_TESTING=OFF . +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=$($(package)_staging_dir) install && \ + cp src/libappimage_hashlib/include/hashlib.h $($(package)_staging_prefix_dir)/include/ && \ + cp src/libappimage_hashlib/include/md5.h $($(package)_staging_prefix_dir)/include/ +endef diff --git a/contrib/depends/packages/libarchive.mk b/contrib/depends/packages/libarchive.mk new file mode 100644 index 0000000..d4ef21c --- /dev/null +++ b/contrib/depends/packages/libarchive.mk @@ -0,0 +1,26 @@ +# Needed for libappimage +package=libarchive +$(package)_version=3.3.1 +$(package)_download_path=https://www.libarchive.org/downloads/ +$(package)_file_name=libarchive-$($(package)_version).tar.gz +$(package)_sha256_hash=29ca5bd1624ca5a007aa57e16080262ab4379dbf8797f5c52f7ea74a3b0424e7 + +define $(package)_set_vars + $(package)_config_opts=--with-pic --disable-shared --enable-static --disable-bsdtar --disable-bsdcat + $(package)_config_opts+=--disable-bsdcpio --with-zlib --without-bz2lib --without-iconv --without-lz4 --without-lzma + $(package)_config_opts+=--without-lzo2 --without-nettle --without-openssl --without-xml2 --without-expat + $(package)_config_opts+=--prefix=$(host_prefix) + $(package)_config_opts+=--libdir=$(host_prefix)/lib +endef + +define $(package)_config_cmds + $($(package)_autoconf) $($(package)_config_opts) +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=$($(package)_staging_dir) install +endef diff --git a/contrib/depends/packages/libfuse.mk b/contrib/depends/packages/libfuse.mk new file mode 100644 index 0000000..fbd9c25 --- /dev/null +++ b/contrib/depends/packages/libfuse.mk @@ -0,0 +1,18 @@ +# Needed for libsquashfuse +package=libfuse +$(package)_version=2.9.9 +$(package)_download_path=https://github.com/libfuse/libfuse/releases/download/fuse-2.9.9/ +$(package)_file_name=fuse-$($(package)_version).tar.gz +$(package)_sha256_hash=d0e69d5d608cc22ff4843791ad097f554dd32540ddc9bed7638cc6fea7c1b4b5 + +define $(package)_config_cmds + $($(package)_autoconf) +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=$($(package)_staging_dir) install +endef diff --git a/contrib/depends/packages/libgcrypt.mk b/contrib/depends/packages/libgcrypt.mk index 0739a22..8b8c637 100644 --- a/contrib/depends/packages/libgcrypt.mk +++ b/contrib/depends/packages/libgcrypt.mk @@ -7,18 +7,19 @@ $(package)_dependencies=libgpg-error $(package)_patches=gost-sb.h no_gen_gost-sb.patch define $(package)_set_vars - $(package)_build_opts=CFLAGS="-fPIE" + $(package)_build_opts=CFLAGS="-fPIE" endef +# TODO: do a native compile first to eliminate the need for this patch define $(package)_preprocess_cmds mv $($(package)_patch_dir)/gost-sb.h cipher/gost-sb.h && \ patch -p1 < $($(package)_patch_dir)/no_gen_gost-sb.patch endef -# building on linux with $($(package)_autoconf) fails for mysterious reasons +# TODO: building on linux with $($(package)_autoconf) fails for mysterious reasons (related to --host) ifeq ($(host_os),linux) define $(package)_config_cmds - CLAGS='-fPIE' CXXFLAGS='-fPIE' ./configure --disable-shared --enable-static --disable-doc --with-libgpg-error-prefix=$(host_prefix) --prefix=$(host_prefix) + CFLAGS='-fPIE' CXXFLAGS='-fPIE' ./configure --enable-digests="sha256 blake2" --enable-ciphers=aes --disable-amd64-as-feature-detection --disable-asm --disable-avx-support --disable-avx2-support --disable-sse41-support --disable-shared --enable-static --disable-doc --with-libgpg-error-prefix=$(host_prefix) --prefix=$(host_prefix) endef else define $(package)_config_cmds diff --git a/contrib/depends/packages/libiconv.mk b/contrib/depends/packages/libiconv.mk index 698aa8b..de6c577 100644 --- a/contrib/depends/packages/libiconv.mk +++ b/contrib/depends/packages/libiconv.mk @@ -1,9 +1,8 @@ package=libiconv -$(package)_version=1.15 +$(package)_version=1.17 $(package)_download_path=https://ftp.gnu.org/gnu/libiconv $(package)_file_name=libiconv-$($(package)_version).tar.gz -$(package)_sha256_hash=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178 -$(package)_patches=fix-whitespace.patch +$(package)_sha256_hash=8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313 define $(package)_set_vars $(package)_config_opts=--disable-nls @@ -13,13 +12,8 @@ define $(package)_set_vars $(package)_config_opts_freebsd=--with-pic endef -define $(package)_preprocess_cmds - cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub build-aux/ &&\ - patch -p1 < $($(package)_patch_dir)/fix-whitespace.patch -endef - define $(package)_config_cmds - $($(package)_autoconf) + $($(package)_autoconf) AR_FLAGS=$($(package)_arflags) endef define $(package)_build_cmds diff --git a/contrib/depends/packages/liblzma.mk b/contrib/depends/packages/liblzma.mk new file mode 100644 index 0000000..81edf61 --- /dev/null +++ b/contrib/depends/packages/liblzma.mk @@ -0,0 +1,24 @@ +# Needed for libappimage +package=liblzma +$(package)_version=5.2.3 +$(package)_download_path=https://netcologne.dl.sourceforge.net/project/lzmautils/ +$(package)_file_name=xz-$($(package)_version).tar.gz +$(package)_sha256_hash=71928b357d0a09a12a4b4c5fafca8c31c19b0e7d3b8ebb19622e96f26dbf28cb + +define $(package)_set_vars + $(package)_config_opts=--with-pic --disable-shared --enable-static --disable-xz --disable-xzdec + $(package)_config_opts+=--prefix=$(host_prefix) + $(package)_config_opts+=--libdir=$(host_prefix)/lib +endef + +define $(package)_config_cmds + $($(package)_autoconf) $($(package)_config_opts) +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=$($(package)_staging_dir) install +endef diff --git a/contrib/depends/packages/libsquashfuse.mk b/contrib/depends/packages/libsquashfuse.mk new file mode 100644 index 0000000..3ed1c01 --- /dev/null +++ b/contrib/depends/packages/libsquashfuse.mk @@ -0,0 +1,45 @@ +# Needed for libappimage +package=libsquashfuse +$(package)_version=1f980303b89c779eabfd0a0fdd36d6a7a311bf92 +$(package)_download_path=https://github.com/vasi/squashfuse/archive/ +$(package)_file_name=$($(package)_version).tar.gz +$(package)_sha256_hash=8cef1539bd9c9efd3c407004fdd7a3bbef44102a5966b892819a275d609013a3 +$(package)_dependencies=liblzma libfuse zlib +$(package)_patches=squashfuse.patch squashfuse_dlopen.patch squashfuse_dlopen.c squashfuse_dlopen.h + +# for some reason, a first run may fail, but it seems just running it a second time fixes the issues +define $(package)_preprocess_cmds + patch -p1 < $($(package)_patch_dir)/squashfuse.patch && \ + patch -p1 < $($(package)_patch_dir)/squashfuse_dlopen.patch && \ + cp -v $($(package)_patch_dir)/squashfuse_dlopen.c $($(package)_patch_dir)/squashfuse_dlopen.h . && \ + libtoolize --force && \ + ./autogen.sh || true && \ + ./autogen.sh && \ + sed -i "/PKG_CHECK_MODULES.*/,/,:./d" configure && \ + sed -i "s/typedef off_t sqfs_off_t/typedef int64_t sqfs_off_t/g" common.h +endef + +define $(package)_set_vars + $(package)_config_opts=--disable-demo --disable-high-level --without-lzo --without-lz4 + $(package)_config_opts+=--prefix=$(host_prefix) + $(package)_config_opts+=--libdir=$(host_prefix)/lib +endef + +define $(package)_config_cmds + $($(package)_autoconf) $($(package)_config_opts) +endef + +define $(package)_build_cmds + $(MAKE) && \ + ls .libs +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=$($(package)_staging_dir) install && \ + mkdir -p $($(package)_staging_prefix_dir)/lib && \ + mkdir -p $($(package)_staging_prefix_dir)/include && \ + cp .libs/libfuseprivate.a $($(package)_staging_prefix_dir)/lib/ && \ + cp .libs/libsquashfuse.a $($(package)_staging_prefix_dir)/lib/ && \ + cp .libs/libsquashfuse_ll.a $($(package)_staging_prefix_dir)/lib/ && \ + find . -name "*.h" -exec cp "{}" $($(package)_staging_prefix_dir)/include/ \; +endef diff --git a/contrib/depends/packages/libusb.mk b/contrib/depends/packages/libusb.mk index d865d2a..452e6c7 100644 --- a/contrib/depends/packages/libusb.mk +++ b/contrib/depends/packages/libusb.mk @@ -35,5 +35,6 @@ define $(package)_stage_cmds $(MAKE) DESTDIR=$($(package)_staging_dir) install endef -define $(package)_postprocess_cmds cp -f lib/libusb-1.0.a lib/libusb.a +define $(package)_postprocess_cmds + cp -f lib/libusb-1.0.a lib/libusb.a endef diff --git a/contrib/depends/packages/native_ds_store.mk b/contrib/depends/packages/native_ds_store.mk index 087c5ad..980e062 100644 --- a/contrib/depends/packages/native_ds_store.mk +++ b/contrib/depends/packages/native_ds_store.mk @@ -1,6 +1,6 @@ package=native_ds_store $(package)_version=1.3.0 -$(package)_download_path=https://github.com/al45tair/ds_store/archive/ +$(package)_download_path=https://github.com/dmgbuild/ds_store/archive/ $(package)_file_name=v$($(package)_version).tar.gz $(package)_sha256_hash=76b3280cd4e19e5179defa23fb594a9dd32643b0c80d774bd3108361d94fb46d $(package)_install_libdir=$(build_prefix)/lib/python3/dist-packages diff --git a/contrib/depends/packages/native_expat.mk b/contrib/depends/packages/native_expat.mk new file mode 100644 index 0000000..f19635b --- /dev/null +++ b/contrib/depends/packages/native_expat.mk @@ -0,0 +1,32 @@ +package=native_expat +$(package)_version=2.4.8 +$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$($(package)_version))/ +$(package)_file_name=expat-$($(package)_version).tar.xz +$(package)_sha256_hash=f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df479dcaf25 + +# -D_DEFAULT_SOURCE defines __USE_MISC, which exposes additional +# definitions in endian.h, which are required for a working +# endianess check in configure when building with -flto. +define $(package)_set_vars + $(package)_config_opts=--disable-shared --without-docbook --without-tests --without-examples + $(package)_config_opts += --disable-dependency-tracking --enable-option-checking + $(package)_config_opts += --without-xmlwf --with-pic + $(package)_cppflags += -D_DEFAULT_SOURCE +endef + +define $(package)_config_cmds + echo "$($(package)_autoconf)" && \ + $($(package)_autoconf) +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=$($(package)_staging_dir) install +endef + +define $(package)_postprocess_cmds + rm -rf share lib/cmake lib/*.la +endef \ No newline at end of file diff --git a/contrib/depends/packages/fontconfig.mk b/contrib/depends/packages/native_fontconfig.mk similarity index 85% rename from contrib/depends/packages/fontconfig.mk rename to contrib/depends/packages/native_fontconfig.mk index c8b2fc3..184ef21 100644 --- a/contrib/depends/packages/fontconfig.mk +++ b/contrib/depends/packages/native_fontconfig.mk @@ -1,9 +1,9 @@ -package=fontconfig +package=native_fontconfig $(package)_version=2.12.6 $(package)_download_path=https://www.freedesktop.org/software/fontconfig/release/ -$(package)_file_name=$(package)-$($(package)_version).tar.bz2 +$(package)_file_name=fontconfig-$($(package)_version).tar.bz2 $(package)_sha256_hash=cf0c30807d08f6a28ab46c61b8dbd55c97d2f292cf88f3a07d3384687f31f017 -$(package)_dependencies=freetype expat +$(package)_dependencies=native_freetype native_expat $(package)_patches=gperf_header_regen.patch define $(package)_set_vars diff --git a/contrib/depends/packages/freetype.mk b/contrib/depends/packages/native_freetype.mk similarity index 63% rename from contrib/depends/packages/freetype.mk rename to contrib/depends/packages/native_freetype.mk index 6f5dbe0..a9662dc 100644 --- a/contrib/depends/packages/freetype.mk +++ b/contrib/depends/packages/native_freetype.mk @@ -1,16 +1,18 @@ -package=freetype +package=native_freetype $(package)_version=2.11.0 -$(package)_download_path=https://download.savannah.gnu.org/releases/$(package) -$(package)_file_name=$(package)-$($(package)_version).tar.xz +$(package)_download_path=https://download.savannah.gnu.org/releases/freetype +$(package)_file_name=freetype-$($(package)_version).tar.xz $(package)_sha256_hash=8bee39bd3968c4804b70614a0a3ad597299ad0e824bc8aad5ce8aaf48067bde7 define $(package)_set_vars - $(package)_config_opts=--without-zlib --without-png --without-harfbuzz --without-bzip2 --disable-static + $(package)_config_opts = --without-zlib --without-png --without-harfbuzz --without-bzip2 --enable-static --disable-shared $(package)_config_opts += --enable-option-checking --without-brotli - $(package)_config_opts_linux=--with-pic + $(package)_config_opts += --with-pic endef define $(package)_config_cmds + printenv && \ + echo "$($(package)_autoconf)" && \ $($(package)_autoconf) endef diff --git a/contrib/depends/packages/libXau.mk b/contrib/depends/packages/native_libXau.mk similarity index 84% rename from contrib/depends/packages/libXau.mk rename to contrib/depends/packages/native_libXau.mk index b7e032c..146c3b7 100644 --- a/contrib/depends/packages/libXau.mk +++ b/contrib/depends/packages/native_libXau.mk @@ -1,16 +1,16 @@ -package=libXau +package=native_libXau $(package)_version=1.0.9 $(package)_download_path=https://xorg.freedesktop.org/releases/individual/lib/ -$(package)_file_name=$(package)-$($(package)_version).tar.bz2 +$(package)_file_name=libXau-$($(package)_version).tar.bz2 $(package)_sha256_hash=ccf8cbf0dbf676faa2ea0a6d64bcc3b6746064722b606c8c52917ed00dcb73ec -$(package)_dependencies=xproto +$(package)_dependencies=native_xproto # When updating this package, check the default value of # --disable-xthreads. It is currently enabled. define $(package)_set_vars $(package)_config_opts=--disable-shared --disable-lint-library --without-lint $(package)_config_opts += --disable-dependency-tracking --enable-option-checking - $(package)_config_opts_linux=--with-pic + $(package)_config_opts += --with-pic endef define $(package)_preprocess_cmds diff --git a/contrib/depends/packages/libxcb.mk b/contrib/depends/packages/native_libxcb.mk similarity index 91% rename from contrib/depends/packages/libxcb.mk rename to contrib/depends/packages/native_libxcb.mk index 0fa41fd..cede1e0 100644 --- a/contrib/depends/packages/libxcb.mk +++ b/contrib/depends/packages/native_libxcb.mk @@ -1,9 +1,9 @@ -package=libxcb +package=native_libxcb $(package)_version=1.14 $(package)_download_path=https://xcb.freedesktop.org/dist -$(package)_file_name=$(package)-$($(package)_version).tar.xz +$(package)_file_name=libxcb-$($(package)_version).tar.xz $(package)_sha256_hash=a55ed6db98d43469801262d81dc2572ed124edc3db31059d4e9916eb9f844c34 -$(package)_dependencies=xcb_proto libXau +$(package)_dependencies=native_xcb_proto native_libXau $(package)_patches = remove_pthread_stubs.patch define $(package)_set_vars diff --git a/contrib/depends/packages/libxcb_util.mk b/contrib/depends/packages/native_libxcb_util.mk similarity index 92% rename from contrib/depends/packages/libxcb_util.mk rename to contrib/depends/packages/native_libxcb_util.mk index 6f1b9cd..07010b8 100644 --- a/contrib/depends/packages/libxcb_util.mk +++ b/contrib/depends/packages/native_libxcb_util.mk @@ -1,9 +1,9 @@ -package=libxcb_util +package=native_libxcb_util $(package)_version=0.4.0 $(package)_download_path=https://xcb.freedesktop.org/dist $(package)_file_name=xcb-util-$($(package)_version).tar.bz2 $(package)_sha256_hash=46e49469cb3b594af1d33176cd7565def2be3fa8be4371d62271fabb5eae50e9 -$(package)_dependencies=libxcb +$(package)_dependencies=native_libxcb define $(package)_set_vars $(package)_config_opts = --disable-shared --disable-devel-docs --without-doxygen diff --git a/contrib/depends/packages/libxcb_util_image.mk b/contrib/depends/packages/native_libxcb_util_image.mk similarity index 89% rename from contrib/depends/packages/libxcb_util_image.mk rename to contrib/depends/packages/native_libxcb_util_image.mk index d12d67e..1251921 100644 --- a/contrib/depends/packages/libxcb_util_image.mk +++ b/contrib/depends/packages/native_libxcb_util_image.mk @@ -1,9 +1,9 @@ -package=libxcb_util_image +package=native_libxcb_util_image $(package)_version=0.4.0 $(package)_download_path=https://xcb.freedesktop.org/dist $(package)_file_name=xcb-util-image-$($(package)_version).tar.bz2 $(package)_sha256_hash=2db96a37d78831d643538dd1b595d7d712e04bdccf8896a5e18ce0f398ea2ffc -$(package)_dependencies=libxcb libxcb_util +$(package)_dependencies=native_libxcb native_libxcb_util define $(package)_set_vars $(package)_config_opts=--disable-static --disable-devel-docs --without-doxygen diff --git a/contrib/depends/packages/libxcb_util_keysyms.mk b/contrib/depends/packages/native_libxcb_util_keysyms.mk similarity index 90% rename from contrib/depends/packages/libxcb_util_keysyms.mk rename to contrib/depends/packages/native_libxcb_util_keysyms.mk index d4f72de..1dbbea8 100644 --- a/contrib/depends/packages/libxcb_util_keysyms.mk +++ b/contrib/depends/packages/native_libxcb_util_keysyms.mk @@ -1,9 +1,9 @@ -package=libxcb_util_keysyms +package=native_libxcb_util_keysyms $(package)_version=0.4.0 $(package)_download_path=https://xcb.freedesktop.org/dist $(package)_file_name=xcb-util-keysyms-$($(package)_version).tar.bz2 $(package)_sha256_hash=0ef8490ff1dede52b7de533158547f8b454b241aa3e4dcca369507f66f216dd9 -$(package)_dependencies=libxcb xproto +$(package)_dependencies=native_libxcb native_xproto define $(package)_set_vars $(package)_config_opts=--disable-static --disable-devel-docs --without-doxygen diff --git a/contrib/depends/packages/libxcb_util_render.mk b/contrib/depends/packages/native_libxcb_util_render.mk similarity index 91% rename from contrib/depends/packages/libxcb_util_render.mk rename to contrib/depends/packages/native_libxcb_util_render.mk index 28f1fb0..3706c75 100644 --- a/contrib/depends/packages/libxcb_util_render.mk +++ b/contrib/depends/packages/native_libxcb_util_render.mk @@ -1,9 +1,9 @@ -package=libxcb_util_render +package=native_libxcb_util_render $(package)_version=0.3.9 $(package)_download_path=https://xcb.freedesktop.org/dist $(package)_file_name=xcb-util-renderutil-$($(package)_version).tar.bz2 $(package)_sha256_hash=c6e97e48fb1286d6394dddb1c1732f00227c70bd1bedb7d1acabefdd340bea5b -$(package)_dependencies=libxcb +$(package)_dependencies=native_libxcb define $(package)_set_vars $(package)_config_opts=--disable-static --disable-devel-docs --without-doxygen diff --git a/contrib/depends/packages/libxcb_util_wm.mk b/contrib/depends/packages/native_libxcb_util_wm.mk similarity index 92% rename from contrib/depends/packages/libxcb_util_wm.mk rename to contrib/depends/packages/native_libxcb_util_wm.mk index 3b905ba..89b31d0 100644 --- a/contrib/depends/packages/libxcb_util_wm.mk +++ b/contrib/depends/packages/native_libxcb_util_wm.mk @@ -1,9 +1,9 @@ -package=libxcb_util_wm +package=native_libxcb_util_wm $(package)_version=0.4.1 $(package)_download_path=https://xcb.freedesktop.org/dist $(package)_file_name=xcb-util-wm-$($(package)_version).tar.bz2 $(package)_sha256_hash=28bf8179640eaa89276d2b0f1ce4285103d136be6c98262b6151aaee1d3c2a3f -$(package)_dependencies=libxcb +$(package)_dependencies=native_libxcb define $(package)_set_vars $(package)_config_opts=--disable-static --disable-devel-docs --without-doxygen diff --git a/contrib/depends/packages/libxkbcommon.mk b/contrib/depends/packages/native_libxkbcommon.mk similarity index 88% rename from contrib/depends/packages/libxkbcommon.mk rename to contrib/depends/packages/native_libxkbcommon.mk index 9040981..55a12c7 100644 --- a/contrib/depends/packages/libxkbcommon.mk +++ b/contrib/depends/packages/native_libxkbcommon.mk @@ -1,9 +1,9 @@ -package=libxkbcommon +package=native_libxkbcommon $(package)_version=0.8.4 $(package)_download_path=https://xkbcommon.org/download/ -$(package)_file_name=$(package)-$($(package)_version).tar.xz +$(package)_file_name=libxkbcommon-$($(package)_version).tar.xz $(package)_sha256_hash=60ddcff932b7fd352752d51a5c4f04f3d0403230a584df9a2e0d5ed87c486c8b -$(package)_dependencies=libxcb +$(package)_dependencies=native_libxcb # This package explicitly enables -Werror=array-bounds, which causes build failures # with GCC 12.1+. Work around that by turning errors back into warnings. diff --git a/contrib/depends/packages/native_qmake.mk b/contrib/depends/packages/native_qmake.mk deleted file mode 100644 index 3f66ef4..0000000 --- a/contrib/depends/packages/native_qmake.mk +++ /dev/null @@ -1,60 +0,0 @@ -package=native_qmake -$(package)_version=5.15.3 -$(package)_download_path=https://download.qt.io/official_releases/qt/5.15/$($(package)_version)/submodules -$(package)_suffix=everywhere-opensource-src-$($(package)_version).tar.xz -$(package)_file_name=qtbase-$($(package)_suffix) -$(package)_sha256_hash=26394ec9375d52c1592bd7b689b1619c6b8dbe9b6f91fdd5c355589787f3a0b6 -$(package)_linux_dependencies=freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm -$(package)_patches += no-xlib.patch - -define $(package)_set_vars -$(package)_config_opts_release = -release -$(package)_config_opts += -bindir $(build_prefix)/bin -$(package)_config_opts += -c++std c++17 -$(package)_config_opts += -confirm-license -$(package)_config_opts += -hostprefix $(build_prefix) -$(package)_config_opts += -opensource -$(package)_config_opts += -prefix $(host_prefix) -$(package)_config_opts += -v -$(package)_config_opts_linux = -xcb -$(package)_config_opts_linux += -no-xcb-xlib -$(package)_config_opts_linux += -no-feature-xlib -$(package)_config_opts_linux += -no-opengl -$(package)_config_opts_linux += -no-feature-vulkan -$(package)_config_opts_linux += -dbus-runtime -endef - -define $(package)_fetch_cmds -$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) -endef - -define $(package)_extract_cmds - mkdir -p $($(package)_extract_dir) && \ - echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \ - $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ - mkdir qtbase && \ - $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase -endef - -define $(package)_preprocess_cmds - patch -p1 -i $($(package)_patch_dir)/no-xlib.patch -endef - -define $(package)_config_cmds - cd qtbase && \ - ./configure $($(package)_config_opts) -endef - -define $(package)_build_cmds - cd qtbase && \ - $(MAKE) -endef - -define $(package)_stage_cmds - cd qtbase && \ - $(MAKE) INSTALL_ROOT=$($(package)_staging_dir) install -endef - -define $(package)_postprocess_cmds - echo -n "" > lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake -endef diff --git a/contrib/depends/packages/native_qt.mk b/contrib/depends/packages/native_qt.mk new file mode 100644 index 0000000..f613db5 --- /dev/null +++ b/contrib/depends/packages/native_qt.mk @@ -0,0 +1,218 @@ +package=native_qt +$(package)_version=6.4.0 +$(package)_download_path=https://download.qt.io/official_releases/qt/6.4/$($(package)_version)/submodules +$(package)_suffix=everywhere-src-$($(package)_version).tar.xz +$(package)_file_name=qtbase-$($(package)_suffix) +$(package)_sha256_hash=cb6475a0bd8567c49f7ffbb072a05516ee6671171bed55db75b22b94ead9b37d +$(package)_dependencies=native_cmake native_libxcb native_libxkbcommon native_libxcb_util native_libxcb_util_render native_libxcb_util_keysyms native_libxcb_util_image native_libxcb_util_wm +$(package)_qt_libs=corelib network widgets gui plugins testlib +$(package)_linguist_tools = lrelease lupdate lconvert +$(package)_patches = root_CMakeLists.txt +$(package)_patches += mac-qmake.conf +$(package)_patches += no-xlib.patch +$(package)_patches += dont_hardcode_pwd.patch +$(package)_patches += qtbase-moc-ignore-gcc-macro.patch +$(package)_patches += rcc_hardcode_timestamp.patch +$(package)_patches += fast_fixed_dtoa_no_optimize.patch +$(package)_patches += guix_cross_lib_path.patch +$(package)_patches += no-statx.patch +$(package)_patches += no-renameat2.patch +$(package)_patches += no_pthread_cond_clockwait.patch +$(package)_patches += QTBUG-92199-fix.patch + +$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix) +$(package)_qttranslations_sha256_hash=7ab93a930b693eeb53ab97b038b4e6e057d06374e6f49a3814d99145a276925f + +$(package)_qttools_file_name=qttools-$($(package)_suffix) +$(package)_qttools_sha256_hash=97f3d5f88c458be7a8f7b7b08efc06c4ebad39ca51669476b18bf9e4c11afba2 + +$(package)_qtsvg_file_name=qtsvg-$($(package)_suffix) +$(package)_qtsvg_sha256_hash=03fdae9437d074dcfa387dc1f2c6e7e14fea0f989bf7e1aa265fd35ffc2c5b25 + +$(package)_qtmultimedia_file_name=qtmultimedia-$($(package)_suffix) +$(package)_qtmultimedia_sha256_hash=e82e8e847cae2a951a11db05b6d10a22b21e3a1d72e06a7781cce4bd197e796f + +$(package)_qtshadertools_file_name=qtshadertools-$($(package)_suffix) +$(package)_qtshadertools_sha256_hash=dbd6a5f00e8178cd2fea7e84c4eef3818de5287d34e20a68383929c754ae3b90 + +$(package)_extra_sources = $($(package)_qttranslations_file_name) +$(package)_extra_sources += $($(package)_qttools_file_name) +$(package)_extra_sources += $($(package)_qtsvg_file_name) +$(package)_extra_sources += $($(package)_qtmultimedia_file_name) +$(package)_extra_sources += $($(package)_qtshadertools_file_name) + +define $(package)_set_vars +$(package)_config_opts_release = -release +$(package)_config_opts_debug = -debug +$(package)_config_opts_debug += -optimized-tools +$(package)_config_opts += -libexecdir $(build_prefix)/qt-host/bin +$(package)_config_opts += -c++std c++17 +$(package)_config_opts += -confirm-license +$(package)_config_opts += -no-cups +$(package)_config_opts += -no-egl +$(package)_config_opts += -no-eglfs +$(package)_config_opts += -no-evdev +$(package)_config_opts += -no-gif +$(package)_config_opts += -no-glib +$(package)_config_opts += -no-icu +$(package)_config_opts += -no-ico +$(package)_config_opts += -no-kms +$(package)_config_opts += -no-linuxfb +#$(package)_config_opts += -no-libjpeg # Needed +#$(package)_config_opts += -no-libproxy # Needed +$(package)_config_opts += -no-libudev +$(package)_config_opts += -no-mtdev +$(package)_config_opts += -no-openssl +#$(package)_config_opts += -openssl-linked +$(package)_config_opts += -no-openvg +$(package)_config_opts += -no-reduce-relocations +$(package)_config_opts += -no-schannel +$(package)_config_opts += -no-sctp +$(package)_config_opts += -no-securetransport +$(package)_config_opts += -no-system-proxies +$(package)_config_opts += -no-use-gold-linker +$(package)_config_opts += -no-zstd +$(package)_config_opts += -nomake examples +$(package)_config_opts += -nomake tests +$(package)_config_opts += -opensource +$(package)_config_opts += -pkg-config +$(package)_config_opts += -prefix $(build_prefix)/qt-host +$(package)_config_opts += -qt-libpng +$(package)_config_opts += -qt-pcre +$(package)_config_opts += -qt-harfbuzz +$(package)_config_opts += -qt-zlib +$(package)_config_opts += -static +$(package)_config_opts += -no-feature-colordialog +#$(package)_config_opts += -no-feature-concurrent # Needed +$(package)_config_opts += -no-feature-dial +$(package)_config_opts += -no-feature-fontcombobox +$(package)_config_opts += -no-feature-http +$(package)_config_opts += -no-feature-image_heuristic_mask +$(package)_config_opts += -no-feature-keysequenceedit +$(package)_config_opts += -no-feature-lcdnumber +$(package)_config_opts += -no-feature-networkdiskcache +#$(package)_config_opts += -no-feature-networkproxy # Needed +$(package)_config_opts += -no-feature-pdf +$(package)_config_opts += -no-feature-printdialog +$(package)_config_opts += -no-feature-printer +$(package)_config_opts += -no-feature-printpreviewdialog +$(package)_config_opts += -no-feature-printpreviewwidget +$(package)_config_opts += -no-feature-sessionmanager +#$(package)_config_opts += -no-feature-socks5 # Needed +$(package)_config_opts += -no-feature-sql +$(package)_config_opts += -no-feature-syntaxhighlighter +#$(package)_config_opts += -no-feature-textbrowser # Needed +$(package)_config_opts += -no-feature-textmarkdownwriter +$(package)_config_opts += -no-feature-textodfwriter +$(package)_config_opts += -no-feature-topleveldomain +#$(package)_config_opts += -no-feature-udpsocket # Neede +$(package)_config_opts += -no-feature-undocommand +$(package)_config_opts += -no-feature-undogroup +$(package)_config_opts += -no-feature-undostack +$(package)_config_opts += -no-feature-undoview +$(package)_config_opts += -no-feature-vnc +#$(package)_config_opts += -no-feature-wizard # Needed +$(package)_config_opts += -no-feature-fontconfig +$(package)_config_opts += -no-feature-dbus + +$(package)_config_opts += -xcb +$(package)_config_opts += -no-xcb-xlib +$(package)_config_opts += -no-feature-xlib +#$(package)_config_opts += -feature-ffmpeg +#$(package)_config_opts += -feature-pulseaudio + +# https://bugreports.qt.io/browse/QTBUG-99957 +$(package)_config_opts += -no-pch + +$(package)_config_opts += -no-opengl +$(package)_config_opts += -no-feature-vulkan +ifneq ($(LTO),) +$(package)_config_opts += -ltcg +endif +$(package)_config_opts += -platform linux-g++ -xplatform bitcoin-linux-g++ +ifneq (,$(findstring -stdlib=libc++,$($(1)_cxx))) +$(package)_config_opts_x86_64 = -xplatform linux-clang-libc++ +endif + +$(package)_config_opts_aarch64_android += -android-arch arm64-v8a +$(package)_config_opts_armv7a_android += -android-arch armeabi-v7a +$(package)_config_opts_x86_64_android += -android-arch x86_64 + +endef + +define $(package)_fetch_cmds +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttranslations_file_name),$($(package)_qttranslations_file_name),$($(package)_qttranslations_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttools_file_name),$($(package)_qttools_file_name),$($(package)_qttools_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtsvg_file_name),$($(package)_qtsvg_file_name),$($(package)_qtsvg_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtmultimedia_file_name),$($(package)_qtmultimedia_file_name),$($(package)_qtmultimedia_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtshadertools_file_name),$($(package)_qtshadertools_file_name),$($(package)_qtshadertools_sha256_hash)) +endef + +define $(package)_extract_cmds + mkdir -p $($(package)_extract_dir) && \ + echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_qttranslations_sha256_hash) $($(package)_source_dir)/$($(package)_qttranslations_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_qtsvg_sha256_hash) $($(package)_source_dir)/$($(package)_qtsvg_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_qtmultimedia_sha256_hash) $($(package)_source_dir)/$($(package)_qtmultimedia_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_qtshadertools_sha256_hash) $($(package)_source_dir)/$($(package)_qtshadertools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + mkdir qtbase && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \ + mkdir qttranslations && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \ + mkdir qttools && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools && \ + mkdir qtsvg && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtsvg_file_name) -C qtsvg && \ + mkdir qtmultimedia && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtmultimedia_file_name) -C qtmultimedia && \ + mkdir qtshadertools && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtshadertools_file_name) -C qtshadertools +endef + +define $(package)_preprocess_cmds + cp $($(package)_patch_dir)/root_CMakeLists.txt CMakeLists.txt && \ + patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \ + patch -p1 -i $($(package)_patch_dir)/no-xlib.patch && \ + patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \ + patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \ + patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \ + patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \ + patch -p1 -i $($(package)_patch_dir)/no-statx.patch && \ + patch -p1 -i $($(package)_patch_dir)/no-renameat2.patch && \ + patch -p1 -i $($(package)_patch_dir)/no_pthread_cond_clockwait.patch && \ + patch -p1 -i $($(package)_patch_dir)/QTBUG-92199-fix.patch && \ + mkdir -p qtbase/mkspecs/macx-clang-linux &&\ + cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\ + cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \ + cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \ + sed -i.old "s|arm-linux-gnueabi-gcc|$($($(package)_type)_CC)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-g++|$($($(package)_type)_CXX)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-ar|$($($(package)_type)_AR)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-objcopy|$($($(package)_type)_OBJCOPY)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-nm|$($($(package)_type)_NM)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-strip|$($($(package)_type)_STRIP)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ + echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ + echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ + sed -i.old "s|QMAKE_CC = \$$$$\$$$${CROSS_COMPILE}clang|QMAKE_CC = $($(package)_cc)|" qtbase/mkspecs/common/clang.conf && \ + sed -i.old "s|QMAKE_CXX = \$$$$\$$$${CROSS_COMPILE}clang++|QMAKE_CXX = $($(package)_cxx)|" qtbase/mkspecs/common/clang.conf +endef + +define $(package)_config_cmds + export PKG_CONFIG_SYSROOT_DIR=/ && \ + export PKG_CONFIG_LIBDIR=$(build_prefix)/lib/pkgconfig && \ + export QT_MAC_SDK_NO_VERSION_CHECK=1 && \ + cd qtbase && \ + ./configure -top-level $($(package)_config_opts) +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + DESTDIR=$($(package)_staging_dir) cmake --install . +endef diff --git a/contrib/depends/packages/xcb_proto.mk b/contrib/depends/packages/native_xcb_proto.mk similarity index 95% rename from contrib/depends/packages/xcb_proto.mk rename to contrib/depends/packages/native_xcb_proto.mk index 9be8225..cc80531 100644 --- a/contrib/depends/packages/xcb_proto.mk +++ b/contrib/depends/packages/native_xcb_proto.mk @@ -1,4 +1,4 @@ -package=xcb_proto +package=native_xcb_proto $(package)_version=1.14.1 $(package)_download_path=https://xorg.freedesktop.org/archive/individual/proto $(package)_file_name=xcb-proto-$($(package)_version).tar.xz diff --git a/contrib/depends/packages/xproto.mk b/contrib/depends/packages/native_xproto.mk similarity index 67% rename from contrib/depends/packages/xproto.mk rename to contrib/depends/packages/native_xproto.mk index 7a43c52..2d1077c 100644 --- a/contrib/depends/packages/xproto.mk +++ b/contrib/depends/packages/native_xproto.mk @@ -1,12 +1,12 @@ -package=xproto +package=native_xproto $(package)_version=7.0.31 $(package)_download_path=https://xorg.freedesktop.org/releases/individual/proto -$(package)_file_name=$(package)-$($(package)_version).tar.bz2 +$(package)_file_name=xproto-$($(package)_version).tar.bz2 $(package)_sha256_hash=c6f9747da0bd3a95f86b17fb8dd5e717c8f3ab7f0ece3ba1b247899ec1ef7747 define $(package)_set_vars -$(package)_config_opts=--without-fop --without-xmlto --without-xsltproc --disable-specs -$(package)_config_opts += --disable-dependency-tracking --enable-option-checking + $(package)_config_opts=--without-fop --without-xmlto --without-xsltproc --disable-specs + $(package)_config_opts += --disable-dependency-tracking --enable-option-checking endef define $(package)_preprocess_cmds diff --git a/contrib/depends/packages/ncurses.mk b/contrib/depends/packages/ncurses.mk deleted file mode 100644 index a69de5b..0000000 --- a/contrib/depends/packages/ncurses.mk +++ /dev/null @@ -1,64 +0,0 @@ -package=ncurses -$(package)_version=6.1 -$(package)_download_path=https://ftp.gnu.org/gnu/ncurses -$(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=aa057eeeb4a14d470101eff4597d5833dcef5965331be3528c08d99cebaa0d17 -$(package)_patches=fallback.c - -define $(package)_set_vars - $(package)_build_opts=CC="$($(package)_cc)" - $(package)_config_env_mingw32=cf_cv_ar_flags="" - $(package)_config_env_linux=cf_cv_ar_flags="" - $(package)_config_opts=--prefix=$(host_prefix) - $(package)_config_opts+=--disable-shared - $(package)_config_opts+=--with-build-cc=gcc - $(package)_config_opts+=--without-debug - $(package)_config_opts+=--without-ada - $(package)_config_opts+=--without-cxx-binding - $(package)_config_opts+=--without-cxx - $(package)_config_opts+=--without-ticlib - $(package)_config_opts+=--without-tic - $(package)_config_opts+=--without-progs - $(package)_config_opts+=--without-tests - $(package)_config_opts+=--without-tack - $(package)_config_opts+=--without-manpages - $(package)_config_opts+=--with-termlib=tinfo - $(package)_config_opts+=--disable-tic-depends - $(package)_config_opts+=--disable-big-strings - $(package)_config_opts+=--disable-ext-colors - $(package)_config_opts+=--enable-pc-files - $(package)_config_opts+=--host=$(HOST) - $(pacakge)_config_opts+=--without-shared - $(pacakge)_config_opts+=--without-pthread - $(pacakge)_config_opts+=--disable-rpath - $(pacakge)_config_opts+=--disable-colorfgbg - $(pacakge)_config_opts+=--disable-ext-mouse - $(pacakge)_config_opts+=--disable-symlinks - $(pacakge)_config_opts+=--enable-warnings - $(pacakge)_config_opts+=--enable-assertions - $(package)_config_opts+=--with-default-terminfo-dir=/etc/_terminfo_ - $(package)_config_opts+=--with-terminfo-dirs=/etc/_terminfo_ - $(pacakge)_config_opts+=--enable-database - $(pacakge)_config_opts+=--enable-sp-funcs - $(pacakge)_config_opts+=--disable-term-driver - $(pacakge)_config_opts+=--enable-interop - $(pacakge)_config_opts+=--enable-widec - $(package)_build_opts=CFLAGS="$($(package)_cflags) $($(package)_cppflags) -fPIC" -endef - -define $(package)_preprocess_cmds - cp $($(package)_patch_dir)/fallback.c ncurses -endef - -define $(package)_config_cmds - $($(package)_autoconf) -endef - -define $(package)_build_cmds - $(MAKE) $($(package)_build_opts) V=1 -endef - -define $(package)_stage_cmds - $(MAKE) install.libs DESTDIR=$($(package)_staging_dir) -endef - diff --git a/contrib/depends/packages/openssl.mk b/contrib/depends/packages/openssl.mk index 79c94a3..ffa195c 100644 --- a/contrib/depends/packages/openssl.mk +++ b/contrib/depends/packages/openssl.mk @@ -1,9 +1,8 @@ package=openssl -$(package)_version=1.1.1l +$(package)_version=1.1.1q $(package)_download_path=https://www.openssl.org/source $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1 -$(package)_patches=fix_darwin.patch +$(package)_sha256_hash=d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca define $(package)_set_vars $(package)_config_env=AR="$($(package)_ar)" ARFLAGS=$($(package)_arflags) RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" @@ -38,6 +37,7 @@ $(package)_config_opts_arm_linux=linux-generic32 $(package)_config_opts_aarch64_linux=linux-generic64 $(package)_config_opts_arm_android=--static android-arm $(package)_config_opts_aarch64_android=--static android-arm64 +$(package)_config_opts_aarch64_darwin=darwin64-arm64-cc $(package)_config_opts_riscv64_linux=linux-generic64 $(package)_config_opts_mipsel_linux=linux-generic32 $(package)_config_opts_mips_linux=linux-generic32 @@ -49,8 +49,8 @@ $(package)_config_opts_x86_64_freebsd=BSD-x86_64 endef define $(package)_preprocess_cmds - sed -i.old 's|"engines", "apps", "test", "util", "tools", "fuzz"|"engines", "tools"|' Configure && \ - patch -p1 < $($(package)_patch_dir)/fix_darwin.patch + printenv && \ + sed -i.old 's|"engines", "apps", "test", "util", "tools", "fuzz"|"engines", "tools"|' Configure endef define $(package)_config_cmds diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk index 8bf1b1f..f1c9c7a 100644 --- a/contrib/depends/packages/packages.mk +++ b/contrib/depends/packages/packages.mk @@ -1,26 +1,24 @@ native_packages := native_cmake -packages := boost openssl libiconv ldns unbound qrencode zbar sodium polyseed hidapi protobuf libusb zlib libgpg-error libgcrypt ncurses readline expat +packages := boost openssl libiconv ldns unbound qrencode zbar sodium polyseed hidapi protobuf libusb zlib libgpg-error libgcrypt expat hardware_packages := hidapi protobuf libusb hardware_native_packages := native_protobuf -linux_packages := eudev libzip +linux_packages := eudev libzip liblzma libarchive libfuse libsquashfuse libappimage linux_native_packages = $(hardware_native_packages) native_patchelf -# native_linuxdeployqt native_squashfs-tools native_qmake -qt_linux_packages:=qt expat libxcb xcb_proto libXau xproto freetype fontconfig libxkbcommon libxcb_util libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm -qt_darwin_packages=qt -qt_mingw32_packages=qt +qt_linux_packages:=qt native_expat native_libxcb native_xcb_proto native_libXau native_xproto native_freetype native_fontconfig native_libxkbcommon native_libxcb_util native_libxcb_util_render native_libxcb_util_keysyms native_libxcb_util_image native_libxcb_util_wm appimage_runtime +qt_darwin_packages=native_qt qt +qt_mingw32_packages=native_qt -# apt install python3-setuptools darwin_packages := libzip -darwin_native_packages = $(hardware_native_packages) native_ds_store native_mac_alias +darwin_native_packages = $(hardware_native_packages) native_ds_store native_mac_alias native_expat native_libxcb native_xcb_proto native_libXau native_xproto native_freetype native_fontconfig native_libxkbcommon native_libxcb_util native_libxcb_util_render native_libxcb_util_keysyms native_libxcb_util_image native_libxcb_util_wm -tor_linux_packages := libevent tor -tor_darwin_packages := tor-macos +tor_linux_packages := libevent tor_linux +tor_darwin_packages := tor_darwin -mingw32_packages = icu4c sodium $(hardware_packages) tor-win libzip -mingw32_native_packages = $(hardware_native_packages) +mingw32_packages = icu4c sodium $(hardware_packages) tor_mingw32 libzip qt +mingw32_native_packages = $(hardware_native_packages) native_expat native_libxcb native_xcb_proto native_libXau native_xproto native_freetype native_fontconfig native_libxkbcommon native_libxcb_util native_libxcb_util_render native_libxcb_util_keysyms native_libxcb_util_image native_libxcb_util_wm ifneq ($(build_os),darwin) darwin_native_packages += native_cctools native_libtapi @@ -29,4 +27,4 @@ ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),) darwin_native_packages+= native_clang endif -endif +endif \ No newline at end of file diff --git a/contrib/depends/packages/qrencode.mk b/contrib/depends/packages/qrencode.mk index d168788..b375a84 100644 --- a/contrib/depends/packages/qrencode.mk +++ b/contrib/depends/packages/qrencode.mk @@ -5,11 +5,11 @@ $(package)_file_name=$(package)-$($(package)_version).tar.bz2 $(package)_sha256_hash=efe5188b1ddbcbf98763b819b146be6a90481aac30cfc8d858ab78a19cde1fa5 define $(package)_set_vars -$(package)_config_opts=--disable-shared --without-tools --without-tests --disable-sdltest -$(package)_config_opts += --disable-gprof --disable-gcov --disable-mudflap -$(package)_config_opts += --disable-dependency-tracking --enable-option-checking -$(package)_config_opts_linux=--with-pic -$(package)_config_opts_android=--with-pic + $(package)_config_opts=--disable-shared --without-tools --without-tests --disable-sdltest + $(package)_config_opts += --disable-gprof --disable-gcov --disable-mudflap + $(package)_config_opts += --disable-dependency-tracking --enable-option-checking + $(package)_config_opts_linux=--with-pic + $(package)_config_opts_android=--with-pic endef define $(package)_preprocess_cmds diff --git a/contrib/depends/packages/qt.mk b/contrib/depends/packages/qt.mk index 03c706a..855b182 100644 --- a/contrib/depends/packages/qt.mk +++ b/contrib/depends/packages/qt.mk @@ -1,57 +1,68 @@ package=qt -$(package)_version=5.15.5 -$(package)_download_path=https://download.qt.io/official_releases/qt/5.15/$($(package)_version)/submodules -$(package)_suffix=everywhere-opensource-src-$($(package)_version).tar.xz +$(package)_version=6.4.0 +$(package)_download_path=https://download.qt.io/official_releases/qt/6.4/$($(package)_version)/submodules +$(package)_suffix=everywhere-src-$($(package)_version).tar.xz $(package)_file_name=qtbase-$($(package)_suffix) -$(package)_sha256_hash=0c42c799aa7c89e479a07c451bf5a301e291266ba789e81afc18f95049524edc -$(package)_dependencies=openssl -$(package)_linux_dependencies=freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm +$(package)_sha256_hash=cb6475a0bd8567c49f7ffbb072a05516ee6671171bed55db75b22b94ead9b37d +$(package)_darwin_dependencies=native_cctools native_qt openssl +$(package)_mingw32_dependencies=openssl native_cmake native_qt native_freetype native_fontconfig native_libxkbcommon +$(package)_linux_dependencies=openssl native_cmake native_freetype native_fontconfig native_libxcb native_libxkbcommon native_libxcb_util native_libxcb_util_render native_libxcb_util_keysyms native_libxcb_util_image native_libxcb_util_wm $(package)_qt_libs=corelib network widgets gui plugins testlib $(package)_linguist_tools = lrelease lupdate lconvert -$(package)_patches = qt.pro -$(package)_patches += qttools_src.pro +$(package)_patches = root_CMakeLists.txt $(package)_patches += mac-qmake.conf -$(package)_patches += fix_qt_pkgconfig.patch $(package)_patches += no-xlib.patch -$(package)_patches += dont_hardcode_x86_64.patch -$(package)_patches += fix_montery_include.patch -$(package)_patches += fix_android_jni_static.patch $(package)_patches += dont_hardcode_pwd.patch $(package)_patches += qtbase-moc-ignore-gcc-macro.patch -$(package)_patches += use_android_ndk23.patch $(package)_patches += rcc_hardcode_timestamp.patch -$(package)_patches += duplicate_lcqpafonts.patch $(package)_patches += fast_fixed_dtoa_no_optimize.patch $(package)_patches += guix_cross_lib_path.patch +$(package)_patches += no-statx.patch +$(package)_patches += no-renameat2.patch +$(package)_patches += no_pthread_cond_clockwait.patch +$(package)_patches += QTBUG-92199-fix.patch +$(package)_patches += WindowsToolchain.cmake +$(package)_patches += windows_func_fix.patch +$(package)_patches += fix_include_capitalization.patch +$(package)_patches += dont_capitalize_wmf_libs.patch +$(package)_patches += MacToolchain.cmake +$(package)_patches += no_wraprt_on_apple.patch +$(package)_patches += ___isOSVersionAtLeast_hack.patch +$(package)_patches += missing-include.patch +$(package)_patches += no-__builtin_available.patch +$(package)_patches += no-ffmpeg.patch $(package)_qttranslations_file_name=qttranslations-$($(package)_suffix) -$(package)_qttranslations_sha256_hash=c92af4171397a0ed272330b4fa0669790fcac8d050b07c8b8cc565ebeba6735e +$(package)_qttranslations_sha256_hash=7ab93a930b693eeb53ab97b038b4e6e057d06374e6f49a3814d99145a276925f $(package)_qttools_file_name=qttools-$($(package)_suffix) -$(package)_qttools_sha256_hash=6d0778b71b2742cb527561791d1d3d255366163d54a10f78c683a398f09ffc6c +$(package)_qttools_sha256_hash=97f3d5f88c458be7a8f7b7b08efc06c4ebad39ca51669476b18bf9e4c11afba2 $(package)_qtsvg_file_name=qtsvg-$($(package)_suffix) -$(package)_qtsvg_sha256_hash=c4cf9e640ad43f157c6b14ee7624047f5945288991ad5de83c9eec673bacb031 +$(package)_qtsvg_sha256_hash=03fdae9437d074dcfa387dc1f2c6e7e14fea0f989bf7e1aa265fd35ffc2c5b25 $(package)_qtwebsockets_file_name=qtwebsockets-$($(package)_suffix) -$(package)_qtwebsockets_sha256_hash=66ab8b5bb2e64392fe43786ca1c2fd4be3306fbc4b969aa1748e568b5d062238 +$(package)_qtwebsockets_sha256_hash=ff3c6629cd6537266123c441709acdd67f231ff2a07216fc848448255bec9bca +$(package)_qtmultimedia_file_name=qtmultimedia-$($(package)_suffix) +$(package)_qtmultimedia_sha256_hash=e82e8e847cae2a951a11db05b6d10a22b21e3a1d72e06a7781cce4bd197e796f + +$(package)_qtshadertools_file_name=qtshadertools-$($(package)_suffix) +$(package)_qtshadertools_sha256_hash=dbd6a5f00e8178cd2fea7e84c4eef3818de5287d34e20a68383929c754ae3b90 $(package)_extra_sources = $($(package)_qttranslations_file_name) $(package)_extra_sources += $($(package)_qttools_file_name) $(package)_extra_sources += $($(package)_qtsvg_file_name) $(package)_extra_sources += $($(package)_qtwebsockets_file_name) +$(package)_extra_sources += $($(package)_qtmultimedia_file_name) +$(package)_extra_sources += $($(package)_qtshadertools_file_name) define $(package)_set_vars $(package)_config_opts_release = -release -$(package)_config_opts_release += -silent $(package)_config_opts_debug = -debug $(package)_config_opts_debug += -optimized-tools -$(package)_config_opts += -bindir $(build_prefix)/bin -$(package)_config_opts += -c++std c++17 +$(package)_config_opts += -libexecdir $(build_prefix)/bin $(package)_config_opts += -confirm-license -$(package)_config_opts += -hostprefix $(build_prefix) -$(package)_config_opts += -no-compile-examples $(package)_config_opts += -no-cups $(package)_config_opts += -no-egl $(package)_config_opts += -no-eglfs @@ -60,36 +71,26 @@ $(package)_config_opts += -no-gif $(package)_config_opts += -no-glib $(package)_config_opts += -no-icu $(package)_config_opts += -no-ico -$(package)_config_opts += -no-iconv $(package)_config_opts += -no-kms $(package)_config_opts += -no-linuxfb -$(package)_config_opts += -no-libjpeg +#$(package)_config_opts += -no-libjpeg # Needed #$(package)_config_opts += -no-libproxy # Needed $(package)_config_opts += -no-libudev $(package)_config_opts += -no-mtdev #$(package)_config_opts += -no-openssl # Needed +$(package)_config_opts_mingw32 += -openssl-linked +$(package)_config_opts_linux += -openssl-linked $(package)_config_opts += -no-openvg $(package)_config_opts += -no-reduce-relocations $(package)_config_opts += -no-schannel $(package)_config_opts += -no-sctp $(package)_config_opts += -no-securetransport -$(package)_config_opts += -no-sql-db2 -$(package)_config_opts += -no-sql-ibase -$(package)_config_opts += -no-sql-oci -$(package)_config_opts += -no-sql-tds -$(package)_config_opts += -no-sql-mysql -$(package)_config_opts += -no-sql-odbc -$(package)_config_opts += -no-sql-psql -$(package)_config_opts += -no-sql-sqlite -$(package)_config_opts += -no-sql-sqlite2 $(package)_config_opts += -no-system-proxies $(package)_config_opts += -no-use-gold-linker $(package)_config_opts += -no-zstd $(package)_config_opts += -nomake examples $(package)_config_opts += -nomake tests -$(package)_config_opts += -nomake tools $(package)_config_opts += -opensource -$(package)_config_opts += -openssl-linked $(package)_config_opts += -pkg-config $(package)_config_opts += -prefix $(host_prefix) $(package)_config_opts += -qt-libpng @@ -97,41 +98,41 @@ $(package)_config_opts += -qt-pcre $(package)_config_opts += -qt-harfbuzz $(package)_config_opts += -qt-zlib $(package)_config_opts += -static -$(package)_config_opts += -v -$(package)_config_opts += -no-feature-bearermanagement $(package)_config_opts += -no-feature-colordialog +#$(package)_config_opts += -no-feature-concurrent # Needed $(package)_config_opts += -no-feature-dial $(package)_config_opts += -no-feature-fontcombobox -$(package)_config_opts += -no-feature-ftp $(package)_config_opts += -no-feature-http $(package)_config_opts += -no-feature-image_heuristic_mask $(package)_config_opts += -no-feature-keysequenceedit $(package)_config_opts += -no-feature-lcdnumber $(package)_config_opts += -no-feature-networkdiskcache +#$(package)_config_opts += -no-feature-networkproxy # Needed $(package)_config_opts += -no-feature-pdf $(package)_config_opts += -no-feature-printdialog $(package)_config_opts += -no-feature-printer $(package)_config_opts += -no-feature-printpreviewdialog $(package)_config_opts += -no-feature-printpreviewwidget +$(package)_config_opts += -no-feature-printsupport $(package)_config_opts += -no-feature-sessionmanager +#$(package)_config_opts += -no-feature-socks5 # Needed $(package)_config_opts += -no-feature-sql -$(package)_config_opts += -no-feature-sqlmodel -$(package)_config_opts += -no-feature-statemachine $(package)_config_opts += -no-feature-syntaxhighlighter +#$(package)_config_opts += -no-feature-textbrowser # Needed $(package)_config_opts += -no-feature-textmarkdownwriter $(package)_config_opts += -no-feature-textodfwriter $(package)_config_opts += -no-feature-topleveldomain +#$(package)_config_opts += -no-feature-udpsocket # Neede $(package)_config_opts += -no-feature-undocommand $(package)_config_opts += -no-feature-undogroup $(package)_config_opts += -no-feature-undostack $(package)_config_opts += -no-feature-undoview $(package)_config_opts += -no-feature-vnc -$(package)_config_opts += -no-feature-xml +#$(package)_config_opts += -no-feature-wizard # Needed $(package)_config_opts_darwin = -no-dbus $(package)_config_opts_darwin += -no-opengl -$(package)_config_opts_darwin += -pch -$(package)_config_opts_darwin += -no-feature-corewlan +$(package)_config_opts_darwin += -no-pch $(package)_config_opts_darwin += -no-freetype $(package)_config_opts_darwin += QMAKE_MACOSX_DEPLOYMENT_TARGET=$(OSX_MIN_VERSION) @@ -142,6 +143,7 @@ $(package)_config_opts_darwin += -device-option MAC_SDK_VERSION=$(OSX_SDK_VERSIO $(package)_config_opts_darwin += -device-option CROSS_COMPILE="$(host)-" $(package)_config_opts_darwin += -device-option MAC_TARGET=$(host) $(package)_config_opts_darwin += -device-option XCODE_VERSION=$(XCODE_VERSION) +$(package)_config_opts_darwin += -qt-host-path $(build_prefix)/qt-host endif ifneq ($(build_arch),$(host_arch)) @@ -149,9 +151,18 @@ $(package)_config_opts_aarch64_darwin += -device-option QMAKE_APPLE_DEVICE_ARCHS $(package)_config_opts_x86_64_darwin += -device-option QMAKE_APPLE_DEVICE_ARCHS=x86_64 endif +$(package)_config_opts_darwin += -no-feature-ffmpeg +$(package)_config_opts_darwin += -- -DCMAKE_TOOLCHAIN_FILE=MacToolchain.cmake -DCMAKE_LIBRARY_PATH=$(HOME)/.guix-profile/lib + $(package)_config_opts_linux = -xcb $(package)_config_opts_linux += -no-xcb-xlib $(package)_config_opts_linux += -no-feature-xlib +#$(package)_config_opts_linux += -feature-ffmpeg +#$(package)_config_opts_linux += -feature-pulseaudio + +# https://bugreports.qt.io/browse/QTBUG-99957 +$(package)_config_opts_linux += -no-pch + $(package)_config_opts_linux += -system-freetype $(package)_config_opts_linux += -fontconfig $(package)_config_opts_linux += -no-opengl @@ -160,30 +171,21 @@ $(package)_config_opts_linux += -dbus-runtime ifneq ($(LTO),) $(package)_config_opts_linux += -ltcg endif -$(package)_config_opts_arm_linux += -platform linux-g++ -xplatform bitcoin-linux-g++ -$(package)_config_opts_i686_linux = -xplatform linux-g++-32 +$(package)_config_opts_linux += -platform linux-g++ -xplatform bitcoin-linux-g++ ifneq (,$(findstring -stdlib=libc++,$($(1)_cxx))) $(package)_config_opts_x86_64_linux = -xplatform linux-clang-libc++ -else -$(package)_config_opts_x86_64_linux = -xplatform linux-g++-64 endif -$(package)_config_opts_aarch64_linux = -xplatform linux-aarch64-gnu-g++ -$(package)_config_opts_powerpc64_linux = -platform linux-g++ -xplatform bitcoin-linux-g++ -$(package)_config_opts_powerpc64le_linux = -platform linux-g++ -xplatform bitcoin-linux-g++ -$(package)_config_opts_riscv64_linux = -platform linux-g++ -xplatform bitcoin-linux-g++ -$(package)_config_opts_s390x_linux = -platform linux-g++ -xplatform bitcoin-linux-g++ $(package)_config_opts_mingw32 = -no-opengl $(package)_config_opts_mingw32 += -no-dbus $(package)_config_opts_mingw32 += -no-freetype $(package)_config_opts_mingw32 += -xplatform win32-g++ -$(package)_config_opts_mingw32 += "QMAKE_CFLAGS = '$($(package)_cflags) $($(package)_cppflags)'" -$(package)_config_opts_mingw32 += "QMAKE_CXX = '$($(package)_cxx)'" -$(package)_config_opts_mingw32 += "QMAKE_CXXFLAGS = '$($(package)_cxxflags) $($(package)_cppflags)'" -$(package)_config_opts_mingw32 += "QMAKE_LFLAGS = '$($(package)_ldflags)'" -$(package)_config_opts_mingw32 += "QMAKE_LIB = '$($(package)_ar) rc'" $(package)_config_opts_mingw32 += -device-option CROSS_COMPILE="$(host)-" $(package)_config_opts_mingw32 += -pch +$(package)_config_opts_mingw32 += -qt-host-path $(build_prefix)/qt-host +$(package)_config_opts_mingw32 += -no-feature-ffmpeg +$(package)_config_opts_mingw32 += -wmf +$(package)_config_opts_mingw32 += -- -DCMAKE_TOOLCHAIN_FILE=WindowsToolchain.cmake -DCMAKE_LIBRARY_PATH=$(HOME)/.guix-profile/lib $(package)_config_opts_android = -xplatform android-clang $(package)_config_opts_android += -android-sdk $(ANDROID_SDK) @@ -212,7 +214,9 @@ $(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_f $(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttranslations_file_name),$($(package)_qttranslations_file_name),$($(package)_qttranslations_sha256_hash)) && \ $(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttools_file_name),$($(package)_qttools_file_name),$($(package)_qttools_sha256_hash)) && \ $(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtsvg_file_name),$($(package)_qtsvg_file_name),$($(package)_qtsvg_sha256_hash)) && \ -$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtwebsockets_file_name),$($(package)_qtwebsockets_file_name),$($(package)_qtwebsockets_sha256_hash)) +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtwebsockets_file_name),$($(package)_qtwebsockets_file_name),$($(package)_qtwebsockets_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtmultimedia_file_name),$($(package)_qtmultimedia_file_name),$($(package)_qtmultimedia_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtshadertools_file_name),$($(package)_qtshadertools_file_name),$($(package)_qtshadertools_sha256_hash)) endef define $(package)_extract_cmds @@ -222,6 +226,8 @@ define $(package)_extract_cmds echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ echo "$($(package)_qtsvg_sha256_hash) $($(package)_source_dir)/$($(package)_qtsvg_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ echo "$($(package)_qtwebsockets_sha256_hash) $($(package)_source_dir)/$($(package)_qtwebsockets_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_qtmultimedia_sha256_hash) $($(package)_source_dir)/$($(package)_qtmultimedia_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_qtshadertools_sha256_hash) $($(package)_source_dir)/$($(package)_qtshadertools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ mkdir qtbase && \ $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \ @@ -232,48 +238,47 @@ define $(package)_extract_cmds mkdir qtsvg && \ $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtsvg_file_name) -C qtsvg && \ mkdir qtwebsockets && \ - $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtwebsockets_file_name) -C qtwebsockets + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtwebsockets_file_name) -C qtwebsockets && \ + mkdir qtmultimedia && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtmultimedia_file_name) -C qtmultimedia && \ + mkdir qtshadertools && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtshadertools_file_name) -C qtshadertools endef -# Preprocessing steps work as follows: -# -# 1. Apply our patches to the extracted source. See each patch for more info. -# -# 2. Create a macOS-Clang-Linux mkspec using our mac-qmake.conf. -# -# 3. After making a copy of the mkspec for the linux-arm-gnueabi host, named -# bitcoin-linux-g++, replace instances of linux-arm-gnueabi with $(host). This -# way we can generically support hosts like riscv64-linux-gnu, which Qt doesn't -# ship a mkspec for. See it's usage in config_opts_* above. -# -# 4. Put our C, CXX and LD FLAGS into gcc-base.conf. Only used for non-host builds. -# -# 5. Do similar for the win32-g++ mkspec. -# -# 6. In clang.conf, swap out clang & clang++, for our compiler + flags. See #17466. -# -# 7. Adjust a regex in toolchain.prf, to accommodate Guix's usage of -# CROSS_LIBRARY_PATH. See #15277. define $(package)_preprocess_cmds - cp $($(package)_patch_dir)/qt.pro qt.pro && \ - cp $($(package)_patch_dir)/qttools_src.pro qttools/src/src.pro && \ + cp $($(package)_patch_dir)/root_CMakeLists.txt CMakeLists.txt && \ patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \ - patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \ - patch -p1 -i $($(package)_patch_dir)/fix_android_jni_static.patch && \ patch -p1 -i $($(package)_patch_dir)/no-xlib.patch && \ - patch -p1 -i $($(package)_patch_dir)/dont_hardcode_x86_64.patch && \ patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \ - patch -p1 -i $($(package)_patch_dir)/fix_montery_include.patch && \ - patch -p1 -i $($(package)_patch_dir)/use_android_ndk23.patch && \ patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \ - patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \ patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \ patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \ + patch -p1 -i $($(package)_patch_dir)/no-statx.patch && \ + patch -p1 -i $($(package)_patch_dir)/no-renameat2.patch && \ + patch -p1 -i $($(package)_patch_dir)/no_pthread_cond_clockwait.patch && \ + patch -p1 -i $($(package)_patch_dir)/QTBUG-92199-fix.patch && \ + patch -p1 -i $($(package)_patch_dir)/windows_func_fix.patch && \ + patch -p1 -i $($(package)_patch_dir)/fix_include_capitalization.patch && \ + patch -p1 -i $($(package)_patch_dir)/dont_capitalize_wmf_libs.patch && \ + patch -p1 -i $($(package)_patch_dir)/no_wraprt_on_apple.patch && \ + patch -p1 -i $($(package)_patch_dir)/___isOSVersionAtLeast_hack.patch && \ + patch -p1 -i $($(package)_patch_dir)/missing-include.patch && \ + patch -p1 -i $($(package)_patch_dir)/no-__builtin_available.patch && \ + mv $($(package)_patch_dir)/WindowsToolchain.cmake . && \ + mv $($(package)_patch_dir)/MacToolchain.cmake . && \ + cd qtmultimedia && \ + patch -p1 -i $($(package)_patch_dir)/no-ffmpeg.patch && \ + cd .. && \ mkdir -p qtbase/mkspecs/macx-clang-linux &&\ cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\ cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \ cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \ - sed -i.old "s/arm-linux-gnueabi-/$(host)-/g" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-gcc|$($($(package)_type)_CC)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-g++|$($($(package)_type)_CXX)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-ar|$($($(package)_type)_AR)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-objcopy|$($($(package)_type)_OBJCOPY)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-nm|$($($(package)_type)_NM)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ + sed -i.old "s|arm-linux-gnueabi-strip|$($($(package)_type)_STRIP)|" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ @@ -281,6 +286,42 @@ define $(package)_preprocess_cmds sed -i.old "s|QMAKE_CXX = \$$$$\$$$${CROSS_COMPILE}clang++|QMAKE_CXX = $($(package)_cxx)|" qtbase/mkspecs/common/clang.conf endef +# TODO: this is a mess, but i'm tired of rebuilding Qt so it is what it is +# TODO: find a better way to make WMF libraries available to Qt without polluting the environment +ifeq ($(host_os),darwin) +define $(package)_config_cmds + export OPENSSL_LIBS=${$(package)_openssl_flags_$(host_os)} \ + export PKG_CONFIG_SYSROOT_DIR=/ && \ + export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig && \ + export QT_MAC_SDK_NO_VERSION_CHECK=1 && \ + cd qtbase && \ + env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH ./configure -top-level $($(package)_config_opts) --debug-find-pkg=Threads -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON +endef +else ifeq ($(host_os),mingw32) +define $(package)_config_cmds + cp $(HOME)/.guix-profile/lib/libstrmiids.a \ + $(HOME)/.guix-profile/lib/libamstrmid.a \ + $(HOME)/.guix-profile/lib/libdmoguids.a \ + $(HOME)/.guix-profile/lib/libuuid.a \ + $(HOME)/.guix-profile/lib/libmsdmo.a \ + $(HOME)/.guix-profile/lib/libole32.a \ + $(HOME)/.guix-profile/lib/liboleaut32.a \ + $(HOME)/.guix-profile/lib/libmf.a \ + $(HOME)/.guix-profile/lib/libmfuuid.a \ + $(HOME)/.guix-profile/lib/libmfplat.a \ + $(HOME)/.guix-profile/lib/libmfcore.a \ + $(HOME)/.guix-profile/lib/libpropsys.a \ + /feather/contrib/depends/x86_64-w64-mingw32/lib/ && \ + export OPENSSL_LIBS=${$(package)_openssl_flags_$(host_os)} \ + export PKG_CONFIG_SYSROOT_DIR=/ && \ + export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig && \ + export QT_MAC_SDK_NO_VERSION_CHECK=1 && \ + export V=1 && \ + export VERBOSE=1 && \ + cd qtbase && \ + ./configure -top-level $($(package)_config_opts) -DCMAKE_LIBRARY_PATH=$(HOME)/.guix-profile/lib --debug-find-pkg=WMF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON +endef +else define $(package)_config_cmds export OPENSSL_LIBS=${$(package)_openssl_flags_$(host_os)} \ export PKG_CONFIG_SYSROOT_DIR=/ && \ @@ -289,19 +330,24 @@ define $(package)_config_cmds cd qtbase && \ ./configure -top-level $($(package)_config_opts) endef +endif +ifeq ($(host_os),darwin) +define $(package)_build_cmds + export LD_LIBRARY_PATH=${build_prefix}/lib/ && \ + env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH $(MAKE) +endef +else ifeq ($(host_os),mingw32) +define $(package)_build_cmds + export LD_LIBRARY_PATH=${build_prefix}/lib/ && \ + $(MAKE) +endef +else define $(package)_build_cmds $(MAKE) endef +endif define $(package)_stage_cmds - $(MAKE) -C qtbase INSTALL_ROOT=$($(package)_staging_dir) install && \ - $(MAKE) -C qttools/src/linguist INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_linguist_tools))) && \ - $(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets && \ - $(MAKE) -C qtsvg/src INSTALL_ROOT=$($(package)_staging_dir) install && \ - $(MAKE) -C qtwebsockets/src INSTALL_ROOT=$($(package)_staging_dir) install -endef - -define $(package)_postprocess_cmds - echo -n "" > lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake + DESTDIR=$($(package)_staging_dir) cmake --install . endef diff --git a/contrib/depends/packages/readline.mk b/contrib/depends/packages/readline.mk deleted file mode 100644 index 957b645..0000000 --- a/contrib/depends/packages/readline.mk +++ /dev/null @@ -1,29 +0,0 @@ -package=readline -$(package)_version=8.0 -$(package)_download_path=https://ftp.gnu.org/gnu/readline -$(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461 -$(package)_dependencies=ncurses - -define $(package)_set_vars - $(package)_build_opts=CC="$($(package)_cc)" - $(package)_config_opts+=--prefix=$(host_prefix) - $(package)_config_opts+=--exec-prefix=$(host_prefix) - $(package)_config_opts+=--host=$(HOST) - $(package)_config_opts+=--disable-shared --with-curses - $(package)_config_opts_release=--disable-debug-mode - $(package)_build_opts=CFLAGS="$($(package)_cflags) $($(package)_cppflags) -fPIC" -endef - -define $(package)_config_cmds - $($(package)_autoconf) -endef - -define $(package)_build_cmds - $(MAKE) $($(package)_build_opts) -endef - -define $(package)_stage_cmds - $(MAKE) install DESTDIR=$($(package)_staging_dir) prefix=$(host_prefix) exec-prefix=$(host_prefix) -endef - diff --git a/contrib/depends/packages/sodium.mk b/contrib/depends/packages/sodium.mk index c834409..b581bbd 100644 --- a/contrib/depends/packages/sodium.mk +++ b/contrib/depends/packages/sodium.mk @@ -6,8 +6,8 @@ $(package)_sha256_hash=6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e $(package)_patches=disable-glibc-getrandom-getentropy.patch fix-whitespace.patch define $(package)_set_vars -$(package)_config_opts=--enable-static --disable-shared -$(package)_config_opts+=--prefix=$(host_prefix) + $(package)_config_opts=--enable-static --disable-shared + $(package)_config_opts+=--prefix=$(host_prefix) endef define $(package)_preprocess_cmds @@ -17,7 +17,7 @@ define $(package)_preprocess_cmds endef define $(package)_config_cmds - $($(package)_autoconf) + $($(package)_autoconf) AR_FLAGS=$($(package)_arflags) endef define $(package)_build_cmds @@ -31,4 +31,3 @@ endef define $(package)_postprocess_cmds rm lib/*.la endef - diff --git a/contrib/depends/packages/tor-win.mk b/contrib/depends/packages/tor-win.mk deleted file mode 100644 index d724d1f..0000000 --- a/contrib/depends/packages/tor-win.mk +++ /dev/null @@ -1,13 +0,0 @@ -package=tor-win -$(package)_version=0.4.7.8 -$(package)_download_path=https://dist.torproject.org/torbrowser/11.5.1/ -$(package)_file_name=tor-win64-$($(package)_version).zip -$(package)_sha256_hash=6658aaf7d22052861631917590e248fdf8b3fe40a795d740811362b517113a47 -$(package)_extract_cmds=mkdir -p $$($(1)_extract_dir) && \ - echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && \ - $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && \ - unzip $$($(1)_source) - -define $(package)_stage_cmds - cp -a Tor $($(package)_staging_prefix_dir)/Tor/ -endef \ No newline at end of file diff --git a/contrib/depends/packages/tor-macos.mk b/contrib/depends/packages/tor_darwin.mk similarity index 72% rename from contrib/depends/packages/tor-macos.mk rename to contrib/depends/packages/tor_darwin.mk index fd9af82..db43879 100644 --- a/contrib/depends/packages/tor-macos.mk +++ b/contrib/depends/packages/tor_darwin.mk @@ -1,8 +1,8 @@ -package=tor-win -$(package)_version=0.4.7.8 -$(package)_download_path=https://dist.torproject.org/torbrowser/11.5.1/ -$(package)_file_name=TorBrowser-11.5.1-osx64_en-US.dmg -$(package)_sha256_hash=616d719572e4917d1264c622033afb1b4dd98e2553a0d09fd72470c99bad48e5 +package=tor_darwin +$(package)_version=0.4.7.11 +$(package)_download_path=https://dist.torproject.org/torbrowser/11.5.8/ +$(package)_file_name=TorBrowser-11.5.8-osx64_en-US.dmg +$(package)_sha256_hash=051e5a92ff493826e569eb5487adb4f767ed4936edf7ca8f5c12a8b31e1fad16 $(package)_extract_cmds=mkdir -p $$($(1)_extract_dir) && \ echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && \ $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && \ diff --git a/contrib/depends/packages/tor.mk b/contrib/depends/packages/tor_linux.mk similarity index 98% rename from contrib/depends/packages/tor.mk rename to contrib/depends/packages/tor_linux.mk index 0fc4efc..2ecf69b 100644 --- a/contrib/depends/packages/tor.mk +++ b/contrib/depends/packages/tor_linux.mk @@ -1,4 +1,4 @@ -package=tor +package=tor_linux $(package)_version=0.4.7.7 $(package)_download_path=https://dist.torproject.org/ $(package)_file_name=tor-$($(package)_version).tar.gz diff --git a/contrib/depends/packages/tor_mingw32.mk b/contrib/depends/packages/tor_mingw32.mk new file mode 100644 index 0000000..cc0a13e --- /dev/null +++ b/contrib/depends/packages/tor_mingw32.mk @@ -0,0 +1,10 @@ +package=tor_mingw32 +$(package)_version=0.4.7.12 +$(package)_download_path=https://dist.torproject.org/torbrowser/12.0.1/ +$(package)_file_name=tor-expert-bundle-12.0.1-windows-x86_64.tar.gz +$(package)_sha256_hash=f53cfbc4f4454a265f10a853219b40067ef73feffc4a7d67472b61dbab9129ba + +define $(package)_stage_cmds + mkdir -p $($(package)_staging_prefix_dir)/Tor/ && \ + cp tor.exe $($(package)_staging_prefix_dir)/Tor/ +endef \ No newline at end of file diff --git a/contrib/depends/packages/unbound.mk b/contrib/depends/packages/unbound.mk index 2d870d6..2c14856 100644 --- a/contrib/depends/packages/unbound.mk +++ b/contrib/depends/packages/unbound.mk @@ -23,6 +23,3 @@ endef define $(package)_stage_cmds $(MAKE) DESTDIR=$($(package)_staging_dir) install endef - -define $(package)_postprocess_cmds -endef diff --git a/contrib/depends/packages/zlib.mk b/contrib/depends/packages/zlib.mk index 77a29c2..977a2cc 100644 --- a/contrib/depends/packages/zlib.mk +++ b/contrib/depends/packages/zlib.mk @@ -1,8 +1,8 @@ package=zlib -$(package)_version=1.2.11 -$(package)_download_path=https://github.com/madler/zlib/archive/refs/tags/ -$(package)_file_name=v1.2.11.tar.gz -$(package)_sha256_hash=629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff +$(package)_version=1.2.13 +$(package)_download_path=https://github.com/madler/zlib/releases/download/v$($(package)_version)/ +$(package)_file_name=$(package)-$($(package)_version).tar.gz +$(package)_sha256_hash=b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30 define $(package)_config_cmds CC="$($(package)_cc)" \ diff --git a/contrib/depends/patches/appimage_runtime/CMakeLists.txt b/contrib/depends/patches/appimage_runtime/CMakeLists.txt new file mode 100644 index 0000000..a619acd --- /dev/null +++ b/contrib/depends/patches/appimage_runtime/CMakeLists.txt @@ -0,0 +1,135 @@ +cmake_minimum_required(VERSION 3.2) +project(appimage_runtime) + +# DISCLAIMER: +# Feather builds should be bootstrappable. For this reason we cannot use the runtime binaries provided by the AppImage devs. +# This directory exists to allow the AppImage runtime to be compiled from source using the depends build system. +# We strongly discourage other projects from copying this code, as it WILL NOT produce a standard runtime. +# The runtime produced here is not guaranteed to run on all officially supported platforms. +# You have been warned. + +set(CMAKE_VERBOSE_MAKEFILE ON) + +# C and C++ versions +set(CMAKE_C_STANDARD 99) +set(CMAKE_CXX_STANDARD 98) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +# sanitizer support +set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH}) + +set(APPIMAGEKIT_RUNTIME_ENABLE_SETPROCTITLE OFF CACHE BOOL "Useful for $TARGET_APPIMAGE; see issue #763") + +# check type of current build +string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_UPPER) +if (BUILD_TYPE_UPPER STREQUAL DEBUG) + set(BUILD_DEBUG TRUE) +else() + set(BUILD_DEBUG FALSE) +endif() + +# must not include -flto in the following flags, otherwise the data sections will be stripped out +set(runtime_cflags + -std=c99 -ffunction-sections -fdata-sections + -I/feather/contrib/depends/x86_64-linux-gnu/include + -I/feather/contrib/depends/x86_64-linux-gnu/include/appimage + ) +# must not include -Wl,--gc-sections in the following flags, otherwise the data sections will be stripped out +set(runtime_ldflags -s -ffunction-sections -fdata-sections -flto) + +if(BUILD_DEBUG) + message(WARNING "Debug build, adding debug information") + set(runtime_cflags -g ${runtime_cflags}) +else() + message(STATUS "Release build, optimizing runtime") + set(runtime_cflags -Os ${runtime_cflags}) +endif() + +if(APPIMAGEKIT_RUNTIME_ENABLE_SETPROCTITLE) + set(runtime_cflags ${runtime_cflags} -DENABLE_SETPROCTITLE) +endif() + +# objcopy requires actual files for creating new sections to populate the new section +# therefore, we generate 3 suitable files containing blank bytes in the right sizes +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/16_blank_bytes + COMMAND dd if=/dev/zero bs=1 count=16 of=${CMAKE_CURRENT_BINARY_DIR}/16_blank_bytes +) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/1024_blank_bytes + COMMAND dd if=/dev/zero bs=1 count=1024 of=${CMAKE_CURRENT_BINARY_DIR}/1024_blank_bytes +) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/8192_blank_bytes + COMMAND dd if=/dev/zero bs=1 count=8192 of=${CMAKE_CURRENT_BINARY_DIR}/8192_blank_bytes +) + +# compile first raw object (not linked yet) into which the sections will be embedded +# TODO: find out how this .o object can be generated using a normal add_executable call +# that'd allow us to get rid of the -I parameters in runtime_cflags +add_custom_command( + MAIN_DEPENDENCY runtime.c + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/runtime.0.o + COMMAND ${CMAKE_C_COMPILER} ${runtime_cflags} -c ${CMAKE_CURRENT_SOURCE_DIR}/runtime.c -o runtime.0.o + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +# embed the sections, one by one +# TODO: find out whether all the sections can be embedded in a single objcopy call +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/runtime.1.o + COMMAND objcopy --add-section .digest_md5=16_blank_bytes --set-section-flags .digest_md5=noload,readonly runtime.0.o runtime.1.o + MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/runtime.0.o + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/16_blank_bytes + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/runtime.2.o + COMMAND objcopy --add-section .upd_info=1024_blank_bytes --set-section-flags .upd_info=noload,readonly runtime.1.o runtime.2.o + MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/runtime.1.o + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/1024_blank_bytes + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/runtime.3.o + COMMAND objcopy --add-section .sha256_sig=1024_blank_bytes --set-section-flags .sha256_sig=noload,readonly runtime.2.o runtime.3.o + MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/runtime.2.o + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/1024_blank_bytes + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/runtime.4.o + COMMAND objcopy --add-section .sig_key=8192_blank_bytes --set-section-flags .sig_key=noload,readonly runtime.3.o runtime.4.o + MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/runtime.3.o + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/8192_blank_bytes + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +# add the runtime as a normal executable +# CLion will recognize it as a normal executable, one can simply step into the code +add_executable(runtime ${CMAKE_CURRENT_BINARY_DIR}/runtime.4.o notify.c) +if(COMMAND target_link_options) + target_link_options(runtime PRIVATE ${runtime_ldflags}) +else() + message(WARNING "CMake version < 3.13, falling back to using target_link_libraries instead of target_link_options") + target_link_libraries(runtime PRIVATE ${runtime_ldflags}) +endif() +# CMake gets confused by the .o object, therefore we need to tell it that it shall link everything using the C compiler +set_property(TARGET runtime PROPERTY LINKER_LANGUAGE C) +target_link_libraries(runtime PRIVATE -Wl,--as-needed -Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2 -static-libstdc++ -Wl,-O2 -zmuldefs -L/feather/contrib/depends/x86_64-linux-gnu/lib squashfuse squashfuse_ll fuseprivate lzma z dl pthread appimage_shared appimage_hashlib ) + +target_include_directories(runtime PRIVATE ${PROJECT_SOURCE_DIR}/include) + +add_custom_command( + TARGET runtime + POST_BUILD + COMMAND strip ${CMAKE_CURRENT_BINARY_DIR}/runtime +) + +add_custom_command( + TARGET runtime + POST_BUILD + COMMAND echo -ne 'AI\\x02' | dd of="${CMAKE_CURRENT_BINARY_DIR}/runtime" bs=1 count=3 seek=8 conv=notrunc +) diff --git a/contrib/depends/patches/appimage_runtime/notify.c b/contrib/depends/patches/appimage_runtime/notify.c new file mode 100644 index 0000000..a05becd --- /dev/null +++ b/contrib/depends/patches/appimage_runtime/notify.c @@ -0,0 +1,78 @@ +#include +#include +#include +#include + +/* Try to show a notification on the GUI, fall back to the command line + * timeout is the timeout in milliseconds. timeout = NULL seems to trigger a + * GUI error dialog rather than a notification */ +int notify(char *title, char *body, int timeout) +{ + /* http://stackoverflow.com/questions/13204177/how-to-find-out-if-running-from-terminal-or-gui */ + if (isatty(fileno(stdin))){ + /* We were launched from the command line. */ + printf("\n%s\n", title); + printf("%s\n", body); + } + else + { + /* We were launched from inside the desktop */ + printf("\n%s\n", title); + printf("%s\n", body); + /* https://debian-administration.org/article/407/Creating_desktop_notifications */ + void *handle, *n; + typedef void (*notify_init_t)(char *); + typedef void *(*notify_notification_new_t)( char *, char *, char *, char *); + typedef void (*notify_notification_set_timeout_t)( void *, int ); + typedef void (*notify_notification_show_t)(void *, char *); + handle = NULL; + if(handle == NULL) + handle= dlopen("libnotify.so.3", RTLD_LAZY); + if(handle == NULL) + handle= dlopen("libnotify.so.4", RTLD_LAZY); + if(handle == NULL) + handle= dlopen("libnotify.so.5", RTLD_LAZY); + if(handle == NULL) + handle= dlopen("libnotify.so.6", RTLD_LAZY); + if(handle == NULL) + handle= dlopen("libnotify.so.7", RTLD_LAZY); + if(handle == NULL) + handle= dlopen("libnotify.so.8", RTLD_LAZY); + + if(handle == NULL) + { + printf("Failed to open libnotify.\n\n" ); + } + notify_init_t init = (notify_init_t)dlsym(handle, "notify_init"); + if ( init == NULL ) + { + dlclose( handle ); + return 1; + } + init("AppImage"); + + notify_notification_new_t nnn = (notify_notification_new_t)dlsym(handle, "notify_notification_new"); + if ( nnn == NULL ) + { + dlclose( handle ); + return 1; + } + n = nnn(title, body, NULL, NULL); + notify_notification_set_timeout_t nnst = (notify_notification_set_timeout_t)dlsym(handle, "notify_notification_set_timeout"); + if ( nnst == NULL ) + { + dlclose( handle ); + return 1; + } + nnst(n, timeout); + notify_notification_show_t show = (notify_notification_show_t)dlsym(handle, "notify_notification_show"); + if ( init == NULL ) + { + dlclose( handle ); + return 1; + } + show(n, NULL ); + dlclose(handle ); + } + return 0; +} diff --git a/contrib/depends/patches/appimage_runtime/runtime.c b/contrib/depends/patches/appimage_runtime/runtime.c new file mode 100644 index 0000000..f8ff341 --- /dev/null +++ b/contrib/depends/patches/appimage_runtime/runtime.c @@ -0,0 +1,946 @@ +/************************************************************************** + * + * Copyright (c) 2004-18 Simon Peter + * Portions Copyright (c) 2007 Alexander Larsson + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + **************************************************************************/ + +#ident "AppImage by Simon Peter, http://appimage.org/" + +#define _GNU_SOURCE + +#include "squashfuse.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifndef ENABLE_DLOPEN +#define ENABLE_DLOPEN +#endif +#include "squashfuse_dlopen.h" + +/* Exit status to use when launching an AppImage fails. + * For applications that assign meanings to exit status codes (e.g. rsync), + * we avoid "cluttering" pre-defined exit status codes by using 127 which + * is known to alias an application exit status and also known as launcher + * error, see SYSTEM(3POSIX). + */ +#define EXIT_EXECERROR 127 /* Execution error exit status. */ + +//#include "notify.c" +extern int notify(char *title, char *body, int timeout); +struct stat st; + +static ssize_t fs_offset; // The offset at which a filesystem image is expected = end of this ELF + +static void die(const char *msg) { + fprintf(stderr, "%s\n", msg); + exit(EXIT_EXECERROR); +} + +/* Check whether directory is writable */ +bool is_writable_directory(char* str) { + if(access(str, W_OK) == 0) { + return true; + } else { + return false; + } +} + +bool startsWith(const char *pre, const char *str) +{ + size_t lenpre = strlen(pre), + lenstr = strlen(str); + return lenstr < lenpre ? false : strncmp(pre, str, lenpre) == 0; +} + +/* Fill in a stat structure. Does not set st_ino */ +sqfs_err private_sqfs_stat(sqfs *fs, sqfs_inode *inode, struct stat *st) { + sqfs_err err = SQFS_OK; + uid_t id; + + memset(st, 0, sizeof(*st)); + st->st_mode = inode->base.mode; + st->st_nlink = inode->nlink; + st->st_mtime = st->st_ctime = st->st_atime = inode->base.mtime; + + if (S_ISREG(st->st_mode)) { + /* FIXME: do symlinks, dirs, etc have a size? */ + st->st_size = inode->xtra.reg.file_size; + st->st_blocks = st->st_size / 512; + } else if (S_ISBLK(st->st_mode) || S_ISCHR(st->st_mode)) { + st->st_rdev = sqfs_makedev(inode->xtra.dev.major, + inode->xtra.dev.minor); + } else if (S_ISLNK(st->st_mode)) { + st->st_size = inode->xtra.symlink_size; + } + + st->st_blksize = fs->sb.block_size; /* seriously? */ + + err = sqfs_id_get(fs, inode->base.uid, &id); + if (err) + return err; + st->st_uid = id; + err = sqfs_id_get(fs, inode->base.guid, &id); + st->st_gid = id; + if (err) + return err; + + return SQFS_OK; +} + +/* ================= End ELF parsing */ + +extern int fusefs_main(int argc, char *argv[], void (*mounted) (void)); +// extern void ext2_quit(void); + +static pid_t fuse_pid; +static int keepalive_pipe[2]; + +static void * +write_pipe_thread (void *arg) +{ + char c[32]; + int res; + // sprintf(stderr, "Called write_pipe_thread"); + memset (c, 'x', sizeof (c)); + while (1) { + /* Write until we block, on broken pipe, exit */ + res = write (keepalive_pipe[1], c, sizeof (c)); + if (res == -1) { + kill (fuse_pid, SIGTERM); + break; + } + } + return NULL; +} + +void +fuse_mounted (void) +{ + pthread_t thread; + fuse_pid = getpid(); + pthread_create(&thread, NULL, write_pipe_thread, keepalive_pipe); +} + +char* getArg(int argc, char *argv[],char chr) +{ + int i; + for (i=1; i sizeof(_path)-1) { + errno = ENAMETOOLONG; + return -1; + } + strcpy(_path, path); + + /* Iterate the string */ + for (p = _path + 1; *p; p++) { + if (*p == '/') { + /* Temporarily truncate */ + *p = '\0'; + + if (mkdir(_path, 0755) != 0) { + if (errno != EEXIST) + return -1; + } + + *p = '/'; + } + } + + if (mkdir(_path, 0755) != 0) { + if (errno != EEXIST) + return -1; + } + + return 0; +} + +void +print_help(const char *appimage_path) +{ + // TODO: "--appimage-list List content from embedded filesystem image\n" + fprintf(stderr, + "AppImage options:\n\n" + " --appimage-extract [] Extract content from embedded filesystem image\n" + " If pattern is passed, only extract matching files\n" + " --appimage-help Print this help\n" + " --appimage-mount Mount embedded filesystem image and print\n" + " mount point and wait for kill with Ctrl-C\n" + " --appimage-offset Print byte offset to start of embedded\n" + " filesystem image\n" + " --appimage-portable-home Create a portable home folder to use as $HOME\n" + " --appimage-portable-config Create a portable config folder to use as\n" + " $XDG_CONFIG_HOME\n" + " --appimage-signature Print digital signature embedded in AppImage\n" + " --appimage-updateinfo[rmation] Print update info embedded in AppImage\n" + "\n" + "Portable home:\n" + "\n" + " If you would like the application contained inside this AppImage to store its\n" + " data alongside this AppImage rather than in your home directory, then you can\n" + " place a directory named\n" + "\n" + " %s.home\n" + "\n" + " Or you can invoke this AppImage with the --appimage-portable-home option,\n" + " which will create this directory for you. As long as the directory exists\n" + " and is neither moved nor renamed, the application contained inside this\n" + " AppImage to store its data in this directory rather than in your home\n" + " directory\n" + , appimage_path); +} + +void +portable_option(const char *arg, const char *appimage_path, const char *name) +{ + char option[32]; + sprintf(option, "appimage-portable-%s", name); + + if (arg && strcmp(arg, option)==0) { + char portable_dir[PATH_MAX]; + char fullpath[PATH_MAX]; + + ssize_t length = readlink(appimage_path, fullpath, sizeof(fullpath)); + if (length < 0) { + fprintf(stderr, "Error getting realpath for %s\n", appimage_path); + exit(EXIT_FAILURE); + } + fullpath[length] = '\0'; + + sprintf(portable_dir, "%s.%s", fullpath, name); + if (!mkdir(portable_dir, S_IRWXU)) + fprintf(stderr, "Portable %s directory created at %s\n", name, portable_dir); + else + fprintf(stderr, "Error creating portable %s directory at %s: %s\n", name, portable_dir, strerror(errno)); + + exit(0); + } +} + +bool extract_appimage(const char* const appimage_path, const char* const _prefix, const char* const _pattern, const bool overwrite, const bool verbose) { + sqfs_err err = SQFS_OK; + sqfs_traverse trv; + sqfs fs; + char prefixed_path_to_extract[1024]; + + // local copy we can modify safely + // allocate 1 more byte than we would need so we can add a trailing slash if there is none yet + char* prefix = malloc(strlen(_prefix) + 2); + strcpy(prefix, _prefix); + + // sanitize prefix + if (prefix[strlen(prefix) - 1] != '/') + strcat(prefix, "/"); + + if (access(prefix, F_OK) == -1) { + if (mkdir_p(prefix) == -1) { + perror("mkdir_p error"); + return false; + } + } + + if ((err = sqfs_open_image(&fs, appimage_path, (size_t) fs_offset))) { + fprintf(stderr, "Failed to open squashfs image\n"); + return false; + }; + + // track duplicate inodes for hardlinks + char** created_inode = calloc(fs.sb.inodes, sizeof(char*)); + if (created_inode == NULL) { + fprintf(stderr, "Failed allocating memory to track hardlinks\n"); + return false; + } + + if ((err = sqfs_traverse_open(&trv, &fs, sqfs_inode_root(&fs)))) { + fprintf(stderr, "sqfs_traverse_open error\n"); + free(created_inode); + return false; + } + + bool rv = true; + + while (sqfs_traverse_next(&trv, &err)) { + if (!trv.dir_end) { + if (_pattern == NULL || fnmatch(_pattern, trv.path, FNM_FILE_NAME | FNM_LEADING_DIR) == 0) { + // fprintf(stderr, "trv.path: %s\n", trv.path); + // fprintf(stderr, "sqfs_inode_id: %lu\n", trv.entry.inode); + sqfs_inode inode; + if (sqfs_inode_get(&fs, &inode, trv.entry.inode)) { + fprintf(stderr, "sqfs_inode_get error\n"); + rv = false; + break; + } + // fprintf(stderr, "inode.base.inode_type: %i\n", inode.base.inode_type); + // fprintf(stderr, "inode.xtra.reg.file_size: %lu\n", inode.xtra.reg.file_size); + strcpy(prefixed_path_to_extract, ""); + strcat(strcat(prefixed_path_to_extract, prefix), trv.path); + + if (verbose) + fprintf(stdout, "%s\n", prefixed_path_to_extract); + + if (inode.base.inode_type == SQUASHFS_DIR_TYPE || inode.base.inode_type == SQUASHFS_LDIR_TYPE) { + // fprintf(stderr, "inode.xtra.dir.parent_inode: %ui\n", inode.xtra.dir.parent_inode); + // fprintf(stderr, "mkdir_p: %s/\n", prefixed_path_to_extract); + if (access(prefixed_path_to_extract, F_OK) == -1) { + if (mkdir_p(prefixed_path_to_extract) == -1) { + perror("mkdir_p error"); + rv = false; + break; + } + } + } else if (inode.base.inode_type == SQUASHFS_REG_TYPE || inode.base.inode_type == SQUASHFS_LREG_TYPE) { + // if we've already created this inode, then this is a hardlink + char* existing_path_for_inode = created_inode[inode.base.inode_number - 1]; + if (existing_path_for_inode != NULL) { + unlink(prefixed_path_to_extract); + if (link(existing_path_for_inode, prefixed_path_to_extract) == -1) { + fprintf(stderr, "Couldn't create hardlink from \"%s\" to \"%s\": %s\n", + prefixed_path_to_extract, existing_path_for_inode, strerror(errno)); + rv = false; + break; + } else { + continue; + } + } else { + struct stat st; + if (!overwrite && stat(prefixed_path_to_extract, &st) == 0 && st.st_size == inode.xtra.reg.file_size) { + fprintf(stderr, "File exists and file size matches, skipping\n"); + continue; + } + + // track the path we extract to for this inode, so that we can `link` if this inode is found again + created_inode[inode.base.inode_number - 1] = strdup(prefixed_path_to_extract); + // fprintf(stderr, "Extract to: %s\n", prefixed_path_to_extract); + if (private_sqfs_stat(&fs, &inode, &st) != 0) + die("private_sqfs_stat error"); + + // create parent dir + char* p = strrchr(prefixed_path_to_extract, '/'); + if (p) { + // set an \0 to end the split the string + *p = '\0'; + mkdir_p(prefixed_path_to_extract); + + // restore dir seprator + *p = '/'; + } + + // Read the file in chunks + off_t bytes_already_read = 0; + sqfs_off_t bytes_at_a_time = 64 * 1024; + FILE* f; + f = fopen(prefixed_path_to_extract, "w+"); + if (f == NULL) { + perror("fopen error"); + rv = false; + break; + } + while (bytes_already_read < inode.xtra.reg.file_size) { + char buf[bytes_at_a_time]; + if (sqfs_read_range(&fs, &inode, (sqfs_off_t) bytes_already_read, &bytes_at_a_time, buf)) { + perror("sqfs_read_range error"); + rv = false; + break; + } + // fwrite(buf, 1, bytes_at_a_time, stdout); + fwrite(buf, 1, bytes_at_a_time, f); + bytes_already_read = bytes_already_read + bytes_at_a_time; + } + fclose(f); + chmod(prefixed_path_to_extract, st.st_mode); + if (!rv) + break; + } + } else if (inode.base.inode_type == SQUASHFS_SYMLINK_TYPE || inode.base.inode_type == SQUASHFS_LSYMLINK_TYPE) { + size_t size; + sqfs_readlink(&fs, &inode, NULL, &size); + char buf[size]; + int ret = sqfs_readlink(&fs, &inode, buf, &size); + if (ret != 0) { + perror("symlink error"); + rv = false; + break; + } + // fprintf(stderr, "Symlink: %s to %s \n", prefixed_path_to_extract, buf); + unlink(prefixed_path_to_extract); + ret = symlink(buf, prefixed_path_to_extract); + if (ret != 0) + fprintf(stderr, "WARNING: could not create symlink\n"); + } else { + fprintf(stderr, "TODO: Implement inode.base.inode_type %i\n", inode.base.inode_type); + } + // fprintf(stderr, "\n"); + + if (!rv) + break; + } + } + } + for (int i = 0; i < fs.sb.inodes; i++) { + free(created_inode[i]); + } + free(created_inode); + + if (err != SQFS_OK) { + fprintf(stderr, "sqfs_traverse_next error\n"); + rv = false; + } + sqfs_traverse_close(&trv); + sqfs_fd_close(fs.fd); + + return rv; +} + +int rm_recursive_callback(const char* path, const struct stat* stat, const int type, struct FTW* ftw) { + (void) stat; + (void) ftw; + + switch (type) { + case FTW_NS: + case FTW_DNR: + fprintf(stderr, "%s: ftw error: %s\n", + path, strerror(errno)); + return 1; + + case FTW_D: + // ignore directories at first, will be handled by FTW_DP + break; + + case FTW_F: + case FTW_SL: + case FTW_SLN: + if (remove(path) != 0) { + fprintf(stderr, "Failed to remove %s: %s\n", path, strerror(errno)); + return false; + } + break; + + + case FTW_DP: + if (rmdir(path) != 0) { + fprintf(stderr, "Failed to remove directory %s: %s\n", path, strerror(errno)); + return false; + } + break; + + default: + fprintf(stderr, "Unexpected fts_info\n"); + return 1; + } + + return 0; +}; + +bool rm_recursive(const char* const path) { + // FTW_DEPTH: perform depth-first search to make sure files are deleted before the containing directories + // FTW_MOUNT: prevent deletion of files on other mounted filesystems + // FTW_PHYS: do not follow symlinks, but report symlinks as such; this way, the symlink targets, which might point + // to locations outside path will not be deleted accidentally (attackers might abuse this) + int rv = nftw(path, &rm_recursive_callback, 0, FTW_DEPTH | FTW_MOUNT | FTW_PHYS); + + return rv == 0; +} + +bool build_mount_point(char* mount_dir, const char* const argv0, char const* const temp_base, const size_t templen) { + const size_t maxnamelen = 6; + + // when running for another AppImage, we should use that for building the mountpoint name instead + char* target_appimage = getenv("TARGET_APPIMAGE"); + + char* path_basename; + if (target_appimage != NULL) { + path_basename = basename(target_appimage); + } else { + path_basename = basename(argv0); + } + + size_t namelen = strlen(path_basename); + // limit length of tempdir name + if (namelen > maxnamelen) { + namelen = maxnamelen; + } + + strcpy(mount_dir, temp_base); + strncpy(mount_dir + templen, "/.mount_", 8); + strncpy(mount_dir + templen + 8, path_basename, namelen); + strncpy(mount_dir+templen+8+namelen, "XXXXXX", 6); + mount_dir[templen+8+namelen+6] = 0; // null terminate destination +} + +int main(int argc, char *argv[]) { + char appimage_path[PATH_MAX]; + char argv0_path[PATH_MAX]; + char * arg; + + /* We might want to operate on a target appimage rather than this file itself, + * e.g., for appimaged which must not run untrusted code from random AppImages. + * This variable is intended for use by e.g., appimaged and is subject to + * change any time. Do not rely on it being present. We might even limit this + * functionality specifically for builds used by appimaged. + */ + if (getenv("TARGET_APPIMAGE") == NULL) { + strcpy(appimage_path, "/proc/self/exe"); + strcpy(argv0_path, argv[0]); + } else { + strcpy(appimage_path, getenv("TARGET_APPIMAGE")); + strcpy(argv0_path, getenv("TARGET_APPIMAGE")); + +#ifdef ENABLE_SETPROCTITLE + // load libbsd dynamically to change proc title + // this is an optional feature, therefore we don't hard require it + void* libbsd = dlopen("libbsd.so", RTLD_NOW); + + if (libbsd != NULL) { + // clear error state + dlerror(); + + // try to load the two required symbols + void (*setproctitle_init)(int, char**, char**) = dlsym(libbsd, "setproctitle_init"); + + char* error; + + if ((error = dlerror()) == NULL) { + void (*setproctitle)(const char*, char*) = dlsym(libbsd, "setproctitle"); + + if (dlerror() == NULL) { + char buffer[1024]; + strcpy(buffer, getenv("TARGET_APPIMAGE")); + for (int i = 1; i < argc; i++) { + strcat(buffer, " "); + strcat(buffer, argv[i]); + } + + (*setproctitle_init)(argc, argv, environ); + (*setproctitle)("%s", buffer); + } + } + + dlclose(libbsd); + } +#endif + } + + // temporary directories are required in a few places + // therefore we implement the detection of the temp base dir at the top of the code to avoid redundancy + char temp_base[PATH_MAX] = P_tmpdir; + + { + const char* const TMPDIR = getenv("TMPDIR"); + if (TMPDIR != NULL) + strcpy(temp_base, getenv("TMPDIR")); + } + + fs_offset = appimage_get_elf_size(appimage_path); + + // error check + if (fs_offset < 0) { + fprintf(stderr, "Failed to get fs offset for %s\n", appimage_path); + exit(EXIT_EXECERROR); + } + + arg=getArg(argc,argv,'-'); + + /* Print the help and then exit */ + if(arg && strcmp(arg,"appimage-help")==0) { + char fullpath[PATH_MAX]; + + ssize_t length = readlink(appimage_path, fullpath, sizeof(fullpath)); + if (length < 0) { + fprintf(stderr, "Error getting realpath for %s\n", appimage_path); + exit(EXIT_EXECERROR); + } + fullpath[length] = '\0'; + + print_help(fullpath); + exit(0); + } + + /* Just print the offset and then exit */ + if(arg && strcmp(arg,"appimage-offset")==0) { + printf("%lu\n", fs_offset); + exit(0); + } + + arg=getArg(argc,argv,'-'); + + /* extract the AppImage */ + if(arg && strcmp(arg,"appimage-extract")==0) { + char* pattern; + + // default use case: use standard prefix + if (argc == 2) { + pattern = NULL; + } else if (argc == 3) { + pattern = argv[2]; + } else { + fprintf(stderr, "Unexpected argument count: %d\n", argc - 1); + fprintf(stderr, "Usage: %s --appimage-extract []\n", argv0_path); + exit(1); + } + + if (!extract_appimage(appimage_path, "squashfs-root/", pattern, true, true)) { + exit(1); + } + + exit(0); + } + + // calculate full path of AppImage + int length; + char fullpath[PATH_MAX]; + + if(getenv("TARGET_APPIMAGE") == NULL) { + // If we are operating on this file itself + ssize_t len = readlink(appimage_path, fullpath, sizeof(fullpath)); + if (len < 0) { + perror("Failed to obtain absolute path"); + exit(EXIT_EXECERROR); + } + fullpath[len] = '\0'; + } else { + char* abspath = realpath(appimage_path, NULL); + if (abspath == NULL) { + perror("Failed to obtain absolute path"); + exit(EXIT_EXECERROR); + } + strcpy(fullpath, abspath); + free(abspath); + } + + if (getenv("APPIMAGE_EXTRACT_AND_RUN") != NULL || (arg && strcmp(arg, "appimage-extract-and-run") == 0)) { + char* hexlified_digest = NULL; + + // calculate MD5 hash of file, and use it to make extracted directory name "content-aware" + // see https://github.com/AppImage/AppImageKit/issues/841 for more information + { + FILE* f = fopen(appimage_path, "rb"); + if (f == NULL) { + perror("Failed to open AppImage file"); + exit(EXIT_EXECERROR); + } + + Md5Context ctx; + Md5Initialise(&ctx); + + char buf[4096]; + for (size_t bytes_read; (bytes_read = fread(buf, sizeof(char), sizeof(buf), f)); bytes_read > 0) { + Md5Update(&ctx, buf, (uint32_t) bytes_read); + } + + MD5_HASH digest; + Md5Finalise(&ctx, &digest); + + hexlified_digest = appimage_hexlify(digest.bytes, sizeof(digest.bytes)); + } + + char* prefix = malloc(strlen(temp_base) + 20 + strlen(hexlified_digest) + 2); + strcpy(prefix, temp_base); + strcat(prefix, "/appimage_extracted_"); + strcat(prefix, hexlified_digest); + free(hexlified_digest); + + const bool verbose = (getenv("VERBOSE") != NULL); + + if (!extract_appimage(appimage_path, prefix, NULL, false, verbose)) { + fprintf(stderr, "Failed to extract AppImage\n"); + exit(EXIT_EXECERROR); + } + + int pid; + if ((pid = fork()) == -1) { + int error = errno; + fprintf(stderr, "fork() failed: %s\n", strerror(error)); + exit(EXIT_EXECERROR); + } else if (pid == 0) { + const char apprun_fname[] = "AppRun"; + char* apprun_path = malloc(strlen(prefix) + 1 + strlen(apprun_fname) + 1); + strcpy(apprun_path, prefix); + strcat(apprun_path, "/"); + strcat(apprun_path, apprun_fname); + + // create copy of argument list without the --appimage-extract-and-run parameter + char* new_argv[argc]; + int new_argc = 0; + new_argv[new_argc++] = strdup(apprun_path); + for (int i = 1; i < argc; ++i) { + if (strcmp(argv[i], "--appimage-extract-and-run") != 0) { + new_argv[new_argc++] = strdup(argv[i]); + } + } + new_argv[new_argc] = NULL; + + /* Setting some environment variables that the app "inside" might use */ + setenv("APPIMAGE", fullpath, 1); + setenv("ARGV0", argv0_path, 1); + setenv("APPDIR", prefix, 1); + + execv(apprun_path, new_argv); + + int error = errno; + fprintf(stderr, "Failed to run %s: %s\n", apprun_path, strerror(error)); + + free(apprun_path); + exit(EXIT_EXECERROR); + } + + int status = 0; + int rv = waitpid(pid, &status, 0); + status = rv > 0 && WIFEXITED (status) ? WEXITSTATUS (status) : EXIT_EXECERROR; + + if (getenv("NO_CLEANUP") == NULL) { + if (!rm_recursive(prefix)) { + fprintf(stderr, "Failed to clean up cache directory\n"); + if (status == 0) /* avoid messing existing failure exit status */ + status = EXIT_EXECERROR; + } + } + + // template == prefix, must be freed only once + free(prefix); + + exit(status); + } + + if(arg && (strcmp(arg,"appimage-updateinformation")==0 || strcmp(arg,"appimage-updateinfo")==0)) { + unsigned long offset = 0; + unsigned long length = 0; + appimage_get_elf_section_offset_and_length(appimage_path, ".upd_info", &offset, &length); + // fprintf(stderr, "offset: %lu\n", offset); + // fprintf(stderr, "length: %lu\n", length); + // print_hex(appimage_path, offset, length); + appimage_print_binary(appimage_path, offset, length); + exit(0); + } + + if(arg && strcmp(arg,"appimage-signature")==0) { + unsigned long offset = 0; + unsigned long length = 0; + appimage_get_elf_section_offset_and_length(appimage_path, ".sha256_sig", &offset, &length); + // fprintf(stderr, "offset: %lu\n", offset); + // fprintf(stderr, "length: %lu\n", length); + // print_hex(appimage_path, offset, length); + appimage_print_binary(appimage_path, offset, length); + exit(0); + } + + portable_option(arg, appimage_path, "home"); + portable_option(arg, appimage_path, "config"); + + // If there is an argument starting with appimage- (but not appimage-mount which is handled further down) + // then stop here and print an error message + if((arg && strncmp(arg, "appimage-", 8) == 0) && (arg && strcmp(arg,"appimage-mount")!=0)) { + fprintf(stderr,"--%s is not yet implemented\n", arg); + exit(1); + } + + LOAD_LIBRARY; /* exit if libfuse is missing */ + + int dir_fd, res; + + size_t templen = strlen(temp_base); + + // allocate enough memory (size of name won't exceed 60 bytes) + char mount_dir[templen + 60]; + + build_mount_point(mount_dir, argv[0], temp_base, templen); + + size_t mount_dir_size = strlen(mount_dir); + pid_t pid; + char **real_argv; + int i; + + if (mkdtemp(mount_dir) == NULL) { + perror ("create mount dir error"); + exit (EXIT_EXECERROR); + } + + if (pipe (keepalive_pipe) == -1) { + perror ("pipe error"); + exit (EXIT_EXECERROR); + } + + pid = fork (); + if (pid == -1) { + perror ("fork error"); + exit (EXIT_EXECERROR); + } + + if (pid == 0) { + /* in child */ + + char *child_argv[5]; + + /* close read pipe */ + close (keepalive_pipe[0]); + + char *dir = realpath(appimage_path, NULL ); + + char options[100]; + sprintf(options, "ro,offset=%lu", fs_offset); + + child_argv[0] = dir; + child_argv[1] = "-o"; + child_argv[2] = options; + child_argv[3] = dir; + child_argv[4] = mount_dir; + + if(0 != fusefs_main (5, child_argv, fuse_mounted)){ + char *title; + char *body; + title = "Cannot mount AppImage, please check your FUSE setup."; + body = "You might still be able to extract the contents of this AppImage \n" + "if you run it with the --appimage-extract option. \n" + "See https://github.com/AppImage/AppImageKit/wiki/FUSE \n" + "for more information"; + notify(title, body, 0); // 3 seconds timeout + }; + } else { + /* in parent, child is $pid */ + int c; + + /* close write pipe */ + close (keepalive_pipe[1]); + + /* Pause until mounted */ + read (keepalive_pipe[0], &c, 1); + + /* Fuse process has now daemonized, reap our child */ + waitpid(pid, NULL, 0); + + dir_fd = open (mount_dir, O_RDONLY); + if (dir_fd == -1) { + perror ("open dir error"); + exit (EXIT_EXECERROR); + } + + res = dup2 (dir_fd, 1023); + if (res == -1) { + perror ("dup2 error"); + exit (EXIT_EXECERROR); + } + close (dir_fd); + + real_argv = malloc (sizeof (char *) * (argc + 1)); + for (i = 0; i < argc; i++) { + real_argv[i] = argv[i]; + } + real_argv[i] = NULL; + + if(arg && strcmp(arg, "appimage-mount") == 0) { + char real_mount_dir[PATH_MAX]; + + if (realpath(mount_dir, real_mount_dir) == real_mount_dir) { + printf("%s\n", real_mount_dir); + } else { + printf("%s\n", mount_dir); + } + + // stdout is, by default, buffered (unlike stderr), therefore in order to allow other processes to read + // the path from stdout, we need to flush the buffers now + // this is a less-invasive alternative to setbuf(stdout, NULL); + fflush(stdout); + + for (;;) pause(); + + exit(0); + } + + /* Setting some environment variables that the app "inside" might use */ + setenv( "APPIMAGE", fullpath, 1 ); + setenv( "ARGV0", argv0_path, 1 ); + setenv( "APPDIR", mount_dir, 1 ); + + char portable_home_dir[PATH_MAX]; + char portable_config_dir[PATH_MAX]; + + /* If there is a directory with the same name as the AppImage plus ".home", then export $HOME */ + strcpy (portable_home_dir, fullpath); + strcat (portable_home_dir, ".home"); + if(is_writable_directory(portable_home_dir)){ + fprintf(stderr, "Setting $HOME to %s\n", portable_home_dir); + setenv("HOME",portable_home_dir,1); + } + + /* If there is a directory with the same name as the AppImage plus ".config", then export $XDG_CONFIG_HOME */ + strcpy (portable_config_dir, fullpath); + strcat (portable_config_dir, ".config"); + if(is_writable_directory(portable_config_dir)){ + fprintf(stderr, "Setting $XDG_CONFIG_HOME to %s\n", portable_config_dir); + setenv("XDG_CONFIG_HOME",portable_config_dir,1); + } + + /* Original working directory */ + char cwd[1024]; + if (getcwd(cwd, sizeof(cwd)) != NULL) { + setenv( "OWD", cwd, 1 ); + } + + char filename[mount_dir_size + 8]; /* enough for mount_dir + "/AppRun" */ + strcpy (filename, mount_dir); + strcat (filename, "/AppRun"); + + /* TODO: Find a way to get the exit status and/or output of this */ + execv (filename, real_argv); + /* Error if we continue here */ + perror("execv error"); + exit(EXIT_EXECERROR); + } + + return 0; +} diff --git a/contrib/depends/patches/libappimage/no-unneeded-deps.patch b/contrib/depends/patches/libappimage/no-unneeded-deps.patch new file mode 100644 index 0000000..e388b7f --- /dev/null +++ b/contrib/depends/patches/libappimage/no-unneeded-deps.patch @@ -0,0 +1,163 @@ +From b7875398d91821a49b7b0233950a3e687257c790 Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Mon, 7 Nov 2022 11:30:46 +0100 +Subject: [PATCH] no unneeded deps + +--- + cmake/dependencies.cmake | 78 +++++++++++++++---------------- + cmake/imported_dependencies.cmake | 10 ++-- + cmake/tools.cmake | 3 -- + src/CMakeLists.txt | 12 ++--- + 4 files changed, 50 insertions(+), 53 deletions(-) + +diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake +index 7c65e85..5bf5e51 100644 +--- a/cmake/dependencies.cmake ++++ b/cmake/dependencies.cmake +@@ -55,45 +55,45 @@ endif() + # for distro packaging, it can be linked to an existing package just fine + set(USE_SYSTEM_SQUASHFUSE OFF CACHE BOOL "Use system libsquashfuse instead of building our own") + +-if(NOT USE_SYSTEM_SQUASHFUSE) +- message(STATUS "Downloading and building squashfuse") +- +- # TODO: implement out-of-source builds for squashfuse, as for the other dependencies +- configure_file( +- ${CMAKE_CURRENT_SOURCE_DIR}/src/patches/patch-squashfuse.sh.in +- ${CMAKE_CURRENT_BINARY_DIR}/patch-squashfuse.sh +- @ONLY +- ) +- +- ExternalProject_Add(squashfuse-EXTERNAL +- GIT_REPOSITORY https://github.com/vasi/squashfuse/ +- GIT_TAG 1f98030 +- UPDATE_COMMAND "" # make sure CMake won't try to fetch updates unnecessarily and hence rebuild the dependency every time +- PATCH_COMMAND bash -xe ${CMAKE_CURRENT_BINARY_DIR}/patch-squashfuse.sh +- CONFIGURE_COMMAND ${LIBTOOLIZE} --force +- # for some reason, a first run may fail, but it seems just running it a second time fixes the issues +- COMMAND env PKG_CONFIG_PATH=${xz_LIBRARY_DIRS}/pkgconfig ./autogen.sh || true +- COMMAND env PKG_CONFIG_PATH=${xz_LIBRARY_DIRS}/pkgconfig ./autogen.sh +- COMMAND ${SED} -i "/PKG_CHECK_MODULES.*/,/,:./d" configure # https://github.com/vasi/squashfuse/issues/12 +- COMMAND ${SED} -i "s/typedef off_t sqfs_off_t/typedef int64_t sqfs_off_t/g" common.h # off_t's size might differ, see https://stackoverflow.com/a/9073762 +- COMMAND CC=${CC} CXX=${CXX} CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} /configure --disable-demo --disable-high-level --without-lzo --without-lz4 --prefix= --libdir=/lib --with-xz=${xz_PREFIX} ${EXTRA_CONFIGURE_FLAGS} +- COMMAND ${SED} -i "s|XZ_LIBS = -llzma |XZ_LIBS = -Bstatic ${xz_LIBRARIES}/|g" Makefile +- BUILD_COMMAND ${MAKE} +- BUILD_IN_SOURCE ON +- INSTALL_COMMAND ${MAKE} install +- ) +- +- import_external_project( +- TARGET_NAME libsquashfuse +- EXT_PROJECT_NAME squashfuse-EXTERNAL +- LIBRARIES "/.libs/libsquashfuse.a;/.libs/libsquashfuse_ll.a;/.libs/libfuseprivate.a" +- INCLUDE_DIRS "" +- ) +-else() +- message(STATUS "Using system squashfuse") +- +- import_pkgconfig_target(TARGET_NAME libsquashfuse PKGCONFIG_TARGET squashfuse) +-endif() ++#if(NOT USE_SYSTEM_SQUASHFUSE) ++# message(STATUS "Downloading and building squashfuse") ++# ++# # TODO: implement out-of-source builds for squashfuse, as for the other dependencies ++# configure_file( ++# ${CMAKE_CURRENT_SOURCE_DIR}/src/patches/patch-squashfuse.sh.in ++# ${CMAKE_CURRENT_BINARY_DIR}/patch-squashfuse.sh ++# @ONLY ++# ) ++# ++# ExternalProject_Add(squashfuse-EXTERNAL ++# GIT_REPOSITORY https://github.com/vasi/squashfuse/ ++# GIT_TAG 1f98030 ++# UPDATE_COMMAND "" # make sure CMake won't try to fetch updates unnecessarily and hence rebuild the dependency every time ++# PATCH_COMMAND bash -xe ${CMAKE_CURRENT_BINARY_DIR}/patch-squashfuse.sh ++# CONFIGURE_COMMAND ${LIBTOOLIZE} --force ++# # for some reason, a first run may fail, but it seems just running it a second time fixes the issues ++# COMMAND env PKG_CONFIG_PATH=${xz_LIBRARY_DIRS}/pkgconfig ./autogen.sh || true ++# COMMAND env PKG_CONFIG_PATH=${xz_LIBRARY_DIRS}/pkgconfig ./autogen.sh ++# COMMAND ${SED} -i "/PKG_CHECK_MODULES.*/,/,:./d" configure # https://github.com/vasi/squashfuse/issues/12 ++# COMMAND ${SED} -i "s/typedef off_t sqfs_off_t/typedef int64_t sqfs_off_t/g" common.h # off_t's size might differ, see https://stackoverflow.com/a/9073762 ++# COMMAND CC=${CC} CXX=${CXX} CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} /configure --disable-demo --disable-high-level --without-lzo --without-lz4 --prefix= --libdir=/lib --with-xz=${xz_PREFIX} ${EXTRA_CONFIGURE_FLAGS} ++# COMMAND ${SED} -i "s|XZ_LIBS = -llzma |XZ_LIBS = -Bstatic ${xz_LIBRARIES}/|g" Makefile ++# BUILD_COMMAND ${MAKE} ++# BUILD_IN_SOURCE ON ++# INSTALL_COMMAND ${MAKE} install ++# ) ++# ++# import_external_project( ++# TARGET_NAME libsquashfuse ++# EXT_PROJECT_NAME squashfuse-EXTERNAL ++# LIBRARIES "/.libs/libsquashfuse.a;/.libs/libsquashfuse_ll.a;/.libs/libfuseprivate.a" ++# INCLUDE_DIRS "" ++# ) ++#else() ++# message(STATUS "Using system squashfuse") ++# ++# import_pkgconfig_target(TARGET_NAME libsquashfuse PKGCONFIG_TARGET squashfuse) ++#endif() + + + set(USE_SYSTEM_LIBARCHIVE OFF CACHE BOOL "Use system libarchive instead of building our own") +diff --git a/cmake/imported_dependencies.cmake b/cmake/imported_dependencies.cmake +index 56d7fc0..2a709c9 100644 +--- a/cmake/imported_dependencies.cmake ++++ b/cmake/imported_dependencies.cmake +@@ -3,8 +3,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/scripts.cmake) + # the names of the targets need to differ from the library filenames + # this is especially an issue with libcairo, where the library is called libcairo + # therefore, all libs imported this way have been prefixed with lib +-import_pkgconfig_target(TARGET_NAME libglib PKGCONFIG_TARGET glib-2.0>=2.40) +-import_pkgconfig_target(TARGET_NAME libgobject PKGCONFIG_TARGET gobject-2.0>=2.40) +-import_pkgconfig_target(TARGET_NAME libgio PKGCONFIG_TARGET gio-2.0>=2.40) +-import_pkgconfig_target(TARGET_NAME libzlib PKGCONFIG_TARGET zlib) +-import_pkgconfig_target(TARGET_NAME libcairo PKGCONFIG_TARGET cairo) ++#import_pkgconfig_target(TARGET_NAME libglib PKGCONFIG_TARGET glib-2.0>=2.40) ++#import_pkgconfig_target(TARGET_NAME libgobject PKGCONFIG_TARGET gobject-2.0>=2.40) ++#import_pkgconfig_target(TARGET_NAME libgio PKGCONFIG_TARGET gio-2.0>=2.40) ++#import_pkgconfig_target(TARGET_NAME libzlib PKGCONFIG_TARGET zlib) ++#import_pkgconfig_target(TARGET_NAME libcairo PKGCONFIG_TARGET cairo) +diff --git a/cmake/tools.cmake b/cmake/tools.cmake +index d0941bb..c93b6b3 100644 +--- a/cmake/tools.cmake ++++ b/cmake/tools.cmake +@@ -50,9 +50,6 @@ check_program(NAME autoreconf) + check_program(NAME libtoolize) + check_program(NAME patch) + check_program(NAME sed) +-check_program(NAME wget) +-check_program(NAME xxd) +-check_program(NAME desktop-file-validate) + check_program(NAME objcopy FORCE_PREFIX) + check_program(NAME objdump FORCE_PREFIX) + check_program(NAME readelf FORCE_PREFIX) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 664bf2a..081523b 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -3,16 +3,16 @@ cmake_minimum_required(VERSION 3.6) + + find_package(PkgConfig) + +-pkg_check_modules(glib glib-2.0>=2.40 IMPORTED_TARGET) +-pkg_check_modules(gobject gobject-2.0>=2.40 IMPORTED_TARGET) +-pkg_check_modules(gio gio-2.0>=2.40 IMPORTED_TARGET) +-pkg_check_modules(zlib zlib IMPORTED_TARGET) +-pkg_check_modules(cairo cairo IMPORTED_TARGET) ++#pkg_check_modules(glib glib-2.0>=2.40 IMPORTED_TARGET) ++#pkg_check_modules(gobject gobject-2.0>=2.40 IMPORTED_TARGET) ++#pkg_check_modules(gio gio-2.0>=2.40 IMPORTED_TARGET) ++#pkg_check_modules(zlib zlib IMPORTED_TARGET) ++#pkg_check_modules(cairo cairo IMPORTED_TARGET) + + add_subdirectory(xdg-basedir) + add_subdirectory(libappimage_hashlib) + add_subdirectory(libappimage_shared) +-add_subdirectory(libappimage) ++#add_subdirectory(libappimage) + + # Export the package for use from the build-tree + # (this registers the build-tree with a global CMake-registry) +-- +2.38.1 + diff --git a/contrib/depends/patches/libsquashfuse/squashfuse.patch b/contrib/depends/patches/libsquashfuse/squashfuse.patch new file mode 100644 index 0000000..db94d2f --- /dev/null +++ b/contrib/depends/patches/libsquashfuse/squashfuse.patch @@ -0,0 +1,57 @@ +diff --git a/Makefile.am b/Makefile.am +index f0d7cde..70c4aa0 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -14,6 +14,7 @@ bin_PROGRAMS = + noinst_PROGRAMS = + + noinst_LTLIBRARIES = libsquashfuse.la ++noinst_LTLIBRARIES += libsquashfuse_ll.la + + # Main library: libsquashfuse + libsquashfuse_la_SOURCES = swap.c cache.c table.c dir.c file.c fs.c \ +@@ -46,10 +47,9 @@ endif + + # Low-level squashfuse_ll, if supported + if SQ_WANT_LOWLEVEL +-bin_PROGRAMS += squashfuse_ll +-squashfuse_ll_SOURCES = ll.c ll_inode.c nonstd-daemon.c ll.h +-squashfuse_ll_CPPFLAGS = $(FUSE_CPPFLAGS) +-squashfuse_ll_LDADD = libsquashfuse.la libfuseprivate.la $(COMPRESSION_LIBS) \ ++libsquashfuse_ll_la_SOURCES = ll.c ll_inode.c nonstd-daemon.c ll.h ++libsquashfuse_ll_la_CPPFLAGS = $(FUSE_CPPFLAGS) ++libsquashfuse_ll_la_LIBADD = libsquashfuse.la libfuseprivate.la $(COMPRESSION_LIBS) \ + $(FUSE_LIBS) + + noinst_LTLIBRARIES += libfuseprivate.la +diff --git a/ll.c b/ll.c +index a2c7902..8fcb3f4 100644 +--- a/ll.c ++++ b/ll.c +@@ -390,7 +390,7 @@ static sqfs_ll *sqfs_ll_open(const char *path, size_t offset) { + return NULL; + } + +-int main(int argc, char *argv[]) { ++int fusefs_main(int argc, char *argv[], void (*mounted) (void)) { + struct fuse_args args; + sqfs_opts opts; + +@@ -451,6 +451,8 @@ int main(int argc, char *argv[]) { + if (sqfs_ll_daemonize(fg) != -1) { + if (fuse_set_signal_handlers(se) != -1) { + fuse_session_add_chan(se, ch.ch); ++ if (mounted) ++ mounted (); + /* FIXME: multithreading */ + err = fuse_session_loop(se); + fuse_remove_signal_handlers(se); +@@ -466,6 +468,8 @@ int main(int argc, char *argv[]) { + } + } + fuse_opt_free_args(&args); ++ if (mounted) ++ rmdir (mountpoint); + free(ll); + free(mountpoint); + diff --git a/contrib/depends/patches/libsquashfuse/squashfuse_dlopen.c b/contrib/depends/patches/libsquashfuse/squashfuse_dlopen.c new file mode 100644 index 0000000..e4a9d6a --- /dev/null +++ b/contrib/depends/patches/libsquashfuse/squashfuse_dlopen.c @@ -0,0 +1,11 @@ +#include "squashfuse_dlopen.h" + +int have_libloaded = 0; + +const char *load_library_errmsg = + "AppImages require FUSE to run. \n" + "You might still be able to extract the contents of this AppImage \n" + "if you run it with the --appimage-extract option. \n" + "See https://github.com/AppImage/AppImageKit/wiki/FUSE \n" + "for more information\n"; + diff --git a/contrib/depends/patches/libsquashfuse/squashfuse_dlopen.h b/contrib/depends/patches/libsquashfuse/squashfuse_dlopen.h new file mode 100644 index 0000000..da3c34f --- /dev/null +++ b/contrib/depends/patches/libsquashfuse/squashfuse_dlopen.h @@ -0,0 +1,262 @@ +#ifndef SQFS_DLOPEN_H +#define SQFS_DLOPEN_H + +//#define ENABLE_DLOPEN + +#ifdef ENABLE_DLOPEN + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/*** dlopen() stuff ***/ + +#define LIBNAME "libfuse.so.2" + +void *libhandle; +int have_libloaded; +const char *load_library_errmsg; + +#define LOAD_LIBRARY \ +if (have_libloaded != 1) { \ + if (!(libhandle = dlopen(LIBNAME, RTLD_LAZY))) { \ + fprintf(stderr, "dlopen(): error loading " LIBNAME "\n\n%s", load_library_errmsg ); \ + exit(1); \ + } else { \ + have_libloaded = 1; \ + } \ +} + +#define STRINGIFY(x) #x + +#define LOAD_SYMBOL(type,x,param) \ +type (*dl_##x) param; \ +*(void **) (&dl_##x) = dlsym(libhandle, STRINGIFY(x)); \ +if (dlerror()) { \ + fprintf(stderr, "dlsym(): error loading symbol from " LIBNAME "\n\n%s", load_library_errmsg ); \ + CLOSE_LIBRARY; \ + exit(1); \ +} + +#define DL(x) dl_##x +#define CLOSE_LIBRARY dlclose(libhandle); + + +/*** libfuse stuff ***/ + +#define FUSE_ROOT_ID 1 +#define FUSE_ARGS_INIT(argc, argv) { argc, argv, 0 } +#define FUSE_OPT_KEY(templ, key) { templ, -1U, key } +#define FUSE_OPT_KEY_OPT -1 +#define FUSE_OPT_KEY_NONOPT -2 +#define FUSE_OPT_END { NULL, 0, 0 } + +enum fuse_buf_flags { + FUSE_BUF_IS_FD = (1 << 1), + FUSE_BUF_FD_SEEK = (1 << 2), + FUSE_BUF_FD_RETRY = (1 << 3), +}; + +typedef unsigned long fuse_ino_t; +typedef struct fuse_req *fuse_req_t; + +struct fuse_chan; +struct fuse_pollhandle; + +struct fuse_args { + int argc; + char **argv; + int allocated; +}; + +typedef int (*fuse_fill_dir_t) (void *buf, const char *name, const struct stat *stbuf, off_t off); +typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key, struct fuse_args *outargs); +typedef struct fuse_dirhandle *fuse_dirh_t; +typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type, ino_t ino); + +struct fuse_file_info { + int flags; + unsigned long fh_old; + int writepage; + unsigned int direct_io : 1; + unsigned int keep_cache : 1; + unsigned int flush : 1; + unsigned int nonseekable : 1; + unsigned int flock_release : 1; + unsigned int padding : 27; + uint64_t fh; + uint64_t lock_owner; +}; + +struct fuse_entry_param { + fuse_ino_t ino; + unsigned long generation; + struct stat attr; + double attr_timeout; + double entry_timeout; +}; + +struct fuse_opt { + const char *templ; + unsigned long offset; + int value; +}; + +struct fuse_forget_data { + uint64_t ino; + uint64_t nlookup; +}; + +struct fuse_conn_info { + unsigned proto_major; + unsigned proto_minor; + unsigned async_read; + unsigned max_write; + unsigned max_readahead; + unsigned capable; + unsigned want; + unsigned max_background; + unsigned congestion_threshold; + unsigned reserved[23]; +}; + +struct fuse_buf { + size_t size; + enum fuse_buf_flags flags; + void *mem; + int fd; + off_t pos; +}; + +struct fuse_bufvec { + size_t count; + size_t idx; + size_t off; + struct fuse_buf buf[1]; +}; + +struct fuse_context { + struct fuse *fuse; + uid_t uid; + gid_t gid; + pid_t pid; + void *private_data; + mode_t umask; +}; + +struct fuse_operations { + int (*getattr) (const char *, struct stat *); + int (*readlink) (const char *, char *, size_t); + int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t); + int (*mknod) (const char *, mode_t, dev_t); + int (*mkdir) (const char *, mode_t); + int (*unlink) (const char *); + int (*rmdir) (const char *); + int (*symlink) (const char *, const char *); + int (*rename) (const char *, const char *); + int (*link) (const char *, const char *); + int (*chmod) (const char *, mode_t); + int (*chown) (const char *, uid_t, gid_t); + int (*truncate) (const char *, off_t); + int (*utime) (const char *, struct utimbuf *); + int (*open) (const char *, struct fuse_file_info *); + int (*read) (const char *, char *, size_t, off_t, struct fuse_file_info *); + int (*write) (const char *, const char *, size_t, off_t, struct fuse_file_info *); + int (*statfs) (const char *, struct statvfs *); + int (*flush) (const char *, struct fuse_file_info *); + int (*release) (const char *, struct fuse_file_info *); + int (*fsync) (const char *, int, struct fuse_file_info *); + int (*setxattr) (const char *, const char *, const char *, size_t, int); + int (*getxattr) (const char *, const char *, char *, size_t); + int (*listxattr) (const char *, char *, size_t); + int (*removexattr) (const char *, const char *); + int (*opendir) (const char *, struct fuse_file_info *); + int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *); + int (*releasedir) (const char *, struct fuse_file_info *); + int (*fsyncdir) (const char *, int, struct fuse_file_info *); + void *(*init) (struct fuse_conn_info *conn); + void (*destroy) (void *); + int (*access) (const char *, int); + int (*create) (const char *, mode_t, struct fuse_file_info *); + int (*ftruncate) (const char *, off_t, struct fuse_file_info *); + int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *); + int (*lock) (const char *, struct fuse_file_info *, int cmd, struct flock *); + int (*utimens) (const char *, const struct timespec tv[2]); + int (*bmap) (const char *, size_t blocksize, uint64_t *idx); + unsigned int flag_nullpath_ok:1; + unsigned int flag_nopath:1; + unsigned int flag_utime_omit_ok:1; + unsigned int flag_reserved:29; + int (*ioctl) (const char *, int cmd, void *arg, struct fuse_file_info *, unsigned int flags, void *data); + int (*poll) (const char *, struct fuse_file_info *, struct fuse_pollhandle *ph, unsigned *reventsp); + int (*write_buf) (const char *, struct fuse_bufvec *buf, off_t off, struct fuse_file_info *); + int (*read_buf) (const char *, struct fuse_bufvec **bufp, size_t size, off_t off, struct fuse_file_info *); + int (*flock) (const char *, struct fuse_file_info *, int op); + int (*fallocate) (const char *, int, off_t, off_t, struct fuse_file_info *); +}; + +struct fuse_lowlevel_ops { + void (*init) (void *userdata, struct fuse_conn_info *conn); + void (*destroy) (void *userdata); + void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name); + void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup); + void (*getattr) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr, int to_set, struct fuse_file_info *fi); + void (*readlink) (fuse_req_t req, fuse_ino_t ino); + void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev_t rdev); + void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode); + void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name); + void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name); + void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent, const char *name); + void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name, fuse_ino_t newparent, const char *newname); + void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, const char *newname); + void (*open) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info *fi); + void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf, size_t size, off_t off, struct fuse_file_info *fi); + void (*flush) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*release) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync, struct fuse_file_info *fi); + void (*opendir) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info *fi); + void (*releasedir) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi); + void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync, struct fuse_file_info *fi); + void (*statfs) (fuse_req_t req, fuse_ino_t ino); + void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name, const char *value, size_t size, int flags); + void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name, size_t size); + void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size); + void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name); + void (*access) (fuse_req_t req, fuse_ino_t ino, int mask); + void (*create) (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, struct fuse_file_info *fi); + void (*getlk) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, struct flock *lock); + void (*setlk) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, struct flock *lock, int sleep); + void (*bmap) (fuse_req_t req, fuse_ino_t ino, size_t blocksize, uint64_t idx); + void (*ioctl) (fuse_req_t req, fuse_ino_t ino, int cmd, void *arg, struct fuse_file_info *fi, unsigned flags, const void *in_buf, size_t in_bufsz, size_t out_bufsz); + void (*poll) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, struct fuse_pollhandle *ph); + void (*write_buf) (fuse_req_t req, fuse_ino_t ino, struct fuse_bufvec *bufv, off_t off, struct fuse_file_info *fi); + void (*retrieve_reply) (fuse_req_t req, void *cookie, fuse_ino_t ino, off_t offset, struct fuse_bufvec *bufv); + void (*forget_multi) (fuse_req_t req, size_t count, struct fuse_forget_data *forgets); + void (*flock) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, int op); + void (*fallocate) (fuse_req_t req, fuse_ino_t ino, int mode, off_t offset, off_t length, struct fuse_file_info *fi); +}; + +#else /* !ENABLE_DLOPEN */ + +#define LOAD_LIBRARY +#define LOAD_SYMBOL(x) +#define DL(x) +#define CLOSE_LIBRARY + +#endif /* !ENABLE_DLOPEN */ + +#endif /* SQFS_DLOPEN_H */ + diff --git a/contrib/depends/patches/libsquashfuse/squashfuse_dlopen.patch b/contrib/depends/patches/libsquashfuse/squashfuse_dlopen.patch new file mode 100644 index 0000000..59e1e6e --- /dev/null +++ b/contrib/depends/patches/libsquashfuse/squashfuse_dlopen.patch @@ -0,0 +1,640 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,6 +1,7 @@ + COMPRESSION_LIBS = $(ZLIB_LIBS) $(XZ_LIBS) $(LZO_LIBS) $(LZ4_LIBS) + + ACLOCAL_AMFLAGS = -I m4 --install ++AM_CFLAGS = -fno-strict-aliasing -DENABLE_DLOPEN + + # Suppress AppleDouble + if MAKE_EXPORT +@@ -19,13 +20,13 @@ + # Main library: libsquashfuse + libsquashfuse_la_SOURCES = swap.c cache.c table.c dir.c file.c fs.c \ + decompress.c xattr.c hash.c stack.c traverse.c util.c \ +- nonstd-pread.c nonstd-stat.c \ ++ nonstd-pread.c nonstd-stat.c squashfuse_dlopen.c \ + squashfs_fs.h common.h nonstd-internal.h nonstd.h swap.h cache.h table.h \ + dir.h file.h decompress.h xattr.h squashfuse.h hash.h stack.h traverse.h \ +- util.h fs.h ++ util.h fs.h squashfuse_dlopen.h + libsquashfuse_la_CPPFLAGS = $(ZLIB_CPPFLAGS) $(XZ_CPPFLAGS) $(LZO_CPPFLAGS) \ + $(LZ4_CPPFLAGS) +-libsquashfuse_la_LIBADD = ++libsquashfuse_la_LIBADD = -ldl + + # Helper for FUSE clients: libfuseprivate + libfuseprivate_la_SOURCES = fuseprivate.c nonstd-makedev.c nonstd-enoattr.c \ +--- a/fuseprivate.c ++++ b/fuseprivate.c +@@ -94,15 +94,17 @@ + } + + void sqfs_usage(char *progname, bool fuse_usage) { ++ LOAD_SYMBOL(int,fuse_opt_add_arg,(struct fuse_args *args, const char *arg)); ++ LOAD_SYMBOL(int,fuse_parse_cmdline,(struct fuse_args *args, char **mountpoint, int *multithreaded, int *foreground)); + fprintf(stderr, "%s (c) 2012 Dave Vasilevsky\n\n", PACKAGE_STRING); + fprintf(stderr, "Usage: %s [options] ARCHIVE MOUNTPOINT\n", + progname ? progname : PACKAGE_NAME); + if (fuse_usage) { + struct fuse_args args = FUSE_ARGS_INIT(0, NULL); +- fuse_opt_add_arg(&args, ""); /* progname */ +- fuse_opt_add_arg(&args, "-ho"); ++ DL(fuse_opt_add_arg)(&args, ""); /* progname */ ++ DL(fuse_opt_add_arg)(&args, "-ho"); + fprintf(stderr, "\n"); +- fuse_parse_cmdline(&args, NULL, NULL, NULL); ++ DL(fuse_parse_cmdline)(&args, NULL, NULL, NULL); + } + exit(-2); + } +--- a/fuseprivate.h ++++ b/fuseprivate.h +@@ -27,7 +27,10 @@ + + #include "squashfuse.h" + +-#include ++#include "squashfuse_dlopen.h" ++#ifndef ENABLE_DLOPEN ++# include ++#endif + + #include + +--- a/hl.c ++++ b/hl.c +@@ -33,6 +33,7 @@ + #include + #include + ++int have_libloaded = 0; + + typedef struct sqfs_hl sqfs_hl; + struct sqfs_hl { +@@ -42,9 +43,10 @@ + + static sqfs_err sqfs_hl_lookup(sqfs **fs, sqfs_inode *inode, + const char *path) { ++ LOAD_SYMBOL(struct fuse_context *,fuse_get_context,(void)); + bool found; + +- sqfs_hl *hl = fuse_get_context()->private_data; ++ sqfs_hl *hl = DL(fuse_get_context)()->private_data; + *fs = &hl->fs; + if (inode) + *inode = hl->root; /* copy */ +@@ -67,7 +69,8 @@ + } + + static void *sqfs_hl_op_init(struct fuse_conn_info *conn) { +- return fuse_get_context()->private_data; ++ LOAD_SYMBOL(struct fuse_context *,fuse_get_context,(void)); ++ return DL(fuse_get_context)()->private_data; + } + + static int sqfs_hl_op_getattr(const char *path, struct stat *st) { +@@ -264,7 +267,16 @@ + return NULL; + } + ++#ifdef ENABLE_DLOPEN ++#define fuse_main(argc, argv, op, user_data) \ ++ DL(fuse_main_real)(argc, argv, op, sizeof(*(op)), user_data) ++#endif ++ + int main(int argc, char *argv[]) { ++ LOAD_SYMBOL(int,fuse_opt_parse,(struct fuse_args *args, void *data, const struct fuse_opt opts[], fuse_opt_proc_t proc)); ++ LOAD_SYMBOL(int,fuse_opt_add_arg,(struct fuse_args *args, const char *arg)); ++ LOAD_SYMBOL(int,fuse_main_real,(int argc, char *argv[], const struct fuse_operations *op, size_t op_size, void *user_data)); /* fuse_main */ ++ LOAD_SYMBOL(void,fuse_opt_free_args,(struct fuse_args *args)); + struct fuse_args args; + sqfs_opts opts; + sqfs_hl *hl; +@@ -299,7 +311,7 @@ + opts.image = NULL; + opts.mountpoint = 0; + opts.offset = 0; +- if (fuse_opt_parse(&args, &opts, fuse_opts, sqfs_opt_proc) == -1) ++ if (DL(fuse_opt_parse)(&args, &opts, fuse_opts, sqfs_opt_proc) == -1) + sqfs_usage(argv[0], true); + if (!opts.image) + sqfs_usage(argv[0], true); +@@ -308,8 +320,9 @@ + if (!hl) + return -1; + +- fuse_opt_add_arg(&args, "-s"); /* single threaded */ ++ DL(fuse_opt_add_arg)(&args, "-s"); /* single threaded */ + ret = fuse_main(args.argc, args.argv, &sqfs_hl_ops, hl); +- fuse_opt_free_args(&args); ++ DL(fuse_opt_free_args)(&args); ++ CLOSE_LIBRARY; + return ret; + } +--- a/ll.h ++++ b/ll.h +@@ -27,7 +27,10 @@ + + #include "squashfuse.h" + +-#include ++#include "squashfuse_dlopen.h" ++#ifndef ENABLE_DLOPEN ++# include ++#endif + + typedef struct sqfs_ll sqfs_ll; + struct sqfs_ll { +--- a/ll_inode.c ++++ b/ll_inode.c +@@ -348,12 +348,14 @@ + + + sqfs_err sqfs_ll_iget(fuse_req_t req, sqfs_ll_i *lli, fuse_ino_t i) { ++ LOAD_SYMBOL(void *,fuse_req_userdata,(fuse_req_t req)); ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); + sqfs_err err = SQFS_OK; +- lli->ll = fuse_req_userdata(req); ++ lli->ll = DL(fuse_req_userdata)(req); + if (i != SQFS_FUSE_INODE_NONE) { + err = sqfs_ll_inode(lli->ll, &lli->inode, i); + if (err) +- fuse_reply_err(req, ENOENT); ++ DL(fuse_reply_err)(req, ENOENT); + } + return err; + } +--- a/nonstd-daemon.c ++++ b/nonstd-daemon.c +@@ -28,11 +28,16 @@ + #include "nonstd-internal.h" + + #include +-#include ++ ++#include "squashfuse_dlopen.h" ++#ifndef ENABLE_DLOPEN ++# include ++#endif + + int sqfs_ll_daemonize(int fg) { + #if HAVE_DECL_FUSE_DAEMONIZE +- return fuse_daemonize(fg); ++ LOAD_SYMBOL(int,fuse_daemonize,(int foreground)); ++ return DL(fuse_daemonize)(fg); + #else + return daemon(0,0); + #endif +--- a/ll.c ++++ b/ll.c +@@ -38,37 +38,41 @@ + + static void sqfs_ll_op_getattr(fuse_req_t req, fuse_ino_t ino, + struct fuse_file_info *fi) { ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ LOAD_SYMBOL(int,fuse_reply_attr,(fuse_req_t req, const struct stat *attr, double attr_timeout)); + sqfs_ll_i lli; + struct stat st; + if (sqfs_ll_iget(req, &lli, ino)) + return; + + if (sqfs_stat(&lli.ll->fs, &lli.inode, &st)) { +- fuse_reply_err(req, ENOENT); ++ DL(fuse_reply_err)(req, ENOENT); + } else { + st.st_ino = ino; +- fuse_reply_attr(req, &st, SQFS_TIMEOUT); ++ DL(fuse_reply_attr)(req, &st, SQFS_TIMEOUT); + } + } + + static void sqfs_ll_op_opendir(fuse_req_t req, fuse_ino_t ino, + struct fuse_file_info *fi) { ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ LOAD_SYMBOL(int,fuse_reply_open,(fuse_req_t req, const struct fuse_file_info *fi)); + sqfs_ll_i *lli; + + fi->fh = (intptr_t)NULL; + + lli = malloc(sizeof(*lli)); + if (!lli) { +- fuse_reply_err(req, ENOMEM); ++ DL(fuse_reply_err)(req, ENOMEM); + return; + } + + if (sqfs_ll_iget(req, lli, ino) == SQFS_OK) { + if (!S_ISDIR(lli->inode.base.mode)) { +- fuse_reply_err(req, ENOTDIR); ++ DL(fuse_reply_err)(req, ENOTDIR); + } else { + fi->fh = (intptr_t)lli; +- fuse_reply_open(req, fi); ++ DL(fuse_reply_open)(req, fi); + return; + } + } +@@ -77,28 +81,35 @@ + + static void sqfs_ll_op_create(fuse_req_t req, fuse_ino_t parent, const char *name, + mode_t mode, struct fuse_file_info *fi) { +- fuse_reply_err(req, EROFS); ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ DL(fuse_reply_err)(req, EROFS); + } + + static void sqfs_ll_op_releasedir(fuse_req_t req, fuse_ino_t ino, + struct fuse_file_info *fi) { + free((sqfs_ll_i*)(intptr_t)fi->fh); +- fuse_reply_err(req, 0); /* yes, this is necessary */ ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ DL(fuse_reply_err)(req, 0); /* yes, this is necessary */ + } + + static size_t sqfs_ll_add_direntry(fuse_req_t req, char *buf, size_t bufsize, + const char *name, const struct stat *st, off_t off) { + #if HAVE_DECL_FUSE_ADD_DIRENTRY +- return fuse_add_direntry(req, buf, bufsize, name, st, off); ++ LOAD_SYMBOL(size_t,fuse_add_direntry,(fuse_req_t req, char *buf, size_t bufsize, const char *name, const struct stat *stbuf, off_t off)); ++ return DL(fuse_add_direntry)(req, buf, bufsize, name, st, off); + #else +- size_t esize = fuse_dirent_size(strlen(name)); ++ LOAD_SYMBOL(size_t,fuse_dirent_size(size_t namelen)); ++ LOAD_SYMBOL(char *,fuse_add_dirent,(char *buf, const char *name, const struct stat *stbuf, off_t off)); ++ size_t esize = DL(fuse_dirent_size)(strlen(name)); + if (bufsize >= esize) +- fuse_add_dirent(buf, name, st, off); ++ DL(fuse_add_dirent)(buf, name, st, off); + return esize; + #endif + } + static void sqfs_ll_op_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, + off_t off, struct fuse_file_info *fi) { ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ LOAD_SYMBOL(int,fuse_reply_buf,(fuse_req_t req, const char *buf, size_t size)); + sqfs_err sqerr; + sqfs_dir dir; + sqfs_name namebuf; +@@ -135,14 +146,16 @@ + } + + if (err) +- fuse_reply_err(req, err); ++ DL(fuse_reply_err)(req, err); + else +- fuse_reply_buf(req, buf, bufpos - buf); ++ DL(fuse_reply_buf)(req, buf, bufpos - buf); + free(buf); + } + + static void sqfs_ll_op_lookup(fuse_req_t req, fuse_ino_t parent, + const char *name) { ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ LOAD_SYMBOL(int,fuse_reply_entry,(fuse_req_t req, const struct fuse_entry_param *e)); + sqfs_ll_i lli; + sqfs_err sqerr; + sqfs_name namebuf; +@@ -154,7 +167,7 @@ + return; + + if (!S_ISDIR(lli.inode.base.mode)) { +- fuse_reply_err(req, ENOTDIR); ++ DL(fuse_reply_err)(req, ENOTDIR); + return; + } + +@@ -162,55 +175,58 @@ + sqerr = sqfs_dir_lookup(&lli.ll->fs, &lli.inode, name, strlen(name), &entry, + &found); + if (sqerr) { +- fuse_reply_err(req, EIO); ++ DL(fuse_reply_err)(req, EIO); + return; + } + if (!found) { +- fuse_reply_err(req, ENOENT); ++ DL(fuse_reply_err)(req, ENOENT); + return; + } + + if (sqfs_inode_get(&lli.ll->fs, &inode, sqfs_dentry_inode(&entry))) { +- fuse_reply_err(req, ENOENT); ++ DL(fuse_reply_err)(req, ENOENT); + } else { + struct fuse_entry_param fentry; + memset(&fentry, 0, sizeof(fentry)); + if (sqfs_stat(&lli.ll->fs, &inode, &fentry.attr)) { +- fuse_reply_err(req, EIO); ++ DL(fuse_reply_err)(req, EIO); + } else { + fentry.attr_timeout = fentry.entry_timeout = SQFS_TIMEOUT; + fentry.ino = lli.ll->ino_register(lli.ll, &entry); + fentry.attr.st_ino = fentry.ino; +- fuse_reply_entry(req, &fentry); ++ DL(fuse_reply_entry)(req, &fentry); + } + } + } + + static void sqfs_ll_op_open(fuse_req_t req, fuse_ino_t ino, + struct fuse_file_info *fi) { ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ LOAD_SYMBOL(int,fuse_reply_open,(fuse_req_t req, const struct fuse_file_info *fi)); ++ LOAD_SYMBOL(void *,fuse_req_userdata,(fuse_req_t req)); + sqfs_inode *inode; + sqfs_ll *ll; + + if (fi->flags & (O_WRONLY | O_RDWR)) { +- fuse_reply_err(req, EROFS); ++ DL(fuse_reply_err)(req, EROFS); + return; + } + + inode = malloc(sizeof(sqfs_inode)); + if (!inode) { +- fuse_reply_err(req, ENOMEM); ++ DL(fuse_reply_err)(req, ENOMEM); + return; + } + +- ll = fuse_req_userdata(req); ++ ll = DL(fuse_req_userdata)(req); + if (sqfs_ll_inode(ll, inode, ino)) { +- fuse_reply_err(req, ENOENT); ++ DL(fuse_reply_err)(req, ENOENT); + } else if (!S_ISREG(inode->base.mode)) { +- fuse_reply_err(req, EISDIR); ++ DL(fuse_reply_err)(req, EISDIR); + } else { + fi->fh = (intptr_t)inode; + fi->keep_cache = 1; +- fuse_reply_open(req, fi); ++ DL(fuse_reply_open)(req, fi); + return; + } + free(inode); +@@ -218,37 +234,43 @@ + + static void sqfs_ll_op_release(fuse_req_t req, fuse_ino_t ino, + struct fuse_file_info *fi) { ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); + free((sqfs_inode*)(intptr_t)fi->fh); + fi->fh = 0; +- fuse_reply_err(req, 0); ++ DL(fuse_reply_err)(req, 0); + } + + static void sqfs_ll_op_read(fuse_req_t req, fuse_ino_t ino, + size_t size, off_t off, struct fuse_file_info *fi) { +- sqfs_ll *ll = fuse_req_userdata(req); ++ LOAD_SYMBOL(void *,fuse_req_userdata,(fuse_req_t req)); ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ LOAD_SYMBOL(int,fuse_reply_buf,(fuse_req_t req, const char *buf, size_t size)); ++ sqfs_ll *ll = DL(fuse_req_userdata)(req); + sqfs_inode *inode = (sqfs_inode*)(intptr_t)fi->fh; + sqfs_err err = SQFS_OK; + + off_t osize; + char *buf = malloc(size); + if (!buf) { +- fuse_reply_err(req, ENOMEM); ++ DL(fuse_reply_err)(req, ENOMEM); + return; + } + + osize = size; + err = sqfs_read_range(&ll->fs, inode, off, &osize, buf); + if (err) { +- fuse_reply_err(req, EIO); ++ DL(fuse_reply_err)(req, EIO); + } else if (osize == 0) { /* EOF */ +- fuse_reply_buf(req, NULL, 0); ++ DL(fuse_reply_buf)(req, NULL, 0); + } else { +- fuse_reply_buf(req, buf, osize); ++ DL(fuse_reply_buf)(req, buf, osize); + } + free(buf); + } + + static void sqfs_ll_op_readlink(fuse_req_t req, fuse_ino_t ino) { ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ LOAD_SYMBOL(int,fuse_reply_readlink,(fuse_req_t req, const char *link)); + char *dst; + size_t size; + sqfs_ll_i lli; +@@ -256,21 +278,24 @@ + return; + + if (!S_ISLNK(lli.inode.base.mode)) { +- fuse_reply_err(req, EINVAL); ++ DL(fuse_reply_err)(req, EINVAL); + } else if (sqfs_readlink(&lli.ll->fs, &lli.inode, NULL, &size)) { +- fuse_reply_err(req, EIO); ++ DL(fuse_reply_err)(req, EIO); + } else if (!(dst = malloc(size + 1))) { +- fuse_reply_err(req, ENOMEM); ++ DL(fuse_reply_err)(req, ENOMEM); + } else if (sqfs_readlink(&lli.ll->fs, &lli.inode, dst, &size)) { +- fuse_reply_err(req, EIO); ++ DL(fuse_reply_err)(req, EIO); + free(dst); + } else { +- fuse_reply_readlink(req, dst); ++ DL(fuse_reply_readlink)(req, dst); + free(dst); + } + } + + static void sqfs_ll_op_listxattr(fuse_req_t req, fuse_ino_t ino, size_t size) { ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ LOAD_SYMBOL(int,fuse_reply_xattr,(fuse_req_t req, size_t count)); ++ LOAD_SYMBOL(int,fuse_reply_buf,(fuse_req_t req, const char *buf, size_t size)); + sqfs_ll_i lli; + char *buf; + int ferr; +@@ -280,17 +305,17 @@ + + buf = NULL; + if (size && !(buf = malloc(size))) { +- fuse_reply_err(req, ENOMEM); ++ DL(fuse_reply_err)(req, ENOMEM); + return; + } + + ferr = sqfs_listxattr(&lli.ll->fs, &lli.inode, buf, &size); + if (ferr) { +- fuse_reply_err(req, ferr); ++ DL(fuse_reply_err)(req, ferr); + } else if (buf) { +- fuse_reply_buf(req, buf, size); ++ DL(fuse_reply_buf)(req, buf, size); + } else { +- fuse_reply_xattr(req, size); ++ DL(fuse_reply_xattr)(req, size); + } + free(buf); + } +@@ -301,13 +326,16 @@ + , uint32_t position + #endif + ) { ++ LOAD_SYMBOL(int,fuse_reply_err,(fuse_req_t req, int err)); ++ LOAD_SYMBOL(int,fuse_reply_xattr,(fuse_req_t req, size_t count)); ++ LOAD_SYMBOL(int,fuse_reply_buf,(fuse_req_t req, const char *buf, size_t size)); + sqfs_ll_i lli; + char *buf = NULL; + size_t real = size; + + #ifdef FUSE_XATTR_POSITION + if (position != 0) { /* We don't support resource forks */ +- fuse_reply_err(req, EINVAL); ++ DL(fuse_reply_err)(req, EINVAL); + return; + } + #endif +@@ -316,26 +344,27 @@ + return; + + if (!(buf = malloc(size))) +- fuse_reply_err(req, ENOMEM); ++ DL(fuse_reply_err)(req, ENOMEM); + else if (sqfs_xattr_lookup(&lli.ll->fs, &lli.inode, name, buf, &real)) +- fuse_reply_err(req, EIO); ++ DL(fuse_reply_err)(req, EIO); + else if (real == 0) +- fuse_reply_err(req, sqfs_enoattr()); ++ DL(fuse_reply_err)(req, sqfs_enoattr()); + else if (size == 0) +- fuse_reply_xattr(req, real); ++ DL(fuse_reply_xattr)(req, real); + else if (size < real) +- fuse_reply_err(req, ERANGE); ++ DL(fuse_reply_err)(req, ERANGE); + else +- fuse_reply_buf(req, buf, real); ++ DL(fuse_reply_buf)(req, buf, real); + free(buf); + } + + static void sqfs_ll_op_forget(fuse_req_t req, fuse_ino_t ino, + unsigned long nlookup) { ++ LOAD_SYMBOL(void,fuse_reply_none,(fuse_req_t req)); + sqfs_ll_i lli; + sqfs_ll_iget(req, &lli, SQFS_FUSE_INODE_NONE); + lli.ll->ino_forget(lli.ll, ino, nlookup); +- fuse_reply_none(req); ++ DL(fuse_reply_none)(req); + } + + +@@ -348,23 +377,27 @@ + + static sqfs_err sqfs_ll_mount(sqfs_ll_chan *ch, const char *mountpoint, + struct fuse_args *args) { ++ LOAD_SYMBOL(struct fuse_chan *,fuse_mount,(const char *mountpoint, struct fuse_args *args)); + #ifdef HAVE_NEW_FUSE_UNMOUNT +- ch->ch = fuse_mount(mountpoint, args); ++ ch->ch = DL(fuse_mount)(mountpoint, args); + #else +- ch->fd = fuse_mount(mountpoint, args); ++ LOAD_SYMBOL(struct fuse_chan *,fuse_kern_chan_new,(int fd)); ++ ch->fd = DL(fuse_mount)(mountpoint, args); + if (ch->fd == -1) + return SQFS_ERR; +- ch->ch = fuse_kern_chan_new(ch->fd); ++ ch->ch = DL(fuse_kern_chan_new)(ch->fd); + #endif + return ch->ch ? SQFS_OK : SQFS_ERR; + } + + static void sqfs_ll_unmount(sqfs_ll_chan *ch, const char *mountpoint) { + #ifdef HAVE_NEW_FUSE_UNMOUNT +- fuse_unmount(mountpoint, ch->ch); ++ LOAD_SYMBOL(void,fuse_unmount,(const char *mountpoint, struct fuse_chan *ch)); ++ DL(fuse_unmount)(mountpoint, ch->ch); + #else ++ LOAD_SYMBOL(void,fuse_unmount,(const char *mountpoint)); + close(ch->fd); +- fuse_unmount(mountpoint); ++ DL(fuse_unmount)(mountpoint); + #endif + } + +@@ -391,6 +424,19 @@ + } + + int fusefs_main(int argc, char *argv[], void (*mounted) (void)) { ++ LOAD_SYMBOL(int,fuse_opt_parse,(struct fuse_args *args, void *data, const struct fuse_opt opts[], fuse_opt_proc_t proc)); ++ LOAD_SYMBOL(int,fuse_parse_cmdline,(struct fuse_args *args, char **mountpoint, int *multithreaded, int *foreground)); ++ LOAD_SYMBOL(struct fuse_session *,fuse_lowlevel_new,(struct fuse_args *args, const struct fuse_lowlevel_ops *op, size_t op_size, void *userdata)); ++ LOAD_SYMBOL(int,fuse_set_signal_handlers,(struct fuse_session *se)); ++ LOAD_SYMBOL(void,fuse_session_add_chan,(struct fuse_session *se, struct fuse_chan *ch)); ++ LOAD_SYMBOL(int,fuse_session_loop,(struct fuse_session *se)); ++ LOAD_SYMBOL(void,fuse_remove_signal_handlers,(struct fuse_session *se)); ++#if HAVE_DECL_FUSE_SESSION_REMOVE_CHAN ++ LOAD_SYMBOL(void,fuse_session_remove_chan,(struct fuse_chan *ch)); ++#endif ++ LOAD_SYMBOL(void,fuse_session_destroy,(struct fuse_session *se)); ++ LOAD_SYMBOL(void,fuse_opt_free_args,(struct fuse_args *args)); ++ + struct fuse_args args; + sqfs_opts opts; + +@@ -429,10 +475,10 @@ + opts.image = NULL; + opts.mountpoint = 0; + opts.offset = 0; +- if (fuse_opt_parse(&args, &opts, fuse_opts, sqfs_opt_proc) == -1) ++ if (DL(fuse_opt_parse)(&args, &opts, fuse_opts, sqfs_opt_proc) == -1) + sqfs_usage(argv[0], true); + +- if (fuse_parse_cmdline(&args, &mountpoint, &mt, &fg) == -1) ++ if (DL(fuse_parse_cmdline)(&args, &mountpoint, &mt, &fg) == -1) + sqfs_usage(argv[0], true); + if (mountpoint == NULL) + sqfs_usage(argv[0], true); +@@ -445,33 +491,34 @@ + sqfs_ll_chan ch; + err = -1; + if (sqfs_ll_mount(&ch, mountpoint, &args) == SQFS_OK) { +- struct fuse_session *se = fuse_lowlevel_new(&args, ++ struct fuse_session *se = DL(fuse_lowlevel_new)(&args, + &sqfs_ll_ops, sizeof(sqfs_ll_ops), ll); + if (se != NULL) { + if (sqfs_ll_daemonize(fg) != -1) { +- if (fuse_set_signal_handlers(se) != -1) { +- fuse_session_add_chan(se, ch.ch); ++ if (DL(fuse_set_signal_handlers)(se) != -1) { ++ DL(fuse_session_add_chan)(se, ch.ch); + if (mounted) + mounted (); + /* FIXME: multithreading */ +- err = fuse_session_loop(se); +- fuse_remove_signal_handlers(se); ++ err = DL(fuse_session_loop)(se); ++ DL(fuse_remove_signal_handlers)(se); + #if HAVE_DECL_FUSE_SESSION_REMOVE_CHAN +- fuse_session_remove_chan(ch.ch); ++ DL(fuse_session_remove_chan)(ch.ch); + #endif + } + } +- fuse_session_destroy(se); ++ DL(fuse_session_destroy)(se); + } + sqfs_ll_destroy(ll); + sqfs_ll_unmount(&ch, mountpoint); + } + } +- fuse_opt_free_args(&args); ++ DL(fuse_opt_free_args)(&args); + if (mounted) + rmdir (mountpoint); + free(ll); + free(mountpoint); ++ CLOSE_LIBRARY; + + return -err; + } diff --git a/contrib/depends/patches/fontconfig/gperf_header_regen.patch b/contrib/depends/patches/native_fontconfig/gperf_header_regen.patch similarity index 100% rename from contrib/depends/patches/fontconfig/gperf_header_regen.patch rename to contrib/depends/patches/native_fontconfig/gperf_header_regen.patch diff --git a/contrib/depends/patches/libxcb/remove_pthread_stubs.patch b/contrib/depends/patches/native_libxcb/remove_pthread_stubs.patch similarity index 100% rename from contrib/depends/patches/libxcb/remove_pthread_stubs.patch rename to contrib/depends/patches/native_libxcb/remove_pthread_stubs.patch diff --git a/contrib/depends/patches/native_qmake/qt.pro b/contrib/depends/patches/native_qmake/qt.pro deleted file mode 100644 index dbc0e08..0000000 --- a/contrib/depends/patches/native_qmake/qt.pro +++ /dev/null @@ -1,19 +0,0 @@ -# Create the super cache so modules will add themselves to it. -cache(, super) - -!QTDIR_build: cache(CONFIG, add, $$list(QTDIR_build)) - -#prl = no_install_prl -#CONFIG += $$prl -cache(CONFIG, add stash, prl) - -TEMPLATE = subdirs -SUBDIRS = qtbase -#SUBDIRS = qtbase qttools qttranslations qtsvg qtwebsockets - -#qtwebsockets.depends = qtbase -#qtsvg.depends = qtbase -#qttools.depends = qtbase -#qttranslations.depends = qttools - -load(qt_configure) diff --git a/contrib/depends/patches/native_qt/QTBUG-92199-fix.patch b/contrib/depends/patches/native_qt/QTBUG-92199-fix.patch new file mode 100644 index 0000000..c04fa73 --- /dev/null +++ b/contrib/depends/patches/native_qt/QTBUG-92199-fix.patch @@ -0,0 +1,59 @@ +From c765bc51864b90ebc46c11780ccc20ad16eddd6a Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Tue, 8 Nov 2022 00:59:36 +0100 +Subject: [PATCH] Fix QTBUG-92199 + +--- + src/widgets/styles/qstylesheetstyle.cpp | 1 - + .../qstylesheetstyle/tst_qstylesheetstyle.cpp | 16 ---------------- + 2 files changed, 17 deletions(-) + +diff --git a/qtbase/src/widgets/styles/qstylesheetstyle.cpp b/qtbase/src/widgets/styles/qstylesheetstyle.cpp +index 6abef62835..7aca4d5788 100644 +--- a/qtbase/src/widgets/styles/qstylesheetstyle.cpp ++++ b/qtbase/src/widgets/styles/qstylesheetstyle.cpp +@@ -1474,7 +1474,6 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q + p->setBrush(cg, w->foregroundRole(), pal->foreground); + p->setBrush(cg, QPalette::WindowText, pal->foreground); + p->setBrush(cg, QPalette::Text, pal->foreground); +- p->setBrush(cg, QPalette::PlaceholderText, pal->foreground); + } + if (pal->selectionBackground.style() != Qt::NoBrush) + p->setBrush(cg, QPalette::Highlight, pal->selectionBackground); +diff --git a/qtbase/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/qtbase/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +index 82d48b1692..9add99325b 100644 +--- a/qtbase/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp ++++ b/qtbase/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +@@ -103,7 +103,6 @@ private slots: + void QTBUG15910_crashNullWidget(); + void QTBUG36933_brokenPseudoClassLookup(); + void styleSheetChangeBeforePolish(); +- void placeholderColor(); + void enumPropertySelector_data(); + void enumPropertySelector(); + //at the end because it mess with the style. +@@ -2331,21 +2330,6 @@ void tst_QStyleSheetStyle::highdpiImages() + QHighDpiScaling::updateHighDpiScaling(); // reset to normal + } + +-void tst_QStyleSheetStyle::placeholderColor() +-{ +- const QColor red(Qt::red); +- qApp->setStyleSheet("* { color: red; }"); +- QLineEdit le1; +- QLineEdit le2; +- le2.setEnabled(false); +- le1.ensurePolished(); +- QCOMPARE(le1.palette().placeholderText(), red); +- le2.ensurePolished(); +- QCOMPARE(le2.palette().placeholderText(), red); +- le2.setEnabled(true); +- QCOMPARE(le2.palette().placeholderText(), red); +-} +- + void tst_QStyleSheetStyle::enumPropertySelector_data() + { + QTest::addColumn("styleSheet"); +-- +2.38.1 + diff --git a/contrib/depends/patches/native_qt/dont_hardcode_pwd.patch b/contrib/depends/patches/native_qt/dont_hardcode_pwd.patch new file mode 100644 index 0000000..cf2c4d3 --- /dev/null +++ b/contrib/depends/patches/native_qt/dont_hardcode_pwd.patch @@ -0,0 +1,25 @@ +commit 0e953866fc4672486e29e1ba6d83b4207e7b2f0b +Author: fanquake +Date: Tue Aug 18 15:09:06 2020 +0800 + + Don't hardcode pwd path + + Let a man use his builtins if he wants to! Also, removes the unnecessary + assumption that pwd lives under /bin/pwd. + + See #15581. + +--- a/qtbase/configure ++++ b/qtbase/configure +@@ -34,9 +34,9 @@ + + # the directory of this script is the "source tree" + relpath=`dirname $0` +-relpath=`(cd "$relpath"; /bin/pwd)` ++relpath=`(cd "$relpath"; pwd)` + # the current directory is the "build tree" or "object tree" +-outpath=`/bin/pwd` ++outpath=`pwd` + + # do this early so we don't store it in config.status + CFG_TOPLEVEL= diff --git a/contrib/depends/patches/native_qt/fast_fixed_dtoa_no_optimize.patch b/contrib/depends/patches/native_qt/fast_fixed_dtoa_no_optimize.patch new file mode 100644 index 0000000..6bf4a43 --- /dev/null +++ b/contrib/depends/patches/native_qt/fast_fixed_dtoa_no_optimize.patch @@ -0,0 +1,20 @@ +Modify the optimisation flags for FastFixedDtoa. +This fixes a non-determinism issue in the asm produced for +this function when cross-compiling on x86_64 and aarch64 for +the arm-linux-gnueabihf HOST. + +--- a/qtbase/src/3rdparty/double-conversion/double-conversion/fixed-dtoa.h ++++ b/qtbase/src/3rdparty/double-conversion/double-conversion/fixed-dtoa.h +@@ -48,9 +48,12 @@ namespace double_conversion { + // + // This method only works for some parameters. If it can't handle the input it + // returns false. The output is null-terminated when the function succeeds. ++#pragma GCC push_options ++#pragma GCC optimize ("-O1") + bool FastFixedDtoa(double v, int fractional_count, + Vector buffer, int* length, int* decimal_point); + ++#pragma GCC pop_options + } // namespace double_conversion + + #endif // DOUBLE_CONVERSION_FIXED_DTOA_H_ diff --git a/contrib/depends/patches/qt/fix_rcc_determinism.patch b/contrib/depends/patches/native_qt/fix_rcc_determinism.patch similarity index 100% rename from contrib/depends/patches/qt/fix_rcc_determinism.patch rename to contrib/depends/patches/native_qt/fix_rcc_determinism.patch diff --git a/contrib/depends/patches/native_qt/guix_cross_lib_path.patch b/contrib/depends/patches/native_qt/guix_cross_lib_path.patch new file mode 100644 index 0000000..7911dc2 --- /dev/null +++ b/contrib/depends/patches/native_qt/guix_cross_lib_path.patch @@ -0,0 +1,17 @@ +Facilitate guix building with CROSS_LIBRARY_PATH + +See discussion in https://github.com/bitcoin/bitcoin/pull/15277. + +--- a/qtbase/mkspecs/features/toolchain.prf ++++ b/qtbase/mkspecs/features/toolchain.prf +@@ -236,8 +236,8 @@ isEmpty($${target_prefix}.INCDIRS) { + add_libraries = false + for (line, output) { + line ~= s/^[ \\t]*// # remove leading spaces +- contains(line, "LIBRARY_PATH=.*") { +- line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH= ++ contains(line, "(CROSS_)?LIBRARY_PATH=.*") { ++ line ~= s/^(CROSS_)?LIBRARY_PATH=// # remove leading (CROSS_)?LIBRARY_PATH= + equals(QMAKE_HOST.os, Windows): \ + paths = $$split(line, ;) + else: \ diff --git a/contrib/depends/patches/native_qt/mac-qmake.conf b/contrib/depends/patches/native_qt/mac-qmake.conf new file mode 100644 index 0000000..cb94bf0 --- /dev/null +++ b/contrib/depends/patches/native_qt/mac-qmake.conf @@ -0,0 +1,22 @@ +MAKEFILE_GENERATOR = UNIX +CONFIG += app_bundle incremental lib_version_first absolute_library_soname +QMAKE_INCREMENTAL_STYLE = sublib +include(../common/macx.conf) +include(../common/gcc-base-mac.conf) +include(../common/clang.conf) +include(../common/clang-mac.conf) +QMAKE_MAC_SDK_PATH=$${MAC_SDK_PATH} +QMAKE_XCODE_VERSION = $${XCODE_VERSION} +QMAKE_XCODE_DEVELOPER_PATH=/Developer +QMAKE_MAC_SDK=macosx +QMAKE_MAC_SDK.macosx.Path = $${MAC_SDK_PATH} +QMAKE_MAC_SDK.macosx.platform_name = macosx +QMAKE_MAC_SDK.macosx.SDKVersion = $${MAC_SDK_VERSION} +QMAKE_MAC_SDK.macosx.PlatformPath = /phony +!host_build: QMAKE_CFLAGS += -target $${MAC_TARGET} +!host_build: QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS +!host_build: QMAKE_CXXFLAGS += -target $${MAC_TARGET} +!host_build: QMAKE_LFLAGS += -target $${MAC_TARGET} +QMAKE_AR = $${CROSS_COMPILE}ar cq +QMAKE_RANLIB=$${CROSS_COMPILE}ranlib +load(qt_config) diff --git a/contrib/depends/patches/native_qt/no-renameat2.patch b/contrib/depends/patches/native_qt/no-renameat2.patch new file mode 100644 index 0000000..d93dd0e --- /dev/null +++ b/contrib/depends/patches/native_qt/no-renameat2.patch @@ -0,0 +1,42 @@ +From 92ba295ee64a55c73c8a32b77c352a6181289fe8 Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sun, 30 Oct 2022 23:15:34 +0100 +Subject: [PATCH] no renameat2 + +--- + qtbase/src/corelib/configure.cmake | 2 -- + qtbase/src/corelib/global/qconfig-bootstrapped.h | 4 ---- + 2 files changed, 6 deletions(-) + +diff --git a/qtbase/src/corelib/configure.cmake b/qtbase/src/corelib/configure.cmake +index 183decb530..f8e9ad0e87 100644 +--- a/qtbase/src/corelib/configure.cmake ++++ b/qtbase/src/corelib/configure.cmake +@@ -434,8 +434,6 @@ qt_config_compile_test(renameat2 + LABEL "renameat2()" + CODE + "#define _ATFILE_SOURCE 1 +-#include +-#include + + int main(int, char **argv) + { +diff --git a/qtbase/src/corelib/global/qconfig-bootstrapped.h b/qtbase/src/corelib/global/qconfig-bootstrapped.h +index 61fd6479b1..06d06235d5 100644 +--- a/qtbase/src/corelib/global/qconfig-bootstrapped.h ++++ b/qtbase/src/corelib/global/qconfig-bootstrapped.h +@@ -74,11 +74,7 @@ + #define QT_NO_QOBJECT + #define QT_FEATURE_process -1 + #define QT_FEATURE_regularexpression 1 +-#ifdef __GLIBC_PREREQ +-# define QT_FEATURE_renameat2 (__GLIBC_PREREQ(2, 28) ? 1 : -1) +-#else + # define QT_FEATURE_renameat2 -1 +-#endif + #define QT_FEATURE_shortcut -1 + #define QT_FEATURE_signaling_nan -1 + #define QT_FEATURE_slog2 -1 +-- +2.38.1 + diff --git a/contrib/depends/patches/native_qt/no-statx.patch b/contrib/depends/patches/native_qt/no-statx.patch new file mode 100644 index 0000000..d4c88ae --- /dev/null +++ b/contrib/depends/patches/native_qt/no-statx.patch @@ -0,0 +1,56 @@ +From ceb48fa2f01b9c421d880f6220778d830e5c5f7b Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sun, 30 Oct 2022 16:52:17 +0100 +Subject: [PATCH] Never use statx + +--- + src/corelib/configure.cmake | 1 - + src/corelib/global/qconfig-bootstrapped.h | 6 +----- + src/corelib/io/qfilesystemengine_unix.cpp | 2 +- + 3 files changed, 2 insertions(+), 7 deletions(-) + +diff --git a/qtbase/src/corelib/configure.cmake b/qtbase/src/corelib/configure.cmake +index 4ab122afd0..7b89fa3dd7 100644 +--- a/qtbase/src/corelib/configure.cmake ++++ b/qtbase/src/corelib/configure.cmake +@@ -428,7 +428,6 @@ qt_config_compile_test(statx + CODE + "#define _ATFILE_SOURCE 1 + #include +-#include + #include + #include + +diff --git a/qtbase/src/corelib/global/qconfig-bootstrapped.h b/qtbase/src/corelib/global/qconfig-bootstrapped.h +index 42d38d0d04..25b551210c 100644 +--- a/qtbase/src/corelib/global/qconfig-bootstrapped.h ++++ b/qtbase/src/corelib/global/qconfig-bootstrapped.h +@@ -119,11 +119,7 @@ + #define QT_FEATURE_shortcut -1 + #define QT_FEATURE_signaling_nan -1 + #define QT_FEATURE_slog2 -1 +-#ifdef __GLIBC_PREREQ +-# define QT_FEATURE_statx (__GLIBC_PREREQ(2, 28) ? 1 : -1) +-#else +-# define QT_FEATURE_statx -1 +-#endif ++#define QT_FEATURE_statx -1 + #define QT_FEATURE_syslog -1 + #define QT_NO_SYSTEMLOCALE + #define QT_FEATURE_systemsemaphore -1 +diff --git a/qtbase/src/corelib/io/qfilesystemengine_unix.cpp b/qtbase/src/corelib/io/qfilesystemengine_unix.cpp +index 5ba9309426..c968d1c61f 100644 +--- a/qtbase/src/corelib/io/qfilesystemengine_unix.cpp ++++ b/qtbase/src/corelib/io/qfilesystemengine_unix.cpp +@@ -99,7 +99,7 @@ extern "C" NSString *NSTemporaryDirectory(); + #endif + #endif + +-#if defined(Q_OS_ANDROID) ++#if defined(Q_OS_LINUX) + // statx() is disabled on Android because quite a few systems + // come with sandboxes that kill applications that make system calls outside a + // whitelist and several Android vendors can't be bothered to update the list. +-- +2.38.1 + diff --git a/contrib/depends/patches/native_qmake/no-xlib.patch b/contrib/depends/patches/native_qt/no-xlib.patch similarity index 67% rename from contrib/depends/patches/native_qmake/no-xlib.patch rename to contrib/depends/patches/native_qt/no-xlib.patch index 5a1334b..f767a4a 100644 --- a/contrib/depends/patches/native_qmake/no-xlib.patch +++ b/contrib/depends/patches/native_qt/no-xlib.patch @@ -1,18 +1,17 @@ -From 9563cef873ae82e06f60708d706d054717e801ce Mon Sep 17 00:00:00 2001 -From: Carl Dong -Date: Thu, 18 Jul 2019 17:22:05 -0400 -Subject: [PATCH] Wrap xlib related code blocks in #if's +From 0171c86423f6c5aa8becf1259d42a3e67b8da59c Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sun, 30 Oct 2022 17:43:43 +0100 +Subject: [PATCH] no xlib -They are not necessary to compile QT. --- - qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp | 8 ++++++++ + src/plugins/platforms/xcb/qxcbcursor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp -index 7c62c2e2b3..c05c6c0a07 100644 +index 2cc39f1e85..90efc1f1fb 100644 --- a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp -@@ -49,7 +49,9 @@ +@@ -13,7 +13,9 @@ #include #include #include @@ -22,23 +21,23 @@ index 7c62c2e2b3..c05c6c0a07 100644 #include #include -@@ -391,6 +391,7 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *window) +@@ -357,6 +359,7 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *window) xcb_flush(xcb_connection()); } - + +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) static int cursorIdForShape(int cshape) { int cursorId = 0; -@@ -444,6 +445,7 @@ static int cursorIdForShape(int cshape) +@@ -410,6 +413,7 @@ static int cursorIdForShape(int cshape) } return cursorId; } +#endif - + xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) { -@@ -556,7 +558,9 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) +@@ -524,7 +528,9 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) xcb_cursor_t QXcbCursor::createFontCursor(int cshape) { xcb_connection_t *conn = xcb_connection(); @@ -46,24 +45,24 @@ index 7c62c2e2b3..c05c6c0a07 100644 int cursorId = cursorIdForShape(cshape); +#endif xcb_cursor_t cursor = XCB_NONE; - - // Try Xcursor first -@@ -586,6 +590,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) + + #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) +@@ -556,6 +562,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) // Non-standard X11 cursors are created from bitmaps cursor = createNonStandardCursor(cshape); - + +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) - // Create a glpyh cursor if everything else failed + // Create a glyph cursor if everything else failed if (!cursor && cursorId) { cursor = xcb_generate_id(conn); -@@ -593,6 +598,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) +@@ -563,6 +570,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) cursorId, cursorId + 1, 0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0); } +#endif - + if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) { const char *name = cursorNames[cshape].front(); --- -2.22.0 +-- +2.38.1 diff --git a/contrib/depends/patches/native_qt/no_pthread_cond_clockwait.patch b/contrib/depends/patches/native_qt/no_pthread_cond_clockwait.patch new file mode 100644 index 0000000..336434a --- /dev/null +++ b/contrib/depends/patches/native_qt/no_pthread_cond_clockwait.patch @@ -0,0 +1,174 @@ +From e062494e888e4dfbb42cb0b2f2c9d41dd76b9bfb Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Mon, 31 Oct 2022 00:38:39 +0100 +Subject: [PATCH] Revert "Re-apply "QReadWriteLock: replace (QWaitCondition, + QMutex) with std::(condition_variable, mutex)"" + +This reverts commit fd8f81f3859fe92082caec925223e08cf61c69d4. +--- + src/corelib/thread/qreadwritelock.cpp | 35 ++++++++++++--------------- + src/corelib/thread/qreadwritelock_p.h | 12 ++++----- + 2 files changed, 22 insertions(+), 25 deletions(-) + +diff --git a/qtbase/src/corelib/thread/qreadwritelock.cpp b/qtbase/src/corelib/thread/qreadwritelock.cpp +index c31782d684..a46b70180c 100644 +--- a/qtbase/src/corelib/thread/qreadwritelock.cpp ++++ b/qtbase/src/corelib/thread/qreadwritelock.cpp +@@ -31,9 +31,6 @@ QT_BEGIN_NAMESPACE + */ + + namespace { +- +-using ms = std::chrono::milliseconds; +- + enum { + StateMask = 0x3, + StateLockedForRead = 0x1, +@@ -243,7 +240,7 @@ bool QReadWriteLock::tryLockForRead(int timeout) + d = d_ptr.loadAcquire(); + continue; + } +- return d->lockForRead(lock, timeout); ++ return d->lockForRead(timeout); + } + } + +@@ -347,7 +344,7 @@ bool QReadWriteLock::tryLockForWrite(int timeout) + d = d_ptr.loadAcquire(); + continue; + } +- return d->lockForWrite(lock, timeout); ++ return d->lockForWrite(timeout); + } + } + +@@ -431,9 +428,9 @@ QReadWriteLock::StateForWaitCondition QReadWriteLock::stateForWaitCondition() co + + } + +-bool QReadWriteLockPrivate::lockForRead(std::unique_lock &lock, int timeout) ++bool QReadWriteLockPrivate::lockForRead(int timeout) + { +- Q_ASSERT(!mutex.try_lock()); // mutex must be locked when entering this function ++ Q_ASSERT(!mutex.tryLock()); // mutex must be locked when entering this function + + QElapsedTimer t; + if (timeout > 0) +@@ -447,10 +444,10 @@ bool QReadWriteLockPrivate::lockForRead(std::unique_lock &lock + if (elapsed > timeout) + return false; + waitingReaders++; +- readerCond.wait_for(lock, ms{timeout - elapsed}); ++ readerCond.wait(&mutex, QDeadlineTimer(timeout - elapsed)); + } else { + waitingReaders++; +- readerCond.wait(lock); ++ readerCond.wait(&mutex); + } + waitingReaders--; + } +@@ -459,9 +456,9 @@ bool QReadWriteLockPrivate::lockForRead(std::unique_lock &lock + return true; + } + +-bool QReadWriteLockPrivate::lockForWrite(std::unique_lock &lock, int timeout) ++bool QReadWriteLockPrivate::lockForWrite(int timeout) + { +- Q_ASSERT(!mutex.try_lock()); // mutex must be locked when entering this function ++ Q_ASSERT(!mutex.tryLock()); // mutex must be locked when entering this function + + QElapsedTimer t; + if (timeout > 0) +@@ -476,15 +473,15 @@ bool QReadWriteLockPrivate::lockForWrite(std::unique_lock &loc + if (waitingReaders && !waitingWriters && !writerCount) { + // We timed out and now there is no more writers or waiting writers, but some + // readers were queued (probably because of us). Wake the waiting readers. +- readerCond.notify_all(); ++ readerCond.wakeAll(); + } + return false; + } + waitingWriters++; +- writerCond.wait_for(lock, ms{timeout - elapsed}); ++ writerCond.wait(&mutex, QDeadlineTimer(timeout - elapsed)); + } else { + waitingWriters++; +- writerCond.wait(lock); ++ writerCond.wait(&mutex); + } + waitingWriters--; + } +@@ -497,11 +494,11 @@ bool QReadWriteLockPrivate::lockForWrite(std::unique_lock &loc + + void QReadWriteLockPrivate::unlock() + { +- Q_ASSERT(!mutex.try_lock()); // mutex must be locked when entering this function ++ Q_ASSERT(!mutex.tryLock()); // mutex must be locked when entering this function + if (waitingWriters) +- writerCond.notify_one(); ++ writerCond.wakeOne(); + else if (waitingReaders) +- readerCond.notify_all(); ++ readerCond.wakeAll(); + } + + static auto handleEquals(Qt::HANDLE handle) +@@ -523,7 +520,7 @@ bool QReadWriteLockPrivate::recursiveLockForRead(int timeout) + return true; + } + +- if (!lockForRead(lock, timeout)) ++ if (!lockForRead(timeout)) + return false; + + Reader r = {self, 1}; +@@ -542,7 +539,7 @@ bool QReadWriteLockPrivate::recursiveLockForWrite(int timeout) + return true; + } + +- if (!lockForWrite(lock, timeout)) ++ if (!lockForWrite(timeout)) + return false; + + currentWriter = self; +diff --git a/qtbase/src/corelib/thread/qreadwritelock_p.h b/qtbase/src/corelib/thread/qreadwritelock_p.h +index e1d42fbbf3..c88eb15e1b 100644 +--- a/qtbase/src/corelib/thread/qreadwritelock_p.h ++++ b/qtbase/src/corelib/thread/qreadwritelock_p.h +@@ -17,8 +17,8 @@ + // + + #include +-#include + #include ++#include + + QT_REQUIRE_CONFIG(thread); + +@@ -30,9 +30,9 @@ public: + explicit QReadWriteLockPrivate(bool isRecursive = false) + : recursive(isRecursive) {} + +- QtPrivate::mutex mutex; +- QtPrivate::condition_variable writerCond; +- QtPrivate::condition_variable readerCond; ++ QMutex mutex; ++ QWaitCondition writerCond; ++ QWaitCondition readerCond; + int readerCount = 0; + int writerCount = 0; + int waitingReaders = 0; +@@ -40,8 +40,8 @@ public: + const bool recursive; + + //Called with the mutex locked +- bool lockForWrite(std::unique_lock &lock, int timeout); +- bool lockForRead(std::unique_lock &lock, int timeout); ++ bool lockForWrite(int timeout); ++ bool lockForRead(int timeout); + void unlock(); + + //memory management +-- +2.38.1 + diff --git a/contrib/depends/patches/native_qt/qtbase-moc-ignore-gcc-macro.patch b/contrib/depends/patches/native_qt/qtbase-moc-ignore-gcc-macro.patch new file mode 100644 index 0000000..9b848cc --- /dev/null +++ b/contrib/depends/patches/native_qt/qtbase-moc-ignore-gcc-macro.patch @@ -0,0 +1,17 @@ +The moc executable loops through headers on CPLUS_INCLUDE_PATH and stumbles +on the GCC internal _GLIBCXX_VISIBILITY macro. Tell it to ignore it as it is +not supposed to be looking there to begin with. + +Upstream report: https://bugreports.qt.io/browse/QTBUG-83160 + +diff --git a/qtbase/src/tools/moc/main.cpp b/qtbase/src/tools/moc/main.cpp +--- a/qtbase/src/tools/moc/main.cpp ++++ b/qtbase/src/tools/moc/main.cpp +@@ -197,6 +197,7 @@ int runMoc(int argc, char **argv) + dummyVariadicFunctionMacro.arguments += Symbol(0, PP_IDENTIFIER, "__VA_ARGS__"); + pp.macros["__attribute__"] = dummyVariadicFunctionMacro; + pp.macros["__declspec"] = dummyVariadicFunctionMacro; ++ pp.macros["_GLIBCXX_VISIBILITY"] = dummyVariadicFunctionMacro; + + QString filename; + QString output; diff --git a/contrib/depends/patches/native_qt/rcc_hardcode_timestamp.patch b/contrib/depends/patches/native_qt/rcc_hardcode_timestamp.patch new file mode 100644 index 0000000..6379112 --- /dev/null +++ b/contrib/depends/patches/native_qt/rcc_hardcode_timestamp.patch @@ -0,0 +1,24 @@ +Hardcode last modified timestamp in Qt RCC + +This change allows the already built qt package to be reused even with +the SOURCE_DATE_EPOCH variable set, e.g., for Guix builds. + + +--- old/qtbase/src/tools/rcc/rcc.cpp ++++ new/qtbase/src/tools/rcc/rcc.cpp +@@ -229,14 +229,7 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib) + + if (lib.formatVersion() >= 2) { + // last modified time stamp +- const QDateTime lastModified = m_fileInfo.lastModified(); +- quint64 lastmod = quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0); +- static const quint64 sourceDate = 1000 * qgetenv("QT_RCC_SOURCE_DATE_OVERRIDE").toULongLong(); +- if (sourceDate != 0) +- lastmod = sourceDate; +- static const quint64 sourceDate2 = 1000 * qgetenv("SOURCE_DATE_EPOCH").toULongLong(); +- if (sourceDate2 != 0) +- lastmod = sourceDate2; ++ quint64 lastmod = quint64(1); + lib.writeNumber8(lastmod); + if (text || pass1) + lib.writeChar('\n'); diff --git a/contrib/depends/patches/native_qt/root_CMakeLists.txt b/contrib/depends/patches/native_qt/root_CMakeLists.txt new file mode 100644 index 0000000..2a7d35c --- /dev/null +++ b/contrib/depends/patches/native_qt/root_CMakeLists.txt @@ -0,0 +1,51 @@ +# The real minimum version will be checked by the qtbase project. +# 3.16 is the absolute minimum though. +cmake_minimum_required(VERSION 3.16...3.20) + +# Include qtbase's .cmake.conf for access to QT_REPO_MODULE_VERSION +set(__qt6_qtbase_src_path "${CMAKE_CURRENT_SOURCE_DIR}/qtbase") +include("${__qt6_qtbase_src_path}/.cmake.conf") + +# Run platform auto-detection /before/ the first project() call and thus +# before the toolchain file is loaded. +include("${__qt6_qtbase_src_path}/cmake/QtAutoDetect.cmake") + +project(Qt + VERSION "${QT_REPO_MODULE_VERSION}" + DESCRIPTION "Qt Libraries" + HOMEPAGE_URL "https://qt.io/" + LANGUAGES CXX C ASM +) + +# Required so we can call ctest from the root build directory +enable_testing() + +set(qt_module_prop_prefix "__qt_prop_") + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +list(APPEND CMAKE_MODULE_PATH "${__qt6_qtbase_src_path}/cmake") +list(APPEND CMAKE_MODULE_PATH + "${__qt6_qtbase_src_path}/cmake/3rdparty/extra-cmake-modules/find-modules") +list(APPEND CMAKE_MODULE_PATH "${__qt6_qtbase_src_path}/cmake/3rdparty/kwin") + +# Also make sure the CMake config files do not recreate the already-existing targets +set(QT_NO_CREATE_TARGETS TRUE) +set(QT_SUPERBUILD TRUE) + +set(QT_BUILD_SUBMODULES "qtbase;qttranslations;qtsvg;qtshadertools;qtmultimedia" CACHE STRING "Submodules to build") + +foreach(module IN LISTS QT_BUILD_SUBMODULES) + message(NOTICE "Configuring '${module}'") + add_subdirectory("${module}") + + if(module STREQUAL "qtbase") + list(APPEND CMAKE_PREFIX_PATH "${QtBase_BINARY_DIR}/lib/cmake") + list(APPEND CMAKE_FIND_ROOT_PATH "${QtBase_BINARY_DIR}") + endif() +endforeach() + +# Display a summary of everything +include(QtBuildInformation) +include(QtPlatformSupport) +qt_print_feature_summary() +qt_print_build_instructions() diff --git a/contrib/depends/patches/ncurses/fallback.c b/contrib/depends/patches/ncurses/fallback.c deleted file mode 100644 index fab108c..0000000 --- a/contrib/depends/patches/ncurses/fallback.c +++ /dev/null @@ -1,6621 +0,0 @@ -/* This file was generated by tinfo/MKfallback.sh */ - -/* - * DO NOT EDIT THIS FILE BY HAND! - */ - -#include - -#include - -/* fallback entries for: linux rxvt vt100 xterm xterm-256color screen screen.linux screen.rxvt screen.xterm-new screen.xterm-256color */ -/* linux */ - -static char linux_alias_data[] = "linux|linux console"; - -static char linux_s_bel [] = "\007"; -static char linux_s_cr [] = "\015"; -static char linux_s_csr [] = "\033[%i%p1%d;%p2%dr"; -static char linux_s_tbc [] = "\033[3g"; -static char linux_s_clear [] = "\033[H\033[J"; -static char linux_s_el [] = "\033[K"; -static char linux_s_ed [] = "\033[J"; -static char linux_s_hpa [] = "\033[%i%p1%dG"; -static char linux_s_cup [] = "\033[%i%p1%d;%p2%dH"; -static char linux_s_cud1 [] = "\012"; -static char linux_s_home [] = "\033[H"; -static char linux_s_civis [] = "\033[?25l\033[?1c"; -static char linux_s_cub1 [] = "\010"; -static char linux_s_cnorm [] = "\033[?25h\033[?0c"; -static char linux_s_cuf1 [] = "\033[C"; -static char linux_s_cuu1 [] = "\033[A"; -static char linux_s_cvvis [] = "\033[?25h\033[?8c"; -static char linux_s_dch1 [] = "\033[P"; -static char linux_s_dl1 [] = "\033[M"; -static char linux_s_smacs [] = "\016"; -static char linux_s_blink [] = "\033[5m"; -static char linux_s_bold [] = "\033[1m"; -static char linux_s_dim [] = "\033[2m"; -static char linux_s_smir [] = "\033[4h"; -static char linux_s_rev [] = "\033[7m"; -static char linux_s_smso [] = "\033[7m"; -static char linux_s_smul [] = "\033[4m"; -static char linux_s_ech [] = "\033[%p1%dX"; -static char linux_s_rmacs [] = "\017"; -static char linux_s_sgr0 [] = "\033[m\017"; -static char linux_s_rmir [] = "\033[4l"; -static char linux_s_rmso [] = "\033[27m"; -static char linux_s_rmul [] = "\033[24m"; -static char linux_s_flash [] = "\033[?5h$<200/>\033[?5l"; -static char linux_s_ich1 [] = "\033[@"; -static char linux_s_il1 [] = "\033[L"; -static char linux_s_kbs [] = "\177"; -static char linux_s_kdch1 [] = "\033[3~"; -static char linux_s_kcud1 [] = "\033[B"; -static char linux_s_kf1 [] = "\033[[A"; -static char linux_s_kf10 [] = "\033[21~"; -static char linux_s_kf2 [] = "\033[[B"; -static char linux_s_kf3 [] = "\033[[C"; -static char linux_s_kf4 [] = "\033[[D"; -static char linux_s_kf5 [] = "\033[[E"; -static char linux_s_kf6 [] = "\033[17~"; -static char linux_s_kf7 [] = "\033[18~"; -static char linux_s_kf8 [] = "\033[19~"; -static char linux_s_kf9 [] = "\033[20~"; -static char linux_s_khome [] = "\033[1~"; -static char linux_s_kich1 [] = "\033[2~"; -static char linux_s_kcub1 [] = "\033[D"; -static char linux_s_knp [] = "\033[6~"; -static char linux_s_kpp [] = "\033[5~"; -static char linux_s_kcuf1 [] = "\033[C"; -static char linux_s_kcuu1 [] = "\033[A"; -static char linux_s_nel [] = "\015\012"; -static char linux_s_dch [] = "\033[%p1%dP"; -static char linux_s_dl [] = "\033[%p1%dM"; -static char linux_s_cud [] = "\033[%p1%dB"; -static char linux_s_ich [] = "\033[%p1%d@"; -static char linux_s_il [] = "\033[%p1%dL"; -static char linux_s_cub [] = "\033[%p1%dD"; -static char linux_s_cuf [] = "\033[%p1%dC"; -static char linux_s_cuu [] = "\033[%p1%dA"; -static char linux_s_rs1 [] = "\033c\033]R"; -static char linux_s_rc [] = "\0338"; -static char linux_s_vpa [] = "\033[%i%p1%dd"; -static char linux_s_sc [] = "\0337"; -static char linux_s_ind [] = "\012"; -static char linux_s_ri [] = "\033M"; -static char linux_s_sgr [] = "\033[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;m%?%p9%t\016%e\017%;"; -static char linux_s_hts [] = "\033H"; -static char linux_s_ht [] = "\011"; -static char linux_s_kb2 [] = "\033[G"; -static char linux_s_acsc [] = "++,,--..00__``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}c~~"; -static char linux_s_kcbt [] = "\033[Z"; -static char linux_s_smam [] = "\033[?7h"; -static char linux_s_rmam [] = "\033[?7l"; -static char linux_s_enacs [] = "\033)0"; -static char linux_s_kend [] = "\033[4~"; -static char linux_s_kspd [] = "\032"; -static char linux_s_kf11 [] = "\033[23~"; -static char linux_s_kf12 [] = "\033[24~"; -static char linux_s_kf13 [] = "\033[25~"; -static char linux_s_kf14 [] = "\033[26~"; -static char linux_s_kf15 [] = "\033[28~"; -static char linux_s_kf16 [] = "\033[29~"; -static char linux_s_kf17 [] = "\033[31~"; -static char linux_s_kf18 [] = "\033[32~"; -static char linux_s_kf19 [] = "\033[33~"; -static char linux_s_kf20 [] = "\033[34~"; -static char linux_s_el1 [] = "\033[1K"; -static char linux_s_u6 [] = "\033[%i%d;%dR"; -static char linux_s_u7 [] = "\033[6n"; -static char linux_s_u8 [] = "\033[?6c"; -static char linux_s_u9 [] = "\033[c"; -static char linux_s_op [] = "\033[39;49m"; -static char linux_s_oc [] = "\033]R"; -static char linux_s_initc [] = "\033]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x"; -static char linux_s_kmous [] = "\033[M"; -static char linux_s_setaf [] = "\033[3%p1%dm"; -static char linux_s_setab [] = "\033[4%p1%dm"; -static char linux_s_smpch [] = "\033[11m"; -static char linux_s_rmpch [] = "\033[10m"; - -static char linux_bool_data[] = { - /* 0: bw */ FALSE, - /* 1: am */ TRUE, - /* 2: xsb */ FALSE, - /* 3: xhp */ FALSE, - /* 4: xenl */ TRUE, - /* 5: eo */ TRUE, - /* 6: gn */ FALSE, - /* 7: hc */ FALSE, - /* 8: km */ FALSE, - /* 9: hs */ FALSE, - /* 10: in */ FALSE, - /* 11: da */ FALSE, - /* 12: db */ FALSE, - /* 13: mir */ TRUE, - /* 14: msgr */ TRUE, - /* 15: os */ FALSE, - /* 16: eslok */ FALSE, - /* 17: xt */ FALSE, - /* 18: hz */ FALSE, - /* 19: ul */ FALSE, - /* 20: xon */ TRUE, - /* 21: nxon */ FALSE, - /* 22: mc5i */ FALSE, - /* 23: chts */ FALSE, - /* 24: nrrmc */ FALSE, - /* 25: npc */ FALSE, - /* 26: ndscr */ FALSE, - /* 27: ccc */ TRUE, - /* 28: bce */ TRUE, - /* 29: hls */ FALSE, - /* 30: xhpa */ FALSE, - /* 31: crxm */ FALSE, - /* 32: daisy */ FALSE, - /* 33: xvpa */ FALSE, - /* 34: sam */ FALSE, - /* 35: cpix */ FALSE, - /* 36: lpix */ FALSE, - /* 37: OTbs */ FALSE, - /* 38: OTns */ FALSE, - /* 39: OTnc */ FALSE, - /* 40: OTMT */ FALSE, - /* 41: OTNL */ FALSE, - /* 42: OTpt */ FALSE, - /* 43: OTxr */ FALSE, -}; -static NCURSES_INT2 linux_number_data[] = { - /* 0: cols */ ABSENT_NUMERIC, - /* 1: it */ 8, - /* 2: lines */ ABSENT_NUMERIC, - /* 3: lm */ ABSENT_NUMERIC, - /* 4: xmc */ ABSENT_NUMERIC, - /* 5: pb */ ABSENT_NUMERIC, - /* 6: vt */ ABSENT_NUMERIC, - /* 7: wsl */ ABSENT_NUMERIC, - /* 8: nlab */ ABSENT_NUMERIC, - /* 9: lh */ ABSENT_NUMERIC, - /* 10: lw */ ABSENT_NUMERIC, - /* 11: ma */ ABSENT_NUMERIC, - /* 12: wnum */ ABSENT_NUMERIC, - /* 13: colors */ 8, - /* 14: pairs */ 64, - /* 15: ncv */ 18, - /* 16: bufsz */ ABSENT_NUMERIC, - /* 17: spinv */ ABSENT_NUMERIC, - /* 18: spinh */ ABSENT_NUMERIC, - /* 19: maddr */ ABSENT_NUMERIC, - /* 20: mjump */ ABSENT_NUMERIC, - /* 21: mcs */ ABSENT_NUMERIC, - /* 22: mls */ ABSENT_NUMERIC, - /* 23: npins */ ABSENT_NUMERIC, - /* 24: orc */ ABSENT_NUMERIC, - /* 25: orl */ ABSENT_NUMERIC, - /* 26: orhi */ ABSENT_NUMERIC, - /* 27: orvi */ ABSENT_NUMERIC, - /* 28: cps */ ABSENT_NUMERIC, - /* 29: widcs */ ABSENT_NUMERIC, - /* 30: btns */ ABSENT_NUMERIC, - /* 31: bitwin */ ABSENT_NUMERIC, - /* 32: bitype */ ABSENT_NUMERIC, - /* 33: OTug */ ABSENT_NUMERIC, - /* 34: OTdC */ ABSENT_NUMERIC, - /* 35: OTdN */ ABSENT_NUMERIC, - /* 36: OTdB */ ABSENT_NUMERIC, - /* 37: OTdT */ ABSENT_NUMERIC, - /* 38: OTkn */ ABSENT_NUMERIC, -}; -static char * linux_string_data[] = { - /* 0: cbt */ ABSENT_STRING, - /* 1: bel */ linux_s_bel, - /* 2: cr */ linux_s_cr, - /* 3: csr */ linux_s_csr, - /* 4: tbc */ linux_s_tbc, - /* 5: clear */ linux_s_clear, - /* 6: el */ linux_s_el, - /* 7: ed */ linux_s_ed, - /* 8: hpa */ linux_s_hpa, - /* 9: cmdch */ ABSENT_STRING, - /* 10: cup */ linux_s_cup, - /* 11: cud1 */ linux_s_cud1, - /* 12: home */ linux_s_home, - /* 13: civis */ linux_s_civis, - /* 14: cub1 */ linux_s_cub1, - /* 15: mrcup */ ABSENT_STRING, - /* 16: cnorm */ linux_s_cnorm, - /* 17: cuf1 */ linux_s_cuf1, - /* 18: ll */ ABSENT_STRING, - /* 19: cuu1 */ linux_s_cuu1, - /* 20: cvvis */ linux_s_cvvis, - /* 21: dch1 */ linux_s_dch1, - /* 22: dl1 */ linux_s_dl1, - /* 23: dsl */ ABSENT_STRING, - /* 24: hd */ ABSENT_STRING, - /* 25: smacs */ linux_s_smacs, - /* 26: blink */ linux_s_blink, - /* 27: bold */ linux_s_bold, - /* 28: smcup */ ABSENT_STRING, - /* 29: smdc */ ABSENT_STRING, - /* 30: dim */ linux_s_dim, - /* 31: smir */ linux_s_smir, - /* 32: invis */ ABSENT_STRING, - /* 33: prot */ ABSENT_STRING, - /* 34: rev */ linux_s_rev, - /* 35: smso */ linux_s_smso, - /* 36: smul */ linux_s_smul, - /* 37: ech */ linux_s_ech, - /* 38: rmacs */ linux_s_rmacs, - /* 39: sgr0 */ linux_s_sgr0, - /* 40: rmcup */ ABSENT_STRING, - /* 41: rmdc */ ABSENT_STRING, - /* 42: rmir */ linux_s_rmir, - /* 43: rmso */ linux_s_rmso, - /* 44: rmul */ linux_s_rmul, - /* 45: flash */ linux_s_flash, - /* 46: ff */ ABSENT_STRING, - /* 47: fsl */ ABSENT_STRING, - /* 48: is1 */ ABSENT_STRING, - /* 49: is2 */ ABSENT_STRING, - /* 50: is3 */ ABSENT_STRING, - /* 51: if */ ABSENT_STRING, - /* 52: ich1 */ linux_s_ich1, - /* 53: il1 */ linux_s_il1, - /* 54: ip */ ABSENT_STRING, - /* 55: kbs */ linux_s_kbs, - /* 56: ktbc */ ABSENT_STRING, - /* 57: kclr */ ABSENT_STRING, - /* 58: kctab */ ABSENT_STRING, - /* 59: kdch1 */ linux_s_kdch1, - /* 60: kdl1 */ ABSENT_STRING, - /* 61: kcud1 */ linux_s_kcud1, - /* 62: krmir */ ABSENT_STRING, - /* 63: kel */ ABSENT_STRING, - /* 64: ked */ ABSENT_STRING, - /* 65: kf0 */ ABSENT_STRING, - /* 66: kf1 */ linux_s_kf1, - /* 67: kf10 */ linux_s_kf10, - /* 68: kf2 */ linux_s_kf2, - /* 69: kf3 */ linux_s_kf3, - /* 70: kf4 */ linux_s_kf4, - /* 71: kf5 */ linux_s_kf5, - /* 72: kf6 */ linux_s_kf6, - /* 73: kf7 */ linux_s_kf7, - /* 74: kf8 */ linux_s_kf8, - /* 75: kf9 */ linux_s_kf9, - /* 76: khome */ linux_s_khome, - /* 77: kich1 */ linux_s_kich1, - /* 78: kil1 */ ABSENT_STRING, - /* 79: kcub1 */ linux_s_kcub1, - /* 80: kll */ ABSENT_STRING, - /* 81: knp */ linux_s_knp, - /* 82: kpp */ linux_s_kpp, - /* 83: kcuf1 */ linux_s_kcuf1, - /* 84: kind */ ABSENT_STRING, - /* 85: kri */ ABSENT_STRING, - /* 86: khts */ ABSENT_STRING, - /* 87: kcuu1 */ linux_s_kcuu1, - /* 88: rmkx */ ABSENT_STRING, - /* 89: smkx */ ABSENT_STRING, - /* 90: lf0 */ ABSENT_STRING, - /* 91: lf1 */ ABSENT_STRING, - /* 92: lf10 */ ABSENT_STRING, - /* 93: lf2 */ ABSENT_STRING, - /* 94: lf3 */ ABSENT_STRING, - /* 95: lf4 */ ABSENT_STRING, - /* 96: lf5 */ ABSENT_STRING, - /* 97: lf6 */ ABSENT_STRING, - /* 98: lf7 */ ABSENT_STRING, - /* 99: lf8 */ ABSENT_STRING, - /* 100: lf9 */ ABSENT_STRING, - /* 101: rmm */ ABSENT_STRING, - /* 102: smm */ ABSENT_STRING, - /* 103: nel */ linux_s_nel, - /* 104: pad */ ABSENT_STRING, - /* 105: dch */ linux_s_dch, - /* 106: dl */ linux_s_dl, - /* 107: cud */ linux_s_cud, - /* 108: ich */ linux_s_ich, - /* 109: indn */ ABSENT_STRING, - /* 110: il */ linux_s_il, - /* 111: cub */ linux_s_cub, - /* 112: cuf */ linux_s_cuf, - /* 113: rin */ ABSENT_STRING, - /* 114: cuu */ linux_s_cuu, - /* 115: pfkey */ ABSENT_STRING, - /* 116: pfloc */ ABSENT_STRING, - /* 117: pfx */ ABSENT_STRING, - /* 118: mc0 */ ABSENT_STRING, - /* 119: mc4 */ ABSENT_STRING, - /* 120: mc5 */ ABSENT_STRING, - /* 121: rep */ ABSENT_STRING, - /* 122: rs1 */ linux_s_rs1, - /* 123: rs2 */ ABSENT_STRING, - /* 124: rs3 */ ABSENT_STRING, - /* 125: rf */ ABSENT_STRING, - /* 126: rc */ linux_s_rc, - /* 127: vpa */ linux_s_vpa, - /* 128: sc */ linux_s_sc, - /* 129: ind */ linux_s_ind, - /* 130: ri */ linux_s_ri, - /* 131: sgr */ linux_s_sgr, - /* 132: hts */ linux_s_hts, - /* 133: wind */ ABSENT_STRING, - /* 134: ht */ linux_s_ht, - /* 135: tsl */ ABSENT_STRING, - /* 136: uc */ ABSENT_STRING, - /* 137: hu */ ABSENT_STRING, - /* 138: iprog */ ABSENT_STRING, - /* 139: ka1 */ ABSENT_STRING, - /* 140: ka3 */ ABSENT_STRING, - /* 141: kb2 */ linux_s_kb2, - /* 142: kc1 */ ABSENT_STRING, - /* 143: kc3 */ ABSENT_STRING, - /* 144: mc5p */ ABSENT_STRING, - /* 145: rmp */ ABSENT_STRING, - /* 146: acsc */ linux_s_acsc, - /* 147: pln */ ABSENT_STRING, - /* 148: kcbt */ linux_s_kcbt, - /* 149: smxon */ ABSENT_STRING, - /* 150: rmxon */ ABSENT_STRING, - /* 151: smam */ linux_s_smam, - /* 152: rmam */ linux_s_rmam, - /* 153: xonc */ ABSENT_STRING, - /* 154: xoffc */ ABSENT_STRING, - /* 155: enacs */ linux_s_enacs, - /* 156: smln */ ABSENT_STRING, - /* 157: rmln */ ABSENT_STRING, - /* 158: kbeg */ ABSENT_STRING, - /* 159: kcan */ ABSENT_STRING, - /* 160: kclo */ ABSENT_STRING, - /* 161: kcmd */ ABSENT_STRING, - /* 162: kcpy */ ABSENT_STRING, - /* 163: kcrt */ ABSENT_STRING, - /* 164: kend */ linux_s_kend, - /* 165: kent */ ABSENT_STRING, - /* 166: kext */ ABSENT_STRING, - /* 167: kfnd */ ABSENT_STRING, - /* 168: khlp */ ABSENT_STRING, - /* 169: kmrk */ ABSENT_STRING, - /* 170: kmsg */ ABSENT_STRING, - /* 171: kmov */ ABSENT_STRING, - /* 172: knxt */ ABSENT_STRING, - /* 173: kopn */ ABSENT_STRING, - /* 174: kopt */ ABSENT_STRING, - /* 175: kprv */ ABSENT_STRING, - /* 176: kprt */ ABSENT_STRING, - /* 177: krdo */ ABSENT_STRING, - /* 178: kref */ ABSENT_STRING, - /* 179: krfr */ ABSENT_STRING, - /* 180: krpl */ ABSENT_STRING, - /* 181: krst */ ABSENT_STRING, - /* 182: kres */ ABSENT_STRING, - /* 183: ksav */ ABSENT_STRING, - /* 184: kspd */ linux_s_kspd, - /* 185: kund */ ABSENT_STRING, - /* 186: kBEG */ ABSENT_STRING, - /* 187: kCAN */ ABSENT_STRING, - /* 188: kCMD */ ABSENT_STRING, - /* 189: kCPY */ ABSENT_STRING, - /* 190: kCRT */ ABSENT_STRING, - /* 191: kDC */ ABSENT_STRING, - /* 192: kDL */ ABSENT_STRING, - /* 193: kslt */ ABSENT_STRING, - /* 194: kEND */ ABSENT_STRING, - /* 195: kEOL */ ABSENT_STRING, - /* 196: kEXT */ ABSENT_STRING, - /* 197: kFND */ ABSENT_STRING, - /* 198: kHLP */ ABSENT_STRING, - /* 199: kHOM */ ABSENT_STRING, - /* 200: kIC */ ABSENT_STRING, - /* 201: kLFT */ ABSENT_STRING, - /* 202: kMSG */ ABSENT_STRING, - /* 203: kMOV */ ABSENT_STRING, - /* 204: kNXT */ ABSENT_STRING, - /* 205: kOPT */ ABSENT_STRING, - /* 206: kPRV */ ABSENT_STRING, - /* 207: kPRT */ ABSENT_STRING, - /* 208: kRDO */ ABSENT_STRING, - /* 209: kRPL */ ABSENT_STRING, - /* 210: kRIT */ ABSENT_STRING, - /* 211: kRES */ ABSENT_STRING, - /* 212: kSAV */ ABSENT_STRING, - /* 213: kSPD */ ABSENT_STRING, - /* 214: kUND */ ABSENT_STRING, - /* 215: rfi */ ABSENT_STRING, - /* 216: kf11 */ linux_s_kf11, - /* 217: kf12 */ linux_s_kf12, - /* 218: kf13 */ linux_s_kf13, - /* 219: kf14 */ linux_s_kf14, - /* 220: kf15 */ linux_s_kf15, - /* 221: kf16 */ linux_s_kf16, - /* 222: kf17 */ linux_s_kf17, - /* 223: kf18 */ linux_s_kf18, - /* 224: kf19 */ linux_s_kf19, - /* 225: kf20 */ linux_s_kf20, - /* 226: kf21 */ ABSENT_STRING, - /* 227: kf22 */ ABSENT_STRING, - /* 228: kf23 */ ABSENT_STRING, - /* 229: kf24 */ ABSENT_STRING, - /* 230: kf25 */ ABSENT_STRING, - /* 231: kf26 */ ABSENT_STRING, - /* 232: kf27 */ ABSENT_STRING, - /* 233: kf28 */ ABSENT_STRING, - /* 234: kf29 */ ABSENT_STRING, - /* 235: kf30 */ ABSENT_STRING, - /* 236: kf31 */ ABSENT_STRING, - /* 237: kf32 */ ABSENT_STRING, - /* 238: kf33 */ ABSENT_STRING, - /* 239: kf34 */ ABSENT_STRING, - /* 240: kf35 */ ABSENT_STRING, - /* 241: kf36 */ ABSENT_STRING, - /* 242: kf37 */ ABSENT_STRING, - /* 243: kf38 */ ABSENT_STRING, - /* 244: kf39 */ ABSENT_STRING, - /* 245: kf40 */ ABSENT_STRING, - /* 246: kf41 */ ABSENT_STRING, - /* 247: kf42 */ ABSENT_STRING, - /* 248: kf43 */ ABSENT_STRING, - /* 249: kf44 */ ABSENT_STRING, - /* 250: kf45 */ ABSENT_STRING, - /* 251: kf46 */ ABSENT_STRING, - /* 252: kf47 */ ABSENT_STRING, - /* 253: kf48 */ ABSENT_STRING, - /* 254: kf49 */ ABSENT_STRING, - /* 255: kf50 */ ABSENT_STRING, - /* 256: kf51 */ ABSENT_STRING, - /* 257: kf52 */ ABSENT_STRING, - /* 258: kf53 */ ABSENT_STRING, - /* 259: kf54 */ ABSENT_STRING, - /* 260: kf55 */ ABSENT_STRING, - /* 261: kf56 */ ABSENT_STRING, - /* 262: kf57 */ ABSENT_STRING, - /* 263: kf58 */ ABSENT_STRING, - /* 264: kf59 */ ABSENT_STRING, - /* 265: kf60 */ ABSENT_STRING, - /* 266: kf61 */ ABSENT_STRING, - /* 267: kf62 */ ABSENT_STRING, - /* 268: kf63 */ ABSENT_STRING, - /* 269: el1 */ linux_s_el1, - /* 270: mgc */ ABSENT_STRING, - /* 271: smgl */ ABSENT_STRING, - /* 272: smgr */ ABSENT_STRING, - /* 273: fln */ ABSENT_STRING, - /* 274: sclk */ ABSENT_STRING, - /* 275: dclk */ ABSENT_STRING, - /* 276: rmclk */ ABSENT_STRING, - /* 277: cwin */ ABSENT_STRING, - /* 278: wingo */ ABSENT_STRING, - /* 279: hup */ ABSENT_STRING, - /* 280: dial */ ABSENT_STRING, - /* 281: qdial */ ABSENT_STRING, - /* 282: tone */ ABSENT_STRING, - /* 283: pulse */ ABSENT_STRING, - /* 284: hook */ ABSENT_STRING, - /* 285: pause */ ABSENT_STRING, - /* 286: wait */ ABSENT_STRING, - /* 287: u0 */ ABSENT_STRING, - /* 288: u1 */ ABSENT_STRING, - /* 289: u2 */ ABSENT_STRING, - /* 290: u3 */ ABSENT_STRING, - /* 291: u4 */ ABSENT_STRING, - /* 292: u5 */ ABSENT_STRING, - /* 293: u6 */ linux_s_u6, - /* 294: u7 */ linux_s_u7, - /* 295: u8 */ linux_s_u8, - /* 296: u9 */ linux_s_u9, - /* 297: op */ linux_s_op, - /* 298: oc */ linux_s_oc, - /* 299: initc */ linux_s_initc, - /* 300: initp */ ABSENT_STRING, - /* 301: scp */ ABSENT_STRING, - /* 302: setf */ ABSENT_STRING, - /* 303: setb */ ABSENT_STRING, - /* 304: cpi */ ABSENT_STRING, - /* 305: lpi */ ABSENT_STRING, - /* 306: chr */ ABSENT_STRING, - /* 307: cvr */ ABSENT_STRING, - /* 308: defc */ ABSENT_STRING, - /* 309: swidm */ ABSENT_STRING, - /* 310: sdrfq */ ABSENT_STRING, - /* 311: sitm */ ABSENT_STRING, - /* 312: slm */ ABSENT_STRING, - /* 313: smicm */ ABSENT_STRING, - /* 314: snlq */ ABSENT_STRING, - /* 315: snrmq */ ABSENT_STRING, - /* 316: sshm */ ABSENT_STRING, - /* 317: ssubm */ ABSENT_STRING, - /* 318: ssupm */ ABSENT_STRING, - /* 319: sum */ ABSENT_STRING, - /* 320: rwidm */ ABSENT_STRING, - /* 321: ritm */ ABSENT_STRING, - /* 322: rlm */ ABSENT_STRING, - /* 323: rmicm */ ABSENT_STRING, - /* 324: rshm */ ABSENT_STRING, - /* 325: rsubm */ ABSENT_STRING, - /* 326: rsupm */ ABSENT_STRING, - /* 327: rum */ ABSENT_STRING, - /* 328: mhpa */ ABSENT_STRING, - /* 329: mcud1 */ ABSENT_STRING, - /* 330: mcub1 */ ABSENT_STRING, - /* 331: mcuf1 */ ABSENT_STRING, - /* 332: mvpa */ ABSENT_STRING, - /* 333: mcuu1 */ ABSENT_STRING, - /* 334: porder */ ABSENT_STRING, - /* 335: mcud */ ABSENT_STRING, - /* 336: mcub */ ABSENT_STRING, - /* 337: mcuf */ ABSENT_STRING, - /* 338: mcuu */ ABSENT_STRING, - /* 339: scs */ ABSENT_STRING, - /* 340: smgb */ ABSENT_STRING, - /* 341: smgbp */ ABSENT_STRING, - /* 342: smglp */ ABSENT_STRING, - /* 343: smgrp */ ABSENT_STRING, - /* 344: smgt */ ABSENT_STRING, - /* 345: smgtp */ ABSENT_STRING, - /* 346: sbim */ ABSENT_STRING, - /* 347: scsd */ ABSENT_STRING, - /* 348: rbim */ ABSENT_STRING, - /* 349: rcsd */ ABSENT_STRING, - /* 350: subcs */ ABSENT_STRING, - /* 351: supcs */ ABSENT_STRING, - /* 352: docr */ ABSENT_STRING, - /* 353: zerom */ ABSENT_STRING, - /* 354: csnm */ ABSENT_STRING, - /* 355: kmous */ linux_s_kmous, - /* 356: minfo */ ABSENT_STRING, - /* 357: reqmp */ ABSENT_STRING, - /* 358: getm */ ABSENT_STRING, - /* 359: setaf */ linux_s_setaf, - /* 360: setab */ linux_s_setab, - /* 361: pfxl */ ABSENT_STRING, - /* 362: devt */ ABSENT_STRING, - /* 363: csin */ ABSENT_STRING, - /* 364: s0ds */ ABSENT_STRING, - /* 365: s1ds */ ABSENT_STRING, - /* 366: s2ds */ ABSENT_STRING, - /* 367: s3ds */ ABSENT_STRING, - /* 368: smglr */ ABSENT_STRING, - /* 369: smgtb */ ABSENT_STRING, - /* 370: birep */ ABSENT_STRING, - /* 371: binel */ ABSENT_STRING, - /* 372: bicr */ ABSENT_STRING, - /* 373: colornm */ ABSENT_STRING, - /* 374: defbi */ ABSENT_STRING, - /* 375: endbi */ ABSENT_STRING, - /* 376: setcolor */ ABSENT_STRING, - /* 377: slines */ ABSENT_STRING, - /* 378: dispc */ ABSENT_STRING, - /* 379: smpch */ linux_s_smpch, - /* 380: rmpch */ linux_s_rmpch, - /* 381: smsc */ ABSENT_STRING, - /* 382: rmsc */ ABSENT_STRING, - /* 383: pctrm */ ABSENT_STRING, - /* 384: scesc */ ABSENT_STRING, - /* 385: scesa */ ABSENT_STRING, - /* 386: ehhlm */ ABSENT_STRING, - /* 387: elhlm */ ABSENT_STRING, - /* 388: elohlm */ ABSENT_STRING, - /* 389: erhlm */ ABSENT_STRING, - /* 390: ethlm */ ABSENT_STRING, - /* 391: evhlm */ ABSENT_STRING, - /* 392: sgr1 */ ABSENT_STRING, - /* 393: slength */ ABSENT_STRING, - /* 394: OTi2 */ ABSENT_STRING, - /* 395: OTrs */ ABSENT_STRING, - /* 396: OTnl */ ABSENT_STRING, - /* 397: OTbc */ ABSENT_STRING, - /* 398: OTko */ ABSENT_STRING, - /* 399: OTma */ ABSENT_STRING, - /* 400: OTG2 */ ABSENT_STRING, - /* 401: OTG3 */ ABSENT_STRING, - /* 402: OTG1 */ ABSENT_STRING, - /* 403: OTG4 */ ABSENT_STRING, - /* 404: OTGR */ ABSENT_STRING, - /* 405: OTGL */ ABSENT_STRING, - /* 406: OTGU */ ABSENT_STRING, - /* 407: OTGD */ ABSENT_STRING, - /* 408: OTGH */ ABSENT_STRING, - /* 409: OTGV */ ABSENT_STRING, - /* 410: OTGC */ ABSENT_STRING, - /* 411: meml */ ABSENT_STRING, - /* 412: memu */ ABSENT_STRING, - /* 413: box1 */ ABSENT_STRING, -}; -/* rxvt */ - -static char rxvt_alias_data[] = "rxvt|rxvt terminal emulator (X Window System)"; - -static char rxvt_s_bel [] = "\007"; -static char rxvt_s_cr [] = "\015"; -static char rxvt_s_csr [] = "\033[%i%p1%d;%p2%dr"; -static char rxvt_s_tbc [] = "\033[3g"; -static char rxvt_s_clear [] = "\033[H\033[2J"; -static char rxvt_s_el [] = "\033[K"; -static char rxvt_s_ed [] = "\033[J"; -static char rxvt_s_hpa [] = "\033[%i%p1%dG"; -static char rxvt_s_cup [] = "\033[%i%p1%d;%p2%dH"; -static char rxvt_s_cud1 [] = "\012"; -static char rxvt_s_home [] = "\033[H"; -static char rxvt_s_civis [] = "\033[?25l"; -static char rxvt_s_cub1 [] = "\010"; -static char rxvt_s_cnorm [] = "\033[?25h"; -static char rxvt_s_cuf1 [] = "\033[C"; -static char rxvt_s_cuu1 [] = "\033[A"; -static char rxvt_s_dl1 [] = "\033[M"; -static char rxvt_s_smacs [] = "\016"; -static char rxvt_s_blink [] = "\033[5m"; -static char rxvt_s_bold [] = "\033[1m"; -static char rxvt_s_smcup [] = "\0337\033[?47h"; -static char rxvt_s_smir [] = "\033[4h"; -static char rxvt_s_rev [] = "\033[7m"; -static char rxvt_s_smso [] = "\033[7m"; -static char rxvt_s_smul [] = "\033[4m"; -static char rxvt_s_rmacs [] = "\017"; -static char rxvt_s_sgr0 [] = "\033[m\017"; -static char rxvt_s_rmcup [] = "\033[2J\033[?47l\0338"; -static char rxvt_s_rmir [] = "\033[4l"; -static char rxvt_s_rmso [] = "\033[27m"; -static char rxvt_s_rmul [] = "\033[24m"; -static char rxvt_s_flash [] = "\033[?5h$<100/>\033[?5l"; -static char rxvt_s_is1 [] = "\033[?47l\033=\033[?1l"; -static char rxvt_s_is2 [] = "\033[r\033[m\033[2J\033[H\033[?7h\033[?1;3;4;6l\033[4l"; -static char rxvt_s_ich1 [] = "\033[@"; -static char rxvt_s_il1 [] = "\033[L"; -static char rxvt_s_kbs [] = "\010"; -static char rxvt_s_kdch1 [] = "\033[3~"; -static char rxvt_s_kcud1 [] = "\033[B"; -static char rxvt_s_kel [] = "\033[8^"; -static char rxvt_s_kf0 [] = "\033[21~"; -static char rxvt_s_kf1 [] = "\033[11~"; -static char rxvt_s_kf10 [] = "\033[21~"; -static char rxvt_s_kf2 [] = "\033[12~"; -static char rxvt_s_kf3 [] = "\033[13~"; -static char rxvt_s_kf4 [] = "\033[14~"; -static char rxvt_s_kf5 [] = "\033[15~"; -static char rxvt_s_kf6 [] = "\033[17~"; -static char rxvt_s_kf7 [] = "\033[18~"; -static char rxvt_s_kf8 [] = "\033[19~"; -static char rxvt_s_kf9 [] = "\033[20~"; -static char rxvt_s_khome [] = "\033[7~"; -static char rxvt_s_kich1 [] = "\033[2~"; -static char rxvt_s_kcub1 [] = "\033[D"; -static char rxvt_s_knp [] = "\033[6~"; -static char rxvt_s_kpp [] = "\033[5~"; -static char rxvt_s_kcuf1 [] = "\033[C"; -static char rxvt_s_kind [] = "\033[a"; -static char rxvt_s_kri [] = "\033[b"; -static char rxvt_s_kcuu1 [] = "\033[A"; -static char rxvt_s_rmkx [] = "\033>"; -static char rxvt_s_smkx [] = "\033="; -static char rxvt_s_dl [] = "\033[%p1%dM"; -static char rxvt_s_cud [] = "\033[%p1%dB"; -static char rxvt_s_ich [] = "\033[%p1%d@"; -static char rxvt_s_il [] = "\033[%p1%dL"; -static char rxvt_s_cub [] = "\033[%p1%dD"; -static char rxvt_s_cuf [] = "\033[%p1%dC"; -static char rxvt_s_cuu [] = "\033[%p1%dA"; -static char rxvt_s_rs1 [] = "\033>\033[1;3;4;5;6l\033[?7h\033[m\033[r\033[2J\033[H"; -static char rxvt_s_rs2 [] = "\033[r\033[m\033[2J\033[H\033[?7h\033[?1;3;4;6l\033[4l\033>\033[?1000l\033[?25h"; -static char rxvt_s_rc [] = "\0338"; -static char rxvt_s_vpa [] = "\033[%i%p1%dd"; -static char rxvt_s_sc [] = "\0337"; -static char rxvt_s_ind [] = "\012"; -static char rxvt_s_ri [] = "\033M"; -static char rxvt_s_sgr [] = "\033[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;"; -static char rxvt_s_hts [] = "\033H"; -static char rxvt_s_ht [] = "\011"; -static char rxvt_s_ka1 [] = "\033Ow"; -static char rxvt_s_ka3 [] = "\033Oy"; -static char rxvt_s_kb2 [] = "\033Ou"; -static char rxvt_s_kc1 [] = "\033Oq"; -static char rxvt_s_kc3 [] = "\033Os"; -static char rxvt_s_acsc [] = "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"; -static char rxvt_s_kcbt [] = "\033[Z"; -static char rxvt_s_enacs [] = "\033(B\033)0"; -static char rxvt_s_kend [] = "\033[8~"; -static char rxvt_s_kent [] = "\033OM"; -static char rxvt_s_kfnd [] = "\033[1~"; -static char rxvt_s_kDC [] = "\033[3$"; -static char rxvt_s_kslt [] = "\033[4~"; -static char rxvt_s_kEND [] = "\033[8$"; -static char rxvt_s_kHOM [] = "\033[7$"; -static char rxvt_s_kIC [] = "\033[2$"; -static char rxvt_s_kLFT [] = "\033[d"; -static char rxvt_s_kNXT [] = "\033[6$"; -static char rxvt_s_kPRV [] = "\033[5$"; -static char rxvt_s_kRIT [] = "\033[c"; -static char rxvt_s_kf11 [] = "\033[23~"; -static char rxvt_s_kf12 [] = "\033[24~"; -static char rxvt_s_kf13 [] = "\033[25~"; -static char rxvt_s_kf14 [] = "\033[26~"; -static char rxvt_s_kf15 [] = "\033[28~"; -static char rxvt_s_kf16 [] = "\033[29~"; -static char rxvt_s_kf17 [] = "\033[31~"; -static char rxvt_s_kf18 [] = "\033[32~"; -static char rxvt_s_kf19 [] = "\033[33~"; -static char rxvt_s_kf20 [] = "\033[34~"; -static char rxvt_s_kf21 [] = "\033[23$"; -static char rxvt_s_kf22 [] = "\033[24$"; -static char rxvt_s_kf23 [] = "\033[11^"; -static char rxvt_s_kf24 [] = "\033[12^"; -static char rxvt_s_kf25 [] = "\033[13^"; -static char rxvt_s_kf26 [] = "\033[14^"; -static char rxvt_s_kf27 [] = "\033[15^"; -static char rxvt_s_kf28 [] = "\033[17^"; -static char rxvt_s_kf29 [] = "\033[18^"; -static char rxvt_s_kf30 [] = "\033[19^"; -static char rxvt_s_kf31 [] = "\033[20^"; -static char rxvt_s_kf32 [] = "\033[21^"; -static char rxvt_s_kf33 [] = "\033[23^"; -static char rxvt_s_kf34 [] = "\033[24^"; -static char rxvt_s_kf35 [] = "\033[25^"; -static char rxvt_s_kf36 [] = "\033[26^"; -static char rxvt_s_kf37 [] = "\033[28^"; -static char rxvt_s_kf38 [] = "\033[29^"; -static char rxvt_s_kf39 [] = "\033[31^"; -static char rxvt_s_kf40 [] = "\033[32^"; -static char rxvt_s_kf41 [] = "\033[33^"; -static char rxvt_s_kf42 [] = "\033[34^"; -static char rxvt_s_kf43 [] = "\033[23@"; -static char rxvt_s_kf44 [] = "\033[24@"; -static char rxvt_s_el1 [] = "\033[1K"; -static char rxvt_s_u6 [] = "\033[%i%d;%dR"; -static char rxvt_s_u7 [] = "\033[6n"; -static char rxvt_s_u8 [] = "\033[?1;2c"; -static char rxvt_s_u9 [] = "\033[c"; -static char rxvt_s_op [] = "\033[39;49m"; -static char rxvt_s_kmous [] = "\033[M"; -static char rxvt_s_setaf [] = "\033[3%p1%dm"; -static char rxvt_s_setab [] = "\033[4%p1%dm"; -static char rxvt_s_s0ds [] = "\033(B"; -static char rxvt_s_s1ds [] = "\033(0"; - -static char rxvt_bool_data[] = { - /* 0: bw */ FALSE, - /* 1: am */ TRUE, - /* 2: xsb */ FALSE, - /* 3: xhp */ FALSE, - /* 4: xenl */ TRUE, - /* 5: eo */ TRUE, - /* 6: gn */ FALSE, - /* 7: hc */ FALSE, - /* 8: km */ FALSE, - /* 9: hs */ FALSE, - /* 10: in */ FALSE, - /* 11: da */ FALSE, - /* 12: db */ FALSE, - /* 13: mir */ TRUE, - /* 14: msgr */ TRUE, - /* 15: os */ FALSE, - /* 16: eslok */ FALSE, - /* 17: xt */ FALSE, - /* 18: hz */ FALSE, - /* 19: ul */ FALSE, - /* 20: xon */ TRUE, - /* 21: nxon */ FALSE, - /* 22: mc5i */ FALSE, - /* 23: chts */ FALSE, - /* 24: nrrmc */ FALSE, - /* 25: npc */ FALSE, - /* 26: ndscr */ FALSE, - /* 27: ccc */ FALSE, - /* 28: bce */ TRUE, - /* 29: hls */ FALSE, - /* 30: xhpa */ FALSE, - /* 31: crxm */ FALSE, - /* 32: daisy */ FALSE, - /* 33: xvpa */ FALSE, - /* 34: sam */ FALSE, - /* 35: cpix */ FALSE, - /* 36: lpix */ FALSE, - /* 37: OTbs */ TRUE, - /* 38: OTns */ FALSE, - /* 39: OTnc */ FALSE, - /* 40: OTMT */ FALSE, - /* 41: OTNL */ FALSE, - /* 42: OTpt */ FALSE, - /* 43: OTxr */ FALSE, -}; -static NCURSES_INT2 rxvt_number_data[] = { - /* 0: cols */ 80, - /* 1: it */ 8, - /* 2: lines */ 24, - /* 3: lm */ ABSENT_NUMERIC, - /* 4: xmc */ ABSENT_NUMERIC, - /* 5: pb */ ABSENT_NUMERIC, - /* 6: vt */ ABSENT_NUMERIC, - /* 7: wsl */ ABSENT_NUMERIC, - /* 8: nlab */ ABSENT_NUMERIC, - /* 9: lh */ ABSENT_NUMERIC, - /* 10: lw */ ABSENT_NUMERIC, - /* 11: ma */ ABSENT_NUMERIC, - /* 12: wnum */ ABSENT_NUMERIC, - /* 13: colors */ 8, - /* 14: pairs */ 64, - /* 15: ncv */ CANCELLED_NUMERIC, - /* 16: bufsz */ ABSENT_NUMERIC, - /* 17: spinv */ ABSENT_NUMERIC, - /* 18: spinh */ ABSENT_NUMERIC, - /* 19: maddr */ ABSENT_NUMERIC, - /* 20: mjump */ ABSENT_NUMERIC, - /* 21: mcs */ ABSENT_NUMERIC, - /* 22: mls */ ABSENT_NUMERIC, - /* 23: npins */ ABSENT_NUMERIC, - /* 24: orc */ ABSENT_NUMERIC, - /* 25: orl */ ABSENT_NUMERIC, - /* 26: orhi */ ABSENT_NUMERIC, - /* 27: orvi */ ABSENT_NUMERIC, - /* 28: cps */ ABSENT_NUMERIC, - /* 29: widcs */ ABSENT_NUMERIC, - /* 30: btns */ ABSENT_NUMERIC, - /* 31: bitwin */ ABSENT_NUMERIC, - /* 32: bitype */ ABSENT_NUMERIC, - /* 33: OTug */ ABSENT_NUMERIC, - /* 34: OTdC */ ABSENT_NUMERIC, - /* 35: OTdN */ ABSENT_NUMERIC, - /* 36: OTdB */ ABSENT_NUMERIC, - /* 37: OTdT */ ABSENT_NUMERIC, - /* 38: OTkn */ ABSENT_NUMERIC, -}; -static char * rxvt_string_data[] = { - /* 0: cbt */ ABSENT_STRING, - /* 1: bel */ rxvt_s_bel, - /* 2: cr */ rxvt_s_cr, - /* 3: csr */ rxvt_s_csr, - /* 4: tbc */ rxvt_s_tbc, - /* 5: clear */ rxvt_s_clear, - /* 6: el */ rxvt_s_el, - /* 7: ed */ rxvt_s_ed, - /* 8: hpa */ rxvt_s_hpa, - /* 9: cmdch */ ABSENT_STRING, - /* 10: cup */ rxvt_s_cup, - /* 11: cud1 */ rxvt_s_cud1, - /* 12: home */ rxvt_s_home, - /* 13: civis */ rxvt_s_civis, - /* 14: cub1 */ rxvt_s_cub1, - /* 15: mrcup */ ABSENT_STRING, - /* 16: cnorm */ rxvt_s_cnorm, - /* 17: cuf1 */ rxvt_s_cuf1, - /* 18: ll */ ABSENT_STRING, - /* 19: cuu1 */ rxvt_s_cuu1, - /* 20: cvvis */ ABSENT_STRING, - /* 21: dch1 */ ABSENT_STRING, - /* 22: dl1 */ rxvt_s_dl1, - /* 23: dsl */ ABSENT_STRING, - /* 24: hd */ ABSENT_STRING, - /* 25: smacs */ rxvt_s_smacs, - /* 26: blink */ rxvt_s_blink, - /* 27: bold */ rxvt_s_bold, - /* 28: smcup */ rxvt_s_smcup, - /* 29: smdc */ ABSENT_STRING, - /* 30: dim */ ABSENT_STRING, - /* 31: smir */ rxvt_s_smir, - /* 32: invis */ ABSENT_STRING, - /* 33: prot */ ABSENT_STRING, - /* 34: rev */ rxvt_s_rev, - /* 35: smso */ rxvt_s_smso, - /* 36: smul */ rxvt_s_smul, - /* 37: ech */ ABSENT_STRING, - /* 38: rmacs */ rxvt_s_rmacs, - /* 39: sgr0 */ rxvt_s_sgr0, - /* 40: rmcup */ rxvt_s_rmcup, - /* 41: rmdc */ ABSENT_STRING, - /* 42: rmir */ rxvt_s_rmir, - /* 43: rmso */ rxvt_s_rmso, - /* 44: rmul */ rxvt_s_rmul, - /* 45: flash */ rxvt_s_flash, - /* 46: ff */ ABSENT_STRING, - /* 47: fsl */ ABSENT_STRING, - /* 48: is1 */ rxvt_s_is1, - /* 49: is2 */ rxvt_s_is2, - /* 50: is3 */ ABSENT_STRING, - /* 51: if */ ABSENT_STRING, - /* 52: ich1 */ rxvt_s_ich1, - /* 53: il1 */ rxvt_s_il1, - /* 54: ip */ ABSENT_STRING, - /* 55: kbs */ rxvt_s_kbs, - /* 56: ktbc */ ABSENT_STRING, - /* 57: kclr */ ABSENT_STRING, - /* 58: kctab */ ABSENT_STRING, - /* 59: kdch1 */ rxvt_s_kdch1, - /* 60: kdl1 */ ABSENT_STRING, - /* 61: kcud1 */ rxvt_s_kcud1, - /* 62: krmir */ ABSENT_STRING, - /* 63: kel */ rxvt_s_kel, - /* 64: ked */ ABSENT_STRING, - /* 65: kf0 */ rxvt_s_kf0, - /* 66: kf1 */ rxvt_s_kf1, - /* 67: kf10 */ rxvt_s_kf10, - /* 68: kf2 */ rxvt_s_kf2, - /* 69: kf3 */ rxvt_s_kf3, - /* 70: kf4 */ rxvt_s_kf4, - /* 71: kf5 */ rxvt_s_kf5, - /* 72: kf6 */ rxvt_s_kf6, - /* 73: kf7 */ rxvt_s_kf7, - /* 74: kf8 */ rxvt_s_kf8, - /* 75: kf9 */ rxvt_s_kf9, - /* 76: khome */ rxvt_s_khome, - /* 77: kich1 */ rxvt_s_kich1, - /* 78: kil1 */ ABSENT_STRING, - /* 79: kcub1 */ rxvt_s_kcub1, - /* 80: kll */ ABSENT_STRING, - /* 81: knp */ rxvt_s_knp, - /* 82: kpp */ rxvt_s_kpp, - /* 83: kcuf1 */ rxvt_s_kcuf1, - /* 84: kind */ rxvt_s_kind, - /* 85: kri */ rxvt_s_kri, - /* 86: khts */ ABSENT_STRING, - /* 87: kcuu1 */ rxvt_s_kcuu1, - /* 88: rmkx */ rxvt_s_rmkx, - /* 89: smkx */ rxvt_s_smkx, - /* 90: lf0 */ ABSENT_STRING, - /* 91: lf1 */ ABSENT_STRING, - /* 92: lf10 */ ABSENT_STRING, - /* 93: lf2 */ ABSENT_STRING, - /* 94: lf3 */ ABSENT_STRING, - /* 95: lf4 */ ABSENT_STRING, - /* 96: lf5 */ ABSENT_STRING, - /* 97: lf6 */ ABSENT_STRING, - /* 98: lf7 */ ABSENT_STRING, - /* 99: lf8 */ ABSENT_STRING, - /* 100: lf9 */ ABSENT_STRING, - /* 101: rmm */ ABSENT_STRING, - /* 102: smm */ ABSENT_STRING, - /* 103: nel */ ABSENT_STRING, - /* 104: pad */ ABSENT_STRING, - /* 105: dch */ ABSENT_STRING, - /* 106: dl */ rxvt_s_dl, - /* 107: cud */ rxvt_s_cud, - /* 108: ich */ rxvt_s_ich, - /* 109: indn */ ABSENT_STRING, - /* 110: il */ rxvt_s_il, - /* 111: cub */ rxvt_s_cub, - /* 112: cuf */ rxvt_s_cuf, - /* 113: rin */ ABSENT_STRING, - /* 114: cuu */ rxvt_s_cuu, - /* 115: pfkey */ ABSENT_STRING, - /* 116: pfloc */ ABSENT_STRING, - /* 117: pfx */ ABSENT_STRING, - /* 118: mc0 */ ABSENT_STRING, - /* 119: mc4 */ ABSENT_STRING, - /* 120: mc5 */ ABSENT_STRING, - /* 121: rep */ ABSENT_STRING, - /* 122: rs1 */ rxvt_s_rs1, - /* 123: rs2 */ rxvt_s_rs2, - /* 124: rs3 */ ABSENT_STRING, - /* 125: rf */ ABSENT_STRING, - /* 126: rc */ rxvt_s_rc, - /* 127: vpa */ rxvt_s_vpa, - /* 128: sc */ rxvt_s_sc, - /* 129: ind */ rxvt_s_ind, - /* 130: ri */ rxvt_s_ri, - /* 131: sgr */ rxvt_s_sgr, - /* 132: hts */ rxvt_s_hts, - /* 133: wind */ ABSENT_STRING, - /* 134: ht */ rxvt_s_ht, - /* 135: tsl */ ABSENT_STRING, - /* 136: uc */ ABSENT_STRING, - /* 137: hu */ ABSENT_STRING, - /* 138: iprog */ ABSENT_STRING, - /* 139: ka1 */ rxvt_s_ka1, - /* 140: ka3 */ rxvt_s_ka3, - /* 141: kb2 */ rxvt_s_kb2, - /* 142: kc1 */ rxvt_s_kc1, - /* 143: kc3 */ rxvt_s_kc3, - /* 144: mc5p */ ABSENT_STRING, - /* 145: rmp */ ABSENT_STRING, - /* 146: acsc */ rxvt_s_acsc, - /* 147: pln */ ABSENT_STRING, - /* 148: kcbt */ rxvt_s_kcbt, - /* 149: smxon */ ABSENT_STRING, - /* 150: rmxon */ ABSENT_STRING, - /* 151: smam */ ABSENT_STRING, - /* 152: rmam */ ABSENT_STRING, - /* 153: xonc */ ABSENT_STRING, - /* 154: xoffc */ ABSENT_STRING, - /* 155: enacs */ rxvt_s_enacs, - /* 156: smln */ ABSENT_STRING, - /* 157: rmln */ ABSENT_STRING, - /* 158: kbeg */ ABSENT_STRING, - /* 159: kcan */ ABSENT_STRING, - /* 160: kclo */ ABSENT_STRING, - /* 161: kcmd */ ABSENT_STRING, - /* 162: kcpy */ ABSENT_STRING, - /* 163: kcrt */ ABSENT_STRING, - /* 164: kend */ rxvt_s_kend, - /* 165: kent */ rxvt_s_kent, - /* 166: kext */ ABSENT_STRING, - /* 167: kfnd */ rxvt_s_kfnd, - /* 168: khlp */ ABSENT_STRING, - /* 169: kmrk */ ABSENT_STRING, - /* 170: kmsg */ ABSENT_STRING, - /* 171: kmov */ ABSENT_STRING, - /* 172: knxt */ ABSENT_STRING, - /* 173: kopn */ ABSENT_STRING, - /* 174: kopt */ ABSENT_STRING, - /* 175: kprv */ ABSENT_STRING, - /* 176: kprt */ ABSENT_STRING, - /* 177: krdo */ ABSENT_STRING, - /* 178: kref */ ABSENT_STRING, - /* 179: krfr */ ABSENT_STRING, - /* 180: krpl */ ABSENT_STRING, - /* 181: krst */ ABSENT_STRING, - /* 182: kres */ ABSENT_STRING, - /* 183: ksav */ ABSENT_STRING, - /* 184: kspd */ ABSENT_STRING, - /* 185: kund */ ABSENT_STRING, - /* 186: kBEG */ ABSENT_STRING, - /* 187: kCAN */ ABSENT_STRING, - /* 188: kCMD */ ABSENT_STRING, - /* 189: kCPY */ ABSENT_STRING, - /* 190: kCRT */ ABSENT_STRING, - /* 191: kDC */ rxvt_s_kDC, - /* 192: kDL */ ABSENT_STRING, - /* 193: kslt */ rxvt_s_kslt, - /* 194: kEND */ rxvt_s_kEND, - /* 195: kEOL */ ABSENT_STRING, - /* 196: kEXT */ ABSENT_STRING, - /* 197: kFND */ ABSENT_STRING, - /* 198: kHLP */ ABSENT_STRING, - /* 199: kHOM */ rxvt_s_kHOM, - /* 200: kIC */ rxvt_s_kIC, - /* 201: kLFT */ rxvt_s_kLFT, - /* 202: kMSG */ ABSENT_STRING, - /* 203: kMOV */ ABSENT_STRING, - /* 204: kNXT */ rxvt_s_kNXT, - /* 205: kOPT */ ABSENT_STRING, - /* 206: kPRV */ rxvt_s_kPRV, - /* 207: kPRT */ ABSENT_STRING, - /* 208: kRDO */ ABSENT_STRING, - /* 209: kRPL */ ABSENT_STRING, - /* 210: kRIT */ rxvt_s_kRIT, - /* 211: kRES */ ABSENT_STRING, - /* 212: kSAV */ ABSENT_STRING, - /* 213: kSPD */ ABSENT_STRING, - /* 214: kUND */ ABSENT_STRING, - /* 215: rfi */ ABSENT_STRING, - /* 216: kf11 */ rxvt_s_kf11, - /* 217: kf12 */ rxvt_s_kf12, - /* 218: kf13 */ rxvt_s_kf13, - /* 219: kf14 */ rxvt_s_kf14, - /* 220: kf15 */ rxvt_s_kf15, - /* 221: kf16 */ rxvt_s_kf16, - /* 222: kf17 */ rxvt_s_kf17, - /* 223: kf18 */ rxvt_s_kf18, - /* 224: kf19 */ rxvt_s_kf19, - /* 225: kf20 */ rxvt_s_kf20, - /* 226: kf21 */ rxvt_s_kf21, - /* 227: kf22 */ rxvt_s_kf22, - /* 228: kf23 */ rxvt_s_kf23, - /* 229: kf24 */ rxvt_s_kf24, - /* 230: kf25 */ rxvt_s_kf25, - /* 231: kf26 */ rxvt_s_kf26, - /* 232: kf27 */ rxvt_s_kf27, - /* 233: kf28 */ rxvt_s_kf28, - /* 234: kf29 */ rxvt_s_kf29, - /* 235: kf30 */ rxvt_s_kf30, - /* 236: kf31 */ rxvt_s_kf31, - /* 237: kf32 */ rxvt_s_kf32, - /* 238: kf33 */ rxvt_s_kf33, - /* 239: kf34 */ rxvt_s_kf34, - /* 240: kf35 */ rxvt_s_kf35, - /* 241: kf36 */ rxvt_s_kf36, - /* 242: kf37 */ rxvt_s_kf37, - /* 243: kf38 */ rxvt_s_kf38, - /* 244: kf39 */ rxvt_s_kf39, - /* 245: kf40 */ rxvt_s_kf40, - /* 246: kf41 */ rxvt_s_kf41, - /* 247: kf42 */ rxvt_s_kf42, - /* 248: kf43 */ rxvt_s_kf43, - /* 249: kf44 */ rxvt_s_kf44, - /* 250: kf45 */ ABSENT_STRING, - /* 251: kf46 */ ABSENT_STRING, - /* 252: kf47 */ ABSENT_STRING, - /* 253: kf48 */ ABSENT_STRING, - /* 254: kf49 */ ABSENT_STRING, - /* 255: kf50 */ ABSENT_STRING, - /* 256: kf51 */ ABSENT_STRING, - /* 257: kf52 */ ABSENT_STRING, - /* 258: kf53 */ ABSENT_STRING, - /* 259: kf54 */ ABSENT_STRING, - /* 260: kf55 */ ABSENT_STRING, - /* 261: kf56 */ ABSENT_STRING, - /* 262: kf57 */ ABSENT_STRING, - /* 263: kf58 */ ABSENT_STRING, - /* 264: kf59 */ ABSENT_STRING, - /* 265: kf60 */ ABSENT_STRING, - /* 266: kf61 */ ABSENT_STRING, - /* 267: kf62 */ ABSENT_STRING, - /* 268: kf63 */ ABSENT_STRING, - /* 269: el1 */ rxvt_s_el1, - /* 270: mgc */ ABSENT_STRING, - /* 271: smgl */ ABSENT_STRING, - /* 272: smgr */ ABSENT_STRING, - /* 273: fln */ ABSENT_STRING, - /* 274: sclk */ ABSENT_STRING, - /* 275: dclk */ ABSENT_STRING, - /* 276: rmclk */ ABSENT_STRING, - /* 277: cwin */ ABSENT_STRING, - /* 278: wingo */ ABSENT_STRING, - /* 279: hup */ ABSENT_STRING, - /* 280: dial */ ABSENT_STRING, - /* 281: qdial */ ABSENT_STRING, - /* 282: tone */ ABSENT_STRING, - /* 283: pulse */ ABSENT_STRING, - /* 284: hook */ ABSENT_STRING, - /* 285: pause */ ABSENT_STRING, - /* 286: wait */ ABSENT_STRING, - /* 287: u0 */ ABSENT_STRING, - /* 288: u1 */ ABSENT_STRING, - /* 289: u2 */ ABSENT_STRING, - /* 290: u3 */ ABSENT_STRING, - /* 291: u4 */ ABSENT_STRING, - /* 292: u5 */ ABSENT_STRING, - /* 293: u6 */ rxvt_s_u6, - /* 294: u7 */ rxvt_s_u7, - /* 295: u8 */ rxvt_s_u8, - /* 296: u9 */ rxvt_s_u9, - /* 297: op */ rxvt_s_op, - /* 298: oc */ ABSENT_STRING, - /* 299: initc */ ABSENT_STRING, - /* 300: initp */ ABSENT_STRING, - /* 301: scp */ ABSENT_STRING, - /* 302: setf */ ABSENT_STRING, - /* 303: setb */ ABSENT_STRING, - /* 304: cpi */ ABSENT_STRING, - /* 305: lpi */ ABSENT_STRING, - /* 306: chr */ ABSENT_STRING, - /* 307: cvr */ ABSENT_STRING, - /* 308: defc */ ABSENT_STRING, - /* 309: swidm */ ABSENT_STRING, - /* 310: sdrfq */ ABSENT_STRING, - /* 311: sitm */ ABSENT_STRING, - /* 312: slm */ ABSENT_STRING, - /* 313: smicm */ ABSENT_STRING, - /* 314: snlq */ ABSENT_STRING, - /* 315: snrmq */ ABSENT_STRING, - /* 316: sshm */ ABSENT_STRING, - /* 317: ssubm */ ABSENT_STRING, - /* 318: ssupm */ ABSENT_STRING, - /* 319: sum */ ABSENT_STRING, - /* 320: rwidm */ ABSENT_STRING, - /* 321: ritm */ ABSENT_STRING, - /* 322: rlm */ ABSENT_STRING, - /* 323: rmicm */ ABSENT_STRING, - /* 324: rshm */ ABSENT_STRING, - /* 325: rsubm */ ABSENT_STRING, - /* 326: rsupm */ ABSENT_STRING, - /* 327: rum */ ABSENT_STRING, - /* 328: mhpa */ ABSENT_STRING, - /* 329: mcud1 */ ABSENT_STRING, - /* 330: mcub1 */ ABSENT_STRING, - /* 331: mcuf1 */ ABSENT_STRING, - /* 332: mvpa */ ABSENT_STRING, - /* 333: mcuu1 */ ABSENT_STRING, - /* 334: porder */ ABSENT_STRING, - /* 335: mcud */ ABSENT_STRING, - /* 336: mcub */ ABSENT_STRING, - /* 337: mcuf */ ABSENT_STRING, - /* 338: mcuu */ ABSENT_STRING, - /* 339: scs */ ABSENT_STRING, - /* 340: smgb */ ABSENT_STRING, - /* 341: smgbp */ ABSENT_STRING, - /* 342: smglp */ ABSENT_STRING, - /* 343: smgrp */ ABSENT_STRING, - /* 344: smgt */ ABSENT_STRING, - /* 345: smgtp */ ABSENT_STRING, - /* 346: sbim */ ABSENT_STRING, - /* 347: scsd */ ABSENT_STRING, - /* 348: rbim */ ABSENT_STRING, - /* 349: rcsd */ ABSENT_STRING, - /* 350: subcs */ ABSENT_STRING, - /* 351: supcs */ ABSENT_STRING, - /* 352: docr */ ABSENT_STRING, - /* 353: zerom */ ABSENT_STRING, - /* 354: csnm */ ABSENT_STRING, - /* 355: kmous */ rxvt_s_kmous, - /* 356: minfo */ ABSENT_STRING, - /* 357: reqmp */ ABSENT_STRING, - /* 358: getm */ ABSENT_STRING, - /* 359: setaf */ rxvt_s_setaf, - /* 360: setab */ rxvt_s_setab, - /* 361: pfxl */ ABSENT_STRING, - /* 362: devt */ ABSENT_STRING, - /* 363: csin */ ABSENT_STRING, - /* 364: s0ds */ rxvt_s_s0ds, - /* 365: s1ds */ rxvt_s_s1ds, - /* 366: s2ds */ ABSENT_STRING, - /* 367: s3ds */ ABSENT_STRING, - /* 368: smglr */ ABSENT_STRING, - /* 369: smgtb */ ABSENT_STRING, - /* 370: birep */ ABSENT_STRING, - /* 371: binel */ ABSENT_STRING, - /* 372: bicr */ ABSENT_STRING, - /* 373: colornm */ ABSENT_STRING, - /* 374: defbi */ ABSENT_STRING, - /* 375: endbi */ ABSENT_STRING, - /* 376: setcolor */ ABSENT_STRING, - /* 377: slines */ ABSENT_STRING, - /* 378: dispc */ ABSENT_STRING, - /* 379: smpch */ ABSENT_STRING, - /* 380: rmpch */ ABSENT_STRING, - /* 381: smsc */ ABSENT_STRING, - /* 382: rmsc */ ABSENT_STRING, - /* 383: pctrm */ ABSENT_STRING, - /* 384: scesc */ ABSENT_STRING, - /* 385: scesa */ ABSENT_STRING, - /* 386: ehhlm */ ABSENT_STRING, - /* 387: elhlm */ ABSENT_STRING, - /* 388: elohlm */ ABSENT_STRING, - /* 389: erhlm */ ABSENT_STRING, - /* 390: ethlm */ ABSENT_STRING, - /* 391: evhlm */ ABSENT_STRING, - /* 392: sgr1 */ ABSENT_STRING, - /* 393: slength */ ABSENT_STRING, - /* 394: OTi2 */ ABSENT_STRING, - /* 395: OTrs */ ABSENT_STRING, - /* 396: OTnl */ ABSENT_STRING, - /* 397: OTbc */ ABSENT_STRING, - /* 398: OTko */ ABSENT_STRING, - /* 399: OTma */ ABSENT_STRING, - /* 400: OTG2 */ ABSENT_STRING, - /* 401: OTG3 */ ABSENT_STRING, - /* 402: OTG1 */ ABSENT_STRING, - /* 403: OTG4 */ ABSENT_STRING, - /* 404: OTGR */ ABSENT_STRING, - /* 405: OTGL */ ABSENT_STRING, - /* 406: OTGU */ ABSENT_STRING, - /* 407: OTGD */ ABSENT_STRING, - /* 408: OTGH */ ABSENT_STRING, - /* 409: OTGV */ ABSENT_STRING, - /* 410: OTGC */ ABSENT_STRING, - /* 411: meml */ ABSENT_STRING, - /* 412: memu */ ABSENT_STRING, - /* 413: box1 */ ABSENT_STRING, -}; -/* vt100 */ - -static char vt100_alias_data[] = "vt100|vt100-am|dec vt100 (w/advanced video)"; - -static char vt100_s_bel [] = "\007"; -static char vt100_s_cr [] = "\015"; -static char vt100_s_csr [] = "\033[%i%p1%d;%p2%dr"; -static char vt100_s_tbc [] = "\033[3g"; -static char vt100_s_clear [] = "\033[H\033[J$<50>"; -static char vt100_s_el [] = "\033[K$<3>"; -static char vt100_s_ed [] = "\033[J$<50>"; -static char vt100_s_cup [] = "\033[%i%p1%d;%p2%dH$<5>"; -static char vt100_s_cud1 [] = "\012"; -static char vt100_s_home [] = "\033[H"; -static char vt100_s_cub1 [] = "\010"; -static char vt100_s_cuf1 [] = "\033[C$<2>"; -static char vt100_s_cuu1 [] = "\033[A$<2>"; -static char vt100_s_smacs [] = "\016"; -static char vt100_s_blink [] = "\033[5m$<2>"; -static char vt100_s_bold [] = "\033[1m$<2>"; -static char vt100_s_rev [] = "\033[7m$<2>"; -static char vt100_s_smso [] = "\033[7m$<2>"; -static char vt100_s_smul [] = "\033[4m$<2>"; -static char vt100_s_rmacs [] = "\017"; -static char vt100_s_sgr0 [] = "\033[m\017$<2>"; -static char vt100_s_rmso [] = "\033[m$<2>"; -static char vt100_s_rmul [] = "\033[m$<2>"; -static char vt100_s_kbs [] = "\010"; -static char vt100_s_kcud1 [] = "\033OB"; -static char vt100_s_kf0 [] = "\033Oy"; -static char vt100_s_kf1 [] = "\033OP"; -static char vt100_s_kf10 [] = "\033Ox"; -static char vt100_s_kf2 [] = "\033OQ"; -static char vt100_s_kf3 [] = "\033OR"; -static char vt100_s_kf4 [] = "\033OS"; -static char vt100_s_kf5 [] = "\033Ot"; -static char vt100_s_kf6 [] = "\033Ou"; -static char vt100_s_kf7 [] = "\033Ov"; -static char vt100_s_kf8 [] = "\033Ol"; -static char vt100_s_kf9 [] = "\033Ow"; -static char vt100_s_kcub1 [] = "\033OD"; -static char vt100_s_kcuf1 [] = "\033OC"; -static char vt100_s_kcuu1 [] = "\033OA"; -static char vt100_s_rmkx [] = "\033[?1l\033>"; -static char vt100_s_smkx [] = "\033[?1h\033="; -static char vt100_s_lf1 [] = "pf1"; -static char vt100_s_lf2 [] = "pf2"; -static char vt100_s_lf3 [] = "pf3"; -static char vt100_s_lf4 [] = "pf4"; -static char vt100_s_cud [] = "\033[%p1%dB"; -static char vt100_s_cub [] = "\033[%p1%dD"; -static char vt100_s_cuf [] = "\033[%p1%dC"; -static char vt100_s_cuu [] = "\033[%p1%dA"; -static char vt100_s_mc0 [] = "\033[0i"; -static char vt100_s_mc4 [] = "\033[4i"; -static char vt100_s_mc5 [] = "\033[5i"; -static char vt100_s_rs2 [] = "\033<\033>\033[?3;4;5l\033[?7;8h\033[r"; -static char vt100_s_rc [] = "\0338"; -static char vt100_s_sc [] = "\0337"; -static char vt100_s_ind [] = "\012"; -static char vt100_s_ri [] = "\033M$<5>"; -static char vt100_s_sgr [] = "\033[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>"; -static char vt100_s_hts [] = "\033H"; -static char vt100_s_ht [] = "\011"; -static char vt100_s_ka1 [] = "\033Oq"; -static char vt100_s_ka3 [] = "\033Os"; -static char vt100_s_kb2 [] = "\033Or"; -static char vt100_s_kc1 [] = "\033Op"; -static char vt100_s_kc3 [] = "\033On"; -static char vt100_s_acsc [] = "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"; -static char vt100_s_smam [] = "\033[?7h"; -static char vt100_s_rmam [] = "\033[?7l"; -static char vt100_s_enacs [] = "\033(B\033)0"; -static char vt100_s_kent [] = "\033OM"; -static char vt100_s_el1 [] = "\033[1K$<3>"; - -static char vt100_bool_data[] = { - /* 0: bw */ FALSE, - /* 1: am */ TRUE, - /* 2: xsb */ FALSE, - /* 3: xhp */ FALSE, - /* 4: xenl */ TRUE, - /* 5: eo */ FALSE, - /* 6: gn */ FALSE, - /* 7: hc */ FALSE, - /* 8: km */ FALSE, - /* 9: hs */ FALSE, - /* 10: in */ FALSE, - /* 11: da */ FALSE, - /* 12: db */ FALSE, - /* 13: mir */ FALSE, - /* 14: msgr */ TRUE, - /* 15: os */ FALSE, - /* 16: eslok */ FALSE, - /* 17: xt */ FALSE, - /* 18: hz */ FALSE, - /* 19: ul */ FALSE, - /* 20: xon */ TRUE, - /* 21: nxon */ FALSE, - /* 22: mc5i */ TRUE, - /* 23: chts */ FALSE, - /* 24: nrrmc */ FALSE, - /* 25: npc */ FALSE, - /* 26: ndscr */ FALSE, - /* 27: ccc */ FALSE, - /* 28: bce */ FALSE, - /* 29: hls */ FALSE, - /* 30: xhpa */ FALSE, - /* 31: crxm */ FALSE, - /* 32: daisy */ FALSE, - /* 33: xvpa */ FALSE, - /* 34: sam */ FALSE, - /* 35: cpix */ FALSE, - /* 36: lpix */ FALSE, - /* 37: OTbs */ TRUE, - /* 38: OTns */ FALSE, - /* 39: OTnc */ FALSE, - /* 40: OTMT */ FALSE, - /* 41: OTNL */ FALSE, - /* 42: OTpt */ FALSE, - /* 43: OTxr */ FALSE, -}; -static NCURSES_INT2 vt100_number_data[] = { - /* 0: cols */ 80, - /* 1: it */ 8, - /* 2: lines */ 24, - /* 3: lm */ ABSENT_NUMERIC, - /* 4: xmc */ ABSENT_NUMERIC, - /* 5: pb */ ABSENT_NUMERIC, - /* 6: vt */ 3, - /* 7: wsl */ ABSENT_NUMERIC, - /* 8: nlab */ ABSENT_NUMERIC, - /* 9: lh */ ABSENT_NUMERIC, - /* 10: lw */ ABSENT_NUMERIC, - /* 11: ma */ ABSENT_NUMERIC, - /* 12: wnum */ ABSENT_NUMERIC, - /* 13: colors */ ABSENT_NUMERIC, - /* 14: pairs */ ABSENT_NUMERIC, - /* 15: ncv */ ABSENT_NUMERIC, - /* 16: bufsz */ ABSENT_NUMERIC, - /* 17: spinv */ ABSENT_NUMERIC, - /* 18: spinh */ ABSENT_NUMERIC, - /* 19: maddr */ ABSENT_NUMERIC, - /* 20: mjump */ ABSENT_NUMERIC, - /* 21: mcs */ ABSENT_NUMERIC, - /* 22: mls */ ABSENT_NUMERIC, - /* 23: npins */ ABSENT_NUMERIC, - /* 24: orc */ ABSENT_NUMERIC, - /* 25: orl */ ABSENT_NUMERIC, - /* 26: orhi */ ABSENT_NUMERIC, - /* 27: orvi */ ABSENT_NUMERIC, - /* 28: cps */ ABSENT_NUMERIC, - /* 29: widcs */ ABSENT_NUMERIC, - /* 30: btns */ ABSENT_NUMERIC, - /* 31: bitwin */ ABSENT_NUMERIC, - /* 32: bitype */ ABSENT_NUMERIC, - /* 33: OTug */ ABSENT_NUMERIC, - /* 34: OTdC */ ABSENT_NUMERIC, - /* 35: OTdN */ ABSENT_NUMERIC, - /* 36: OTdB */ ABSENT_NUMERIC, - /* 37: OTdT */ ABSENT_NUMERIC, - /* 38: OTkn */ ABSENT_NUMERIC, -}; -static char * vt100_string_data[] = { - /* 0: cbt */ ABSENT_STRING, - /* 1: bel */ vt100_s_bel, - /* 2: cr */ vt100_s_cr, - /* 3: csr */ vt100_s_csr, - /* 4: tbc */ vt100_s_tbc, - /* 5: clear */ vt100_s_clear, - /* 6: el */ vt100_s_el, - /* 7: ed */ vt100_s_ed, - /* 8: hpa */ ABSENT_STRING, - /* 9: cmdch */ ABSENT_STRING, - /* 10: cup */ vt100_s_cup, - /* 11: cud1 */ vt100_s_cud1, - /* 12: home */ vt100_s_home, - /* 13: civis */ ABSENT_STRING, - /* 14: cub1 */ vt100_s_cub1, - /* 15: mrcup */ ABSENT_STRING, - /* 16: cnorm */ ABSENT_STRING, - /* 17: cuf1 */ vt100_s_cuf1, - /* 18: ll */ ABSENT_STRING, - /* 19: cuu1 */ vt100_s_cuu1, - /* 20: cvvis */ ABSENT_STRING, - /* 21: dch1 */ ABSENT_STRING, - /* 22: dl1 */ ABSENT_STRING, - /* 23: dsl */ ABSENT_STRING, - /* 24: hd */ ABSENT_STRING, - /* 25: smacs */ vt100_s_smacs, - /* 26: blink */ vt100_s_blink, - /* 27: bold */ vt100_s_bold, - /* 28: smcup */ ABSENT_STRING, - /* 29: smdc */ ABSENT_STRING, - /* 30: dim */ ABSENT_STRING, - /* 31: smir */ ABSENT_STRING, - /* 32: invis */ ABSENT_STRING, - /* 33: prot */ ABSENT_STRING, - /* 34: rev */ vt100_s_rev, - /* 35: smso */ vt100_s_smso, - /* 36: smul */ vt100_s_smul, - /* 37: ech */ ABSENT_STRING, - /* 38: rmacs */ vt100_s_rmacs, - /* 39: sgr0 */ vt100_s_sgr0, - /* 40: rmcup */ ABSENT_STRING, - /* 41: rmdc */ ABSENT_STRING, - /* 42: rmir */ ABSENT_STRING, - /* 43: rmso */ vt100_s_rmso, - /* 44: rmul */ vt100_s_rmul, - /* 45: flash */ ABSENT_STRING, - /* 46: ff */ ABSENT_STRING, - /* 47: fsl */ ABSENT_STRING, - /* 48: is1 */ ABSENT_STRING, - /* 49: is2 */ ABSENT_STRING, - /* 50: is3 */ ABSENT_STRING, - /* 51: if */ ABSENT_STRING, - /* 52: ich1 */ ABSENT_STRING, - /* 53: il1 */ ABSENT_STRING, - /* 54: ip */ ABSENT_STRING, - /* 55: kbs */ vt100_s_kbs, - /* 56: ktbc */ ABSENT_STRING, - /* 57: kclr */ ABSENT_STRING, - /* 58: kctab */ ABSENT_STRING, - /* 59: kdch1 */ ABSENT_STRING, - /* 60: kdl1 */ ABSENT_STRING, - /* 61: kcud1 */ vt100_s_kcud1, - /* 62: krmir */ ABSENT_STRING, - /* 63: kel */ ABSENT_STRING, - /* 64: ked */ ABSENT_STRING, - /* 65: kf0 */ vt100_s_kf0, - /* 66: kf1 */ vt100_s_kf1, - /* 67: kf10 */ vt100_s_kf10, - /* 68: kf2 */ vt100_s_kf2, - /* 69: kf3 */ vt100_s_kf3, - /* 70: kf4 */ vt100_s_kf4, - /* 71: kf5 */ vt100_s_kf5, - /* 72: kf6 */ vt100_s_kf6, - /* 73: kf7 */ vt100_s_kf7, - /* 74: kf8 */ vt100_s_kf8, - /* 75: kf9 */ vt100_s_kf9, - /* 76: khome */ ABSENT_STRING, - /* 77: kich1 */ ABSENT_STRING, - /* 78: kil1 */ ABSENT_STRING, - /* 79: kcub1 */ vt100_s_kcub1, - /* 80: kll */ ABSENT_STRING, - /* 81: knp */ ABSENT_STRING, - /* 82: kpp */ ABSENT_STRING, - /* 83: kcuf1 */ vt100_s_kcuf1, - /* 84: kind */ ABSENT_STRING, - /* 85: kri */ ABSENT_STRING, - /* 86: khts */ ABSENT_STRING, - /* 87: kcuu1 */ vt100_s_kcuu1, - /* 88: rmkx */ vt100_s_rmkx, - /* 89: smkx */ vt100_s_smkx, - /* 90: lf0 */ ABSENT_STRING, - /* 91: lf1 */ vt100_s_lf1, - /* 92: lf10 */ ABSENT_STRING, - /* 93: lf2 */ vt100_s_lf2, - /* 94: lf3 */ vt100_s_lf3, - /* 95: lf4 */ vt100_s_lf4, - /* 96: lf5 */ ABSENT_STRING, - /* 97: lf6 */ ABSENT_STRING, - /* 98: lf7 */ ABSENT_STRING, - /* 99: lf8 */ ABSENT_STRING, - /* 100: lf9 */ ABSENT_STRING, - /* 101: rmm */ ABSENT_STRING, - /* 102: smm */ ABSENT_STRING, - /* 103: nel */ ABSENT_STRING, - /* 104: pad */ ABSENT_STRING, - /* 105: dch */ ABSENT_STRING, - /* 106: dl */ ABSENT_STRING, - /* 107: cud */ vt100_s_cud, - /* 108: ich */ ABSENT_STRING, - /* 109: indn */ ABSENT_STRING, - /* 110: il */ ABSENT_STRING, - /* 111: cub */ vt100_s_cub, - /* 112: cuf */ vt100_s_cuf, - /* 113: rin */ ABSENT_STRING, - /* 114: cuu */ vt100_s_cuu, - /* 115: pfkey */ ABSENT_STRING, - /* 116: pfloc */ ABSENT_STRING, - /* 117: pfx */ ABSENT_STRING, - /* 118: mc0 */ vt100_s_mc0, - /* 119: mc4 */ vt100_s_mc4, - /* 120: mc5 */ vt100_s_mc5, - /* 121: rep */ ABSENT_STRING, - /* 122: rs1 */ ABSENT_STRING, - /* 123: rs2 */ vt100_s_rs2, - /* 124: rs3 */ ABSENT_STRING, - /* 125: rf */ ABSENT_STRING, - /* 126: rc */ vt100_s_rc, - /* 127: vpa */ ABSENT_STRING, - /* 128: sc */ vt100_s_sc, - /* 129: ind */ vt100_s_ind, - /* 130: ri */ vt100_s_ri, - /* 131: sgr */ vt100_s_sgr, - /* 132: hts */ vt100_s_hts, - /* 133: wind */ ABSENT_STRING, - /* 134: ht */ vt100_s_ht, - /* 135: tsl */ ABSENT_STRING, - /* 136: uc */ ABSENT_STRING, - /* 137: hu */ ABSENT_STRING, - /* 138: iprog */ ABSENT_STRING, - /* 139: ka1 */ vt100_s_ka1, - /* 140: ka3 */ vt100_s_ka3, - /* 141: kb2 */ vt100_s_kb2, - /* 142: kc1 */ vt100_s_kc1, - /* 143: kc3 */ vt100_s_kc3, - /* 144: mc5p */ ABSENT_STRING, - /* 145: rmp */ ABSENT_STRING, - /* 146: acsc */ vt100_s_acsc, - /* 147: pln */ ABSENT_STRING, - /* 148: kcbt */ ABSENT_STRING, - /* 149: smxon */ ABSENT_STRING, - /* 150: rmxon */ ABSENT_STRING, - /* 151: smam */ vt100_s_smam, - /* 152: rmam */ vt100_s_rmam, - /* 153: xonc */ ABSENT_STRING, - /* 154: xoffc */ ABSENT_STRING, - /* 155: enacs */ vt100_s_enacs, - /* 156: smln */ ABSENT_STRING, - /* 157: rmln */ ABSENT_STRING, - /* 158: kbeg */ ABSENT_STRING, - /* 159: kcan */ ABSENT_STRING, - /* 160: kclo */ ABSENT_STRING, - /* 161: kcmd */ ABSENT_STRING, - /* 162: kcpy */ ABSENT_STRING, - /* 163: kcrt */ ABSENT_STRING, - /* 164: kend */ ABSENT_STRING, - /* 165: kent */ vt100_s_kent, - /* 166: kext */ ABSENT_STRING, - /* 167: kfnd */ ABSENT_STRING, - /* 168: khlp */ ABSENT_STRING, - /* 169: kmrk */ ABSENT_STRING, - /* 170: kmsg */ ABSENT_STRING, - /* 171: kmov */ ABSENT_STRING, - /* 172: knxt */ ABSENT_STRING, - /* 173: kopn */ ABSENT_STRING, - /* 174: kopt */ ABSENT_STRING, - /* 175: kprv */ ABSENT_STRING, - /* 176: kprt */ ABSENT_STRING, - /* 177: krdo */ ABSENT_STRING, - /* 178: kref */ ABSENT_STRING, - /* 179: krfr */ ABSENT_STRING, - /* 180: krpl */ ABSENT_STRING, - /* 181: krst */ ABSENT_STRING, - /* 182: kres */ ABSENT_STRING, - /* 183: ksav */ ABSENT_STRING, - /* 184: kspd */ ABSENT_STRING, - /* 185: kund */ ABSENT_STRING, - /* 186: kBEG */ ABSENT_STRING, - /* 187: kCAN */ ABSENT_STRING, - /* 188: kCMD */ ABSENT_STRING, - /* 189: kCPY */ ABSENT_STRING, - /* 190: kCRT */ ABSENT_STRING, - /* 191: kDC */ ABSENT_STRING, - /* 192: kDL */ ABSENT_STRING, - /* 193: kslt */ ABSENT_STRING, - /* 194: kEND */ ABSENT_STRING, - /* 195: kEOL */ ABSENT_STRING, - /* 196: kEXT */ ABSENT_STRING, - /* 197: kFND */ ABSENT_STRING, - /* 198: kHLP */ ABSENT_STRING, - /* 199: kHOM */ ABSENT_STRING, - /* 200: kIC */ ABSENT_STRING, - /* 201: kLFT */ ABSENT_STRING, - /* 202: kMSG */ ABSENT_STRING, - /* 203: kMOV */ ABSENT_STRING, - /* 204: kNXT */ ABSENT_STRING, - /* 205: kOPT */ ABSENT_STRING, - /* 206: kPRV */ ABSENT_STRING, - /* 207: kPRT */ ABSENT_STRING, - /* 208: kRDO */ ABSENT_STRING, - /* 209: kRPL */ ABSENT_STRING, - /* 210: kRIT */ ABSENT_STRING, - /* 211: kRES */ ABSENT_STRING, - /* 212: kSAV */ ABSENT_STRING, - /* 213: kSPD */ ABSENT_STRING, - /* 214: kUND */ ABSENT_STRING, - /* 215: rfi */ ABSENT_STRING, - /* 216: kf11 */ ABSENT_STRING, - /* 217: kf12 */ ABSENT_STRING, - /* 218: kf13 */ ABSENT_STRING, - /* 219: kf14 */ ABSENT_STRING, - /* 220: kf15 */ ABSENT_STRING, - /* 221: kf16 */ ABSENT_STRING, - /* 222: kf17 */ ABSENT_STRING, - /* 223: kf18 */ ABSENT_STRING, - /* 224: kf19 */ ABSENT_STRING, - /* 225: kf20 */ ABSENT_STRING, - /* 226: kf21 */ ABSENT_STRING, - /* 227: kf22 */ ABSENT_STRING, - /* 228: kf23 */ ABSENT_STRING, - /* 229: kf24 */ ABSENT_STRING, - /* 230: kf25 */ ABSENT_STRING, - /* 231: kf26 */ ABSENT_STRING, - /* 232: kf27 */ ABSENT_STRING, - /* 233: kf28 */ ABSENT_STRING, - /* 234: kf29 */ ABSENT_STRING, - /* 235: kf30 */ ABSENT_STRING, - /* 236: kf31 */ ABSENT_STRING, - /* 237: kf32 */ ABSENT_STRING, - /* 238: kf33 */ ABSENT_STRING, - /* 239: kf34 */ ABSENT_STRING, - /* 240: kf35 */ ABSENT_STRING, - /* 241: kf36 */ ABSENT_STRING, - /* 242: kf37 */ ABSENT_STRING, - /* 243: kf38 */ ABSENT_STRING, - /* 244: kf39 */ ABSENT_STRING, - /* 245: kf40 */ ABSENT_STRING, - /* 246: kf41 */ ABSENT_STRING, - /* 247: kf42 */ ABSENT_STRING, - /* 248: kf43 */ ABSENT_STRING, - /* 249: kf44 */ ABSENT_STRING, - /* 250: kf45 */ ABSENT_STRING, - /* 251: kf46 */ ABSENT_STRING, - /* 252: kf47 */ ABSENT_STRING, - /* 253: kf48 */ ABSENT_STRING, - /* 254: kf49 */ ABSENT_STRING, - /* 255: kf50 */ ABSENT_STRING, - /* 256: kf51 */ ABSENT_STRING, - /* 257: kf52 */ ABSENT_STRING, - /* 258: kf53 */ ABSENT_STRING, - /* 259: kf54 */ ABSENT_STRING, - /* 260: kf55 */ ABSENT_STRING, - /* 261: kf56 */ ABSENT_STRING, - /* 262: kf57 */ ABSENT_STRING, - /* 263: kf58 */ ABSENT_STRING, - /* 264: kf59 */ ABSENT_STRING, - /* 265: kf60 */ ABSENT_STRING, - /* 266: kf61 */ ABSENT_STRING, - /* 267: kf62 */ ABSENT_STRING, - /* 268: kf63 */ ABSENT_STRING, - /* 269: el1 */ vt100_s_el1, - /* 270: mgc */ ABSENT_STRING, - /* 271: smgl */ ABSENT_STRING, - /* 272: smgr */ ABSENT_STRING, - /* 273: fln */ ABSENT_STRING, - /* 274: sclk */ ABSENT_STRING, - /* 275: dclk */ ABSENT_STRING, - /* 276: rmclk */ ABSENT_STRING, - /* 277: cwin */ ABSENT_STRING, - /* 278: wingo */ ABSENT_STRING, - /* 279: hup */ ABSENT_STRING, - /* 280: dial */ ABSENT_STRING, - /* 281: qdial */ ABSENT_STRING, - /* 282: tone */ ABSENT_STRING, - /* 283: pulse */ ABSENT_STRING, - /* 284: hook */ ABSENT_STRING, - /* 285: pause */ ABSENT_STRING, - /* 286: wait */ ABSENT_STRING, - /* 287: u0 */ ABSENT_STRING, - /* 288: u1 */ ABSENT_STRING, - /* 289: u2 */ ABSENT_STRING, - /* 290: u3 */ ABSENT_STRING, - /* 291: u4 */ ABSENT_STRING, - /* 292: u5 */ ABSENT_STRING, - /* 293: u6 */ ABSENT_STRING, - /* 294: u7 */ ABSENT_STRING, - /* 295: u8 */ ABSENT_STRING, - /* 296: u9 */ ABSENT_STRING, - /* 297: op */ ABSENT_STRING, - /* 298: oc */ ABSENT_STRING, - /* 299: initc */ ABSENT_STRING, - /* 300: initp */ ABSENT_STRING, - /* 301: scp */ ABSENT_STRING, - /* 302: setf */ ABSENT_STRING, - /* 303: setb */ ABSENT_STRING, - /* 304: cpi */ ABSENT_STRING, - /* 305: lpi */ ABSENT_STRING, - /* 306: chr */ ABSENT_STRING, - /* 307: cvr */ ABSENT_STRING, - /* 308: defc */ ABSENT_STRING, - /* 309: swidm */ ABSENT_STRING, - /* 310: sdrfq */ ABSENT_STRING, - /* 311: sitm */ ABSENT_STRING, - /* 312: slm */ ABSENT_STRING, - /* 313: smicm */ ABSENT_STRING, - /* 314: snlq */ ABSENT_STRING, - /* 315: snrmq */ ABSENT_STRING, - /* 316: sshm */ ABSENT_STRING, - /* 317: ssubm */ ABSENT_STRING, - /* 318: ssupm */ ABSENT_STRING, - /* 319: sum */ ABSENT_STRING, - /* 320: rwidm */ ABSENT_STRING, - /* 321: ritm */ ABSENT_STRING, - /* 322: rlm */ ABSENT_STRING, - /* 323: rmicm */ ABSENT_STRING, - /* 324: rshm */ ABSENT_STRING, - /* 325: rsubm */ ABSENT_STRING, - /* 326: rsupm */ ABSENT_STRING, - /* 327: rum */ ABSENT_STRING, - /* 328: mhpa */ ABSENT_STRING, - /* 329: mcud1 */ ABSENT_STRING, - /* 330: mcub1 */ ABSENT_STRING, - /* 331: mcuf1 */ ABSENT_STRING, - /* 332: mvpa */ ABSENT_STRING, - /* 333: mcuu1 */ ABSENT_STRING, - /* 334: porder */ ABSENT_STRING, - /* 335: mcud */ ABSENT_STRING, - /* 336: mcub */ ABSENT_STRING, - /* 337: mcuf */ ABSENT_STRING, - /* 338: mcuu */ ABSENT_STRING, - /* 339: scs */ ABSENT_STRING, - /* 340: smgb */ ABSENT_STRING, - /* 341: smgbp */ ABSENT_STRING, - /* 342: smglp */ ABSENT_STRING, - /* 343: smgrp */ ABSENT_STRING, - /* 344: smgt */ ABSENT_STRING, - /* 345: smgtp */ ABSENT_STRING, - /* 346: sbim */ ABSENT_STRING, - /* 347: scsd */ ABSENT_STRING, - /* 348: rbim */ ABSENT_STRING, - /* 349: rcsd */ ABSENT_STRING, - /* 350: subcs */ ABSENT_STRING, - /* 351: supcs */ ABSENT_STRING, - /* 352: docr */ ABSENT_STRING, - /* 353: zerom */ ABSENT_STRING, - /* 354: csnm */ ABSENT_STRING, - /* 355: kmous */ ABSENT_STRING, - /* 356: minfo */ ABSENT_STRING, - /* 357: reqmp */ ABSENT_STRING, - /* 358: getm */ ABSENT_STRING, - /* 359: setaf */ ABSENT_STRING, - /* 360: setab */ ABSENT_STRING, - /* 361: pfxl */ ABSENT_STRING, - /* 362: devt */ ABSENT_STRING, - /* 363: csin */ ABSENT_STRING, - /* 364: s0ds */ ABSENT_STRING, - /* 365: s1ds */ ABSENT_STRING, - /* 366: s2ds */ ABSENT_STRING, - /* 367: s3ds */ ABSENT_STRING, - /* 368: smglr */ ABSENT_STRING, - /* 369: smgtb */ ABSENT_STRING, - /* 370: birep */ ABSENT_STRING, - /* 371: binel */ ABSENT_STRING, - /* 372: bicr */ ABSENT_STRING, - /* 373: colornm */ ABSENT_STRING, - /* 374: defbi */ ABSENT_STRING, - /* 375: endbi */ ABSENT_STRING, - /* 376: setcolor */ ABSENT_STRING, - /* 377: slines */ ABSENT_STRING, - /* 378: dispc */ ABSENT_STRING, - /* 379: smpch */ ABSENT_STRING, - /* 380: rmpch */ ABSENT_STRING, - /* 381: smsc */ ABSENT_STRING, - /* 382: rmsc */ ABSENT_STRING, - /* 383: pctrm */ ABSENT_STRING, - /* 384: scesc */ ABSENT_STRING, - /* 385: scesa */ ABSENT_STRING, - /* 386: ehhlm */ ABSENT_STRING, - /* 387: elhlm */ ABSENT_STRING, - /* 388: elohlm */ ABSENT_STRING, - /* 389: erhlm */ ABSENT_STRING, - /* 390: ethlm */ ABSENT_STRING, - /* 391: evhlm */ ABSENT_STRING, - /* 392: sgr1 */ ABSENT_STRING, - /* 393: slength */ ABSENT_STRING, - /* 394: OTi2 */ ABSENT_STRING, - /* 395: OTrs */ ABSENT_STRING, - /* 396: OTnl */ ABSENT_STRING, - /* 397: OTbc */ ABSENT_STRING, - /* 398: OTko */ ABSENT_STRING, - /* 399: OTma */ ABSENT_STRING, - /* 400: OTG2 */ ABSENT_STRING, - /* 401: OTG3 */ ABSENT_STRING, - /* 402: OTG1 */ ABSENT_STRING, - /* 403: OTG4 */ ABSENT_STRING, - /* 404: OTGR */ ABSENT_STRING, - /* 405: OTGL */ ABSENT_STRING, - /* 406: OTGU */ ABSENT_STRING, - /* 407: OTGD */ ABSENT_STRING, - /* 408: OTGH */ ABSENT_STRING, - /* 409: OTGV */ ABSENT_STRING, - /* 410: OTGC */ ABSENT_STRING, - /* 411: meml */ ABSENT_STRING, - /* 412: memu */ ABSENT_STRING, - /* 413: box1 */ ABSENT_STRING, -}; -/* xterm */ - -static char xterm_alias_data[] = "xterm|xterm terminal emulator (X Window System)"; - -static char xterm_s_cbt [] = "\033[Z"; -static char xterm_s_bel [] = "\007"; -static char xterm_s_cr [] = "\015"; -static char xterm_s_csr [] = "\033[%i%p1%d;%p2%dr"; -static char xterm_s_tbc [] = "\033[3g"; -static char xterm_s_clear [] = "\033[H\033[2J"; -static char xterm_s_el [] = "\033[K"; -static char xterm_s_ed [] = "\033[J"; -static char xterm_s_hpa [] = "\033[%i%p1%dG"; -static char xterm_s_cup [] = "\033[%i%p1%d;%p2%dH"; -static char xterm_s_cud1 [] = "\012"; -static char xterm_s_home [] = "\033[H"; -static char xterm_s_civis [] = "\033[?25l"; -static char xterm_s_cub1 [] = "\010"; -static char xterm_s_cnorm [] = "\033[?12l\033[?25h"; -static char xterm_s_cuf1 [] = "\033[C"; -static char xterm_s_cuu1 [] = "\033[A"; -static char xterm_s_cvvis [] = "\033[?12;25h"; -static char xterm_s_dch1 [] = "\033[P"; -static char xterm_s_dl1 [] = "\033[M"; -static char xterm_s_smacs [] = "\033(0"; -static char xterm_s_blink [] = "\033[5m"; -static char xterm_s_bold [] = "\033[1m"; -static char xterm_s_smcup [] = "\033[?1049h\033[22;0;0t"; -static char xterm_s_dim [] = "\033[2m"; -static char xterm_s_smir [] = "\033[4h"; -static char xterm_s_invis [] = "\033[8m"; -static char xterm_s_rev [] = "\033[7m"; -static char xterm_s_smso [] = "\033[7m"; -static char xterm_s_smul [] = "\033[4m"; -static char xterm_s_ech [] = "\033[%p1%dX"; -static char xterm_s_rmacs [] = "\033(B"; -static char xterm_s_sgr0 [] = "\033(B\033[m"; -static char xterm_s_rmcup [] = "\033[?1049l\033[23;0;0t"; -static char xterm_s_rmir [] = "\033[4l"; -static char xterm_s_rmso [] = "\033[27m"; -static char xterm_s_rmul [] = "\033[24m"; -static char xterm_s_flash [] = "\033[?5h$<100/>\033[?5l"; -static char xterm_s_is2 [] = "\033[!p\033[?3;4l\033[4l\033>"; -static char xterm_s_il1 [] = "\033[L"; -static char xterm_s_kbs [] = "\010"; -static char xterm_s_kdch1 [] = "\033[3~"; -static char xterm_s_kcud1 [] = "\033OB"; -static char xterm_s_kf1 [] = "\033OP"; -static char xterm_s_kf10 [] = "\033[21~"; -static char xterm_s_kf2 [] = "\033OQ"; -static char xterm_s_kf3 [] = "\033OR"; -static char xterm_s_kf4 [] = "\033OS"; -static char xterm_s_kf5 [] = "\033[15~"; -static char xterm_s_kf6 [] = "\033[17~"; -static char xterm_s_kf7 [] = "\033[18~"; -static char xterm_s_kf8 [] = "\033[19~"; -static char xterm_s_kf9 [] = "\033[20~"; -static char xterm_s_khome [] = "\033OH"; -static char xterm_s_kich1 [] = "\033[2~"; -static char xterm_s_kcub1 [] = "\033OD"; -static char xterm_s_knp [] = "\033[6~"; -static char xterm_s_kpp [] = "\033[5~"; -static char xterm_s_kcuf1 [] = "\033OC"; -static char xterm_s_kind [] = "\033[1;2B"; -static char xterm_s_kri [] = "\033[1;2A"; -static char xterm_s_kcuu1 [] = "\033OA"; -static char xterm_s_rmkx [] = "\033[?1l\033>"; -static char xterm_s_smkx [] = "\033[?1h\033="; -static char xterm_s_rmm [] = "\033[?1034l"; -static char xterm_s_smm [] = "\033[?1034h"; -static char xterm_s_dch [] = "\033[%p1%dP"; -static char xterm_s_dl [] = "\033[%p1%dM"; -static char xterm_s_cud [] = "\033[%p1%dB"; -static char xterm_s_ich [] = "\033[%p1%d@"; -static char xterm_s_indn [] = "\033[%p1%dS"; -static char xterm_s_il [] = "\033[%p1%dL"; -static char xterm_s_cub [] = "\033[%p1%dD"; -static char xterm_s_cuf [] = "\033[%p1%dC"; -static char xterm_s_rin [] = "\033[%p1%dT"; -static char xterm_s_cuu [] = "\033[%p1%dA"; -static char xterm_s_mc0 [] = "\033[i"; -static char xterm_s_mc4 [] = "\033[4i"; -static char xterm_s_mc5 [] = "\033[5i"; -static char xterm_s_rep [] = "%p1%c\033[%p2%{1}%-%db"; -static char xterm_s_rs1 [] = "\033c"; -static char xterm_s_rs2 [] = "\033[!p\033[?3;4l\033[4l\033>"; -static char xterm_s_rc [] = "\0338"; -static char xterm_s_vpa [] = "\033[%i%p1%dd"; -static char xterm_s_sc [] = "\0337"; -static char xterm_s_ind [] = "\012"; -static char xterm_s_ri [] = "\033M"; -static char xterm_s_sgr [] = "%?%p9%t\033(0%e\033(B%;\033[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m"; -static char xterm_s_hts [] = "\033H"; -static char xterm_s_ht [] = "\011"; -static char xterm_s_kb2 [] = "\033OE"; -static char xterm_s_acsc [] = "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"; -static char xterm_s_kcbt [] = "\033[Z"; -static char xterm_s_smam [] = "\033[?7h"; -static char xterm_s_rmam [] = "\033[?7l"; -static char xterm_s_kend [] = "\033OF"; -static char xterm_s_kent [] = "\033OM"; -static char xterm_s_kDC [] = "\033[3;2~"; -static char xterm_s_kEND [] = "\033[1;2F"; -static char xterm_s_kHOM [] = "\033[1;2H"; -static char xterm_s_kIC [] = "\033[2;2~"; -static char xterm_s_kLFT [] = "\033[1;2D"; -static char xterm_s_kNXT [] = "\033[6;2~"; -static char xterm_s_kPRV [] = "\033[5;2~"; -static char xterm_s_kRIT [] = "\033[1;2C"; -static char xterm_s_kf11 [] = "\033[23~"; -static char xterm_s_kf12 [] = "\033[24~"; -static char xterm_s_kf13 [] = "\033[1;2P"; -static char xterm_s_kf14 [] = "\033[1;2Q"; -static char xterm_s_kf15 [] = "\033[1;2R"; -static char xterm_s_kf16 [] = "\033[1;2S"; -static char xterm_s_kf17 [] = "\033[15;2~"; -static char xterm_s_kf18 [] = "\033[17;2~"; -static char xterm_s_kf19 [] = "\033[18;2~"; -static char xterm_s_kf20 [] = "\033[19;2~"; -static char xterm_s_kf21 [] = "\033[20;2~"; -static char xterm_s_kf22 [] = "\033[21;2~"; -static char xterm_s_kf23 [] = "\033[23;2~"; -static char xterm_s_kf24 [] = "\033[24;2~"; -static char xterm_s_kf25 [] = "\033[1;5P"; -static char xterm_s_kf26 [] = "\033[1;5Q"; -static char xterm_s_kf27 [] = "\033[1;5R"; -static char xterm_s_kf28 [] = "\033[1;5S"; -static char xterm_s_kf29 [] = "\033[15;5~"; -static char xterm_s_kf30 [] = "\033[17;5~"; -static char xterm_s_kf31 [] = "\033[18;5~"; -static char xterm_s_kf32 [] = "\033[19;5~"; -static char xterm_s_kf33 [] = "\033[20;5~"; -static char xterm_s_kf34 [] = "\033[21;5~"; -static char xterm_s_kf35 [] = "\033[23;5~"; -static char xterm_s_kf36 [] = "\033[24;5~"; -static char xterm_s_kf37 [] = "\033[1;6P"; -static char xterm_s_kf38 [] = "\033[1;6Q"; -static char xterm_s_kf39 [] = "\033[1;6R"; -static char xterm_s_kf40 [] = "\033[1;6S"; -static char xterm_s_kf41 [] = "\033[15;6~"; -static char xterm_s_kf42 [] = "\033[17;6~"; -static char xterm_s_kf43 [] = "\033[18;6~"; -static char xterm_s_kf44 [] = "\033[19;6~"; -static char xterm_s_kf45 [] = "\033[20;6~"; -static char xterm_s_kf46 [] = "\033[21;6~"; -static char xterm_s_kf47 [] = "\033[23;6~"; -static char xterm_s_kf48 [] = "\033[24;6~"; -static char xterm_s_kf49 [] = "\033[1;3P"; -static char xterm_s_kf50 [] = "\033[1;3Q"; -static char xterm_s_kf51 [] = "\033[1;3R"; -static char xterm_s_kf52 [] = "\033[1;3S"; -static char xterm_s_kf53 [] = "\033[15;3~"; -static char xterm_s_kf54 [] = "\033[17;3~"; -static char xterm_s_kf55 [] = "\033[18;3~"; -static char xterm_s_kf56 [] = "\033[19;3~"; -static char xterm_s_kf57 [] = "\033[20;3~"; -static char xterm_s_kf58 [] = "\033[21;3~"; -static char xterm_s_kf59 [] = "\033[23;3~"; -static char xterm_s_kf60 [] = "\033[24;3~"; -static char xterm_s_kf61 [] = "\033[1;4P"; -static char xterm_s_kf62 [] = "\033[1;4Q"; -static char xterm_s_kf63 [] = "\033[1;4R"; -static char xterm_s_el1 [] = "\033[1K"; -static char xterm_s_u6 [] = "\033[%i%d;%dR"; -static char xterm_s_u7 [] = "\033[6n"; -static char xterm_s_u8 [] = "\033[?%[;0123456789]c"; -static char xterm_s_u9 [] = "\033[c"; -static char xterm_s_op [] = "\033[39;49m"; -static char xterm_s_setf [] = "\033[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m"; -static char xterm_s_setb [] = "\033[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m"; -static char xterm_s_sitm [] = "\033[3m"; -static char xterm_s_ritm [] = "\033[23m"; -static char xterm_s_kmous [] = "\033[<"; -static char xterm_s_setaf [] = "\033[3%p1%dm"; -static char xterm_s_setab [] = "\033[4%p1%dm"; -static char xterm_s_meml [] = "\033l"; -static char xterm_s_memu [] = "\033m"; - -static char xterm_bool_data[] = { - /* 0: bw */ FALSE, - /* 1: am */ TRUE, - /* 2: xsb */ FALSE, - /* 3: xhp */ FALSE, - /* 4: xenl */ TRUE, - /* 5: eo */ FALSE, - /* 6: gn */ FALSE, - /* 7: hc */ FALSE, - /* 8: km */ TRUE, - /* 9: hs */ FALSE, - /* 10: in */ FALSE, - /* 11: da */ FALSE, - /* 12: db */ FALSE, - /* 13: mir */ TRUE, - /* 14: msgr */ TRUE, - /* 15: os */ FALSE, - /* 16: eslok */ FALSE, - /* 17: xt */ FALSE, - /* 18: hz */ FALSE, - /* 19: ul */ FALSE, - /* 20: xon */ FALSE, - /* 21: nxon */ FALSE, - /* 22: mc5i */ TRUE, - /* 23: chts */ FALSE, - /* 24: nrrmc */ FALSE, - /* 25: npc */ TRUE, - /* 26: ndscr */ FALSE, - /* 27: ccc */ FALSE, - /* 28: bce */ TRUE, - /* 29: hls */ FALSE, - /* 30: xhpa */ FALSE, - /* 31: crxm */ FALSE, - /* 32: daisy */ FALSE, - /* 33: xvpa */ FALSE, - /* 34: sam */ FALSE, - /* 35: cpix */ FALSE, - /* 36: lpix */ FALSE, - /* 37: OTbs */ TRUE, - /* 38: OTns */ FALSE, - /* 39: OTnc */ FALSE, - /* 40: OTMT */ FALSE, - /* 41: OTNL */ FALSE, - /* 42: OTpt */ FALSE, - /* 43: OTxr */ FALSE, -}; -static NCURSES_INT2 xterm_number_data[] = { - /* 0: cols */ 80, - /* 1: it */ 8, - /* 2: lines */ 24, - /* 3: lm */ ABSENT_NUMERIC, - /* 4: xmc */ ABSENT_NUMERIC, - /* 5: pb */ ABSENT_NUMERIC, - /* 6: vt */ ABSENT_NUMERIC, - /* 7: wsl */ ABSENT_NUMERIC, - /* 8: nlab */ ABSENT_NUMERIC, - /* 9: lh */ ABSENT_NUMERIC, - /* 10: lw */ ABSENT_NUMERIC, - /* 11: ma */ ABSENT_NUMERIC, - /* 12: wnum */ ABSENT_NUMERIC, - /* 13: colors */ 8, - /* 14: pairs */ 64, - /* 15: ncv */ ABSENT_NUMERIC, - /* 16: bufsz */ ABSENT_NUMERIC, - /* 17: spinv */ ABSENT_NUMERIC, - /* 18: spinh */ ABSENT_NUMERIC, - /* 19: maddr */ ABSENT_NUMERIC, - /* 20: mjump */ ABSENT_NUMERIC, - /* 21: mcs */ ABSENT_NUMERIC, - /* 22: mls */ ABSENT_NUMERIC, - /* 23: npins */ ABSENT_NUMERIC, - /* 24: orc */ ABSENT_NUMERIC, - /* 25: orl */ ABSENT_NUMERIC, - /* 26: orhi */ ABSENT_NUMERIC, - /* 27: orvi */ ABSENT_NUMERIC, - /* 28: cps */ ABSENT_NUMERIC, - /* 29: widcs */ ABSENT_NUMERIC, - /* 30: btns */ ABSENT_NUMERIC, - /* 31: bitwin */ ABSENT_NUMERIC, - /* 32: bitype */ ABSENT_NUMERIC, - /* 33: OTug */ ABSENT_NUMERIC, - /* 34: OTdC */ ABSENT_NUMERIC, - /* 35: OTdN */ ABSENT_NUMERIC, - /* 36: OTdB */ ABSENT_NUMERIC, - /* 37: OTdT */ ABSENT_NUMERIC, - /* 38: OTkn */ ABSENT_NUMERIC, -}; -static char * xterm_string_data[] = { - /* 0: cbt */ xterm_s_cbt, - /* 1: bel */ xterm_s_bel, - /* 2: cr */ xterm_s_cr, - /* 3: csr */ xterm_s_csr, - /* 4: tbc */ xterm_s_tbc, - /* 5: clear */ xterm_s_clear, - /* 6: el */ xterm_s_el, - /* 7: ed */ xterm_s_ed, - /* 8: hpa */ xterm_s_hpa, - /* 9: cmdch */ ABSENT_STRING, - /* 10: cup */ xterm_s_cup, - /* 11: cud1 */ xterm_s_cud1, - /* 12: home */ xterm_s_home, - /* 13: civis */ xterm_s_civis, - /* 14: cub1 */ xterm_s_cub1, - /* 15: mrcup */ ABSENT_STRING, - /* 16: cnorm */ xterm_s_cnorm, - /* 17: cuf1 */ xterm_s_cuf1, - /* 18: ll */ ABSENT_STRING, - /* 19: cuu1 */ xterm_s_cuu1, - /* 20: cvvis */ xterm_s_cvvis, - /* 21: dch1 */ xterm_s_dch1, - /* 22: dl1 */ xterm_s_dl1, - /* 23: dsl */ ABSENT_STRING, - /* 24: hd */ ABSENT_STRING, - /* 25: smacs */ xterm_s_smacs, - /* 26: blink */ xterm_s_blink, - /* 27: bold */ xterm_s_bold, - /* 28: smcup */ xterm_s_smcup, - /* 29: smdc */ ABSENT_STRING, - /* 30: dim */ xterm_s_dim, - /* 31: smir */ xterm_s_smir, - /* 32: invis */ xterm_s_invis, - /* 33: prot */ ABSENT_STRING, - /* 34: rev */ xterm_s_rev, - /* 35: smso */ xterm_s_smso, - /* 36: smul */ xterm_s_smul, - /* 37: ech */ xterm_s_ech, - /* 38: rmacs */ xterm_s_rmacs, - /* 39: sgr0 */ xterm_s_sgr0, - /* 40: rmcup */ xterm_s_rmcup, - /* 41: rmdc */ ABSENT_STRING, - /* 42: rmir */ xterm_s_rmir, - /* 43: rmso */ xterm_s_rmso, - /* 44: rmul */ xterm_s_rmul, - /* 45: flash */ xterm_s_flash, - /* 46: ff */ ABSENT_STRING, - /* 47: fsl */ ABSENT_STRING, - /* 48: is1 */ ABSENT_STRING, - /* 49: is2 */ xterm_s_is2, - /* 50: is3 */ ABSENT_STRING, - /* 51: if */ ABSENT_STRING, - /* 52: ich1 */ ABSENT_STRING, - /* 53: il1 */ xterm_s_il1, - /* 54: ip */ ABSENT_STRING, - /* 55: kbs */ xterm_s_kbs, - /* 56: ktbc */ ABSENT_STRING, - /* 57: kclr */ ABSENT_STRING, - /* 58: kctab */ ABSENT_STRING, - /* 59: kdch1 */ xterm_s_kdch1, - /* 60: kdl1 */ ABSENT_STRING, - /* 61: kcud1 */ xterm_s_kcud1, - /* 62: krmir */ ABSENT_STRING, - /* 63: kel */ ABSENT_STRING, - /* 64: ked */ ABSENT_STRING, - /* 65: kf0 */ ABSENT_STRING, - /* 66: kf1 */ xterm_s_kf1, - /* 67: kf10 */ xterm_s_kf10, - /* 68: kf2 */ xterm_s_kf2, - /* 69: kf3 */ xterm_s_kf3, - /* 70: kf4 */ xterm_s_kf4, - /* 71: kf5 */ xterm_s_kf5, - /* 72: kf6 */ xterm_s_kf6, - /* 73: kf7 */ xterm_s_kf7, - /* 74: kf8 */ xterm_s_kf8, - /* 75: kf9 */ xterm_s_kf9, - /* 76: khome */ xterm_s_khome, - /* 77: kich1 */ xterm_s_kich1, - /* 78: kil1 */ ABSENT_STRING, - /* 79: kcub1 */ xterm_s_kcub1, - /* 80: kll */ ABSENT_STRING, - /* 81: knp */ xterm_s_knp, - /* 82: kpp */ xterm_s_kpp, - /* 83: kcuf1 */ xterm_s_kcuf1, - /* 84: kind */ xterm_s_kind, - /* 85: kri */ xterm_s_kri, - /* 86: khts */ ABSENT_STRING, - /* 87: kcuu1 */ xterm_s_kcuu1, - /* 88: rmkx */ xterm_s_rmkx, - /* 89: smkx */ xterm_s_smkx, - /* 90: lf0 */ ABSENT_STRING, - /* 91: lf1 */ ABSENT_STRING, - /* 92: lf10 */ ABSENT_STRING, - /* 93: lf2 */ ABSENT_STRING, - /* 94: lf3 */ ABSENT_STRING, - /* 95: lf4 */ ABSENT_STRING, - /* 96: lf5 */ ABSENT_STRING, - /* 97: lf6 */ ABSENT_STRING, - /* 98: lf7 */ ABSENT_STRING, - /* 99: lf8 */ ABSENT_STRING, - /* 100: lf9 */ ABSENT_STRING, - /* 101: rmm */ xterm_s_rmm, - /* 102: smm */ xterm_s_smm, - /* 103: nel */ ABSENT_STRING, - /* 104: pad */ ABSENT_STRING, - /* 105: dch */ xterm_s_dch, - /* 106: dl */ xterm_s_dl, - /* 107: cud */ xterm_s_cud, - /* 108: ich */ xterm_s_ich, - /* 109: indn */ xterm_s_indn, - /* 110: il */ xterm_s_il, - /* 111: cub */ xterm_s_cub, - /* 112: cuf */ xterm_s_cuf, - /* 113: rin */ xterm_s_rin, - /* 114: cuu */ xterm_s_cuu, - /* 115: pfkey */ ABSENT_STRING, - /* 116: pfloc */ ABSENT_STRING, - /* 117: pfx */ ABSENT_STRING, - /* 118: mc0 */ xterm_s_mc0, - /* 119: mc4 */ xterm_s_mc4, - /* 120: mc5 */ xterm_s_mc5, - /* 121: rep */ xterm_s_rep, - /* 122: rs1 */ xterm_s_rs1, - /* 123: rs2 */ xterm_s_rs2, - /* 124: rs3 */ ABSENT_STRING, - /* 125: rf */ ABSENT_STRING, - /* 126: rc */ xterm_s_rc, - /* 127: vpa */ xterm_s_vpa, - /* 128: sc */ xterm_s_sc, - /* 129: ind */ xterm_s_ind, - /* 130: ri */ xterm_s_ri, - /* 131: sgr */ xterm_s_sgr, - /* 132: hts */ xterm_s_hts, - /* 133: wind */ ABSENT_STRING, - /* 134: ht */ xterm_s_ht, - /* 135: tsl */ ABSENT_STRING, - /* 136: uc */ ABSENT_STRING, - /* 137: hu */ ABSENT_STRING, - /* 138: iprog */ ABSENT_STRING, - /* 139: ka1 */ ABSENT_STRING, - /* 140: ka3 */ ABSENT_STRING, - /* 141: kb2 */ xterm_s_kb2, - /* 142: kc1 */ ABSENT_STRING, - /* 143: kc3 */ ABSENT_STRING, - /* 144: mc5p */ ABSENT_STRING, - /* 145: rmp */ ABSENT_STRING, - /* 146: acsc */ xterm_s_acsc, - /* 147: pln */ ABSENT_STRING, - /* 148: kcbt */ xterm_s_kcbt, - /* 149: smxon */ ABSENT_STRING, - /* 150: rmxon */ ABSENT_STRING, - /* 151: smam */ xterm_s_smam, - /* 152: rmam */ xterm_s_rmam, - /* 153: xonc */ ABSENT_STRING, - /* 154: xoffc */ ABSENT_STRING, - /* 155: enacs */ ABSENT_STRING, - /* 156: smln */ ABSENT_STRING, - /* 157: rmln */ ABSENT_STRING, - /* 158: kbeg */ ABSENT_STRING, - /* 159: kcan */ ABSENT_STRING, - /* 160: kclo */ ABSENT_STRING, - /* 161: kcmd */ ABSENT_STRING, - /* 162: kcpy */ ABSENT_STRING, - /* 163: kcrt */ ABSENT_STRING, - /* 164: kend */ xterm_s_kend, - /* 165: kent */ xterm_s_kent, - /* 166: kext */ ABSENT_STRING, - /* 167: kfnd */ ABSENT_STRING, - /* 168: khlp */ ABSENT_STRING, - /* 169: kmrk */ ABSENT_STRING, - /* 170: kmsg */ ABSENT_STRING, - /* 171: kmov */ ABSENT_STRING, - /* 172: knxt */ ABSENT_STRING, - /* 173: kopn */ ABSENT_STRING, - /* 174: kopt */ ABSENT_STRING, - /* 175: kprv */ ABSENT_STRING, - /* 176: kprt */ ABSENT_STRING, - /* 177: krdo */ ABSENT_STRING, - /* 178: kref */ ABSENT_STRING, - /* 179: krfr */ ABSENT_STRING, - /* 180: krpl */ ABSENT_STRING, - /* 181: krst */ ABSENT_STRING, - /* 182: kres */ ABSENT_STRING, - /* 183: ksav */ ABSENT_STRING, - /* 184: kspd */ ABSENT_STRING, - /* 185: kund */ ABSENT_STRING, - /* 186: kBEG */ ABSENT_STRING, - /* 187: kCAN */ ABSENT_STRING, - /* 188: kCMD */ ABSENT_STRING, - /* 189: kCPY */ ABSENT_STRING, - /* 190: kCRT */ ABSENT_STRING, - /* 191: kDC */ xterm_s_kDC, - /* 192: kDL */ ABSENT_STRING, - /* 193: kslt */ ABSENT_STRING, - /* 194: kEND */ xterm_s_kEND, - /* 195: kEOL */ ABSENT_STRING, - /* 196: kEXT */ ABSENT_STRING, - /* 197: kFND */ ABSENT_STRING, - /* 198: kHLP */ ABSENT_STRING, - /* 199: kHOM */ xterm_s_kHOM, - /* 200: kIC */ xterm_s_kIC, - /* 201: kLFT */ xterm_s_kLFT, - /* 202: kMSG */ ABSENT_STRING, - /* 203: kMOV */ ABSENT_STRING, - /* 204: kNXT */ xterm_s_kNXT, - /* 205: kOPT */ ABSENT_STRING, - /* 206: kPRV */ xterm_s_kPRV, - /* 207: kPRT */ ABSENT_STRING, - /* 208: kRDO */ ABSENT_STRING, - /* 209: kRPL */ ABSENT_STRING, - /* 210: kRIT */ xterm_s_kRIT, - /* 211: kRES */ ABSENT_STRING, - /* 212: kSAV */ ABSENT_STRING, - /* 213: kSPD */ ABSENT_STRING, - /* 214: kUND */ ABSENT_STRING, - /* 215: rfi */ ABSENT_STRING, - /* 216: kf11 */ xterm_s_kf11, - /* 217: kf12 */ xterm_s_kf12, - /* 218: kf13 */ xterm_s_kf13, - /* 219: kf14 */ xterm_s_kf14, - /* 220: kf15 */ xterm_s_kf15, - /* 221: kf16 */ xterm_s_kf16, - /* 222: kf17 */ xterm_s_kf17, - /* 223: kf18 */ xterm_s_kf18, - /* 224: kf19 */ xterm_s_kf19, - /* 225: kf20 */ xterm_s_kf20, - /* 226: kf21 */ xterm_s_kf21, - /* 227: kf22 */ xterm_s_kf22, - /* 228: kf23 */ xterm_s_kf23, - /* 229: kf24 */ xterm_s_kf24, - /* 230: kf25 */ xterm_s_kf25, - /* 231: kf26 */ xterm_s_kf26, - /* 232: kf27 */ xterm_s_kf27, - /* 233: kf28 */ xterm_s_kf28, - /* 234: kf29 */ xterm_s_kf29, - /* 235: kf30 */ xterm_s_kf30, - /* 236: kf31 */ xterm_s_kf31, - /* 237: kf32 */ xterm_s_kf32, - /* 238: kf33 */ xterm_s_kf33, - /* 239: kf34 */ xterm_s_kf34, - /* 240: kf35 */ xterm_s_kf35, - /* 241: kf36 */ xterm_s_kf36, - /* 242: kf37 */ xterm_s_kf37, - /* 243: kf38 */ xterm_s_kf38, - /* 244: kf39 */ xterm_s_kf39, - /* 245: kf40 */ xterm_s_kf40, - /* 246: kf41 */ xterm_s_kf41, - /* 247: kf42 */ xterm_s_kf42, - /* 248: kf43 */ xterm_s_kf43, - /* 249: kf44 */ xterm_s_kf44, - /* 250: kf45 */ xterm_s_kf45, - /* 251: kf46 */ xterm_s_kf46, - /* 252: kf47 */ xterm_s_kf47, - /* 253: kf48 */ xterm_s_kf48, - /* 254: kf49 */ xterm_s_kf49, - /* 255: kf50 */ xterm_s_kf50, - /* 256: kf51 */ xterm_s_kf51, - /* 257: kf52 */ xterm_s_kf52, - /* 258: kf53 */ xterm_s_kf53, - /* 259: kf54 */ xterm_s_kf54, - /* 260: kf55 */ xterm_s_kf55, - /* 261: kf56 */ xterm_s_kf56, - /* 262: kf57 */ xterm_s_kf57, - /* 263: kf58 */ xterm_s_kf58, - /* 264: kf59 */ xterm_s_kf59, - /* 265: kf60 */ xterm_s_kf60, - /* 266: kf61 */ xterm_s_kf61, - /* 267: kf62 */ xterm_s_kf62, - /* 268: kf63 */ xterm_s_kf63, - /* 269: el1 */ xterm_s_el1, - /* 270: mgc */ ABSENT_STRING, - /* 271: smgl */ ABSENT_STRING, - /* 272: smgr */ ABSENT_STRING, - /* 273: fln */ ABSENT_STRING, - /* 274: sclk */ ABSENT_STRING, - /* 275: dclk */ ABSENT_STRING, - /* 276: rmclk */ ABSENT_STRING, - /* 277: cwin */ ABSENT_STRING, - /* 278: wingo */ ABSENT_STRING, - /* 279: hup */ ABSENT_STRING, - /* 280: dial */ ABSENT_STRING, - /* 281: qdial */ ABSENT_STRING, - /* 282: tone */ ABSENT_STRING, - /* 283: pulse */ ABSENT_STRING, - /* 284: hook */ ABSENT_STRING, - /* 285: pause */ ABSENT_STRING, - /* 286: wait */ ABSENT_STRING, - /* 287: u0 */ ABSENT_STRING, - /* 288: u1 */ ABSENT_STRING, - /* 289: u2 */ ABSENT_STRING, - /* 290: u3 */ ABSENT_STRING, - /* 291: u4 */ ABSENT_STRING, - /* 292: u5 */ ABSENT_STRING, - /* 293: u6 */ xterm_s_u6, - /* 294: u7 */ xterm_s_u7, - /* 295: u8 */ xterm_s_u8, - /* 296: u9 */ xterm_s_u9, - /* 297: op */ xterm_s_op, - /* 298: oc */ ABSENT_STRING, - /* 299: initc */ ABSENT_STRING, - /* 300: initp */ ABSENT_STRING, - /* 301: scp */ ABSENT_STRING, - /* 302: setf */ xterm_s_setf, - /* 303: setb */ xterm_s_setb, - /* 304: cpi */ ABSENT_STRING, - /* 305: lpi */ ABSENT_STRING, - /* 306: chr */ ABSENT_STRING, - /* 307: cvr */ ABSENT_STRING, - /* 308: defc */ ABSENT_STRING, - /* 309: swidm */ ABSENT_STRING, - /* 310: sdrfq */ ABSENT_STRING, - /* 311: sitm */ xterm_s_sitm, - /* 312: slm */ ABSENT_STRING, - /* 313: smicm */ ABSENT_STRING, - /* 314: snlq */ ABSENT_STRING, - /* 315: snrmq */ ABSENT_STRING, - /* 316: sshm */ ABSENT_STRING, - /* 317: ssubm */ ABSENT_STRING, - /* 318: ssupm */ ABSENT_STRING, - /* 319: sum */ ABSENT_STRING, - /* 320: rwidm */ ABSENT_STRING, - /* 321: ritm */ xterm_s_ritm, - /* 322: rlm */ ABSENT_STRING, - /* 323: rmicm */ ABSENT_STRING, - /* 324: rshm */ ABSENT_STRING, - /* 325: rsubm */ ABSENT_STRING, - /* 326: rsupm */ ABSENT_STRING, - /* 327: rum */ ABSENT_STRING, - /* 328: mhpa */ ABSENT_STRING, - /* 329: mcud1 */ ABSENT_STRING, - /* 330: mcub1 */ ABSENT_STRING, - /* 331: mcuf1 */ ABSENT_STRING, - /* 332: mvpa */ ABSENT_STRING, - /* 333: mcuu1 */ ABSENT_STRING, - /* 334: porder */ ABSENT_STRING, - /* 335: mcud */ ABSENT_STRING, - /* 336: mcub */ ABSENT_STRING, - /* 337: mcuf */ ABSENT_STRING, - /* 338: mcuu */ ABSENT_STRING, - /* 339: scs */ ABSENT_STRING, - /* 340: smgb */ ABSENT_STRING, - /* 341: smgbp */ ABSENT_STRING, - /* 342: smglp */ ABSENT_STRING, - /* 343: smgrp */ ABSENT_STRING, - /* 344: smgt */ ABSENT_STRING, - /* 345: smgtp */ ABSENT_STRING, - /* 346: sbim */ ABSENT_STRING, - /* 347: scsd */ ABSENT_STRING, - /* 348: rbim */ ABSENT_STRING, - /* 349: rcsd */ ABSENT_STRING, - /* 350: subcs */ ABSENT_STRING, - /* 351: supcs */ ABSENT_STRING, - /* 352: docr */ ABSENT_STRING, - /* 353: zerom */ ABSENT_STRING, - /* 354: csnm */ ABSENT_STRING, - /* 355: kmous */ xterm_s_kmous, - /* 356: minfo */ ABSENT_STRING, - /* 357: reqmp */ ABSENT_STRING, - /* 358: getm */ ABSENT_STRING, - /* 359: setaf */ xterm_s_setaf, - /* 360: setab */ xterm_s_setab, - /* 361: pfxl */ ABSENT_STRING, - /* 362: devt */ ABSENT_STRING, - /* 363: csin */ ABSENT_STRING, - /* 364: s0ds */ ABSENT_STRING, - /* 365: s1ds */ ABSENT_STRING, - /* 366: s2ds */ ABSENT_STRING, - /* 367: s3ds */ ABSENT_STRING, - /* 368: smglr */ ABSENT_STRING, - /* 369: smgtb */ ABSENT_STRING, - /* 370: birep */ ABSENT_STRING, - /* 371: binel */ ABSENT_STRING, - /* 372: bicr */ ABSENT_STRING, - /* 373: colornm */ ABSENT_STRING, - /* 374: defbi */ ABSENT_STRING, - /* 375: endbi */ ABSENT_STRING, - /* 376: setcolor */ ABSENT_STRING, - /* 377: slines */ ABSENT_STRING, - /* 378: dispc */ ABSENT_STRING, - /* 379: smpch */ ABSENT_STRING, - /* 380: rmpch */ ABSENT_STRING, - /* 381: smsc */ ABSENT_STRING, - /* 382: rmsc */ ABSENT_STRING, - /* 383: pctrm */ ABSENT_STRING, - /* 384: scesc */ ABSENT_STRING, - /* 385: scesa */ ABSENT_STRING, - /* 386: ehhlm */ ABSENT_STRING, - /* 387: elhlm */ ABSENT_STRING, - /* 388: elohlm */ ABSENT_STRING, - /* 389: erhlm */ ABSENT_STRING, - /* 390: ethlm */ ABSENT_STRING, - /* 391: evhlm */ ABSENT_STRING, - /* 392: sgr1 */ ABSENT_STRING, - /* 393: slength */ ABSENT_STRING, - /* 394: OTi2 */ ABSENT_STRING, - /* 395: OTrs */ ABSENT_STRING, - /* 396: OTnl */ ABSENT_STRING, - /* 397: OTbc */ ABSENT_STRING, - /* 398: OTko */ ABSENT_STRING, - /* 399: OTma */ ABSENT_STRING, - /* 400: OTG2 */ ABSENT_STRING, - /* 401: OTG3 */ ABSENT_STRING, - /* 402: OTG1 */ ABSENT_STRING, - /* 403: OTG4 */ ABSENT_STRING, - /* 404: OTGR */ ABSENT_STRING, - /* 405: OTGL */ ABSENT_STRING, - /* 406: OTGU */ ABSENT_STRING, - /* 407: OTGD */ ABSENT_STRING, - /* 408: OTGH */ ABSENT_STRING, - /* 409: OTGV */ ABSENT_STRING, - /* 410: OTGC */ ABSENT_STRING, - /* 411: meml */ xterm_s_meml, - /* 412: memu */ xterm_s_memu, - /* 413: box1 */ ABSENT_STRING, -}; -/* xterm-256color */ - -static char xterm_256color_alias_data[] = "xterm-256color|xterm with 256 colors"; - -static char xterm_256color_s_cbt[] = "\033[Z"; -static char xterm_256color_s_bel[] = "\007"; -static char xterm_256color_s_cr [] = "\015"; -static char xterm_256color_s_csr[] = "\033[%i%p1%d;%p2%dr"; -static char xterm_256color_s_tbc[] = "\033[3g"; -static char xterm_256color_s_clear[] = "\033[H\033[2J"; -static char xterm_256color_s_el [] = "\033[K"; -static char xterm_256color_s_ed [] = "\033[J"; -static char xterm_256color_s_hpa[] = "\033[%i%p1%dG"; -static char xterm_256color_s_cup[] = "\033[%i%p1%d;%p2%dH"; -static char xterm_256color_s_cud1[] = "\012"; -static char xterm_256color_s_home[] = "\033[H"; -static char xterm_256color_s_civis[] = "\033[?25l"; -static char xterm_256color_s_cub1[] = "\010"; -static char xterm_256color_s_cnorm[] = "\033[?12l\033[?25h"; -static char xterm_256color_s_cuf1[] = "\033[C"; -static char xterm_256color_s_cuu1[] = "\033[A"; -static char xterm_256color_s_cvvis[] = "\033[?12;25h"; -static char xterm_256color_s_dch1[] = "\033[P"; -static char xterm_256color_s_dl1[] = "\033[M"; -static char xterm_256color_s_smacs[] = "\033(0"; -static char xterm_256color_s_blink[] = "\033[5m"; -static char xterm_256color_s_bold[] = "\033[1m"; -static char xterm_256color_s_smcup[] = "\033[?1049h\033[22;0;0t"; -static char xterm_256color_s_dim[] = "\033[2m"; -static char xterm_256color_s_smir[] = "\033[4h"; -static char xterm_256color_s_invis[] = "\033[8m"; -static char xterm_256color_s_rev[] = "\033[7m"; -static char xterm_256color_s_smso[] = "\033[7m"; -static char xterm_256color_s_smul[] = "\033[4m"; -static char xterm_256color_s_ech[] = "\033[%p1%dX"; -static char xterm_256color_s_rmacs[] = "\033(B"; -static char xterm_256color_s_sgr0[] = "\033(B\033[m"; -static char xterm_256color_s_rmcup[] = "\033[?1049l\033[23;0;0t"; -static char xterm_256color_s_rmir[] = "\033[4l"; -static char xterm_256color_s_rmso[] = "\033[27m"; -static char xterm_256color_s_rmul[] = "\033[24m"; -static char xterm_256color_s_flash[] = "\033[?5h$<100/>\033[?5l"; -static char xterm_256color_s_is2[] = "\033[!p\033[?3;4l\033[4l\033>"; -static char xterm_256color_s_il1[] = "\033[L"; -static char xterm_256color_s_kbs[] = "\010"; -static char xterm_256color_s_kdch1[] = "\033[3~"; -static char xterm_256color_s_kcud1[] = "\033OB"; -static char xterm_256color_s_kf1[] = "\033OP"; -static char xterm_256color_s_kf10[] = "\033[21~"; -static char xterm_256color_s_kf2[] = "\033OQ"; -static char xterm_256color_s_kf3[] = "\033OR"; -static char xterm_256color_s_kf4[] = "\033OS"; -static char xterm_256color_s_kf5[] = "\033[15~"; -static char xterm_256color_s_kf6[] = "\033[17~"; -static char xterm_256color_s_kf7[] = "\033[18~"; -static char xterm_256color_s_kf8[] = "\033[19~"; -static char xterm_256color_s_kf9[] = "\033[20~"; -static char xterm_256color_s_khome[] = "\033OH"; -static char xterm_256color_s_kich1[] = "\033[2~"; -static char xterm_256color_s_kcub1[] = "\033OD"; -static char xterm_256color_s_knp[] = "\033[6~"; -static char xterm_256color_s_kpp[] = "\033[5~"; -static char xterm_256color_s_kcuf1[] = "\033OC"; -static char xterm_256color_s_kind[] = "\033[1;2B"; -static char xterm_256color_s_kri[] = "\033[1;2A"; -static char xterm_256color_s_kcuu1[] = "\033OA"; -static char xterm_256color_s_rmkx[] = "\033[?1l\033>"; -static char xterm_256color_s_smkx[] = "\033[?1h\033="; -static char xterm_256color_s_rmm[] = "\033[?1034l"; -static char xterm_256color_s_smm[] = "\033[?1034h"; -static char xterm_256color_s_dch[] = "\033[%p1%dP"; -static char xterm_256color_s_dl [] = "\033[%p1%dM"; -static char xterm_256color_s_cud[] = "\033[%p1%dB"; -static char xterm_256color_s_ich[] = "\033[%p1%d@"; -static char xterm_256color_s_indn[] = "\033[%p1%dS"; -static char xterm_256color_s_il [] = "\033[%p1%dL"; -static char xterm_256color_s_cub[] = "\033[%p1%dD"; -static char xterm_256color_s_cuf[] = "\033[%p1%dC"; -static char xterm_256color_s_rin[] = "\033[%p1%dT"; -static char xterm_256color_s_cuu[] = "\033[%p1%dA"; -static char xterm_256color_s_mc0[] = "\033[i"; -static char xterm_256color_s_mc4[] = "\033[4i"; -static char xterm_256color_s_mc5[] = "\033[5i"; -static char xterm_256color_s_rep[] = "%p1%c\033[%p2%{1}%-%db"; -static char xterm_256color_s_rs1[] = "\033c\033]104\007"; -static char xterm_256color_s_rs2[] = "\033[!p\033[?3;4l\033[4l\033>"; -static char xterm_256color_s_rc [] = "\0338"; -static char xterm_256color_s_vpa[] = "\033[%i%p1%dd"; -static char xterm_256color_s_sc [] = "\0337"; -static char xterm_256color_s_ind[] = "\012"; -static char xterm_256color_s_ri [] = "\033M"; -static char xterm_256color_s_sgr[] = "%?%p9%t\033(0%e\033(B%;\033[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m"; -static char xterm_256color_s_hts[] = "\033H"; -static char xterm_256color_s_ht [] = "\011"; -static char xterm_256color_s_kb2[] = "\033OE"; -static char xterm_256color_s_acsc[] = "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"; -static char xterm_256color_s_kcbt[] = "\033[Z"; -static char xterm_256color_s_smam[] = "\033[?7h"; -static char xterm_256color_s_rmam[] = "\033[?7l"; -static char xterm_256color_s_kend[] = "\033OF"; -static char xterm_256color_s_kent[] = "\033OM"; -static char xterm_256color_s_kDC[] = "\033[3;2~"; -static char xterm_256color_s_kEND[] = "\033[1;2F"; -static char xterm_256color_s_kHOM[] = "\033[1;2H"; -static char xterm_256color_s_kIC[] = "\033[2;2~"; -static char xterm_256color_s_kLFT[] = "\033[1;2D"; -static char xterm_256color_s_kNXT[] = "\033[6;2~"; -static char xterm_256color_s_kPRV[] = "\033[5;2~"; -static char xterm_256color_s_kRIT[] = "\033[1;2C"; -static char xterm_256color_s_kf11[] = "\033[23~"; -static char xterm_256color_s_kf12[] = "\033[24~"; -static char xterm_256color_s_kf13[] = "\033[1;2P"; -static char xterm_256color_s_kf14[] = "\033[1;2Q"; -static char xterm_256color_s_kf15[] = "\033[1;2R"; -static char xterm_256color_s_kf16[] = "\033[1;2S"; -static char xterm_256color_s_kf17[] = "\033[15;2~"; -static char xterm_256color_s_kf18[] = "\033[17;2~"; -static char xterm_256color_s_kf19[] = "\033[18;2~"; -static char xterm_256color_s_kf20[] = "\033[19;2~"; -static char xterm_256color_s_kf21[] = "\033[20;2~"; -static char xterm_256color_s_kf22[] = "\033[21;2~"; -static char xterm_256color_s_kf23[] = "\033[23;2~"; -static char xterm_256color_s_kf24[] = "\033[24;2~"; -static char xterm_256color_s_kf25[] = "\033[1;5P"; -static char xterm_256color_s_kf26[] = "\033[1;5Q"; -static char xterm_256color_s_kf27[] = "\033[1;5R"; -static char xterm_256color_s_kf28[] = "\033[1;5S"; -static char xterm_256color_s_kf29[] = "\033[15;5~"; -static char xterm_256color_s_kf30[] = "\033[17;5~"; -static char xterm_256color_s_kf31[] = "\033[18;5~"; -static char xterm_256color_s_kf32[] = "\033[19;5~"; -static char xterm_256color_s_kf33[] = "\033[20;5~"; -static char xterm_256color_s_kf34[] = "\033[21;5~"; -static char xterm_256color_s_kf35[] = "\033[23;5~"; -static char xterm_256color_s_kf36[] = "\033[24;5~"; -static char xterm_256color_s_kf37[] = "\033[1;6P"; -static char xterm_256color_s_kf38[] = "\033[1;6Q"; -static char xterm_256color_s_kf39[] = "\033[1;6R"; -static char xterm_256color_s_kf40[] = "\033[1;6S"; -static char xterm_256color_s_kf41[] = "\033[15;6~"; -static char xterm_256color_s_kf42[] = "\033[17;6~"; -static char xterm_256color_s_kf43[] = "\033[18;6~"; -static char xterm_256color_s_kf44[] = "\033[19;6~"; -static char xterm_256color_s_kf45[] = "\033[20;6~"; -static char xterm_256color_s_kf46[] = "\033[21;6~"; -static char xterm_256color_s_kf47[] = "\033[23;6~"; -static char xterm_256color_s_kf48[] = "\033[24;6~"; -static char xterm_256color_s_kf49[] = "\033[1;3P"; -static char xterm_256color_s_kf50[] = "\033[1;3Q"; -static char xterm_256color_s_kf51[] = "\033[1;3R"; -static char xterm_256color_s_kf52[] = "\033[1;3S"; -static char xterm_256color_s_kf53[] = "\033[15;3~"; -static char xterm_256color_s_kf54[] = "\033[17;3~"; -static char xterm_256color_s_kf55[] = "\033[18;3~"; -static char xterm_256color_s_kf56[] = "\033[19;3~"; -static char xterm_256color_s_kf57[] = "\033[20;3~"; -static char xterm_256color_s_kf58[] = "\033[21;3~"; -static char xterm_256color_s_kf59[] = "\033[23;3~"; -static char xterm_256color_s_kf60[] = "\033[24;3~"; -static char xterm_256color_s_kf61[] = "\033[1;4P"; -static char xterm_256color_s_kf62[] = "\033[1;4Q"; -static char xterm_256color_s_kf63[] = "\033[1;4R"; -static char xterm_256color_s_el1[] = "\033[1K"; -static char xterm_256color_s_u6 [] = "\033[%i%d;%dR"; -static char xterm_256color_s_u7 [] = "\033[6n"; -static char xterm_256color_s_u8 [] = "\033[?%[;0123456789]c"; -static char xterm_256color_s_u9 [] = "\033[c"; -static char xterm_256color_s_op [] = "\033[39;49m"; -static char xterm_256color_s_oc [] = "\033]104\007"; -static char xterm_256color_s_initc[] = "\033]4;%p1%d;rgb:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\033\134"; -static char xterm_256color_s_sitm[] = "\033[3m"; -static char xterm_256color_s_ritm[] = "\033[23m"; -static char xterm_256color_s_kmous[] = "\033[<"; -static char xterm_256color_s_setaf[] = "\033[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"; -static char xterm_256color_s_setab[] = "\033[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m"; -static char xterm_256color_s_meml[] = "\033l"; -static char xterm_256color_s_memu[] = "\033m"; - -static char xterm_256color_bool_data[] = { - /* 0: bw */ FALSE, - /* 1: am */ TRUE, - /* 2: xsb */ FALSE, - /* 3: xhp */ FALSE, - /* 4: xenl */ TRUE, - /* 5: eo */ FALSE, - /* 6: gn */ FALSE, - /* 7: hc */ FALSE, - /* 8: km */ TRUE, - /* 9: hs */ FALSE, - /* 10: in */ FALSE, - /* 11: da */ FALSE, - /* 12: db */ FALSE, - /* 13: mir */ TRUE, - /* 14: msgr */ TRUE, - /* 15: os */ FALSE, - /* 16: eslok */ FALSE, - /* 17: xt */ FALSE, - /* 18: hz */ FALSE, - /* 19: ul */ FALSE, - /* 20: xon */ FALSE, - /* 21: nxon */ FALSE, - /* 22: mc5i */ TRUE, - /* 23: chts */ FALSE, - /* 24: nrrmc */ FALSE, - /* 25: npc */ TRUE, - /* 26: ndscr */ FALSE, - /* 27: ccc */ TRUE, - /* 28: bce */ TRUE, - /* 29: hls */ FALSE, - /* 30: xhpa */ FALSE, - /* 31: crxm */ FALSE, - /* 32: daisy */ FALSE, - /* 33: xvpa */ FALSE, - /* 34: sam */ FALSE, - /* 35: cpix */ FALSE, - /* 36: lpix */ FALSE, - /* 37: OTbs */ TRUE, - /* 38: OTns */ FALSE, - /* 39: OTnc */ FALSE, - /* 40: OTMT */ FALSE, - /* 41: OTNL */ FALSE, - /* 42: OTpt */ FALSE, - /* 43: OTxr */ FALSE, -}; -static NCURSES_INT2 xterm_256color_number_data[] = { - /* 0: cols */ 80, - /* 1: it */ 8, - /* 2: lines */ 24, - /* 3: lm */ ABSENT_NUMERIC, - /* 4: xmc */ ABSENT_NUMERIC, - /* 5: pb */ ABSENT_NUMERIC, - /* 6: vt */ ABSENT_NUMERIC, - /* 7: wsl */ ABSENT_NUMERIC, - /* 8: nlab */ ABSENT_NUMERIC, - /* 9: lh */ ABSENT_NUMERIC, - /* 10: lw */ ABSENT_NUMERIC, - /* 11: ma */ ABSENT_NUMERIC, - /* 12: wnum */ ABSENT_NUMERIC, - /* 13: colors */ 256, - /* 14: pairs */ 32767, - /* 15: ncv */ ABSENT_NUMERIC, - /* 16: bufsz */ ABSENT_NUMERIC, - /* 17: spinv */ ABSENT_NUMERIC, - /* 18: spinh */ ABSENT_NUMERIC, - /* 19: maddr */ ABSENT_NUMERIC, - /* 20: mjump */ ABSENT_NUMERIC, - /* 21: mcs */ ABSENT_NUMERIC, - /* 22: mls */ ABSENT_NUMERIC, - /* 23: npins */ ABSENT_NUMERIC, - /* 24: orc */ ABSENT_NUMERIC, - /* 25: orl */ ABSENT_NUMERIC, - /* 26: orhi */ ABSENT_NUMERIC, - /* 27: orvi */ ABSENT_NUMERIC, - /* 28: cps */ ABSENT_NUMERIC, - /* 29: widcs */ ABSENT_NUMERIC, - /* 30: btns */ ABSENT_NUMERIC, - /* 31: bitwin */ ABSENT_NUMERIC, - /* 32: bitype */ ABSENT_NUMERIC, - /* 33: OTug */ ABSENT_NUMERIC, - /* 34: OTdC */ ABSENT_NUMERIC, - /* 35: OTdN */ ABSENT_NUMERIC, - /* 36: OTdB */ ABSENT_NUMERIC, - /* 37: OTdT */ ABSENT_NUMERIC, - /* 38: OTkn */ ABSENT_NUMERIC, -}; -static char * xterm_256color_string_data[] = { - /* 0: cbt */ xterm_256color_s_cbt, - /* 1: bel */ xterm_256color_s_bel, - /* 2: cr */ xterm_256color_s_cr, - /* 3: csr */ xterm_256color_s_csr, - /* 4: tbc */ xterm_256color_s_tbc, - /* 5: clear */ xterm_256color_s_clear, - /* 6: el */ xterm_256color_s_el, - /* 7: ed */ xterm_256color_s_ed, - /* 8: hpa */ xterm_256color_s_hpa, - /* 9: cmdch */ ABSENT_STRING, - /* 10: cup */ xterm_256color_s_cup, - /* 11: cud1 */ xterm_256color_s_cud1, - /* 12: home */ xterm_256color_s_home, - /* 13: civis */ xterm_256color_s_civis, - /* 14: cub1 */ xterm_256color_s_cub1, - /* 15: mrcup */ ABSENT_STRING, - /* 16: cnorm */ xterm_256color_s_cnorm, - /* 17: cuf1 */ xterm_256color_s_cuf1, - /* 18: ll */ ABSENT_STRING, - /* 19: cuu1 */ xterm_256color_s_cuu1, - /* 20: cvvis */ xterm_256color_s_cvvis, - /* 21: dch1 */ xterm_256color_s_dch1, - /* 22: dl1 */ xterm_256color_s_dl1, - /* 23: dsl */ ABSENT_STRING, - /* 24: hd */ ABSENT_STRING, - /* 25: smacs */ xterm_256color_s_smacs, - /* 26: blink */ xterm_256color_s_blink, - /* 27: bold */ xterm_256color_s_bold, - /* 28: smcup */ xterm_256color_s_smcup, - /* 29: smdc */ ABSENT_STRING, - /* 30: dim */ xterm_256color_s_dim, - /* 31: smir */ xterm_256color_s_smir, - /* 32: invis */ xterm_256color_s_invis, - /* 33: prot */ ABSENT_STRING, - /* 34: rev */ xterm_256color_s_rev, - /* 35: smso */ xterm_256color_s_smso, - /* 36: smul */ xterm_256color_s_smul, - /* 37: ech */ xterm_256color_s_ech, - /* 38: rmacs */ xterm_256color_s_rmacs, - /* 39: sgr0 */ xterm_256color_s_sgr0, - /* 40: rmcup */ xterm_256color_s_rmcup, - /* 41: rmdc */ ABSENT_STRING, - /* 42: rmir */ xterm_256color_s_rmir, - /* 43: rmso */ xterm_256color_s_rmso, - /* 44: rmul */ xterm_256color_s_rmul, - /* 45: flash */ xterm_256color_s_flash, - /* 46: ff */ ABSENT_STRING, - /* 47: fsl */ ABSENT_STRING, - /* 48: is1 */ ABSENT_STRING, - /* 49: is2 */ xterm_256color_s_is2, - /* 50: is3 */ ABSENT_STRING, - /* 51: if */ ABSENT_STRING, - /* 52: ich1 */ ABSENT_STRING, - /* 53: il1 */ xterm_256color_s_il1, - /* 54: ip */ ABSENT_STRING, - /* 55: kbs */ xterm_256color_s_kbs, - /* 56: ktbc */ ABSENT_STRING, - /* 57: kclr */ ABSENT_STRING, - /* 58: kctab */ ABSENT_STRING, - /* 59: kdch1 */ xterm_256color_s_kdch1, - /* 60: kdl1 */ ABSENT_STRING, - /* 61: kcud1 */ xterm_256color_s_kcud1, - /* 62: krmir */ ABSENT_STRING, - /* 63: kel */ ABSENT_STRING, - /* 64: ked */ ABSENT_STRING, - /* 65: kf0 */ ABSENT_STRING, - /* 66: kf1 */ xterm_256color_s_kf1, - /* 67: kf10 */ xterm_256color_s_kf10, - /* 68: kf2 */ xterm_256color_s_kf2, - /* 69: kf3 */ xterm_256color_s_kf3, - /* 70: kf4 */ xterm_256color_s_kf4, - /* 71: kf5 */ xterm_256color_s_kf5, - /* 72: kf6 */ xterm_256color_s_kf6, - /* 73: kf7 */ xterm_256color_s_kf7, - /* 74: kf8 */ xterm_256color_s_kf8, - /* 75: kf9 */ xterm_256color_s_kf9, - /* 76: khome */ xterm_256color_s_khome, - /* 77: kich1 */ xterm_256color_s_kich1, - /* 78: kil1 */ ABSENT_STRING, - /* 79: kcub1 */ xterm_256color_s_kcub1, - /* 80: kll */ ABSENT_STRING, - /* 81: knp */ xterm_256color_s_knp, - /* 82: kpp */ xterm_256color_s_kpp, - /* 83: kcuf1 */ xterm_256color_s_kcuf1, - /* 84: kind */ xterm_256color_s_kind, - /* 85: kri */ xterm_256color_s_kri, - /* 86: khts */ ABSENT_STRING, - /* 87: kcuu1 */ xterm_256color_s_kcuu1, - /* 88: rmkx */ xterm_256color_s_rmkx, - /* 89: smkx */ xterm_256color_s_smkx, - /* 90: lf0 */ ABSENT_STRING, - /* 91: lf1 */ ABSENT_STRING, - /* 92: lf10 */ ABSENT_STRING, - /* 93: lf2 */ ABSENT_STRING, - /* 94: lf3 */ ABSENT_STRING, - /* 95: lf4 */ ABSENT_STRING, - /* 96: lf5 */ ABSENT_STRING, - /* 97: lf6 */ ABSENT_STRING, - /* 98: lf7 */ ABSENT_STRING, - /* 99: lf8 */ ABSENT_STRING, - /* 100: lf9 */ ABSENT_STRING, - /* 101: rmm */ xterm_256color_s_rmm, - /* 102: smm */ xterm_256color_s_smm, - /* 103: nel */ ABSENT_STRING, - /* 104: pad */ ABSENT_STRING, - /* 105: dch */ xterm_256color_s_dch, - /* 106: dl */ xterm_256color_s_dl, - /* 107: cud */ xterm_256color_s_cud, - /* 108: ich */ xterm_256color_s_ich, - /* 109: indn */ xterm_256color_s_indn, - /* 110: il */ xterm_256color_s_il, - /* 111: cub */ xterm_256color_s_cub, - /* 112: cuf */ xterm_256color_s_cuf, - /* 113: rin */ xterm_256color_s_rin, - /* 114: cuu */ xterm_256color_s_cuu, - /* 115: pfkey */ ABSENT_STRING, - /* 116: pfloc */ ABSENT_STRING, - /* 117: pfx */ ABSENT_STRING, - /* 118: mc0 */ xterm_256color_s_mc0, - /* 119: mc4 */ xterm_256color_s_mc4, - /* 120: mc5 */ xterm_256color_s_mc5, - /* 121: rep */ xterm_256color_s_rep, - /* 122: rs1 */ xterm_256color_s_rs1, - /* 123: rs2 */ xterm_256color_s_rs2, - /* 124: rs3 */ ABSENT_STRING, - /* 125: rf */ ABSENT_STRING, - /* 126: rc */ xterm_256color_s_rc, - /* 127: vpa */ xterm_256color_s_vpa, - /* 128: sc */ xterm_256color_s_sc, - /* 129: ind */ xterm_256color_s_ind, - /* 130: ri */ xterm_256color_s_ri, - /* 131: sgr */ xterm_256color_s_sgr, - /* 132: hts */ xterm_256color_s_hts, - /* 133: wind */ ABSENT_STRING, - /* 134: ht */ xterm_256color_s_ht, - /* 135: tsl */ ABSENT_STRING, - /* 136: uc */ ABSENT_STRING, - /* 137: hu */ ABSENT_STRING, - /* 138: iprog */ ABSENT_STRING, - /* 139: ka1 */ ABSENT_STRING, - /* 140: ka3 */ ABSENT_STRING, - /* 141: kb2 */ xterm_256color_s_kb2, - /* 142: kc1 */ ABSENT_STRING, - /* 143: kc3 */ ABSENT_STRING, - /* 144: mc5p */ ABSENT_STRING, - /* 145: rmp */ ABSENT_STRING, - /* 146: acsc */ xterm_256color_s_acsc, - /* 147: pln */ ABSENT_STRING, - /* 148: kcbt */ xterm_256color_s_kcbt, - /* 149: smxon */ ABSENT_STRING, - /* 150: rmxon */ ABSENT_STRING, - /* 151: smam */ xterm_256color_s_smam, - /* 152: rmam */ xterm_256color_s_rmam, - /* 153: xonc */ ABSENT_STRING, - /* 154: xoffc */ ABSENT_STRING, - /* 155: enacs */ ABSENT_STRING, - /* 156: smln */ ABSENT_STRING, - /* 157: rmln */ ABSENT_STRING, - /* 158: kbeg */ ABSENT_STRING, - /* 159: kcan */ ABSENT_STRING, - /* 160: kclo */ ABSENT_STRING, - /* 161: kcmd */ ABSENT_STRING, - /* 162: kcpy */ ABSENT_STRING, - /* 163: kcrt */ ABSENT_STRING, - /* 164: kend */ xterm_256color_s_kend, - /* 165: kent */ xterm_256color_s_kent, - /* 166: kext */ ABSENT_STRING, - /* 167: kfnd */ ABSENT_STRING, - /* 168: khlp */ ABSENT_STRING, - /* 169: kmrk */ ABSENT_STRING, - /* 170: kmsg */ ABSENT_STRING, - /* 171: kmov */ ABSENT_STRING, - /* 172: knxt */ ABSENT_STRING, - /* 173: kopn */ ABSENT_STRING, - /* 174: kopt */ ABSENT_STRING, - /* 175: kprv */ ABSENT_STRING, - /* 176: kprt */ ABSENT_STRING, - /* 177: krdo */ ABSENT_STRING, - /* 178: kref */ ABSENT_STRING, - /* 179: krfr */ ABSENT_STRING, - /* 180: krpl */ ABSENT_STRING, - /* 181: krst */ ABSENT_STRING, - /* 182: kres */ ABSENT_STRING, - /* 183: ksav */ ABSENT_STRING, - /* 184: kspd */ ABSENT_STRING, - /* 185: kund */ ABSENT_STRING, - /* 186: kBEG */ ABSENT_STRING, - /* 187: kCAN */ ABSENT_STRING, - /* 188: kCMD */ ABSENT_STRING, - /* 189: kCPY */ ABSENT_STRING, - /* 190: kCRT */ ABSENT_STRING, - /* 191: kDC */ xterm_256color_s_kDC, - /* 192: kDL */ ABSENT_STRING, - /* 193: kslt */ ABSENT_STRING, - /* 194: kEND */ xterm_256color_s_kEND, - /* 195: kEOL */ ABSENT_STRING, - /* 196: kEXT */ ABSENT_STRING, - /* 197: kFND */ ABSENT_STRING, - /* 198: kHLP */ ABSENT_STRING, - /* 199: kHOM */ xterm_256color_s_kHOM, - /* 200: kIC */ xterm_256color_s_kIC, - /* 201: kLFT */ xterm_256color_s_kLFT, - /* 202: kMSG */ ABSENT_STRING, - /* 203: kMOV */ ABSENT_STRING, - /* 204: kNXT */ xterm_256color_s_kNXT, - /* 205: kOPT */ ABSENT_STRING, - /* 206: kPRV */ xterm_256color_s_kPRV, - /* 207: kPRT */ ABSENT_STRING, - /* 208: kRDO */ ABSENT_STRING, - /* 209: kRPL */ ABSENT_STRING, - /* 210: kRIT */ xterm_256color_s_kRIT, - /* 211: kRES */ ABSENT_STRING, - /* 212: kSAV */ ABSENT_STRING, - /* 213: kSPD */ ABSENT_STRING, - /* 214: kUND */ ABSENT_STRING, - /* 215: rfi */ ABSENT_STRING, - /* 216: kf11 */ xterm_256color_s_kf11, - /* 217: kf12 */ xterm_256color_s_kf12, - /* 218: kf13 */ xterm_256color_s_kf13, - /* 219: kf14 */ xterm_256color_s_kf14, - /* 220: kf15 */ xterm_256color_s_kf15, - /* 221: kf16 */ xterm_256color_s_kf16, - /* 222: kf17 */ xterm_256color_s_kf17, - /* 223: kf18 */ xterm_256color_s_kf18, - /* 224: kf19 */ xterm_256color_s_kf19, - /* 225: kf20 */ xterm_256color_s_kf20, - /* 226: kf21 */ xterm_256color_s_kf21, - /* 227: kf22 */ xterm_256color_s_kf22, - /* 228: kf23 */ xterm_256color_s_kf23, - /* 229: kf24 */ xterm_256color_s_kf24, - /* 230: kf25 */ xterm_256color_s_kf25, - /* 231: kf26 */ xterm_256color_s_kf26, - /* 232: kf27 */ xterm_256color_s_kf27, - /* 233: kf28 */ xterm_256color_s_kf28, - /* 234: kf29 */ xterm_256color_s_kf29, - /* 235: kf30 */ xterm_256color_s_kf30, - /* 236: kf31 */ xterm_256color_s_kf31, - /* 237: kf32 */ xterm_256color_s_kf32, - /* 238: kf33 */ xterm_256color_s_kf33, - /* 239: kf34 */ xterm_256color_s_kf34, - /* 240: kf35 */ xterm_256color_s_kf35, - /* 241: kf36 */ xterm_256color_s_kf36, - /* 242: kf37 */ xterm_256color_s_kf37, - /* 243: kf38 */ xterm_256color_s_kf38, - /* 244: kf39 */ xterm_256color_s_kf39, - /* 245: kf40 */ xterm_256color_s_kf40, - /* 246: kf41 */ xterm_256color_s_kf41, - /* 247: kf42 */ xterm_256color_s_kf42, - /* 248: kf43 */ xterm_256color_s_kf43, - /* 249: kf44 */ xterm_256color_s_kf44, - /* 250: kf45 */ xterm_256color_s_kf45, - /* 251: kf46 */ xterm_256color_s_kf46, - /* 252: kf47 */ xterm_256color_s_kf47, - /* 253: kf48 */ xterm_256color_s_kf48, - /* 254: kf49 */ xterm_256color_s_kf49, - /* 255: kf50 */ xterm_256color_s_kf50, - /* 256: kf51 */ xterm_256color_s_kf51, - /* 257: kf52 */ xterm_256color_s_kf52, - /* 258: kf53 */ xterm_256color_s_kf53, - /* 259: kf54 */ xterm_256color_s_kf54, - /* 260: kf55 */ xterm_256color_s_kf55, - /* 261: kf56 */ xterm_256color_s_kf56, - /* 262: kf57 */ xterm_256color_s_kf57, - /* 263: kf58 */ xterm_256color_s_kf58, - /* 264: kf59 */ xterm_256color_s_kf59, - /* 265: kf60 */ xterm_256color_s_kf60, - /* 266: kf61 */ xterm_256color_s_kf61, - /* 267: kf62 */ xterm_256color_s_kf62, - /* 268: kf63 */ xterm_256color_s_kf63, - /* 269: el1 */ xterm_256color_s_el1, - /* 270: mgc */ ABSENT_STRING, - /* 271: smgl */ ABSENT_STRING, - /* 272: smgr */ ABSENT_STRING, - /* 273: fln */ ABSENT_STRING, - /* 274: sclk */ ABSENT_STRING, - /* 275: dclk */ ABSENT_STRING, - /* 276: rmclk */ ABSENT_STRING, - /* 277: cwin */ ABSENT_STRING, - /* 278: wingo */ ABSENT_STRING, - /* 279: hup */ ABSENT_STRING, - /* 280: dial */ ABSENT_STRING, - /* 281: qdial */ ABSENT_STRING, - /* 282: tone */ ABSENT_STRING, - /* 283: pulse */ ABSENT_STRING, - /* 284: hook */ ABSENT_STRING, - /* 285: pause */ ABSENT_STRING, - /* 286: wait */ ABSENT_STRING, - /* 287: u0 */ ABSENT_STRING, - /* 288: u1 */ ABSENT_STRING, - /* 289: u2 */ ABSENT_STRING, - /* 290: u3 */ ABSENT_STRING, - /* 291: u4 */ ABSENT_STRING, - /* 292: u5 */ ABSENT_STRING, - /* 293: u6 */ xterm_256color_s_u6, - /* 294: u7 */ xterm_256color_s_u7, - /* 295: u8 */ xterm_256color_s_u8, - /* 296: u9 */ xterm_256color_s_u9, - /* 297: op */ xterm_256color_s_op, - /* 298: oc */ xterm_256color_s_oc, - /* 299: initc */ xterm_256color_s_initc, - /* 300: initp */ ABSENT_STRING, - /* 301: scp */ ABSENT_STRING, - /* 302: setf */ ABSENT_STRING, - /* 303: setb */ ABSENT_STRING, - /* 304: cpi */ ABSENT_STRING, - /* 305: lpi */ ABSENT_STRING, - /* 306: chr */ ABSENT_STRING, - /* 307: cvr */ ABSENT_STRING, - /* 308: defc */ ABSENT_STRING, - /* 309: swidm */ ABSENT_STRING, - /* 310: sdrfq */ ABSENT_STRING, - /* 311: sitm */ xterm_256color_s_sitm, - /* 312: slm */ ABSENT_STRING, - /* 313: smicm */ ABSENT_STRING, - /* 314: snlq */ ABSENT_STRING, - /* 315: snrmq */ ABSENT_STRING, - /* 316: sshm */ ABSENT_STRING, - /* 317: ssubm */ ABSENT_STRING, - /* 318: ssupm */ ABSENT_STRING, - /* 319: sum */ ABSENT_STRING, - /* 320: rwidm */ ABSENT_STRING, - /* 321: ritm */ xterm_256color_s_ritm, - /* 322: rlm */ ABSENT_STRING, - /* 323: rmicm */ ABSENT_STRING, - /* 324: rshm */ ABSENT_STRING, - /* 325: rsubm */ ABSENT_STRING, - /* 326: rsupm */ ABSENT_STRING, - /* 327: rum */ ABSENT_STRING, - /* 328: mhpa */ ABSENT_STRING, - /* 329: mcud1 */ ABSENT_STRING, - /* 330: mcub1 */ ABSENT_STRING, - /* 331: mcuf1 */ ABSENT_STRING, - /* 332: mvpa */ ABSENT_STRING, - /* 333: mcuu1 */ ABSENT_STRING, - /* 334: porder */ ABSENT_STRING, - /* 335: mcud */ ABSENT_STRING, - /* 336: mcub */ ABSENT_STRING, - /* 337: mcuf */ ABSENT_STRING, - /* 338: mcuu */ ABSENT_STRING, - /* 339: scs */ ABSENT_STRING, - /* 340: smgb */ ABSENT_STRING, - /* 341: smgbp */ ABSENT_STRING, - /* 342: smglp */ ABSENT_STRING, - /* 343: smgrp */ ABSENT_STRING, - /* 344: smgt */ ABSENT_STRING, - /* 345: smgtp */ ABSENT_STRING, - /* 346: sbim */ ABSENT_STRING, - /* 347: scsd */ ABSENT_STRING, - /* 348: rbim */ ABSENT_STRING, - /* 349: rcsd */ ABSENT_STRING, - /* 350: subcs */ ABSENT_STRING, - /* 351: supcs */ ABSENT_STRING, - /* 352: docr */ ABSENT_STRING, - /* 353: zerom */ ABSENT_STRING, - /* 354: csnm */ ABSENT_STRING, - /* 355: kmous */ xterm_256color_s_kmous, - /* 356: minfo */ ABSENT_STRING, - /* 357: reqmp */ ABSENT_STRING, - /* 358: getm */ ABSENT_STRING, - /* 359: setaf */ xterm_256color_s_setaf, - /* 360: setab */ xterm_256color_s_setab, - /* 361: pfxl */ ABSENT_STRING, - /* 362: devt */ ABSENT_STRING, - /* 363: csin */ ABSENT_STRING, - /* 364: s0ds */ ABSENT_STRING, - /* 365: s1ds */ ABSENT_STRING, - /* 366: s2ds */ ABSENT_STRING, - /* 367: s3ds */ ABSENT_STRING, - /* 368: smglr */ ABSENT_STRING, - /* 369: smgtb */ ABSENT_STRING, - /* 370: birep */ ABSENT_STRING, - /* 371: binel */ ABSENT_STRING, - /* 372: bicr */ ABSENT_STRING, - /* 373: colornm */ ABSENT_STRING, - /* 374: defbi */ ABSENT_STRING, - /* 375: endbi */ ABSENT_STRING, - /* 376: setcolor */ ABSENT_STRING, - /* 377: slines */ ABSENT_STRING, - /* 378: dispc */ ABSENT_STRING, - /* 379: smpch */ ABSENT_STRING, - /* 380: rmpch */ ABSENT_STRING, - /* 381: smsc */ ABSENT_STRING, - /* 382: rmsc */ ABSENT_STRING, - /* 383: pctrm */ ABSENT_STRING, - /* 384: scesc */ ABSENT_STRING, - /* 385: scesa */ ABSENT_STRING, - /* 386: ehhlm */ ABSENT_STRING, - /* 387: elhlm */ ABSENT_STRING, - /* 388: elohlm */ ABSENT_STRING, - /* 389: erhlm */ ABSENT_STRING, - /* 390: ethlm */ ABSENT_STRING, - /* 391: evhlm */ ABSENT_STRING, - /* 392: sgr1 */ ABSENT_STRING, - /* 393: slength */ ABSENT_STRING, - /* 394: OTi2 */ ABSENT_STRING, - /* 395: OTrs */ ABSENT_STRING, - /* 396: OTnl */ ABSENT_STRING, - /* 397: OTbc */ ABSENT_STRING, - /* 398: OTko */ ABSENT_STRING, - /* 399: OTma */ ABSENT_STRING, - /* 400: OTG2 */ ABSENT_STRING, - /* 401: OTG3 */ ABSENT_STRING, - /* 402: OTG1 */ ABSENT_STRING, - /* 403: OTG4 */ ABSENT_STRING, - /* 404: OTGR */ ABSENT_STRING, - /* 405: OTGL */ ABSENT_STRING, - /* 406: OTGU */ ABSENT_STRING, - /* 407: OTGD */ ABSENT_STRING, - /* 408: OTGH */ ABSENT_STRING, - /* 409: OTGV */ ABSENT_STRING, - /* 410: OTGC */ ABSENT_STRING, - /* 411: meml */ xterm_256color_s_meml, - /* 412: memu */ xterm_256color_s_memu, - /* 413: box1 */ ABSENT_STRING, -}; -/* screen */ - -static char screen_alias_data[] = "screen|VT 100/ANSI X3.64 virtual terminal"; - -static char screen_s_cbt [] = "\033[Z"; -static char screen_s_bel [] = "\007"; -static char screen_s_cr [] = "\015"; -static char screen_s_csr [] = "\033[%i%p1%d;%p2%dr"; -static char screen_s_tbc [] = "\033[3g"; -static char screen_s_clear [] = "\033[H\033[J"; -static char screen_s_el [] = "\033[K"; -static char screen_s_ed [] = "\033[J"; -static char screen_s_hpa [] = "\033[%i%p1%dG"; -static char screen_s_cup [] = "\033[%i%p1%d;%p2%dH"; -static char screen_s_cud1 [] = "\012"; -static char screen_s_home [] = "\033[H"; -static char screen_s_civis [] = "\033[?25l"; -static char screen_s_cub1 [] = "\010"; -static char screen_s_cnorm [] = "\033[34h\033[?25h"; -static char screen_s_cuf1 [] = "\033[C"; -static char screen_s_cuu1 [] = "\033M"; -static char screen_s_cvvis [] = "\033[34l"; -static char screen_s_dch1 [] = "\033[P"; -static char screen_s_dl1 [] = "\033[M"; -static char screen_s_smacs [] = "\016"; -static char screen_s_blink [] = "\033[5m"; -static char screen_s_bold [] = "\033[1m"; -static char screen_s_smcup [] = "\033[?1049h"; -static char screen_s_dim [] = "\033[2m"; -static char screen_s_smir [] = "\033[4h"; -static char screen_s_rev [] = "\033[7m"; -static char screen_s_smso [] = "\033[3m"; -static char screen_s_smul [] = "\033[4m"; -static char screen_s_rmacs [] = "\017"; -static char screen_s_sgr0 [] = "\033[m\017"; -static char screen_s_rmcup [] = "\033[?1049l"; -static char screen_s_rmir [] = "\033[4l"; -static char screen_s_rmso [] = "\033[23m"; -static char screen_s_rmul [] = "\033[24m"; -static char screen_s_flash [] = "\033g"; -static char screen_s_is2 [] = "\033)0"; -static char screen_s_il1 [] = "\033[L"; -static char screen_s_kbs [] = "\010"; -static char screen_s_kdch1 [] = "\033[3~"; -static char screen_s_kcud1 [] = "\033OB"; -static char screen_s_kf1 [] = "\033OP"; -static char screen_s_kf10 [] = "\033[21~"; -static char screen_s_kf2 [] = "\033OQ"; -static char screen_s_kf3 [] = "\033OR"; -static char screen_s_kf4 [] = "\033OS"; -static char screen_s_kf5 [] = "\033[15~"; -static char screen_s_kf6 [] = "\033[17~"; -static char screen_s_kf7 [] = "\033[18~"; -static char screen_s_kf8 [] = "\033[19~"; -static char screen_s_kf9 [] = "\033[20~"; -static char screen_s_khome [] = "\033[1~"; -static char screen_s_kich1 [] = "\033[2~"; -static char screen_s_kcub1 [] = "\033OD"; -static char screen_s_knp [] = "\033[6~"; -static char screen_s_kpp [] = "\033[5~"; -static char screen_s_kcuf1 [] = "\033OC"; -static char screen_s_kcuu1 [] = "\033OA"; -static char screen_s_rmkx [] = "\033[?1l\033>"; -static char screen_s_smkx [] = "\033[?1h\033="; -static char screen_s_nel [] = "\033E"; -static char screen_s_dch [] = "\033[%p1%dP"; -static char screen_s_dl [] = "\033[%p1%dM"; -static char screen_s_cud [] = "\033[%p1%dB"; -static char screen_s_ich [] = "\033[%p1%d@"; -static char screen_s_indn [] = "\033[%p1%dS"; -static char screen_s_il [] = "\033[%p1%dL"; -static char screen_s_cub [] = "\033[%p1%dD"; -static char screen_s_cuf [] = "\033[%p1%dC"; -static char screen_s_cuu [] = "\033[%p1%dA"; -static char screen_s_rs2 [] = "\033c\033[?1000l\033[?25h"; -static char screen_s_rc [] = "\0338"; -static char screen_s_vpa [] = "\033[%i%p1%dd"; -static char screen_s_sc [] = "\0337"; -static char screen_s_ind [] = "\012"; -static char screen_s_ri [] = "\033M"; -static char screen_s_sgr [] = "\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;"; -static char screen_s_hts [] = "\033H"; -static char screen_s_ht [] = "\011"; -static char screen_s_acsc [] = "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"; -static char screen_s_kcbt [] = "\033[Z"; -static char screen_s_enacs [] = "\033(B\033)0"; -static char screen_s_kend [] = "\033[4~"; -static char screen_s_kf11 [] = "\033[23~"; -static char screen_s_kf12 [] = "\033[24~"; -static char screen_s_el1 [] = "\033[1K"; -static char screen_s_op [] = "\033[39;49m"; -static char screen_s_kmous [] = "\033[M"; -static char screen_s_setaf [] = "\033[3%p1%dm"; -static char screen_s_setab [] = "\033[4%p1%dm"; - -static char screen_bool_data[] = { - /* 0: bw */ FALSE, - /* 1: am */ TRUE, - /* 2: xsb */ FALSE, - /* 3: xhp */ FALSE, - /* 4: xenl */ TRUE, - /* 5: eo */ FALSE, - /* 6: gn */ FALSE, - /* 7: hc */ FALSE, - /* 8: km */ TRUE, - /* 9: hs */ FALSE, - /* 10: in */ FALSE, - /* 11: da */ FALSE, - /* 12: db */ FALSE, - /* 13: mir */ TRUE, - /* 14: msgr */ TRUE, - /* 15: os */ FALSE, - /* 16: eslok */ FALSE, - /* 17: xt */ FALSE, - /* 18: hz */ FALSE, - /* 19: ul */ FALSE, - /* 20: xon */ FALSE, - /* 21: nxon */ FALSE, - /* 22: mc5i */ FALSE, - /* 23: chts */ FALSE, - /* 24: nrrmc */ FALSE, - /* 25: npc */ FALSE, - /* 26: ndscr */ FALSE, - /* 27: ccc */ FALSE, - /* 28: bce */ FALSE, - /* 29: hls */ FALSE, - /* 30: xhpa */ FALSE, - /* 31: crxm */ FALSE, - /* 32: daisy */ FALSE, - /* 33: xvpa */ FALSE, - /* 34: sam */ FALSE, - /* 35: cpix */ FALSE, - /* 36: lpix */ FALSE, - /* 37: OTbs */ TRUE, - /* 38: OTns */ FALSE, - /* 39: OTnc */ FALSE, - /* 40: OTMT */ FALSE, - /* 41: OTNL */ FALSE, - /* 42: OTpt */ TRUE, - /* 43: OTxr */ FALSE, -}; -static NCURSES_INT2 screen_number_data[] = { - /* 0: cols */ 80, - /* 1: it */ 8, - /* 2: lines */ 24, - /* 3: lm */ ABSENT_NUMERIC, - /* 4: xmc */ ABSENT_NUMERIC, - /* 5: pb */ ABSENT_NUMERIC, - /* 6: vt */ ABSENT_NUMERIC, - /* 7: wsl */ ABSENT_NUMERIC, - /* 8: nlab */ ABSENT_NUMERIC, - /* 9: lh */ ABSENT_NUMERIC, - /* 10: lw */ ABSENT_NUMERIC, - /* 11: ma */ ABSENT_NUMERIC, - /* 12: wnum */ ABSENT_NUMERIC, - /* 13: colors */ 8, - /* 14: pairs */ 64, - /* 15: ncv */ CANCELLED_NUMERIC, - /* 16: bufsz */ ABSENT_NUMERIC, - /* 17: spinv */ ABSENT_NUMERIC, - /* 18: spinh */ ABSENT_NUMERIC, - /* 19: maddr */ ABSENT_NUMERIC, - /* 20: mjump */ ABSENT_NUMERIC, - /* 21: mcs */ ABSENT_NUMERIC, - /* 22: mls */ ABSENT_NUMERIC, - /* 23: npins */ ABSENT_NUMERIC, - /* 24: orc */ ABSENT_NUMERIC, - /* 25: orl */ ABSENT_NUMERIC, - /* 26: orhi */ ABSENT_NUMERIC, - /* 27: orvi */ ABSENT_NUMERIC, - /* 28: cps */ ABSENT_NUMERIC, - /* 29: widcs */ ABSENT_NUMERIC, - /* 30: btns */ ABSENT_NUMERIC, - /* 31: bitwin */ ABSENT_NUMERIC, - /* 32: bitype */ ABSENT_NUMERIC, - /* 33: OTug */ ABSENT_NUMERIC, - /* 34: OTdC */ ABSENT_NUMERIC, - /* 35: OTdN */ ABSENT_NUMERIC, - /* 36: OTdB */ ABSENT_NUMERIC, - /* 37: OTdT */ ABSENT_NUMERIC, - /* 38: OTkn */ ABSENT_NUMERIC, -}; -static char * screen_string_data[] = { - /* 0: cbt */ screen_s_cbt, - /* 1: bel */ screen_s_bel, - /* 2: cr */ screen_s_cr, - /* 3: csr */ screen_s_csr, - /* 4: tbc */ screen_s_tbc, - /* 5: clear */ screen_s_clear, - /* 6: el */ screen_s_el, - /* 7: ed */ screen_s_ed, - /* 8: hpa */ screen_s_hpa, - /* 9: cmdch */ ABSENT_STRING, - /* 10: cup */ screen_s_cup, - /* 11: cud1 */ screen_s_cud1, - /* 12: home */ screen_s_home, - /* 13: civis */ screen_s_civis, - /* 14: cub1 */ screen_s_cub1, - /* 15: mrcup */ ABSENT_STRING, - /* 16: cnorm */ screen_s_cnorm, - /* 17: cuf1 */ screen_s_cuf1, - /* 18: ll */ ABSENT_STRING, - /* 19: cuu1 */ screen_s_cuu1, - /* 20: cvvis */ screen_s_cvvis, - /* 21: dch1 */ screen_s_dch1, - /* 22: dl1 */ screen_s_dl1, - /* 23: dsl */ ABSENT_STRING, - /* 24: hd */ ABSENT_STRING, - /* 25: smacs */ screen_s_smacs, - /* 26: blink */ screen_s_blink, - /* 27: bold */ screen_s_bold, - /* 28: smcup */ screen_s_smcup, - /* 29: smdc */ ABSENT_STRING, - /* 30: dim */ screen_s_dim, - /* 31: smir */ screen_s_smir, - /* 32: invis */ ABSENT_STRING, - /* 33: prot */ ABSENT_STRING, - /* 34: rev */ screen_s_rev, - /* 35: smso */ screen_s_smso, - /* 36: smul */ screen_s_smul, - /* 37: ech */ ABSENT_STRING, - /* 38: rmacs */ screen_s_rmacs, - /* 39: sgr0 */ screen_s_sgr0, - /* 40: rmcup */ screen_s_rmcup, - /* 41: rmdc */ ABSENT_STRING, - /* 42: rmir */ screen_s_rmir, - /* 43: rmso */ screen_s_rmso, - /* 44: rmul */ screen_s_rmul, - /* 45: flash */ screen_s_flash, - /* 46: ff */ ABSENT_STRING, - /* 47: fsl */ ABSENT_STRING, - /* 48: is1 */ ABSENT_STRING, - /* 49: is2 */ screen_s_is2, - /* 50: is3 */ ABSENT_STRING, - /* 51: if */ ABSENT_STRING, - /* 52: ich1 */ ABSENT_STRING, - /* 53: il1 */ screen_s_il1, - /* 54: ip */ ABSENT_STRING, - /* 55: kbs */ screen_s_kbs, - /* 56: ktbc */ ABSENT_STRING, - /* 57: kclr */ ABSENT_STRING, - /* 58: kctab */ ABSENT_STRING, - /* 59: kdch1 */ screen_s_kdch1, - /* 60: kdl1 */ ABSENT_STRING, - /* 61: kcud1 */ screen_s_kcud1, - /* 62: krmir */ ABSENT_STRING, - /* 63: kel */ ABSENT_STRING, - /* 64: ked */ ABSENT_STRING, - /* 65: kf0 */ ABSENT_STRING, - /* 66: kf1 */ screen_s_kf1, - /* 67: kf10 */ screen_s_kf10, - /* 68: kf2 */ screen_s_kf2, - /* 69: kf3 */ screen_s_kf3, - /* 70: kf4 */ screen_s_kf4, - /* 71: kf5 */ screen_s_kf5, - /* 72: kf6 */ screen_s_kf6, - /* 73: kf7 */ screen_s_kf7, - /* 74: kf8 */ screen_s_kf8, - /* 75: kf9 */ screen_s_kf9, - /* 76: khome */ screen_s_khome, - /* 77: kich1 */ screen_s_kich1, - /* 78: kil1 */ ABSENT_STRING, - /* 79: kcub1 */ screen_s_kcub1, - /* 80: kll */ ABSENT_STRING, - /* 81: knp */ screen_s_knp, - /* 82: kpp */ screen_s_kpp, - /* 83: kcuf1 */ screen_s_kcuf1, - /* 84: kind */ ABSENT_STRING, - /* 85: kri */ ABSENT_STRING, - /* 86: khts */ ABSENT_STRING, - /* 87: kcuu1 */ screen_s_kcuu1, - /* 88: rmkx */ screen_s_rmkx, - /* 89: smkx */ screen_s_smkx, - /* 90: lf0 */ ABSENT_STRING, - /* 91: lf1 */ ABSENT_STRING, - /* 92: lf10 */ ABSENT_STRING, - /* 93: lf2 */ ABSENT_STRING, - /* 94: lf3 */ ABSENT_STRING, - /* 95: lf4 */ ABSENT_STRING, - /* 96: lf5 */ ABSENT_STRING, - /* 97: lf6 */ ABSENT_STRING, - /* 98: lf7 */ ABSENT_STRING, - /* 99: lf8 */ ABSENT_STRING, - /* 100: lf9 */ ABSENT_STRING, - /* 101: rmm */ ABSENT_STRING, - /* 102: smm */ ABSENT_STRING, - /* 103: nel */ screen_s_nel, - /* 104: pad */ ABSENT_STRING, - /* 105: dch */ screen_s_dch, - /* 106: dl */ screen_s_dl, - /* 107: cud */ screen_s_cud, - /* 108: ich */ screen_s_ich, - /* 109: indn */ screen_s_indn, - /* 110: il */ screen_s_il, - /* 111: cub */ screen_s_cub, - /* 112: cuf */ screen_s_cuf, - /* 113: rin */ ABSENT_STRING, - /* 114: cuu */ screen_s_cuu, - /* 115: pfkey */ ABSENT_STRING, - /* 116: pfloc */ ABSENT_STRING, - /* 117: pfx */ ABSENT_STRING, - /* 118: mc0 */ ABSENT_STRING, - /* 119: mc4 */ ABSENT_STRING, - /* 120: mc5 */ ABSENT_STRING, - /* 121: rep */ ABSENT_STRING, - /* 122: rs1 */ ABSENT_STRING, - /* 123: rs2 */ screen_s_rs2, - /* 124: rs3 */ ABSENT_STRING, - /* 125: rf */ ABSENT_STRING, - /* 126: rc */ screen_s_rc, - /* 127: vpa */ screen_s_vpa, - /* 128: sc */ screen_s_sc, - /* 129: ind */ screen_s_ind, - /* 130: ri */ screen_s_ri, - /* 131: sgr */ screen_s_sgr, - /* 132: hts */ screen_s_hts, - /* 133: wind */ ABSENT_STRING, - /* 134: ht */ screen_s_ht, - /* 135: tsl */ ABSENT_STRING, - /* 136: uc */ ABSENT_STRING, - /* 137: hu */ ABSENT_STRING, - /* 138: iprog */ ABSENT_STRING, - /* 139: ka1 */ ABSENT_STRING, - /* 140: ka3 */ ABSENT_STRING, - /* 141: kb2 */ ABSENT_STRING, - /* 142: kc1 */ ABSENT_STRING, - /* 143: kc3 */ ABSENT_STRING, - /* 144: mc5p */ ABSENT_STRING, - /* 145: rmp */ ABSENT_STRING, - /* 146: acsc */ screen_s_acsc, - /* 147: pln */ ABSENT_STRING, - /* 148: kcbt */ screen_s_kcbt, - /* 149: smxon */ ABSENT_STRING, - /* 150: rmxon */ ABSENT_STRING, - /* 151: smam */ ABSENT_STRING, - /* 152: rmam */ ABSENT_STRING, - /* 153: xonc */ ABSENT_STRING, - /* 154: xoffc */ ABSENT_STRING, - /* 155: enacs */ screen_s_enacs, - /* 156: smln */ ABSENT_STRING, - /* 157: rmln */ ABSENT_STRING, - /* 158: kbeg */ ABSENT_STRING, - /* 159: kcan */ ABSENT_STRING, - /* 160: kclo */ ABSENT_STRING, - /* 161: kcmd */ ABSENT_STRING, - /* 162: kcpy */ ABSENT_STRING, - /* 163: kcrt */ ABSENT_STRING, - /* 164: kend */ screen_s_kend, - /* 165: kent */ ABSENT_STRING, - /* 166: kext */ ABSENT_STRING, - /* 167: kfnd */ ABSENT_STRING, - /* 168: khlp */ ABSENT_STRING, - /* 169: kmrk */ ABSENT_STRING, - /* 170: kmsg */ ABSENT_STRING, - /* 171: kmov */ ABSENT_STRING, - /* 172: knxt */ ABSENT_STRING, - /* 173: kopn */ ABSENT_STRING, - /* 174: kopt */ ABSENT_STRING, - /* 175: kprv */ ABSENT_STRING, - /* 176: kprt */ ABSENT_STRING, - /* 177: krdo */ ABSENT_STRING, - /* 178: kref */ ABSENT_STRING, - /* 179: krfr */ ABSENT_STRING, - /* 180: krpl */ ABSENT_STRING, - /* 181: krst */ ABSENT_STRING, - /* 182: kres */ ABSENT_STRING, - /* 183: ksav */ ABSENT_STRING, - /* 184: kspd */ ABSENT_STRING, - /* 185: kund */ ABSENT_STRING, - /* 186: kBEG */ ABSENT_STRING, - /* 187: kCAN */ ABSENT_STRING, - /* 188: kCMD */ ABSENT_STRING, - /* 189: kCPY */ ABSENT_STRING, - /* 190: kCRT */ ABSENT_STRING, - /* 191: kDC */ ABSENT_STRING, - /* 192: kDL */ ABSENT_STRING, - /* 193: kslt */ ABSENT_STRING, - /* 194: kEND */ ABSENT_STRING, - /* 195: kEOL */ ABSENT_STRING, - /* 196: kEXT */ ABSENT_STRING, - /* 197: kFND */ ABSENT_STRING, - /* 198: kHLP */ ABSENT_STRING, - /* 199: kHOM */ ABSENT_STRING, - /* 200: kIC */ ABSENT_STRING, - /* 201: kLFT */ ABSENT_STRING, - /* 202: kMSG */ ABSENT_STRING, - /* 203: kMOV */ ABSENT_STRING, - /* 204: kNXT */ ABSENT_STRING, - /* 205: kOPT */ ABSENT_STRING, - /* 206: kPRV */ ABSENT_STRING, - /* 207: kPRT */ ABSENT_STRING, - /* 208: kRDO */ ABSENT_STRING, - /* 209: kRPL */ ABSENT_STRING, - /* 210: kRIT */ ABSENT_STRING, - /* 211: kRES */ ABSENT_STRING, - /* 212: kSAV */ ABSENT_STRING, - /* 213: kSPD */ ABSENT_STRING, - /* 214: kUND */ ABSENT_STRING, - /* 215: rfi */ ABSENT_STRING, - /* 216: kf11 */ screen_s_kf11, - /* 217: kf12 */ screen_s_kf12, - /* 218: kf13 */ ABSENT_STRING, - /* 219: kf14 */ ABSENT_STRING, - /* 220: kf15 */ ABSENT_STRING, - /* 221: kf16 */ ABSENT_STRING, - /* 222: kf17 */ ABSENT_STRING, - /* 223: kf18 */ ABSENT_STRING, - /* 224: kf19 */ ABSENT_STRING, - /* 225: kf20 */ ABSENT_STRING, - /* 226: kf21 */ ABSENT_STRING, - /* 227: kf22 */ ABSENT_STRING, - /* 228: kf23 */ ABSENT_STRING, - /* 229: kf24 */ ABSENT_STRING, - /* 230: kf25 */ ABSENT_STRING, - /* 231: kf26 */ ABSENT_STRING, - /* 232: kf27 */ ABSENT_STRING, - /* 233: kf28 */ ABSENT_STRING, - /* 234: kf29 */ ABSENT_STRING, - /* 235: kf30 */ ABSENT_STRING, - /* 236: kf31 */ ABSENT_STRING, - /* 237: kf32 */ ABSENT_STRING, - /* 238: kf33 */ ABSENT_STRING, - /* 239: kf34 */ ABSENT_STRING, - /* 240: kf35 */ ABSENT_STRING, - /* 241: kf36 */ ABSENT_STRING, - /* 242: kf37 */ ABSENT_STRING, - /* 243: kf38 */ ABSENT_STRING, - /* 244: kf39 */ ABSENT_STRING, - /* 245: kf40 */ ABSENT_STRING, - /* 246: kf41 */ ABSENT_STRING, - /* 247: kf42 */ ABSENT_STRING, - /* 248: kf43 */ ABSENT_STRING, - /* 249: kf44 */ ABSENT_STRING, - /* 250: kf45 */ ABSENT_STRING, - /* 251: kf46 */ ABSENT_STRING, - /* 252: kf47 */ ABSENT_STRING, - /* 253: kf48 */ ABSENT_STRING, - /* 254: kf49 */ ABSENT_STRING, - /* 255: kf50 */ ABSENT_STRING, - /* 256: kf51 */ ABSENT_STRING, - /* 257: kf52 */ ABSENT_STRING, - /* 258: kf53 */ ABSENT_STRING, - /* 259: kf54 */ ABSENT_STRING, - /* 260: kf55 */ ABSENT_STRING, - /* 261: kf56 */ ABSENT_STRING, - /* 262: kf57 */ ABSENT_STRING, - /* 263: kf58 */ ABSENT_STRING, - /* 264: kf59 */ ABSENT_STRING, - /* 265: kf60 */ ABSENT_STRING, - /* 266: kf61 */ ABSENT_STRING, - /* 267: kf62 */ ABSENT_STRING, - /* 268: kf63 */ ABSENT_STRING, - /* 269: el1 */ screen_s_el1, - /* 270: mgc */ ABSENT_STRING, - /* 271: smgl */ ABSENT_STRING, - /* 272: smgr */ ABSENT_STRING, - /* 273: fln */ ABSENT_STRING, - /* 274: sclk */ ABSENT_STRING, - /* 275: dclk */ ABSENT_STRING, - /* 276: rmclk */ ABSENT_STRING, - /* 277: cwin */ ABSENT_STRING, - /* 278: wingo */ ABSENT_STRING, - /* 279: hup */ ABSENT_STRING, - /* 280: dial */ ABSENT_STRING, - /* 281: qdial */ ABSENT_STRING, - /* 282: tone */ ABSENT_STRING, - /* 283: pulse */ ABSENT_STRING, - /* 284: hook */ ABSENT_STRING, - /* 285: pause */ ABSENT_STRING, - /* 286: wait */ ABSENT_STRING, - /* 287: u0 */ ABSENT_STRING, - /* 288: u1 */ ABSENT_STRING, - /* 289: u2 */ ABSENT_STRING, - /* 290: u3 */ ABSENT_STRING, - /* 291: u4 */ ABSENT_STRING, - /* 292: u5 */ ABSENT_STRING, - /* 293: u6 */ ABSENT_STRING, - /* 294: u7 */ ABSENT_STRING, - /* 295: u8 */ ABSENT_STRING, - /* 296: u9 */ ABSENT_STRING, - /* 297: op */ screen_s_op, - /* 298: oc */ ABSENT_STRING, - /* 299: initc */ ABSENT_STRING, - /* 300: initp */ ABSENT_STRING, - /* 301: scp */ ABSENT_STRING, - /* 302: setf */ ABSENT_STRING, - /* 303: setb */ ABSENT_STRING, - /* 304: cpi */ ABSENT_STRING, - /* 305: lpi */ ABSENT_STRING, - /* 306: chr */ ABSENT_STRING, - /* 307: cvr */ ABSENT_STRING, - /* 308: defc */ ABSENT_STRING, - /* 309: swidm */ ABSENT_STRING, - /* 310: sdrfq */ ABSENT_STRING, - /* 311: sitm */ ABSENT_STRING, - /* 312: slm */ ABSENT_STRING, - /* 313: smicm */ ABSENT_STRING, - /* 314: snlq */ ABSENT_STRING, - /* 315: snrmq */ ABSENT_STRING, - /* 316: sshm */ ABSENT_STRING, - /* 317: ssubm */ ABSENT_STRING, - /* 318: ssupm */ ABSENT_STRING, - /* 319: sum */ ABSENT_STRING, - /* 320: rwidm */ ABSENT_STRING, - /* 321: ritm */ ABSENT_STRING, - /* 322: rlm */ ABSENT_STRING, - /* 323: rmicm */ ABSENT_STRING, - /* 324: rshm */ ABSENT_STRING, - /* 325: rsubm */ ABSENT_STRING, - /* 326: rsupm */ ABSENT_STRING, - /* 327: rum */ ABSENT_STRING, - /* 328: mhpa */ ABSENT_STRING, - /* 329: mcud1 */ ABSENT_STRING, - /* 330: mcub1 */ ABSENT_STRING, - /* 331: mcuf1 */ ABSENT_STRING, - /* 332: mvpa */ ABSENT_STRING, - /* 333: mcuu1 */ ABSENT_STRING, - /* 334: porder */ ABSENT_STRING, - /* 335: mcud */ ABSENT_STRING, - /* 336: mcub */ ABSENT_STRING, - /* 337: mcuf */ ABSENT_STRING, - /* 338: mcuu */ ABSENT_STRING, - /* 339: scs */ ABSENT_STRING, - /* 340: smgb */ ABSENT_STRING, - /* 341: smgbp */ ABSENT_STRING, - /* 342: smglp */ ABSENT_STRING, - /* 343: smgrp */ ABSENT_STRING, - /* 344: smgt */ ABSENT_STRING, - /* 345: smgtp */ ABSENT_STRING, - /* 346: sbim */ ABSENT_STRING, - /* 347: scsd */ ABSENT_STRING, - /* 348: rbim */ ABSENT_STRING, - /* 349: rcsd */ ABSENT_STRING, - /* 350: subcs */ ABSENT_STRING, - /* 351: supcs */ ABSENT_STRING, - /* 352: docr */ ABSENT_STRING, - /* 353: zerom */ ABSENT_STRING, - /* 354: csnm */ ABSENT_STRING, - /* 355: kmous */ screen_s_kmous, - /* 356: minfo */ ABSENT_STRING, - /* 357: reqmp */ ABSENT_STRING, - /* 358: getm */ ABSENT_STRING, - /* 359: setaf */ screen_s_setaf, - /* 360: setab */ screen_s_setab, - /* 361: pfxl */ ABSENT_STRING, - /* 362: devt */ ABSENT_STRING, - /* 363: csin */ ABSENT_STRING, - /* 364: s0ds */ ABSENT_STRING, - /* 365: s1ds */ ABSENT_STRING, - /* 366: s2ds */ ABSENT_STRING, - /* 367: s3ds */ ABSENT_STRING, - /* 368: smglr */ ABSENT_STRING, - /* 369: smgtb */ ABSENT_STRING, - /* 370: birep */ ABSENT_STRING, - /* 371: binel */ ABSENT_STRING, - /* 372: bicr */ ABSENT_STRING, - /* 373: colornm */ ABSENT_STRING, - /* 374: defbi */ ABSENT_STRING, - /* 375: endbi */ ABSENT_STRING, - /* 376: setcolor */ ABSENT_STRING, - /* 377: slines */ ABSENT_STRING, - /* 378: dispc */ ABSENT_STRING, - /* 379: smpch */ ABSENT_STRING, - /* 380: rmpch */ ABSENT_STRING, - /* 381: smsc */ ABSENT_STRING, - /* 382: rmsc */ ABSENT_STRING, - /* 383: pctrm */ ABSENT_STRING, - /* 384: scesc */ ABSENT_STRING, - /* 385: scesa */ ABSENT_STRING, - /* 386: ehhlm */ ABSENT_STRING, - /* 387: elhlm */ ABSENT_STRING, - /* 388: elohlm */ ABSENT_STRING, - /* 389: erhlm */ ABSENT_STRING, - /* 390: ethlm */ ABSENT_STRING, - /* 391: evhlm */ ABSENT_STRING, - /* 392: sgr1 */ ABSENT_STRING, - /* 393: slength */ ABSENT_STRING, - /* 394: OTi2 */ ABSENT_STRING, - /* 395: OTrs */ ABSENT_STRING, - /* 396: OTnl */ ABSENT_STRING, - /* 397: OTbc */ ABSENT_STRING, - /* 398: OTko */ ABSENT_STRING, - /* 399: OTma */ ABSENT_STRING, - /* 400: OTG2 */ ABSENT_STRING, - /* 401: OTG3 */ ABSENT_STRING, - /* 402: OTG1 */ ABSENT_STRING, - /* 403: OTG4 */ ABSENT_STRING, - /* 404: OTGR */ ABSENT_STRING, - /* 405: OTGL */ ABSENT_STRING, - /* 406: OTGU */ ABSENT_STRING, - /* 407: OTGD */ ABSENT_STRING, - /* 408: OTGH */ ABSENT_STRING, - /* 409: OTGV */ ABSENT_STRING, - /* 410: OTGC */ ABSENT_STRING, - /* 411: meml */ ABSENT_STRING, - /* 412: memu */ ABSENT_STRING, - /* 413: box1 */ ABSENT_STRING, -}; -/* screen.linux */ - -static char screen_linux_alias_data[] = "screen.linux|screen in linux console"; - -static char screen_linux_s_cbt [] = "\033[Z"; -static char screen_linux_s_bel [] = "\007"; -static char screen_linux_s_cr [] = "\015"; -static char screen_linux_s_csr [] = "\033[%i%p1%d;%p2%dr"; -static char screen_linux_s_tbc [] = "\033[3g"; -static char screen_linux_s_clear[] = "\033[H\033[J"; -static char screen_linux_s_el [] = "\033[K"; -static char screen_linux_s_ed [] = "\033[J"; -static char screen_linux_s_hpa [] = "\033[%i%p1%dG"; -static char screen_linux_s_cup [] = "\033[%i%p1%d;%p2%dH"; -static char screen_linux_s_cud1 [] = "\012"; -static char screen_linux_s_home [] = "\033[H"; -static char screen_linux_s_civis[] = "\033[?25l"; -static char screen_linux_s_cub1 [] = "\010"; -static char screen_linux_s_cnorm[] = "\033[34h\033[?25h"; -static char screen_linux_s_cuf1 [] = "\033[C"; -static char screen_linux_s_cuu1 [] = "\033M"; -static char screen_linux_s_cvvis[] = "\033[34l"; -static char screen_linux_s_dch1 [] = "\033[P"; -static char screen_linux_s_dl1 [] = "\033[M"; -static char screen_linux_s_smacs[] = "\016"; -static char screen_linux_s_blink[] = "\033[5m"; -static char screen_linux_s_bold [] = "\033[1m"; -static char screen_linux_s_smcup[] = "\033[?1049h"; -static char screen_linux_s_dim [] = "\033[2m"; -static char screen_linux_s_smir [] = "\033[4h"; -static char screen_linux_s_rev [] = "\033[7m"; -static char screen_linux_s_smso [] = "\033[3m"; -static char screen_linux_s_smul [] = "\033[4m"; -static char screen_linux_s_rmacs[] = "\017"; -static char screen_linux_s_sgr0 [] = "\033[m\017"; -static char screen_linux_s_rmcup[] = "\033[?1049l"; -static char screen_linux_s_rmir [] = "\033[4l"; -static char screen_linux_s_rmso [] = "\033[23m"; -static char screen_linux_s_rmul [] = "\033[24m"; -static char screen_linux_s_flash[] = "\033g"; -static char screen_linux_s_is2 [] = "\033)0"; -static char screen_linux_s_il1 [] = "\033[L"; -static char screen_linux_s_kbs [] = "\177"; -static char screen_linux_s_kdch1[] = "\033[3~"; -static char screen_linux_s_kcud1[] = "\033OB"; -static char screen_linux_s_kf1 [] = "\033OP"; -static char screen_linux_s_kf10 [] = "\033[21~"; -static char screen_linux_s_kf2 [] = "\033OQ"; -static char screen_linux_s_kf3 [] = "\033OR"; -static char screen_linux_s_kf4 [] = "\033OS"; -static char screen_linux_s_kf5 [] = "\033[15~"; -static char screen_linux_s_kf6 [] = "\033[17~"; -static char screen_linux_s_kf7 [] = "\033[18~"; -static char screen_linux_s_kf8 [] = "\033[19~"; -static char screen_linux_s_kf9 [] = "\033[20~"; -static char screen_linux_s_khome[] = "\033[1~"; -static char screen_linux_s_kich1[] = "\033[2~"; -static char screen_linux_s_kcub1[] = "\033OD"; -static char screen_linux_s_knp [] = "\033[6~"; -static char screen_linux_s_kpp [] = "\033[5~"; -static char screen_linux_s_kcuf1[] = "\033OC"; -static char screen_linux_s_kcuu1[] = "\033OA"; -static char screen_linux_s_rmkx [] = "\033[?1l\033>"; -static char screen_linux_s_smkx [] = "\033[?1h\033="; -static char screen_linux_s_nel [] = "\033E"; -static char screen_linux_s_dch [] = "\033[%p1%dP"; -static char screen_linux_s_dl [] = "\033[%p1%dM"; -static char screen_linux_s_cud [] = "\033[%p1%dB"; -static char screen_linux_s_ich [] = "\033[%p1%d@"; -static char screen_linux_s_indn [] = "\033[%p1%dS"; -static char screen_linux_s_il [] = "\033[%p1%dL"; -static char screen_linux_s_cub [] = "\033[%p1%dD"; -static char screen_linux_s_cuf [] = "\033[%p1%dC"; -static char screen_linux_s_cuu [] = "\033[%p1%dA"; -static char screen_linux_s_rs2 [] = "\033c\033[?1000l\033[?25h"; -static char screen_linux_s_rc [] = "\0338"; -static char screen_linux_s_vpa [] = "\033[%i%p1%dd"; -static char screen_linux_s_sc [] = "\0337"; -static char screen_linux_s_ind [] = "\012"; -static char screen_linux_s_ri [] = "\033M"; -static char screen_linux_s_sgr [] = "\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;"; -static char screen_linux_s_hts [] = "\033H"; -static char screen_linux_s_ht [] = "\011"; -static char screen_linux_s_acsc [] = "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"; -static char screen_linux_s_enacs[] = "\033(B\033)0"; -static char screen_linux_s_kend [] = "\033[4~"; -static char screen_linux_s_kf11 [] = "\033[23~"; -static char screen_linux_s_kf12 [] = "\033[24~"; -static char screen_linux_s_el1 [] = "\033[1K"; -static char screen_linux_s_op [] = "\033[39;49m"; -static char screen_linux_s_kmous[] = "\033[M"; -static char screen_linux_s_setaf[] = "\033[3%p1%dm"; -static char screen_linux_s_setab[] = "\033[4%p1%dm"; - -static char screen_linux_bool_data[] = { - /* 0: bw */ TRUE, - /* 1: am */ TRUE, - /* 2: xsb */ FALSE, - /* 3: xhp */ FALSE, - /* 4: xenl */ TRUE, - /* 5: eo */ FALSE, - /* 6: gn */ FALSE, - /* 7: hc */ FALSE, - /* 8: km */ TRUE, - /* 9: hs */ FALSE, - /* 10: in */ FALSE, - /* 11: da */ FALSE, - /* 12: db */ FALSE, - /* 13: mir */ TRUE, - /* 14: msgr */ TRUE, - /* 15: os */ FALSE, - /* 16: eslok */ FALSE, - /* 17: xt */ FALSE, - /* 18: hz */ FALSE, - /* 19: ul */ FALSE, - /* 20: xon */ FALSE, - /* 21: nxon */ FALSE, - /* 22: mc5i */ FALSE, - /* 23: chts */ FALSE, - /* 24: nrrmc */ FALSE, - /* 25: npc */ FALSE, - /* 26: ndscr */ FALSE, - /* 27: ccc */ FALSE, - /* 28: bce */ FALSE, - /* 29: hls */ FALSE, - /* 30: xhpa */ FALSE, - /* 31: crxm */ FALSE, - /* 32: daisy */ FALSE, - /* 33: xvpa */ FALSE, - /* 34: sam */ FALSE, - /* 35: cpix */ FALSE, - /* 36: lpix */ FALSE, - /* 37: OTbs */ TRUE, - /* 38: OTns */ FALSE, - /* 39: OTnc */ FALSE, - /* 40: OTMT */ FALSE, - /* 41: OTNL */ FALSE, - /* 42: OTpt */ TRUE, - /* 43: OTxr */ FALSE, -}; -static NCURSES_INT2 screen_linux_number_data[] = { - /* 0: cols */ 80, - /* 1: it */ 8, - /* 2: lines */ 24, - /* 3: lm */ ABSENT_NUMERIC, - /* 4: xmc */ ABSENT_NUMERIC, - /* 5: pb */ ABSENT_NUMERIC, - /* 6: vt */ ABSENT_NUMERIC, - /* 7: wsl */ ABSENT_NUMERIC, - /* 8: nlab */ ABSENT_NUMERIC, - /* 9: lh */ ABSENT_NUMERIC, - /* 10: lw */ ABSENT_NUMERIC, - /* 11: ma */ ABSENT_NUMERIC, - /* 12: wnum */ ABSENT_NUMERIC, - /* 13: colors */ 8, - /* 14: pairs */ 64, - /* 15: ncv */ ABSENT_NUMERIC, - /* 16: bufsz */ ABSENT_NUMERIC, - /* 17: spinv */ ABSENT_NUMERIC, - /* 18: spinh */ ABSENT_NUMERIC, - /* 19: maddr */ ABSENT_NUMERIC, - /* 20: mjump */ ABSENT_NUMERIC, - /* 21: mcs */ ABSENT_NUMERIC, - /* 22: mls */ ABSENT_NUMERIC, - /* 23: npins */ ABSENT_NUMERIC, - /* 24: orc */ ABSENT_NUMERIC, - /* 25: orl */ ABSENT_NUMERIC, - /* 26: orhi */ ABSENT_NUMERIC, - /* 27: orvi */ ABSENT_NUMERIC, - /* 28: cps */ ABSENT_NUMERIC, - /* 29: widcs */ ABSENT_NUMERIC, - /* 30: btns */ ABSENT_NUMERIC, - /* 31: bitwin */ ABSENT_NUMERIC, - /* 32: bitype */ ABSENT_NUMERIC, - /* 33: OTug */ ABSENT_NUMERIC, - /* 34: OTdC */ ABSENT_NUMERIC, - /* 35: OTdN */ ABSENT_NUMERIC, - /* 36: OTdB */ ABSENT_NUMERIC, - /* 37: OTdT */ ABSENT_NUMERIC, - /* 38: OTkn */ ABSENT_NUMERIC, -}; -static char * screen_linux_string_data[] = { - /* 0: cbt */ screen_linux_s_cbt, - /* 1: bel */ screen_linux_s_bel, - /* 2: cr */ screen_linux_s_cr, - /* 3: csr */ screen_linux_s_csr, - /* 4: tbc */ screen_linux_s_tbc, - /* 5: clear */ screen_linux_s_clear, - /* 6: el */ screen_linux_s_el, - /* 7: ed */ screen_linux_s_ed, - /* 8: hpa */ screen_linux_s_hpa, - /* 9: cmdch */ ABSENT_STRING, - /* 10: cup */ screen_linux_s_cup, - /* 11: cud1 */ screen_linux_s_cud1, - /* 12: home */ screen_linux_s_home, - /* 13: civis */ screen_linux_s_civis, - /* 14: cub1 */ screen_linux_s_cub1, - /* 15: mrcup */ ABSENT_STRING, - /* 16: cnorm */ screen_linux_s_cnorm, - /* 17: cuf1 */ screen_linux_s_cuf1, - /* 18: ll */ ABSENT_STRING, - /* 19: cuu1 */ screen_linux_s_cuu1, - /* 20: cvvis */ screen_linux_s_cvvis, - /* 21: dch1 */ screen_linux_s_dch1, - /* 22: dl1 */ screen_linux_s_dl1, - /* 23: dsl */ ABSENT_STRING, - /* 24: hd */ ABSENT_STRING, - /* 25: smacs */ screen_linux_s_smacs, - /* 26: blink */ screen_linux_s_blink, - /* 27: bold */ screen_linux_s_bold, - /* 28: smcup */ screen_linux_s_smcup, - /* 29: smdc */ ABSENT_STRING, - /* 30: dim */ screen_linux_s_dim, - /* 31: smir */ screen_linux_s_smir, - /* 32: invis */ ABSENT_STRING, - /* 33: prot */ ABSENT_STRING, - /* 34: rev */ screen_linux_s_rev, - /* 35: smso */ screen_linux_s_smso, - /* 36: smul */ screen_linux_s_smul, - /* 37: ech */ ABSENT_STRING, - /* 38: rmacs */ screen_linux_s_rmacs, - /* 39: sgr0 */ screen_linux_s_sgr0, - /* 40: rmcup */ screen_linux_s_rmcup, - /* 41: rmdc */ ABSENT_STRING, - /* 42: rmir */ screen_linux_s_rmir, - /* 43: rmso */ screen_linux_s_rmso, - /* 44: rmul */ screen_linux_s_rmul, - /* 45: flash */ screen_linux_s_flash, - /* 46: ff */ ABSENT_STRING, - /* 47: fsl */ ABSENT_STRING, - /* 48: is1 */ ABSENT_STRING, - /* 49: is2 */ screen_linux_s_is2, - /* 50: is3 */ ABSENT_STRING, - /* 51: if */ ABSENT_STRING, - /* 52: ich1 */ ABSENT_STRING, - /* 53: il1 */ screen_linux_s_il1, - /* 54: ip */ ABSENT_STRING, - /* 55: kbs */ screen_linux_s_kbs, - /* 56: ktbc */ ABSENT_STRING, - /* 57: kclr */ ABSENT_STRING, - /* 58: kctab */ ABSENT_STRING, - /* 59: kdch1 */ screen_linux_s_kdch1, - /* 60: kdl1 */ ABSENT_STRING, - /* 61: kcud1 */ screen_linux_s_kcud1, - /* 62: krmir */ ABSENT_STRING, - /* 63: kel */ ABSENT_STRING, - /* 64: ked */ ABSENT_STRING, - /* 65: kf0 */ ABSENT_STRING, - /* 66: kf1 */ screen_linux_s_kf1, - /* 67: kf10 */ screen_linux_s_kf10, - /* 68: kf2 */ screen_linux_s_kf2, - /* 69: kf3 */ screen_linux_s_kf3, - /* 70: kf4 */ screen_linux_s_kf4, - /* 71: kf5 */ screen_linux_s_kf5, - /* 72: kf6 */ screen_linux_s_kf6, - /* 73: kf7 */ screen_linux_s_kf7, - /* 74: kf8 */ screen_linux_s_kf8, - /* 75: kf9 */ screen_linux_s_kf9, - /* 76: khome */ screen_linux_s_khome, - /* 77: kich1 */ screen_linux_s_kich1, - /* 78: kil1 */ ABSENT_STRING, - /* 79: kcub1 */ screen_linux_s_kcub1, - /* 80: kll */ ABSENT_STRING, - /* 81: knp */ screen_linux_s_knp, - /* 82: kpp */ screen_linux_s_kpp, - /* 83: kcuf1 */ screen_linux_s_kcuf1, - /* 84: kind */ ABSENT_STRING, - /* 85: kri */ ABSENT_STRING, - /* 86: khts */ ABSENT_STRING, - /* 87: kcuu1 */ screen_linux_s_kcuu1, - /* 88: rmkx */ screen_linux_s_rmkx, - /* 89: smkx */ screen_linux_s_smkx, - /* 90: lf0 */ ABSENT_STRING, - /* 91: lf1 */ ABSENT_STRING, - /* 92: lf10 */ ABSENT_STRING, - /* 93: lf2 */ ABSENT_STRING, - /* 94: lf3 */ ABSENT_STRING, - /* 95: lf4 */ ABSENT_STRING, - /* 96: lf5 */ ABSENT_STRING, - /* 97: lf6 */ ABSENT_STRING, - /* 98: lf7 */ ABSENT_STRING, - /* 99: lf8 */ ABSENT_STRING, - /* 100: lf9 */ ABSENT_STRING, - /* 101: rmm */ ABSENT_STRING, - /* 102: smm */ ABSENT_STRING, - /* 103: nel */ screen_linux_s_nel, - /* 104: pad */ ABSENT_STRING, - /* 105: dch */ screen_linux_s_dch, - /* 106: dl */ screen_linux_s_dl, - /* 107: cud */ screen_linux_s_cud, - /* 108: ich */ screen_linux_s_ich, - /* 109: indn */ screen_linux_s_indn, - /* 110: il */ screen_linux_s_il, - /* 111: cub */ screen_linux_s_cub, - /* 112: cuf */ screen_linux_s_cuf, - /* 113: rin */ ABSENT_STRING, - /* 114: cuu */ screen_linux_s_cuu, - /* 115: pfkey */ ABSENT_STRING, - /* 116: pfloc */ ABSENT_STRING, - /* 117: pfx */ ABSENT_STRING, - /* 118: mc0 */ ABSENT_STRING, - /* 119: mc4 */ ABSENT_STRING, - /* 120: mc5 */ ABSENT_STRING, - /* 121: rep */ ABSENT_STRING, - /* 122: rs1 */ ABSENT_STRING, - /* 123: rs2 */ screen_linux_s_rs2, - /* 124: rs3 */ ABSENT_STRING, - /* 125: rf */ ABSENT_STRING, - /* 126: rc */ screen_linux_s_rc, - /* 127: vpa */ screen_linux_s_vpa, - /* 128: sc */ screen_linux_s_sc, - /* 129: ind */ screen_linux_s_ind, - /* 130: ri */ screen_linux_s_ri, - /* 131: sgr */ screen_linux_s_sgr, - /* 132: hts */ screen_linux_s_hts, - /* 133: wind */ ABSENT_STRING, - /* 134: ht */ screen_linux_s_ht, - /* 135: tsl */ ABSENT_STRING, - /* 136: uc */ ABSENT_STRING, - /* 137: hu */ ABSENT_STRING, - /* 138: iprog */ ABSENT_STRING, - /* 139: ka1 */ ABSENT_STRING, - /* 140: ka3 */ ABSENT_STRING, - /* 141: kb2 */ ABSENT_STRING, - /* 142: kc1 */ ABSENT_STRING, - /* 143: kc3 */ ABSENT_STRING, - /* 144: mc5p */ ABSENT_STRING, - /* 145: rmp */ ABSENT_STRING, - /* 146: acsc */ screen_linux_s_acsc, - /* 147: pln */ ABSENT_STRING, - /* 148: kcbt */ CANCELLED_STRING, - /* 149: smxon */ ABSENT_STRING, - /* 150: rmxon */ ABSENT_STRING, - /* 151: smam */ ABSENT_STRING, - /* 152: rmam */ ABSENT_STRING, - /* 153: xonc */ ABSENT_STRING, - /* 154: xoffc */ ABSENT_STRING, - /* 155: enacs */ screen_linux_s_enacs, - /* 156: smln */ ABSENT_STRING, - /* 157: rmln */ ABSENT_STRING, - /* 158: kbeg */ ABSENT_STRING, - /* 159: kcan */ ABSENT_STRING, - /* 160: kclo */ ABSENT_STRING, - /* 161: kcmd */ ABSENT_STRING, - /* 162: kcpy */ ABSENT_STRING, - /* 163: kcrt */ ABSENT_STRING, - /* 164: kend */ screen_linux_s_kend, - /* 165: kent */ ABSENT_STRING, - /* 166: kext */ ABSENT_STRING, - /* 167: kfnd */ ABSENT_STRING, - /* 168: khlp */ ABSENT_STRING, - /* 169: kmrk */ ABSENT_STRING, - /* 170: kmsg */ ABSENT_STRING, - /* 171: kmov */ ABSENT_STRING, - /* 172: knxt */ ABSENT_STRING, - /* 173: kopn */ ABSENT_STRING, - /* 174: kopt */ ABSENT_STRING, - /* 175: kprv */ ABSENT_STRING, - /* 176: kprt */ ABSENT_STRING, - /* 177: krdo */ ABSENT_STRING, - /* 178: kref */ ABSENT_STRING, - /* 179: krfr */ ABSENT_STRING, - /* 180: krpl */ ABSENT_STRING, - /* 181: krst */ ABSENT_STRING, - /* 182: kres */ ABSENT_STRING, - /* 183: ksav */ ABSENT_STRING, - /* 184: kspd */ ABSENT_STRING, - /* 185: kund */ ABSENT_STRING, - /* 186: kBEG */ ABSENT_STRING, - /* 187: kCAN */ ABSENT_STRING, - /* 188: kCMD */ ABSENT_STRING, - /* 189: kCPY */ ABSENT_STRING, - /* 190: kCRT */ ABSENT_STRING, - /* 191: kDC */ ABSENT_STRING, - /* 192: kDL */ ABSENT_STRING, - /* 193: kslt */ ABSENT_STRING, - /* 194: kEND */ ABSENT_STRING, - /* 195: kEOL */ ABSENT_STRING, - /* 196: kEXT */ ABSENT_STRING, - /* 197: kFND */ ABSENT_STRING, - /* 198: kHLP */ ABSENT_STRING, - /* 199: kHOM */ ABSENT_STRING, - /* 200: kIC */ ABSENT_STRING, - /* 201: kLFT */ ABSENT_STRING, - /* 202: kMSG */ ABSENT_STRING, - /* 203: kMOV */ ABSENT_STRING, - /* 204: kNXT */ ABSENT_STRING, - /* 205: kOPT */ ABSENT_STRING, - /* 206: kPRV */ ABSENT_STRING, - /* 207: kPRT */ ABSENT_STRING, - /* 208: kRDO */ ABSENT_STRING, - /* 209: kRPL */ ABSENT_STRING, - /* 210: kRIT */ ABSENT_STRING, - /* 211: kRES */ ABSENT_STRING, - /* 212: kSAV */ ABSENT_STRING, - /* 213: kSPD */ ABSENT_STRING, - /* 214: kUND */ ABSENT_STRING, - /* 215: rfi */ ABSENT_STRING, - /* 216: kf11 */ screen_linux_s_kf11, - /* 217: kf12 */ screen_linux_s_kf12, - /* 218: kf13 */ ABSENT_STRING, - /* 219: kf14 */ ABSENT_STRING, - /* 220: kf15 */ ABSENT_STRING, - /* 221: kf16 */ ABSENT_STRING, - /* 222: kf17 */ ABSENT_STRING, - /* 223: kf18 */ ABSENT_STRING, - /* 224: kf19 */ ABSENT_STRING, - /* 225: kf20 */ ABSENT_STRING, - /* 226: kf21 */ ABSENT_STRING, - /* 227: kf22 */ ABSENT_STRING, - /* 228: kf23 */ ABSENT_STRING, - /* 229: kf24 */ ABSENT_STRING, - /* 230: kf25 */ ABSENT_STRING, - /* 231: kf26 */ ABSENT_STRING, - /* 232: kf27 */ ABSENT_STRING, - /* 233: kf28 */ ABSENT_STRING, - /* 234: kf29 */ ABSENT_STRING, - /* 235: kf30 */ ABSENT_STRING, - /* 236: kf31 */ ABSENT_STRING, - /* 237: kf32 */ ABSENT_STRING, - /* 238: kf33 */ ABSENT_STRING, - /* 239: kf34 */ ABSENT_STRING, - /* 240: kf35 */ ABSENT_STRING, - /* 241: kf36 */ ABSENT_STRING, - /* 242: kf37 */ ABSENT_STRING, - /* 243: kf38 */ ABSENT_STRING, - /* 244: kf39 */ ABSENT_STRING, - /* 245: kf40 */ ABSENT_STRING, - /* 246: kf41 */ ABSENT_STRING, - /* 247: kf42 */ ABSENT_STRING, - /* 248: kf43 */ ABSENT_STRING, - /* 249: kf44 */ ABSENT_STRING, - /* 250: kf45 */ ABSENT_STRING, - /* 251: kf46 */ ABSENT_STRING, - /* 252: kf47 */ ABSENT_STRING, - /* 253: kf48 */ ABSENT_STRING, - /* 254: kf49 */ ABSENT_STRING, - /* 255: kf50 */ ABSENT_STRING, - /* 256: kf51 */ ABSENT_STRING, - /* 257: kf52 */ ABSENT_STRING, - /* 258: kf53 */ ABSENT_STRING, - /* 259: kf54 */ ABSENT_STRING, - /* 260: kf55 */ ABSENT_STRING, - /* 261: kf56 */ ABSENT_STRING, - /* 262: kf57 */ ABSENT_STRING, - /* 263: kf58 */ ABSENT_STRING, - /* 264: kf59 */ ABSENT_STRING, - /* 265: kf60 */ ABSENT_STRING, - /* 266: kf61 */ ABSENT_STRING, - /* 267: kf62 */ ABSENT_STRING, - /* 268: kf63 */ ABSENT_STRING, - /* 269: el1 */ screen_linux_s_el1, - /* 270: mgc */ ABSENT_STRING, - /* 271: smgl */ ABSENT_STRING, - /* 272: smgr */ ABSENT_STRING, - /* 273: fln */ ABSENT_STRING, - /* 274: sclk */ ABSENT_STRING, - /* 275: dclk */ ABSENT_STRING, - /* 276: rmclk */ ABSENT_STRING, - /* 277: cwin */ ABSENT_STRING, - /* 278: wingo */ ABSENT_STRING, - /* 279: hup */ ABSENT_STRING, - /* 280: dial */ ABSENT_STRING, - /* 281: qdial */ ABSENT_STRING, - /* 282: tone */ ABSENT_STRING, - /* 283: pulse */ ABSENT_STRING, - /* 284: hook */ ABSENT_STRING, - /* 285: pause */ ABSENT_STRING, - /* 286: wait */ ABSENT_STRING, - /* 287: u0 */ ABSENT_STRING, - /* 288: u1 */ ABSENT_STRING, - /* 289: u2 */ ABSENT_STRING, - /* 290: u3 */ ABSENT_STRING, - /* 291: u4 */ ABSENT_STRING, - /* 292: u5 */ ABSENT_STRING, - /* 293: u6 */ ABSENT_STRING, - /* 294: u7 */ ABSENT_STRING, - /* 295: u8 */ ABSENT_STRING, - /* 296: u9 */ ABSENT_STRING, - /* 297: op */ screen_linux_s_op, - /* 298: oc */ ABSENT_STRING, - /* 299: initc */ ABSENT_STRING, - /* 300: initp */ ABSENT_STRING, - /* 301: scp */ ABSENT_STRING, - /* 302: setf */ ABSENT_STRING, - /* 303: setb */ ABSENT_STRING, - /* 304: cpi */ ABSENT_STRING, - /* 305: lpi */ ABSENT_STRING, - /* 306: chr */ ABSENT_STRING, - /* 307: cvr */ ABSENT_STRING, - /* 308: defc */ ABSENT_STRING, - /* 309: swidm */ ABSENT_STRING, - /* 310: sdrfq */ ABSENT_STRING, - /* 311: sitm */ ABSENT_STRING, - /* 312: slm */ ABSENT_STRING, - /* 313: smicm */ ABSENT_STRING, - /* 314: snlq */ ABSENT_STRING, - /* 315: snrmq */ ABSENT_STRING, - /* 316: sshm */ ABSENT_STRING, - /* 317: ssubm */ ABSENT_STRING, - /* 318: ssupm */ ABSENT_STRING, - /* 319: sum */ ABSENT_STRING, - /* 320: rwidm */ ABSENT_STRING, - /* 321: ritm */ ABSENT_STRING, - /* 322: rlm */ ABSENT_STRING, - /* 323: rmicm */ ABSENT_STRING, - /* 324: rshm */ ABSENT_STRING, - /* 325: rsubm */ ABSENT_STRING, - /* 326: rsupm */ ABSENT_STRING, - /* 327: rum */ ABSENT_STRING, - /* 328: mhpa */ ABSENT_STRING, - /* 329: mcud1 */ ABSENT_STRING, - /* 330: mcub1 */ ABSENT_STRING, - /* 331: mcuf1 */ ABSENT_STRING, - /* 332: mvpa */ ABSENT_STRING, - /* 333: mcuu1 */ ABSENT_STRING, - /* 334: porder */ ABSENT_STRING, - /* 335: mcud */ ABSENT_STRING, - /* 336: mcub */ ABSENT_STRING, - /* 337: mcuf */ ABSENT_STRING, - /* 338: mcuu */ ABSENT_STRING, - /* 339: scs */ ABSENT_STRING, - /* 340: smgb */ ABSENT_STRING, - /* 341: smgbp */ ABSENT_STRING, - /* 342: smglp */ ABSENT_STRING, - /* 343: smgrp */ ABSENT_STRING, - /* 344: smgt */ ABSENT_STRING, - /* 345: smgtp */ ABSENT_STRING, - /* 346: sbim */ ABSENT_STRING, - /* 347: scsd */ ABSENT_STRING, - /* 348: rbim */ ABSENT_STRING, - /* 349: rcsd */ ABSENT_STRING, - /* 350: subcs */ ABSENT_STRING, - /* 351: supcs */ ABSENT_STRING, - /* 352: docr */ ABSENT_STRING, - /* 353: zerom */ ABSENT_STRING, - /* 354: csnm */ ABSENT_STRING, - /* 355: kmous */ screen_linux_s_kmous, - /* 356: minfo */ ABSENT_STRING, - /* 357: reqmp */ ABSENT_STRING, - /* 358: getm */ ABSENT_STRING, - /* 359: setaf */ screen_linux_s_setaf, - /* 360: setab */ screen_linux_s_setab, - /* 361: pfxl */ ABSENT_STRING, - /* 362: devt */ ABSENT_STRING, - /* 363: csin */ ABSENT_STRING, - /* 364: s0ds */ ABSENT_STRING, - /* 365: s1ds */ ABSENT_STRING, - /* 366: s2ds */ ABSENT_STRING, - /* 367: s3ds */ ABSENT_STRING, - /* 368: smglr */ ABSENT_STRING, - /* 369: smgtb */ ABSENT_STRING, - /* 370: birep */ ABSENT_STRING, - /* 371: binel */ ABSENT_STRING, - /* 372: bicr */ ABSENT_STRING, - /* 373: colornm */ ABSENT_STRING, - /* 374: defbi */ ABSENT_STRING, - /* 375: endbi */ ABSENT_STRING, - /* 376: setcolor */ ABSENT_STRING, - /* 377: slines */ ABSENT_STRING, - /* 378: dispc */ ABSENT_STRING, - /* 379: smpch */ ABSENT_STRING, - /* 380: rmpch */ ABSENT_STRING, - /* 381: smsc */ ABSENT_STRING, - /* 382: rmsc */ ABSENT_STRING, - /* 383: pctrm */ ABSENT_STRING, - /* 384: scesc */ ABSENT_STRING, - /* 385: scesa */ ABSENT_STRING, - /* 386: ehhlm */ ABSENT_STRING, - /* 387: elhlm */ ABSENT_STRING, - /* 388: elohlm */ ABSENT_STRING, - /* 389: erhlm */ ABSENT_STRING, - /* 390: ethlm */ ABSENT_STRING, - /* 391: evhlm */ ABSENT_STRING, - /* 392: sgr1 */ ABSENT_STRING, - /* 393: slength */ ABSENT_STRING, - /* 394: OTi2 */ ABSENT_STRING, - /* 395: OTrs */ ABSENT_STRING, - /* 396: OTnl */ ABSENT_STRING, - /* 397: OTbc */ ABSENT_STRING, - /* 398: OTko */ ABSENT_STRING, - /* 399: OTma */ ABSENT_STRING, - /* 400: OTG2 */ ABSENT_STRING, - /* 401: OTG3 */ ABSENT_STRING, - /* 402: OTG1 */ ABSENT_STRING, - /* 403: OTG4 */ ABSENT_STRING, - /* 404: OTGR */ ABSENT_STRING, - /* 405: OTGL */ ABSENT_STRING, - /* 406: OTGU */ ABSENT_STRING, - /* 407: OTGD */ ABSENT_STRING, - /* 408: OTGH */ ABSENT_STRING, - /* 409: OTGV */ ABSENT_STRING, - /* 410: OTGC */ ABSENT_STRING, - /* 411: meml */ ABSENT_STRING, - /* 412: memu */ ABSENT_STRING, - /* 413: box1 */ ABSENT_STRING, -}; -/* screen.rxvt */ - -static char screen_rxvt_alias_data[] = "screen.rxvt|screen in rxvt"; - -static char screen_rxvt_s_cbt [] = "\033[Z"; -static char screen_rxvt_s_bel [] = "\007"; -static char screen_rxvt_s_cr [] = "\015"; -static char screen_rxvt_s_csr [] = "\033[%i%p1%d;%p2%dr"; -static char screen_rxvt_s_tbc [] = "\033[3g"; -static char screen_rxvt_s_clear [] = "\033[H\033[J"; -static char screen_rxvt_s_el [] = "\033[K"; -static char screen_rxvt_s_ed [] = "\033[J"; -static char screen_rxvt_s_hpa [] = "\033[%i%p1%dG"; -static char screen_rxvt_s_cup [] = "\033[%i%p1%d;%p2%dH"; -static char screen_rxvt_s_cud1 [] = "\012"; -static char screen_rxvt_s_home [] = "\033[H"; -static char screen_rxvt_s_civis [] = "\033[?25l"; -static char screen_rxvt_s_cub1 [] = "\010"; -static char screen_rxvt_s_cnorm [] = "\033[34h\033[?25h"; -static char screen_rxvt_s_cuf1 [] = "\033[C"; -static char screen_rxvt_s_cuu1 [] = "\033M"; -static char screen_rxvt_s_dch1 [] = "\033[P"; -static char screen_rxvt_s_dl1 [] = "\033[M"; -static char screen_rxvt_s_smacs [] = "\016"; -static char screen_rxvt_s_blink [] = "\033[5m"; -static char screen_rxvt_s_bold [] = "\033[1m"; -static char screen_rxvt_s_smcup [] = "\033[?1049h"; -static char screen_rxvt_s_dim [] = "\033[2m"; -static char screen_rxvt_s_smir [] = "\033[4h"; -static char screen_rxvt_s_rev [] = "\033[7m"; -static char screen_rxvt_s_smso [] = "\033[3m"; -static char screen_rxvt_s_smul [] = "\033[4m"; -static char screen_rxvt_s_rmacs [] = "\017"; -static char screen_rxvt_s_sgr0 [] = "\033[m\017"; -static char screen_rxvt_s_rmcup [] = "\033[?1049l"; -static char screen_rxvt_s_rmir [] = "\033[4l"; -static char screen_rxvt_s_rmso [] = "\033[23m"; -static char screen_rxvt_s_rmul [] = "\033[24m"; -static char screen_rxvt_s_is2 [] = "\033)0"; -static char screen_rxvt_s_il1 [] = "\033[L"; -static char screen_rxvt_s_kbs [] = "\010"; -static char screen_rxvt_s_kdch1 [] = "\033[3~"; -static char screen_rxvt_s_kcud1 [] = "\033OB"; -static char screen_rxvt_s_kel [] = "\033[8^"; -static char screen_rxvt_s_kf1 [] = "\033OP"; -static char screen_rxvt_s_kf10 [] = "\033[21~"; -static char screen_rxvt_s_kf2 [] = "\033OQ"; -static char screen_rxvt_s_kf3 [] = "\033OR"; -static char screen_rxvt_s_kf4 [] = "\033OS"; -static char screen_rxvt_s_kf5 [] = "\033[15~"; -static char screen_rxvt_s_kf6 [] = "\033[17~"; -static char screen_rxvt_s_kf7 [] = "\033[18~"; -static char screen_rxvt_s_kf8 [] = "\033[19~"; -static char screen_rxvt_s_kf9 [] = "\033[20~"; -static char screen_rxvt_s_khome [] = "\033[1~"; -static char screen_rxvt_s_kich1 [] = "\033[2~"; -static char screen_rxvt_s_kcub1 [] = "\033OD"; -static char screen_rxvt_s_knp [] = "\033[6~"; -static char screen_rxvt_s_kpp [] = "\033[5~"; -static char screen_rxvt_s_kcuf1 [] = "\033OC"; -static char screen_rxvt_s_kind [] = "\033[a"; -static char screen_rxvt_s_kri [] = "\033[b"; -static char screen_rxvt_s_kcuu1 [] = "\033OA"; -static char screen_rxvt_s_rmkx [] = "\033[?1l\033>"; -static char screen_rxvt_s_smkx [] = "\033[?1h\033="; -static char screen_rxvt_s_nel [] = "\033E"; -static char screen_rxvt_s_dch [] = "\033[%p1%dP"; -static char screen_rxvt_s_dl [] = "\033[%p1%dM"; -static char screen_rxvt_s_cud [] = "\033[%p1%dB"; -static char screen_rxvt_s_ich [] = "\033[%p1%d@"; -static char screen_rxvt_s_indn [] = "\033[%p1%dS"; -static char screen_rxvt_s_il [] = "\033[%p1%dL"; -static char screen_rxvt_s_cub [] = "\033[%p1%dD"; -static char screen_rxvt_s_cuf [] = "\033[%p1%dC"; -static char screen_rxvt_s_cuu [] = "\033[%p1%dA"; -static char screen_rxvt_s_rs2 [] = "\033c\033[?1000l\033[?25h"; -static char screen_rxvt_s_rc [] = "\0338"; -static char screen_rxvt_s_vpa [] = "\033[%i%p1%dd"; -static char screen_rxvt_s_sc [] = "\0337"; -static char screen_rxvt_s_ind [] = "\012"; -static char screen_rxvt_s_ri [] = "\033M"; -static char screen_rxvt_s_sgr [] = "\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;"; -static char screen_rxvt_s_hts [] = "\033H"; -static char screen_rxvt_s_ht [] = "\011"; -static char screen_rxvt_s_ka1 [] = "\033Ow"; -static char screen_rxvt_s_ka3 [] = "\033Oy"; -static char screen_rxvt_s_kb2 [] = "\033Ou"; -static char screen_rxvt_s_kc1 [] = "\033Oq"; -static char screen_rxvt_s_kc3 [] = "\033Os"; -static char screen_rxvt_s_acsc [] = "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"; -static char screen_rxvt_s_kcbt [] = "\033[Z"; -static char screen_rxvt_s_enacs [] = "\033(B\033)0"; -static char screen_rxvt_s_kend [] = "\033[4~"; -static char screen_rxvt_s_kent [] = "\033OM"; -static char screen_rxvt_s_kDC [] = "\033[3$"; -static char screen_rxvt_s_kEND [] = "\033[8$"; -static char screen_rxvt_s_kHOM [] = "\033[7$"; -static char screen_rxvt_s_kIC [] = "\033[2$"; -static char screen_rxvt_s_kLFT [] = "\033[d"; -static char screen_rxvt_s_kNXT [] = "\033[6$"; -static char screen_rxvt_s_kPRV [] = "\033[5$"; -static char screen_rxvt_s_kRIT [] = "\033[c"; -static char screen_rxvt_s_kf11 [] = "\033[23~"; -static char screen_rxvt_s_kf12 [] = "\033[24~"; -static char screen_rxvt_s_kf13 [] = "\033[25~"; -static char screen_rxvt_s_kf14 [] = "\033[26~"; -static char screen_rxvt_s_kf15 [] = "\033[28~"; -static char screen_rxvt_s_kf16 [] = "\033[29~"; -static char screen_rxvt_s_kf17 [] = "\033[31~"; -static char screen_rxvt_s_kf18 [] = "\033[32~"; -static char screen_rxvt_s_kf19 [] = "\033[33~"; -static char screen_rxvt_s_kf20 [] = "\033[34~"; -static char screen_rxvt_s_kf21 [] = "\033[23$"; -static char screen_rxvt_s_kf22 [] = "\033[24$"; -static char screen_rxvt_s_kf23 [] = "\033[11^"; -static char screen_rxvt_s_kf24 [] = "\033[12^"; -static char screen_rxvt_s_kf25 [] = "\033[13^"; -static char screen_rxvt_s_kf26 [] = "\033[14^"; -static char screen_rxvt_s_kf27 [] = "\033[15^"; -static char screen_rxvt_s_kf28 [] = "\033[17^"; -static char screen_rxvt_s_kf29 [] = "\033[18^"; -static char screen_rxvt_s_kf30 [] = "\033[19^"; -static char screen_rxvt_s_kf31 [] = "\033[20^"; -static char screen_rxvt_s_kf32 [] = "\033[21^"; -static char screen_rxvt_s_kf33 [] = "\033[23^"; -static char screen_rxvt_s_kf34 [] = "\033[24^"; -static char screen_rxvt_s_kf35 [] = "\033[25^"; -static char screen_rxvt_s_kf36 [] = "\033[26^"; -static char screen_rxvt_s_kf37 [] = "\033[28^"; -static char screen_rxvt_s_kf38 [] = "\033[29^"; -static char screen_rxvt_s_kf39 [] = "\033[31^"; -static char screen_rxvt_s_kf40 [] = "\033[32^"; -static char screen_rxvt_s_kf41 [] = "\033[33^"; -static char screen_rxvt_s_kf42 [] = "\033[34^"; -static char screen_rxvt_s_kf43 [] = "\033[23@"; -static char screen_rxvt_s_kf44 [] = "\033[24@"; -static char screen_rxvt_s_el1 [] = "\033[1K"; -static char screen_rxvt_s_u6 [] = "\033[%i%d;%dR"; -static char screen_rxvt_s_u7 [] = "\033[6n"; -static char screen_rxvt_s_u8 [] = "\033[?1;2c"; -static char screen_rxvt_s_u9 [] = "\033[c"; -static char screen_rxvt_s_op [] = "\033[39;49m"; -static char screen_rxvt_s_kmous [] = "\033[M"; -static char screen_rxvt_s_setaf [] = "\033[3%p1%dm"; -static char screen_rxvt_s_setab [] = "\033[4%p1%dm"; - -static char screen_rxvt_bool_data[] = { - /* 0: bw */ TRUE, - /* 1: am */ TRUE, - /* 2: xsb */ FALSE, - /* 3: xhp */ FALSE, - /* 4: xenl */ TRUE, - /* 5: eo */ FALSE, - /* 6: gn */ FALSE, - /* 7: hc */ FALSE, - /* 8: km */ TRUE, - /* 9: hs */ FALSE, - /* 10: in */ FALSE, - /* 11: da */ FALSE, - /* 12: db */ FALSE, - /* 13: mir */ TRUE, - /* 14: msgr */ TRUE, - /* 15: os */ FALSE, - /* 16: eslok */ FALSE, - /* 17: xt */ FALSE, - /* 18: hz */ FALSE, - /* 19: ul */ FALSE, - /* 20: xon */ FALSE, - /* 21: nxon */ FALSE, - /* 22: mc5i */ FALSE, - /* 23: chts */ FALSE, - /* 24: nrrmc */ FALSE, - /* 25: npc */ FALSE, - /* 26: ndscr */ FALSE, - /* 27: ccc */ FALSE, - /* 28: bce */ FALSE, - /* 29: hls */ FALSE, - /* 30: xhpa */ FALSE, - /* 31: crxm */ FALSE, - /* 32: daisy */ FALSE, - /* 33: xvpa */ FALSE, - /* 34: sam */ FALSE, - /* 35: cpix */ FALSE, - /* 36: lpix */ FALSE, - /* 37: OTbs */ TRUE, - /* 38: OTns */ FALSE, - /* 39: OTnc */ FALSE, - /* 40: OTMT */ FALSE, - /* 41: OTNL */ FALSE, - /* 42: OTpt */ TRUE, - /* 43: OTxr */ FALSE, -}; -static NCURSES_INT2 screen_rxvt_number_data[] = { - /* 0: cols */ 80, - /* 1: it */ 8, - /* 2: lines */ 24, - /* 3: lm */ ABSENT_NUMERIC, - /* 4: xmc */ ABSENT_NUMERIC, - /* 5: pb */ ABSENT_NUMERIC, - /* 6: vt */ ABSENT_NUMERIC, - /* 7: wsl */ ABSENT_NUMERIC, - /* 8: nlab */ ABSENT_NUMERIC, - /* 9: lh */ ABSENT_NUMERIC, - /* 10: lw */ ABSENT_NUMERIC, - /* 11: ma */ ABSENT_NUMERIC, - /* 12: wnum */ ABSENT_NUMERIC, - /* 13: colors */ 8, - /* 14: pairs */ 64, - /* 15: ncv */ ABSENT_NUMERIC, - /* 16: bufsz */ ABSENT_NUMERIC, - /* 17: spinv */ ABSENT_NUMERIC, - /* 18: spinh */ ABSENT_NUMERIC, - /* 19: maddr */ ABSENT_NUMERIC, - /* 20: mjump */ ABSENT_NUMERIC, - /* 21: mcs */ ABSENT_NUMERIC, - /* 22: mls */ ABSENT_NUMERIC, - /* 23: npins */ ABSENT_NUMERIC, - /* 24: orc */ ABSENT_NUMERIC, - /* 25: orl */ ABSENT_NUMERIC, - /* 26: orhi */ ABSENT_NUMERIC, - /* 27: orvi */ ABSENT_NUMERIC, - /* 28: cps */ ABSENT_NUMERIC, - /* 29: widcs */ ABSENT_NUMERIC, - /* 30: btns */ ABSENT_NUMERIC, - /* 31: bitwin */ ABSENT_NUMERIC, - /* 32: bitype */ ABSENT_NUMERIC, - /* 33: OTug */ ABSENT_NUMERIC, - /* 34: OTdC */ ABSENT_NUMERIC, - /* 35: OTdN */ ABSENT_NUMERIC, - /* 36: OTdB */ ABSENT_NUMERIC, - /* 37: OTdT */ ABSENT_NUMERIC, - /* 38: OTkn */ ABSENT_NUMERIC, -}; -static char * screen_rxvt_string_data[] = { - /* 0: cbt */ screen_rxvt_s_cbt, - /* 1: bel */ screen_rxvt_s_bel, - /* 2: cr */ screen_rxvt_s_cr, - /* 3: csr */ screen_rxvt_s_csr, - /* 4: tbc */ screen_rxvt_s_tbc, - /* 5: clear */ screen_rxvt_s_clear, - /* 6: el */ screen_rxvt_s_el, - /* 7: ed */ screen_rxvt_s_ed, - /* 8: hpa */ screen_rxvt_s_hpa, - /* 9: cmdch */ ABSENT_STRING, - /* 10: cup */ screen_rxvt_s_cup, - /* 11: cud1 */ screen_rxvt_s_cud1, - /* 12: home */ screen_rxvt_s_home, - /* 13: civis */ screen_rxvt_s_civis, - /* 14: cub1 */ screen_rxvt_s_cub1, - /* 15: mrcup */ ABSENT_STRING, - /* 16: cnorm */ screen_rxvt_s_cnorm, - /* 17: cuf1 */ screen_rxvt_s_cuf1, - /* 18: ll */ ABSENT_STRING, - /* 19: cuu1 */ screen_rxvt_s_cuu1, - /* 20: cvvis */ CANCELLED_STRING, - /* 21: dch1 */ screen_rxvt_s_dch1, - /* 22: dl1 */ screen_rxvt_s_dl1, - /* 23: dsl */ ABSENT_STRING, - /* 24: hd */ ABSENT_STRING, - /* 25: smacs */ screen_rxvt_s_smacs, - /* 26: blink */ screen_rxvt_s_blink, - /* 27: bold */ screen_rxvt_s_bold, - /* 28: smcup */ screen_rxvt_s_smcup, - /* 29: smdc */ ABSENT_STRING, - /* 30: dim */ screen_rxvt_s_dim, - /* 31: smir */ screen_rxvt_s_smir, - /* 32: invis */ ABSENT_STRING, - /* 33: prot */ ABSENT_STRING, - /* 34: rev */ screen_rxvt_s_rev, - /* 35: smso */ screen_rxvt_s_smso, - /* 36: smul */ screen_rxvt_s_smul, - /* 37: ech */ ABSENT_STRING, - /* 38: rmacs */ screen_rxvt_s_rmacs, - /* 39: sgr0 */ screen_rxvt_s_sgr0, - /* 40: rmcup */ screen_rxvt_s_rmcup, - /* 41: rmdc */ ABSENT_STRING, - /* 42: rmir */ screen_rxvt_s_rmir, - /* 43: rmso */ screen_rxvt_s_rmso, - /* 44: rmul */ screen_rxvt_s_rmul, - /* 45: flash */ CANCELLED_STRING, - /* 46: ff */ ABSENT_STRING, - /* 47: fsl */ ABSENT_STRING, - /* 48: is1 */ ABSENT_STRING, - /* 49: is2 */ screen_rxvt_s_is2, - /* 50: is3 */ ABSENT_STRING, - /* 51: if */ ABSENT_STRING, - /* 52: ich1 */ ABSENT_STRING, - /* 53: il1 */ screen_rxvt_s_il1, - /* 54: ip */ ABSENT_STRING, - /* 55: kbs */ screen_rxvt_s_kbs, - /* 56: ktbc */ ABSENT_STRING, - /* 57: kclr */ ABSENT_STRING, - /* 58: kctab */ ABSENT_STRING, - /* 59: kdch1 */ screen_rxvt_s_kdch1, - /* 60: kdl1 */ ABSENT_STRING, - /* 61: kcud1 */ screen_rxvt_s_kcud1, - /* 62: krmir */ ABSENT_STRING, - /* 63: kel */ screen_rxvt_s_kel, - /* 64: ked */ ABSENT_STRING, - /* 65: kf0 */ ABSENT_STRING, - /* 66: kf1 */ screen_rxvt_s_kf1, - /* 67: kf10 */ screen_rxvt_s_kf10, - /* 68: kf2 */ screen_rxvt_s_kf2, - /* 69: kf3 */ screen_rxvt_s_kf3, - /* 70: kf4 */ screen_rxvt_s_kf4, - /* 71: kf5 */ screen_rxvt_s_kf5, - /* 72: kf6 */ screen_rxvt_s_kf6, - /* 73: kf7 */ screen_rxvt_s_kf7, - /* 74: kf8 */ screen_rxvt_s_kf8, - /* 75: kf9 */ screen_rxvt_s_kf9, - /* 76: khome */ screen_rxvt_s_khome, - /* 77: kich1 */ screen_rxvt_s_kich1, - /* 78: kil1 */ ABSENT_STRING, - /* 79: kcub1 */ screen_rxvt_s_kcub1, - /* 80: kll */ ABSENT_STRING, - /* 81: knp */ screen_rxvt_s_knp, - /* 82: kpp */ screen_rxvt_s_kpp, - /* 83: kcuf1 */ screen_rxvt_s_kcuf1, - /* 84: kind */ screen_rxvt_s_kind, - /* 85: kri */ screen_rxvt_s_kri, - /* 86: khts */ ABSENT_STRING, - /* 87: kcuu1 */ screen_rxvt_s_kcuu1, - /* 88: rmkx */ screen_rxvt_s_rmkx, - /* 89: smkx */ screen_rxvt_s_smkx, - /* 90: lf0 */ ABSENT_STRING, - /* 91: lf1 */ ABSENT_STRING, - /* 92: lf10 */ ABSENT_STRING, - /* 93: lf2 */ ABSENT_STRING, - /* 94: lf3 */ ABSENT_STRING, - /* 95: lf4 */ ABSENT_STRING, - /* 96: lf5 */ ABSENT_STRING, - /* 97: lf6 */ ABSENT_STRING, - /* 98: lf7 */ ABSENT_STRING, - /* 99: lf8 */ ABSENT_STRING, - /* 100: lf9 */ ABSENT_STRING, - /* 101: rmm */ ABSENT_STRING, - /* 102: smm */ ABSENT_STRING, - /* 103: nel */ screen_rxvt_s_nel, - /* 104: pad */ ABSENT_STRING, - /* 105: dch */ screen_rxvt_s_dch, - /* 106: dl */ screen_rxvt_s_dl, - /* 107: cud */ screen_rxvt_s_cud, - /* 108: ich */ screen_rxvt_s_ich, - /* 109: indn */ screen_rxvt_s_indn, - /* 110: il */ screen_rxvt_s_il, - /* 111: cub */ screen_rxvt_s_cub, - /* 112: cuf */ screen_rxvt_s_cuf, - /* 113: rin */ ABSENT_STRING, - /* 114: cuu */ screen_rxvt_s_cuu, - /* 115: pfkey */ ABSENT_STRING, - /* 116: pfloc */ ABSENT_STRING, - /* 117: pfx */ ABSENT_STRING, - /* 118: mc0 */ ABSENT_STRING, - /* 119: mc4 */ ABSENT_STRING, - /* 120: mc5 */ ABSENT_STRING, - /* 121: rep */ ABSENT_STRING, - /* 122: rs1 */ ABSENT_STRING, - /* 123: rs2 */ screen_rxvt_s_rs2, - /* 124: rs3 */ ABSENT_STRING, - /* 125: rf */ ABSENT_STRING, - /* 126: rc */ screen_rxvt_s_rc, - /* 127: vpa */ screen_rxvt_s_vpa, - /* 128: sc */ screen_rxvt_s_sc, - /* 129: ind */ screen_rxvt_s_ind, - /* 130: ri */ screen_rxvt_s_ri, - /* 131: sgr */ screen_rxvt_s_sgr, - /* 132: hts */ screen_rxvt_s_hts, - /* 133: wind */ ABSENT_STRING, - /* 134: ht */ screen_rxvt_s_ht, - /* 135: tsl */ ABSENT_STRING, - /* 136: uc */ ABSENT_STRING, - /* 137: hu */ ABSENT_STRING, - /* 138: iprog */ ABSENT_STRING, - /* 139: ka1 */ screen_rxvt_s_ka1, - /* 140: ka3 */ screen_rxvt_s_ka3, - /* 141: kb2 */ screen_rxvt_s_kb2, - /* 142: kc1 */ screen_rxvt_s_kc1, - /* 143: kc3 */ screen_rxvt_s_kc3, - /* 144: mc5p */ ABSENT_STRING, - /* 145: rmp */ ABSENT_STRING, - /* 146: acsc */ screen_rxvt_s_acsc, - /* 147: pln */ ABSENT_STRING, - /* 148: kcbt */ screen_rxvt_s_kcbt, - /* 149: smxon */ ABSENT_STRING, - /* 150: rmxon */ ABSENT_STRING, - /* 151: smam */ ABSENT_STRING, - /* 152: rmam */ ABSENT_STRING, - /* 153: xonc */ ABSENT_STRING, - /* 154: xoffc */ ABSENT_STRING, - /* 155: enacs */ screen_rxvt_s_enacs, - /* 156: smln */ ABSENT_STRING, - /* 157: rmln */ ABSENT_STRING, - /* 158: kbeg */ ABSENT_STRING, - /* 159: kcan */ ABSENT_STRING, - /* 160: kclo */ ABSENT_STRING, - /* 161: kcmd */ ABSENT_STRING, - /* 162: kcpy */ ABSENT_STRING, - /* 163: kcrt */ ABSENT_STRING, - /* 164: kend */ screen_rxvt_s_kend, - /* 165: kent */ screen_rxvt_s_kent, - /* 166: kext */ ABSENT_STRING, - /* 167: kfnd */ ABSENT_STRING, - /* 168: khlp */ ABSENT_STRING, - /* 169: kmrk */ ABSENT_STRING, - /* 170: kmsg */ ABSENT_STRING, - /* 171: kmov */ ABSENT_STRING, - /* 172: knxt */ ABSENT_STRING, - /* 173: kopn */ ABSENT_STRING, - /* 174: kopt */ ABSENT_STRING, - /* 175: kprv */ ABSENT_STRING, - /* 176: kprt */ ABSENT_STRING, - /* 177: krdo */ ABSENT_STRING, - /* 178: kref */ ABSENT_STRING, - /* 179: krfr */ ABSENT_STRING, - /* 180: krpl */ ABSENT_STRING, - /* 181: krst */ ABSENT_STRING, - /* 182: kres */ ABSENT_STRING, - /* 183: ksav */ ABSENT_STRING, - /* 184: kspd */ ABSENT_STRING, - /* 185: kund */ ABSENT_STRING, - /* 186: kBEG */ ABSENT_STRING, - /* 187: kCAN */ ABSENT_STRING, - /* 188: kCMD */ ABSENT_STRING, - /* 189: kCPY */ ABSENT_STRING, - /* 190: kCRT */ ABSENT_STRING, - /* 191: kDC */ screen_rxvt_s_kDC, - /* 192: kDL */ ABSENT_STRING, - /* 193: kslt */ ABSENT_STRING, - /* 194: kEND */ screen_rxvt_s_kEND, - /* 195: kEOL */ ABSENT_STRING, - /* 196: kEXT */ ABSENT_STRING, - /* 197: kFND */ ABSENT_STRING, - /* 198: kHLP */ ABSENT_STRING, - /* 199: kHOM */ screen_rxvt_s_kHOM, - /* 200: kIC */ screen_rxvt_s_kIC, - /* 201: kLFT */ screen_rxvt_s_kLFT, - /* 202: kMSG */ ABSENT_STRING, - /* 203: kMOV */ ABSENT_STRING, - /* 204: kNXT */ screen_rxvt_s_kNXT, - /* 205: kOPT */ ABSENT_STRING, - /* 206: kPRV */ screen_rxvt_s_kPRV, - /* 207: kPRT */ ABSENT_STRING, - /* 208: kRDO */ ABSENT_STRING, - /* 209: kRPL */ ABSENT_STRING, - /* 210: kRIT */ screen_rxvt_s_kRIT, - /* 211: kRES */ ABSENT_STRING, - /* 212: kSAV */ ABSENT_STRING, - /* 213: kSPD */ ABSENT_STRING, - /* 214: kUND */ ABSENT_STRING, - /* 215: rfi */ ABSENT_STRING, - /* 216: kf11 */ screen_rxvt_s_kf11, - /* 217: kf12 */ screen_rxvt_s_kf12, - /* 218: kf13 */ screen_rxvt_s_kf13, - /* 219: kf14 */ screen_rxvt_s_kf14, - /* 220: kf15 */ screen_rxvt_s_kf15, - /* 221: kf16 */ screen_rxvt_s_kf16, - /* 222: kf17 */ screen_rxvt_s_kf17, - /* 223: kf18 */ screen_rxvt_s_kf18, - /* 224: kf19 */ screen_rxvt_s_kf19, - /* 225: kf20 */ screen_rxvt_s_kf20, - /* 226: kf21 */ screen_rxvt_s_kf21, - /* 227: kf22 */ screen_rxvt_s_kf22, - /* 228: kf23 */ screen_rxvt_s_kf23, - /* 229: kf24 */ screen_rxvt_s_kf24, - /* 230: kf25 */ screen_rxvt_s_kf25, - /* 231: kf26 */ screen_rxvt_s_kf26, - /* 232: kf27 */ screen_rxvt_s_kf27, - /* 233: kf28 */ screen_rxvt_s_kf28, - /* 234: kf29 */ screen_rxvt_s_kf29, - /* 235: kf30 */ screen_rxvt_s_kf30, - /* 236: kf31 */ screen_rxvt_s_kf31, - /* 237: kf32 */ screen_rxvt_s_kf32, - /* 238: kf33 */ screen_rxvt_s_kf33, - /* 239: kf34 */ screen_rxvt_s_kf34, - /* 240: kf35 */ screen_rxvt_s_kf35, - /* 241: kf36 */ screen_rxvt_s_kf36, - /* 242: kf37 */ screen_rxvt_s_kf37, - /* 243: kf38 */ screen_rxvt_s_kf38, - /* 244: kf39 */ screen_rxvt_s_kf39, - /* 245: kf40 */ screen_rxvt_s_kf40, - /* 246: kf41 */ screen_rxvt_s_kf41, - /* 247: kf42 */ screen_rxvt_s_kf42, - /* 248: kf43 */ screen_rxvt_s_kf43, - /* 249: kf44 */ screen_rxvt_s_kf44, - /* 250: kf45 */ ABSENT_STRING, - /* 251: kf46 */ ABSENT_STRING, - /* 252: kf47 */ ABSENT_STRING, - /* 253: kf48 */ ABSENT_STRING, - /* 254: kf49 */ ABSENT_STRING, - /* 255: kf50 */ ABSENT_STRING, - /* 256: kf51 */ ABSENT_STRING, - /* 257: kf52 */ ABSENT_STRING, - /* 258: kf53 */ ABSENT_STRING, - /* 259: kf54 */ ABSENT_STRING, - /* 260: kf55 */ ABSENT_STRING, - /* 261: kf56 */ ABSENT_STRING, - /* 262: kf57 */ ABSENT_STRING, - /* 263: kf58 */ ABSENT_STRING, - /* 264: kf59 */ ABSENT_STRING, - /* 265: kf60 */ ABSENT_STRING, - /* 266: kf61 */ ABSENT_STRING, - /* 267: kf62 */ ABSENT_STRING, - /* 268: kf63 */ ABSENT_STRING, - /* 269: el1 */ screen_rxvt_s_el1, - /* 270: mgc */ ABSENT_STRING, - /* 271: smgl */ ABSENT_STRING, - /* 272: smgr */ ABSENT_STRING, - /* 273: fln */ ABSENT_STRING, - /* 274: sclk */ ABSENT_STRING, - /* 275: dclk */ ABSENT_STRING, - /* 276: rmclk */ ABSENT_STRING, - /* 277: cwin */ ABSENT_STRING, - /* 278: wingo */ ABSENT_STRING, - /* 279: hup */ ABSENT_STRING, - /* 280: dial */ ABSENT_STRING, - /* 281: qdial */ ABSENT_STRING, - /* 282: tone */ ABSENT_STRING, - /* 283: pulse */ ABSENT_STRING, - /* 284: hook */ ABSENT_STRING, - /* 285: pause */ ABSENT_STRING, - /* 286: wait */ ABSENT_STRING, - /* 287: u0 */ ABSENT_STRING, - /* 288: u1 */ ABSENT_STRING, - /* 289: u2 */ ABSENT_STRING, - /* 290: u3 */ ABSENT_STRING, - /* 291: u4 */ ABSENT_STRING, - /* 292: u5 */ ABSENT_STRING, - /* 293: u6 */ screen_rxvt_s_u6, - /* 294: u7 */ screen_rxvt_s_u7, - /* 295: u8 */ screen_rxvt_s_u8, - /* 296: u9 */ screen_rxvt_s_u9, - /* 297: op */ screen_rxvt_s_op, - /* 298: oc */ ABSENT_STRING, - /* 299: initc */ ABSENT_STRING, - /* 300: initp */ ABSENT_STRING, - /* 301: scp */ ABSENT_STRING, - /* 302: setf */ ABSENT_STRING, - /* 303: setb */ ABSENT_STRING, - /* 304: cpi */ ABSENT_STRING, - /* 305: lpi */ ABSENT_STRING, - /* 306: chr */ ABSENT_STRING, - /* 307: cvr */ ABSENT_STRING, - /* 308: defc */ ABSENT_STRING, - /* 309: swidm */ ABSENT_STRING, - /* 310: sdrfq */ ABSENT_STRING, - /* 311: sitm */ ABSENT_STRING, - /* 312: slm */ ABSENT_STRING, - /* 313: smicm */ ABSENT_STRING, - /* 314: snlq */ ABSENT_STRING, - /* 315: snrmq */ ABSENT_STRING, - /* 316: sshm */ ABSENT_STRING, - /* 317: ssubm */ ABSENT_STRING, - /* 318: ssupm */ ABSENT_STRING, - /* 319: sum */ ABSENT_STRING, - /* 320: rwidm */ ABSENT_STRING, - /* 321: ritm */ ABSENT_STRING, - /* 322: rlm */ ABSENT_STRING, - /* 323: rmicm */ ABSENT_STRING, - /* 324: rshm */ ABSENT_STRING, - /* 325: rsubm */ ABSENT_STRING, - /* 326: rsupm */ ABSENT_STRING, - /* 327: rum */ ABSENT_STRING, - /* 328: mhpa */ ABSENT_STRING, - /* 329: mcud1 */ ABSENT_STRING, - /* 330: mcub1 */ ABSENT_STRING, - /* 331: mcuf1 */ ABSENT_STRING, - /* 332: mvpa */ ABSENT_STRING, - /* 333: mcuu1 */ ABSENT_STRING, - /* 334: porder */ ABSENT_STRING, - /* 335: mcud */ ABSENT_STRING, - /* 336: mcub */ ABSENT_STRING, - /* 337: mcuf */ ABSENT_STRING, - /* 338: mcuu */ ABSENT_STRING, - /* 339: scs */ ABSENT_STRING, - /* 340: smgb */ ABSENT_STRING, - /* 341: smgbp */ ABSENT_STRING, - /* 342: smglp */ ABSENT_STRING, - /* 343: smgrp */ ABSENT_STRING, - /* 344: smgt */ ABSENT_STRING, - /* 345: smgtp */ ABSENT_STRING, - /* 346: sbim */ ABSENT_STRING, - /* 347: scsd */ ABSENT_STRING, - /* 348: rbim */ ABSENT_STRING, - /* 349: rcsd */ ABSENT_STRING, - /* 350: subcs */ ABSENT_STRING, - /* 351: supcs */ ABSENT_STRING, - /* 352: docr */ ABSENT_STRING, - /* 353: zerom */ ABSENT_STRING, - /* 354: csnm */ ABSENT_STRING, - /* 355: kmous */ screen_rxvt_s_kmous, - /* 356: minfo */ ABSENT_STRING, - /* 357: reqmp */ ABSENT_STRING, - /* 358: getm */ ABSENT_STRING, - /* 359: setaf */ screen_rxvt_s_setaf, - /* 360: setab */ screen_rxvt_s_setab, - /* 361: pfxl */ ABSENT_STRING, - /* 362: devt */ ABSENT_STRING, - /* 363: csin */ ABSENT_STRING, - /* 364: s0ds */ ABSENT_STRING, - /* 365: s1ds */ ABSENT_STRING, - /* 366: s2ds */ ABSENT_STRING, - /* 367: s3ds */ ABSENT_STRING, - /* 368: smglr */ ABSENT_STRING, - /* 369: smgtb */ ABSENT_STRING, - /* 370: birep */ ABSENT_STRING, - /* 371: binel */ ABSENT_STRING, - /* 372: bicr */ ABSENT_STRING, - /* 373: colornm */ ABSENT_STRING, - /* 374: defbi */ ABSENT_STRING, - /* 375: endbi */ ABSENT_STRING, - /* 376: setcolor */ ABSENT_STRING, - /* 377: slines */ ABSENT_STRING, - /* 378: dispc */ ABSENT_STRING, - /* 379: smpch */ ABSENT_STRING, - /* 380: rmpch */ ABSENT_STRING, - /* 381: smsc */ ABSENT_STRING, - /* 382: rmsc */ ABSENT_STRING, - /* 383: pctrm */ ABSENT_STRING, - /* 384: scesc */ ABSENT_STRING, - /* 385: scesa */ ABSENT_STRING, - /* 386: ehhlm */ ABSENT_STRING, - /* 387: elhlm */ ABSENT_STRING, - /* 388: elohlm */ ABSENT_STRING, - /* 389: erhlm */ ABSENT_STRING, - /* 390: ethlm */ ABSENT_STRING, - /* 391: evhlm */ ABSENT_STRING, - /* 392: sgr1 */ ABSENT_STRING, - /* 393: slength */ ABSENT_STRING, - /* 394: OTi2 */ ABSENT_STRING, - /* 395: OTrs */ ABSENT_STRING, - /* 396: OTnl */ ABSENT_STRING, - /* 397: OTbc */ ABSENT_STRING, - /* 398: OTko */ ABSENT_STRING, - /* 399: OTma */ ABSENT_STRING, - /* 400: OTG2 */ ABSENT_STRING, - /* 401: OTG3 */ ABSENT_STRING, - /* 402: OTG1 */ ABSENT_STRING, - /* 403: OTG4 */ ABSENT_STRING, - /* 404: OTGR */ ABSENT_STRING, - /* 405: OTGL */ ABSENT_STRING, - /* 406: OTGU */ ABSENT_STRING, - /* 407: OTGD */ ABSENT_STRING, - /* 408: OTGH */ ABSENT_STRING, - /* 409: OTGV */ ABSENT_STRING, - /* 410: OTGC */ ABSENT_STRING, - /* 411: meml */ ABSENT_STRING, - /* 412: memu */ ABSENT_STRING, - /* 413: box1 */ ABSENT_STRING, -}; -/* screen.xterm-new */ - -static char screen_xterm_xfree86_alias_data[] = "screen.xterm-xfree86|screen.xterm-new|screen customized for modern xterm"; - -static char screen_xterm_xfree86_s_cbt[] = "\033[Z"; -static char screen_xterm_xfree86_s_bel[] = "\007"; -static char screen_xterm_xfree86_s_cr[] = "\015"; -static char screen_xterm_xfree86_s_csr[] = "\033[%i%p1%d;%p2%dr"; -static char screen_xterm_xfree86_s_tbc[] = "\033[3g"; -static char screen_xterm_xfree86_s_clear[] = "\033[H\033[2J"; -static char screen_xterm_xfree86_s_el[] = "\033[K"; -static char screen_xterm_xfree86_s_ed[] = "\033[J"; -static char screen_xterm_xfree86_s_hpa[] = "\033[%i%p1%dG"; -static char screen_xterm_xfree86_s_cup[] = "\033[%i%p1%d;%p2%dH"; -static char screen_xterm_xfree86_s_cud1[] = "\012"; -static char screen_xterm_xfree86_s_home[] = "\033[H"; -static char screen_xterm_xfree86_s_civis[] = "\033[?25l"; -static char screen_xterm_xfree86_s_cub1[] = "\010"; -static char screen_xterm_xfree86_s_cnorm[] = "\033[?12l\033[?25h"; -static char screen_xterm_xfree86_s_cuf1[] = "\033[C"; -static char screen_xterm_xfree86_s_cuu1[] = "\033[A"; -static char screen_xterm_xfree86_s_cvvis[] = "\033[?12;25h"; -static char screen_xterm_xfree86_s_dch1[] = "\033[P"; -static char screen_xterm_xfree86_s_dl1[] = "\033[M"; -static char screen_xterm_xfree86_s_smacs[] = "\033(0"; -static char screen_xterm_xfree86_s_blink[] = "\033[5m"; -static char screen_xterm_xfree86_s_bold[] = "\033[1m"; -static char screen_xterm_xfree86_s_smcup[] = "\033[?1049h\033[22;0;0t"; -static char screen_xterm_xfree86_s_dim[] = "\033[2m"; -static char screen_xterm_xfree86_s_smir[] = "\033[4h"; -static char screen_xterm_xfree86_s_rev[] = "\033[7m"; -static char screen_xterm_xfree86_s_smso[] = "\033[7m"; -static char screen_xterm_xfree86_s_smul[] = "\033[4m"; -static char screen_xterm_xfree86_s_ech[] = "\033[%p1%dX"; -static char screen_xterm_xfree86_s_rmacs[] = "\033(B"; -static char screen_xterm_xfree86_s_sgr0[] = "\033(B\033[m"; -static char screen_xterm_xfree86_s_rmcup[] = "\033[?1049l\033[23;0;0t"; -static char screen_xterm_xfree86_s_rmir[] = "\033[4l"; -static char screen_xterm_xfree86_s_rmso[] = "\033[27m"; -static char screen_xterm_xfree86_s_rmul[] = "\033[24m"; -static char screen_xterm_xfree86_s_flash[] = "\033[?5h$<100/>\033[?5l"; -static char screen_xterm_xfree86_s_is2[] = "\033[!p\033[?3;4l\033[4l\033>"; -static char screen_xterm_xfree86_s_il1[] = "\033[L"; -static char screen_xterm_xfree86_s_kbs[] = "\010"; -static char screen_xterm_xfree86_s_kdch1[] = "\033[3~"; -static char screen_xterm_xfree86_s_kcud1[] = "\033OB"; -static char screen_xterm_xfree86_s_kf1[] = "\033OP"; -static char screen_xterm_xfree86_s_kf10[] = "\033[21~"; -static char screen_xterm_xfree86_s_kf2[] = "\033OQ"; -static char screen_xterm_xfree86_s_kf3[] = "\033OR"; -static char screen_xterm_xfree86_s_kf4[] = "\033OS"; -static char screen_xterm_xfree86_s_kf5[] = "\033[15~"; -static char screen_xterm_xfree86_s_kf6[] = "\033[17~"; -static char screen_xterm_xfree86_s_kf7[] = "\033[18~"; -static char screen_xterm_xfree86_s_kf8[] = "\033[19~"; -static char screen_xterm_xfree86_s_kf9[] = "\033[20~"; -static char screen_xterm_xfree86_s_khome[] = "\033[1~"; -static char screen_xterm_xfree86_s_kich1[] = "\033[2~"; -static char screen_xterm_xfree86_s_kcub1[] = "\033OD"; -static char screen_xterm_xfree86_s_knp[] = "\033[6~"; -static char screen_xterm_xfree86_s_kpp[] = "\033[5~"; -static char screen_xterm_xfree86_s_kcuf1[] = "\033OC"; -static char screen_xterm_xfree86_s_kind[] = "\033[1;2B"; -static char screen_xterm_xfree86_s_kri[] = "\033[1;2A"; -static char screen_xterm_xfree86_s_kcuu1[] = "\033OA"; -static char screen_xterm_xfree86_s_rmkx[] = "\033[?1l\033>"; -static char screen_xterm_xfree86_s_smkx[] = "\033[?1h\033="; -static char screen_xterm_xfree86_s_rmm[] = "\033[?1034l"; -static char screen_xterm_xfree86_s_smm[] = "\033[?1034h"; -static char screen_xterm_xfree86_s_dch[] = "\033[%p1%dP"; -static char screen_xterm_xfree86_s_dl[] = "\033[%p1%dM"; -static char screen_xterm_xfree86_s_cud[] = "\033[%p1%dB"; -static char screen_xterm_xfree86_s_ich[] = "\033[%p1%d@"; -static char screen_xterm_xfree86_s_indn[] = "\033[%p1%dS"; -static char screen_xterm_xfree86_s_il[] = "\033[%p1%dL"; -static char screen_xterm_xfree86_s_cub[] = "\033[%p1%dD"; -static char screen_xterm_xfree86_s_cuf[] = "\033[%p1%dC"; -static char screen_xterm_xfree86_s_rin[] = "\033[%p1%dT"; -static char screen_xterm_xfree86_s_cuu[] = "\033[%p1%dA"; -static char screen_xterm_xfree86_s_mc0[] = "\033[i"; -static char screen_xterm_xfree86_s_mc4[] = "\033[4i"; -static char screen_xterm_xfree86_s_mc5[] = "\033[5i"; -static char screen_xterm_xfree86_s_rs1[] = "\033c"; -static char screen_xterm_xfree86_s_rs2[] = "\033[!p\033[?3;4l\033[4l\033>"; -static char screen_xterm_xfree86_s_rc[] = "\0338"; -static char screen_xterm_xfree86_s_vpa[] = "\033[%i%p1%dd"; -static char screen_xterm_xfree86_s_sc[] = "\0337"; -static char screen_xterm_xfree86_s_ind[] = "\012"; -static char screen_xterm_xfree86_s_ri[] = "\033M"; -static char screen_xterm_xfree86_s_sgr[] = "%?%p9%t\033(0%e\033(B%;\033[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;m"; -static char screen_xterm_xfree86_s_hts[] = "\033H"; -static char screen_xterm_xfree86_s_ht[] = "\011"; -static char screen_xterm_xfree86_s_kb2[] = "\033OE"; -static char screen_xterm_xfree86_s_acsc[] = "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"; -static char screen_xterm_xfree86_s_kcbt[] = "\033[Z"; -static char screen_xterm_xfree86_s_smam[] = "\033[?7h"; -static char screen_xterm_xfree86_s_rmam[] = "\033[?7l"; -static char screen_xterm_xfree86_s_kend[] = "\033[4~"; -static char screen_xterm_xfree86_s_kent[] = "\033OM"; -static char screen_xterm_xfree86_s_kDC[] = "\033[3;2~"; -static char screen_xterm_xfree86_s_kEND[] = "\033[1;2F"; -static char screen_xterm_xfree86_s_kHOM[] = "\033[1;2H"; -static char screen_xterm_xfree86_s_kLFT[] = "\033[1;2D"; -static char screen_xterm_xfree86_s_kRIT[] = "\033[1;2C"; -static char screen_xterm_xfree86_s_kf11[] = "\033[23~"; -static char screen_xterm_xfree86_s_kf12[] = "\033[24~"; -static char screen_xterm_xfree86_s_kf13[] = "\033[1;2P"; -static char screen_xterm_xfree86_s_kf14[] = "\033[1;2Q"; -static char screen_xterm_xfree86_s_kf15[] = "\033[1;2R"; -static char screen_xterm_xfree86_s_kf16[] = "\033[1;2S"; -static char screen_xterm_xfree86_s_kf17[] = "\033[15;2~"; -static char screen_xterm_xfree86_s_kf18[] = "\033[17;2~"; -static char screen_xterm_xfree86_s_kf19[] = "\033[18;2~"; -static char screen_xterm_xfree86_s_kf20[] = "\033[19;2~"; -static char screen_xterm_xfree86_s_kf21[] = "\033[20;2~"; -static char screen_xterm_xfree86_s_kf22[] = "\033[21;2~"; -static char screen_xterm_xfree86_s_kf23[] = "\033[23;2~"; -static char screen_xterm_xfree86_s_kf24[] = "\033[24;2~"; -static char screen_xterm_xfree86_s_kf25[] = "\033[1;5P"; -static char screen_xterm_xfree86_s_kf26[] = "\033[1;5Q"; -static char screen_xterm_xfree86_s_kf27[] = "\033[1;5R"; -static char screen_xterm_xfree86_s_kf28[] = "\033[1;5S"; -static char screen_xterm_xfree86_s_kf29[] = "\033[15;5~"; -static char screen_xterm_xfree86_s_kf30[] = "\033[17;5~"; -static char screen_xterm_xfree86_s_kf31[] = "\033[18;5~"; -static char screen_xterm_xfree86_s_kf32[] = "\033[19;5~"; -static char screen_xterm_xfree86_s_kf33[] = "\033[20;5~"; -static char screen_xterm_xfree86_s_kf34[] = "\033[21;5~"; -static char screen_xterm_xfree86_s_kf35[] = "\033[23;5~"; -static char screen_xterm_xfree86_s_kf36[] = "\033[24;5~"; -static char screen_xterm_xfree86_s_kf37[] = "\033[1;6P"; -static char screen_xterm_xfree86_s_kf38[] = "\033[1;6Q"; -static char screen_xterm_xfree86_s_kf39[] = "\033[1;6R"; -static char screen_xterm_xfree86_s_kf40[] = "\033[1;6S"; -static char screen_xterm_xfree86_s_kf41[] = "\033[15;6~"; -static char screen_xterm_xfree86_s_kf42[] = "\033[17;6~"; -static char screen_xterm_xfree86_s_kf43[] = "\033[18;6~"; -static char screen_xterm_xfree86_s_kf44[] = "\033[19;6~"; -static char screen_xterm_xfree86_s_kf45[] = "\033[20;6~"; -static char screen_xterm_xfree86_s_kf46[] = "\033[21;6~"; -static char screen_xterm_xfree86_s_kf47[] = "\033[23;6~"; -static char screen_xterm_xfree86_s_kf48[] = "\033[24;6~"; -static char screen_xterm_xfree86_s_kf49[] = "\033[1;3P"; -static char screen_xterm_xfree86_s_kf50[] = "\033[1;3Q"; -static char screen_xterm_xfree86_s_kf51[] = "\033[1;3R"; -static char screen_xterm_xfree86_s_kf52[] = "\033[1;3S"; -static char screen_xterm_xfree86_s_kf53[] = "\033[15;3~"; -static char screen_xterm_xfree86_s_kf54[] = "\033[17;3~"; -static char screen_xterm_xfree86_s_kf55[] = "\033[18;3~"; -static char screen_xterm_xfree86_s_kf56[] = "\033[19;3~"; -static char screen_xterm_xfree86_s_kf57[] = "\033[20;3~"; -static char screen_xterm_xfree86_s_kf58[] = "\033[21;3~"; -static char screen_xterm_xfree86_s_kf59[] = "\033[23;3~"; -static char screen_xterm_xfree86_s_kf60[] = "\033[24;3~"; -static char screen_xterm_xfree86_s_kf61[] = "\033[1;4P"; -static char screen_xterm_xfree86_s_kf62[] = "\033[1;4Q"; -static char screen_xterm_xfree86_s_kf63[] = "\033[1;4R"; -static char screen_xterm_xfree86_s_el1[] = "\033[1K"; -static char screen_xterm_xfree86_s_u6[] = "\033[%i%d;%dR"; -static char screen_xterm_xfree86_s_u7[] = "\033[6n"; -static char screen_xterm_xfree86_s_u8[] = "\033[?%[;0123456789]c"; -static char screen_xterm_xfree86_s_u9[] = "\033[c"; -static char screen_xterm_xfree86_s_op[] = "\033[39;49m"; -static char screen_xterm_xfree86_s_setf[] = "\033[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m"; -static char screen_xterm_xfree86_s_setb[] = "\033[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m"; -static char screen_xterm_xfree86_s_kmous[] = "\033[M"; -static char screen_xterm_xfree86_s_setaf[] = "\033[3%p1%dm"; -static char screen_xterm_xfree86_s_setab[] = "\033[4%p1%dm"; - -static char screen_xterm_xfree86_bool_data[] = { - /* 0: bw */ TRUE, - /* 1: am */ TRUE, - /* 2: xsb */ FALSE, - /* 3: xhp */ FALSE, - /* 4: xenl */ TRUE, - /* 5: eo */ FALSE, - /* 6: gn */ FALSE, - /* 7: hc */ FALSE, - /* 8: km */ TRUE, - /* 9: hs */ FALSE, - /* 10: in */ FALSE, - /* 11: da */ FALSE, - /* 12: db */ FALSE, - /* 13: mir */ TRUE, - /* 14: msgr */ TRUE, - /* 15: os */ FALSE, - /* 16: eslok */ FALSE, - /* 17: xt */ FALSE, - /* 18: hz */ FALSE, - /* 19: ul */ FALSE, - /* 20: xon */ FALSE, - /* 21: nxon */ FALSE, - /* 22: mc5i */ TRUE, - /* 23: chts */ FALSE, - /* 24: nrrmc */ FALSE, - /* 25: npc */ TRUE, - /* 26: ndscr */ FALSE, - /* 27: ccc */ FALSE, - /* 28: bce */ FALSE, - /* 29: hls */ FALSE, - /* 30: xhpa */ FALSE, - /* 31: crxm */ FALSE, - /* 32: daisy */ FALSE, - /* 33: xvpa */ FALSE, - /* 34: sam */ FALSE, - /* 35: cpix */ FALSE, - /* 36: lpix */ FALSE, - /* 37: OTbs */ TRUE, - /* 38: OTns */ FALSE, - /* 39: OTnc */ FALSE, - /* 40: OTMT */ FALSE, - /* 41: OTNL */ FALSE, - /* 42: OTpt */ FALSE, - /* 43: OTxr */ FALSE, -}; -static NCURSES_INT2 screen_xterm_xfree86_number_data[] = { - /* 0: cols */ 80, - /* 1: it */ 8, - /* 2: lines */ 24, - /* 3: lm */ ABSENT_NUMERIC, - /* 4: xmc */ ABSENT_NUMERIC, - /* 5: pb */ ABSENT_NUMERIC, - /* 6: vt */ ABSENT_NUMERIC, - /* 7: wsl */ ABSENT_NUMERIC, - /* 8: nlab */ ABSENT_NUMERIC, - /* 9: lh */ ABSENT_NUMERIC, - /* 10: lw */ ABSENT_NUMERIC, - /* 11: ma */ ABSENT_NUMERIC, - /* 12: wnum */ ABSENT_NUMERIC, - /* 13: colors */ 8, - /* 14: pairs */ 64, - /* 15: ncv */ ABSENT_NUMERIC, - /* 16: bufsz */ ABSENT_NUMERIC, - /* 17: spinv */ ABSENT_NUMERIC, - /* 18: spinh */ ABSENT_NUMERIC, - /* 19: maddr */ ABSENT_NUMERIC, - /* 20: mjump */ ABSENT_NUMERIC, - /* 21: mcs */ ABSENT_NUMERIC, - /* 22: mls */ ABSENT_NUMERIC, - /* 23: npins */ ABSENT_NUMERIC, - /* 24: orc */ ABSENT_NUMERIC, - /* 25: orl */ ABSENT_NUMERIC, - /* 26: orhi */ ABSENT_NUMERIC, - /* 27: orvi */ ABSENT_NUMERIC, - /* 28: cps */ ABSENT_NUMERIC, - /* 29: widcs */ ABSENT_NUMERIC, - /* 30: btns */ ABSENT_NUMERIC, - /* 31: bitwin */ ABSENT_NUMERIC, - /* 32: bitype */ ABSENT_NUMERIC, - /* 33: OTug */ ABSENT_NUMERIC, - /* 34: OTdC */ ABSENT_NUMERIC, - /* 35: OTdN */ ABSENT_NUMERIC, - /* 36: OTdB */ ABSENT_NUMERIC, - /* 37: OTdT */ ABSENT_NUMERIC, - /* 38: OTkn */ ABSENT_NUMERIC, -}; -static char * screen_xterm_xfree86_string_data[] = { - /* 0: cbt */ screen_xterm_xfree86_s_cbt, - /* 1: bel */ screen_xterm_xfree86_s_bel, - /* 2: cr */ screen_xterm_xfree86_s_cr, - /* 3: csr */ screen_xterm_xfree86_s_csr, - /* 4: tbc */ screen_xterm_xfree86_s_tbc, - /* 5: clear */ screen_xterm_xfree86_s_clear, - /* 6: el */ screen_xterm_xfree86_s_el, - /* 7: ed */ screen_xterm_xfree86_s_ed, - /* 8: hpa */ screen_xterm_xfree86_s_hpa, - /* 9: cmdch */ ABSENT_STRING, - /* 10: cup */ screen_xterm_xfree86_s_cup, - /* 11: cud1 */ screen_xterm_xfree86_s_cud1, - /* 12: home */ screen_xterm_xfree86_s_home, - /* 13: civis */ screen_xterm_xfree86_s_civis, - /* 14: cub1 */ screen_xterm_xfree86_s_cub1, - /* 15: mrcup */ ABSENT_STRING, - /* 16: cnorm */ screen_xterm_xfree86_s_cnorm, - /* 17: cuf1 */ screen_xterm_xfree86_s_cuf1, - /* 18: ll */ ABSENT_STRING, - /* 19: cuu1 */ screen_xterm_xfree86_s_cuu1, - /* 20: cvvis */ screen_xterm_xfree86_s_cvvis, - /* 21: dch1 */ screen_xterm_xfree86_s_dch1, - /* 22: dl1 */ screen_xterm_xfree86_s_dl1, - /* 23: dsl */ ABSENT_STRING, - /* 24: hd */ ABSENT_STRING, - /* 25: smacs */ screen_xterm_xfree86_s_smacs, - /* 26: blink */ screen_xterm_xfree86_s_blink, - /* 27: bold */ screen_xterm_xfree86_s_bold, - /* 28: smcup */ screen_xterm_xfree86_s_smcup, - /* 29: smdc */ ABSENT_STRING, - /* 30: dim */ screen_xterm_xfree86_s_dim, - /* 31: smir */ screen_xterm_xfree86_s_smir, - /* 32: invis */ CANCELLED_STRING, - /* 33: prot */ ABSENT_STRING, - /* 34: rev */ screen_xterm_xfree86_s_rev, - /* 35: smso */ screen_xterm_xfree86_s_smso, - /* 36: smul */ screen_xterm_xfree86_s_smul, - /* 37: ech */ screen_xterm_xfree86_s_ech, - /* 38: rmacs */ screen_xterm_xfree86_s_rmacs, - /* 39: sgr0 */ screen_xterm_xfree86_s_sgr0, - /* 40: rmcup */ screen_xterm_xfree86_s_rmcup, - /* 41: rmdc */ ABSENT_STRING, - /* 42: rmir */ screen_xterm_xfree86_s_rmir, - /* 43: rmso */ screen_xterm_xfree86_s_rmso, - /* 44: rmul */ screen_xterm_xfree86_s_rmul, - /* 45: flash */ screen_xterm_xfree86_s_flash, - /* 46: ff */ ABSENT_STRING, - /* 47: fsl */ ABSENT_STRING, - /* 48: is1 */ ABSENT_STRING, - /* 49: is2 */ screen_xterm_xfree86_s_is2, - /* 50: is3 */ ABSENT_STRING, - /* 51: if */ ABSENT_STRING, - /* 52: ich1 */ ABSENT_STRING, - /* 53: il1 */ screen_xterm_xfree86_s_il1, - /* 54: ip */ ABSENT_STRING, - /* 55: kbs */ screen_xterm_xfree86_s_kbs, - /* 56: ktbc */ ABSENT_STRING, - /* 57: kclr */ ABSENT_STRING, - /* 58: kctab */ ABSENT_STRING, - /* 59: kdch1 */ screen_xterm_xfree86_s_kdch1, - /* 60: kdl1 */ ABSENT_STRING, - /* 61: kcud1 */ screen_xterm_xfree86_s_kcud1, - /* 62: krmir */ ABSENT_STRING, - /* 63: kel */ ABSENT_STRING, - /* 64: ked */ ABSENT_STRING, - /* 65: kf0 */ ABSENT_STRING, - /* 66: kf1 */ screen_xterm_xfree86_s_kf1, - /* 67: kf10 */ screen_xterm_xfree86_s_kf10, - /* 68: kf2 */ screen_xterm_xfree86_s_kf2, - /* 69: kf3 */ screen_xterm_xfree86_s_kf3, - /* 70: kf4 */ screen_xterm_xfree86_s_kf4, - /* 71: kf5 */ screen_xterm_xfree86_s_kf5, - /* 72: kf6 */ screen_xterm_xfree86_s_kf6, - /* 73: kf7 */ screen_xterm_xfree86_s_kf7, - /* 74: kf8 */ screen_xterm_xfree86_s_kf8, - /* 75: kf9 */ screen_xterm_xfree86_s_kf9, - /* 76: khome */ screen_xterm_xfree86_s_khome, - /* 77: kich1 */ screen_xterm_xfree86_s_kich1, - /* 78: kil1 */ ABSENT_STRING, - /* 79: kcub1 */ screen_xterm_xfree86_s_kcub1, - /* 80: kll */ ABSENT_STRING, - /* 81: knp */ screen_xterm_xfree86_s_knp, - /* 82: kpp */ screen_xterm_xfree86_s_kpp, - /* 83: kcuf1 */ screen_xterm_xfree86_s_kcuf1, - /* 84: kind */ screen_xterm_xfree86_s_kind, - /* 85: kri */ screen_xterm_xfree86_s_kri, - /* 86: khts */ ABSENT_STRING, - /* 87: kcuu1 */ screen_xterm_xfree86_s_kcuu1, - /* 88: rmkx */ screen_xterm_xfree86_s_rmkx, - /* 89: smkx */ screen_xterm_xfree86_s_smkx, - /* 90: lf0 */ ABSENT_STRING, - /* 91: lf1 */ ABSENT_STRING, - /* 92: lf10 */ ABSENT_STRING, - /* 93: lf2 */ ABSENT_STRING, - /* 94: lf3 */ ABSENT_STRING, - /* 95: lf4 */ ABSENT_STRING, - /* 96: lf5 */ ABSENT_STRING, - /* 97: lf6 */ ABSENT_STRING, - /* 98: lf7 */ ABSENT_STRING, - /* 99: lf8 */ ABSENT_STRING, - /* 100: lf9 */ ABSENT_STRING, - /* 101: rmm */ screen_xterm_xfree86_s_rmm, - /* 102: smm */ screen_xterm_xfree86_s_smm, - /* 103: nel */ ABSENT_STRING, - /* 104: pad */ ABSENT_STRING, - /* 105: dch */ screen_xterm_xfree86_s_dch, - /* 106: dl */ screen_xterm_xfree86_s_dl, - /* 107: cud */ screen_xterm_xfree86_s_cud, - /* 108: ich */ screen_xterm_xfree86_s_ich, - /* 109: indn */ screen_xterm_xfree86_s_indn, - /* 110: il */ screen_xterm_xfree86_s_il, - /* 111: cub */ screen_xterm_xfree86_s_cub, - /* 112: cuf */ screen_xterm_xfree86_s_cuf, - /* 113: rin */ screen_xterm_xfree86_s_rin, - /* 114: cuu */ screen_xterm_xfree86_s_cuu, - /* 115: pfkey */ ABSENT_STRING, - /* 116: pfloc */ ABSENT_STRING, - /* 117: pfx */ ABSENT_STRING, - /* 118: mc0 */ screen_xterm_xfree86_s_mc0, - /* 119: mc4 */ screen_xterm_xfree86_s_mc4, - /* 120: mc5 */ screen_xterm_xfree86_s_mc5, - /* 121: rep */ CANCELLED_STRING, - /* 122: rs1 */ screen_xterm_xfree86_s_rs1, - /* 123: rs2 */ screen_xterm_xfree86_s_rs2, - /* 124: rs3 */ ABSENT_STRING, - /* 125: rf */ ABSENT_STRING, - /* 126: rc */ screen_xterm_xfree86_s_rc, - /* 127: vpa */ screen_xterm_xfree86_s_vpa, - /* 128: sc */ screen_xterm_xfree86_s_sc, - /* 129: ind */ screen_xterm_xfree86_s_ind, - /* 130: ri */ screen_xterm_xfree86_s_ri, - /* 131: sgr */ screen_xterm_xfree86_s_sgr, - /* 132: hts */ screen_xterm_xfree86_s_hts, - /* 133: wind */ ABSENT_STRING, - /* 134: ht */ screen_xterm_xfree86_s_ht, - /* 135: tsl */ ABSENT_STRING, - /* 136: uc */ ABSENT_STRING, - /* 137: hu */ ABSENT_STRING, - /* 138: iprog */ ABSENT_STRING, - /* 139: ka1 */ ABSENT_STRING, - /* 140: ka3 */ ABSENT_STRING, - /* 141: kb2 */ screen_xterm_xfree86_s_kb2, - /* 142: kc1 */ ABSENT_STRING, - /* 143: kc3 */ ABSENT_STRING, - /* 144: mc5p */ ABSENT_STRING, - /* 145: rmp */ ABSENT_STRING, - /* 146: acsc */ screen_xterm_xfree86_s_acsc, - /* 147: pln */ ABSENT_STRING, - /* 148: kcbt */ screen_xterm_xfree86_s_kcbt, - /* 149: smxon */ ABSENT_STRING, - /* 150: rmxon */ ABSENT_STRING, - /* 151: smam */ screen_xterm_xfree86_s_smam, - /* 152: rmam */ screen_xterm_xfree86_s_rmam, - /* 153: xonc */ ABSENT_STRING, - /* 154: xoffc */ ABSENT_STRING, - /* 155: enacs */ ABSENT_STRING, - /* 156: smln */ ABSENT_STRING, - /* 157: rmln */ ABSENT_STRING, - /* 158: kbeg */ ABSENT_STRING, - /* 159: kcan */ ABSENT_STRING, - /* 160: kclo */ ABSENT_STRING, - /* 161: kcmd */ ABSENT_STRING, - /* 162: kcpy */ ABSENT_STRING, - /* 163: kcrt */ ABSENT_STRING, - /* 164: kend */ screen_xterm_xfree86_s_kend, - /* 165: kent */ screen_xterm_xfree86_s_kent, - /* 166: kext */ ABSENT_STRING, - /* 167: kfnd */ ABSENT_STRING, - /* 168: khlp */ ABSENT_STRING, - /* 169: kmrk */ ABSENT_STRING, - /* 170: kmsg */ ABSENT_STRING, - /* 171: kmov */ ABSENT_STRING, - /* 172: knxt */ ABSENT_STRING, - /* 173: kopn */ ABSENT_STRING, - /* 174: kopt */ ABSENT_STRING, - /* 175: kprv */ ABSENT_STRING, - /* 176: kprt */ ABSENT_STRING, - /* 177: krdo */ ABSENT_STRING, - /* 178: kref */ ABSENT_STRING, - /* 179: krfr */ ABSENT_STRING, - /* 180: krpl */ ABSENT_STRING, - /* 181: krst */ ABSENT_STRING, - /* 182: kres */ ABSENT_STRING, - /* 183: ksav */ ABSENT_STRING, - /* 184: kspd */ ABSENT_STRING, - /* 185: kund */ ABSENT_STRING, - /* 186: kBEG */ ABSENT_STRING, - /* 187: kCAN */ ABSENT_STRING, - /* 188: kCMD */ ABSENT_STRING, - /* 189: kCPY */ ABSENT_STRING, - /* 190: kCRT */ ABSENT_STRING, - /* 191: kDC */ screen_xterm_xfree86_s_kDC, - /* 192: kDL */ ABSENT_STRING, - /* 193: kslt */ ABSENT_STRING, - /* 194: kEND */ screen_xterm_xfree86_s_kEND, - /* 195: kEOL */ ABSENT_STRING, - /* 196: kEXT */ ABSENT_STRING, - /* 197: kFND */ ABSENT_STRING, - /* 198: kHLP */ ABSENT_STRING, - /* 199: kHOM */ screen_xterm_xfree86_s_kHOM, - /* 200: kIC */ CANCELLED_STRING, - /* 201: kLFT */ screen_xterm_xfree86_s_kLFT, - /* 202: kMSG */ ABSENT_STRING, - /* 203: kMOV */ ABSENT_STRING, - /* 204: kNXT */ CANCELLED_STRING, - /* 205: kOPT */ ABSENT_STRING, - /* 206: kPRV */ CANCELLED_STRING, - /* 207: kPRT */ ABSENT_STRING, - /* 208: kRDO */ ABSENT_STRING, - /* 209: kRPL */ ABSENT_STRING, - /* 210: kRIT */ screen_xterm_xfree86_s_kRIT, - /* 211: kRES */ ABSENT_STRING, - /* 212: kSAV */ ABSENT_STRING, - /* 213: kSPD */ ABSENT_STRING, - /* 214: kUND */ ABSENT_STRING, - /* 215: rfi */ ABSENT_STRING, - /* 216: kf11 */ screen_xterm_xfree86_s_kf11, - /* 217: kf12 */ screen_xterm_xfree86_s_kf12, - /* 218: kf13 */ screen_xterm_xfree86_s_kf13, - /* 219: kf14 */ screen_xterm_xfree86_s_kf14, - /* 220: kf15 */ screen_xterm_xfree86_s_kf15, - /* 221: kf16 */ screen_xterm_xfree86_s_kf16, - /* 222: kf17 */ screen_xterm_xfree86_s_kf17, - /* 223: kf18 */ screen_xterm_xfree86_s_kf18, - /* 224: kf19 */ screen_xterm_xfree86_s_kf19, - /* 225: kf20 */ screen_xterm_xfree86_s_kf20, - /* 226: kf21 */ screen_xterm_xfree86_s_kf21, - /* 227: kf22 */ screen_xterm_xfree86_s_kf22, - /* 228: kf23 */ screen_xterm_xfree86_s_kf23, - /* 229: kf24 */ screen_xterm_xfree86_s_kf24, - /* 230: kf25 */ screen_xterm_xfree86_s_kf25, - /* 231: kf26 */ screen_xterm_xfree86_s_kf26, - /* 232: kf27 */ screen_xterm_xfree86_s_kf27, - /* 233: kf28 */ screen_xterm_xfree86_s_kf28, - /* 234: kf29 */ screen_xterm_xfree86_s_kf29, - /* 235: kf30 */ screen_xterm_xfree86_s_kf30, - /* 236: kf31 */ screen_xterm_xfree86_s_kf31, - /* 237: kf32 */ screen_xterm_xfree86_s_kf32, - /* 238: kf33 */ screen_xterm_xfree86_s_kf33, - /* 239: kf34 */ screen_xterm_xfree86_s_kf34, - /* 240: kf35 */ screen_xterm_xfree86_s_kf35, - /* 241: kf36 */ screen_xterm_xfree86_s_kf36, - /* 242: kf37 */ screen_xterm_xfree86_s_kf37, - /* 243: kf38 */ screen_xterm_xfree86_s_kf38, - /* 244: kf39 */ screen_xterm_xfree86_s_kf39, - /* 245: kf40 */ screen_xterm_xfree86_s_kf40, - /* 246: kf41 */ screen_xterm_xfree86_s_kf41, - /* 247: kf42 */ screen_xterm_xfree86_s_kf42, - /* 248: kf43 */ screen_xterm_xfree86_s_kf43, - /* 249: kf44 */ screen_xterm_xfree86_s_kf44, - /* 250: kf45 */ screen_xterm_xfree86_s_kf45, - /* 251: kf46 */ screen_xterm_xfree86_s_kf46, - /* 252: kf47 */ screen_xterm_xfree86_s_kf47, - /* 253: kf48 */ screen_xterm_xfree86_s_kf48, - /* 254: kf49 */ screen_xterm_xfree86_s_kf49, - /* 255: kf50 */ screen_xterm_xfree86_s_kf50, - /* 256: kf51 */ screen_xterm_xfree86_s_kf51, - /* 257: kf52 */ screen_xterm_xfree86_s_kf52, - /* 258: kf53 */ screen_xterm_xfree86_s_kf53, - /* 259: kf54 */ screen_xterm_xfree86_s_kf54, - /* 260: kf55 */ screen_xterm_xfree86_s_kf55, - /* 261: kf56 */ screen_xterm_xfree86_s_kf56, - /* 262: kf57 */ screen_xterm_xfree86_s_kf57, - /* 263: kf58 */ screen_xterm_xfree86_s_kf58, - /* 264: kf59 */ screen_xterm_xfree86_s_kf59, - /* 265: kf60 */ screen_xterm_xfree86_s_kf60, - /* 266: kf61 */ screen_xterm_xfree86_s_kf61, - /* 267: kf62 */ screen_xterm_xfree86_s_kf62, - /* 268: kf63 */ screen_xterm_xfree86_s_kf63, - /* 269: el1 */ screen_xterm_xfree86_s_el1, - /* 270: mgc */ ABSENT_STRING, - /* 271: smgl */ ABSENT_STRING, - /* 272: smgr */ ABSENT_STRING, - /* 273: fln */ ABSENT_STRING, - /* 274: sclk */ ABSENT_STRING, - /* 275: dclk */ ABSENT_STRING, - /* 276: rmclk */ ABSENT_STRING, - /* 277: cwin */ ABSENT_STRING, - /* 278: wingo */ ABSENT_STRING, - /* 279: hup */ ABSENT_STRING, - /* 280: dial */ ABSENT_STRING, - /* 281: qdial */ ABSENT_STRING, - /* 282: tone */ ABSENT_STRING, - /* 283: pulse */ ABSENT_STRING, - /* 284: hook */ ABSENT_STRING, - /* 285: pause */ ABSENT_STRING, - /* 286: wait */ ABSENT_STRING, - /* 287: u0 */ ABSENT_STRING, - /* 288: u1 */ ABSENT_STRING, - /* 289: u2 */ ABSENT_STRING, - /* 290: u3 */ ABSENT_STRING, - /* 291: u4 */ ABSENT_STRING, - /* 292: u5 */ ABSENT_STRING, - /* 293: u6 */ screen_xterm_xfree86_s_u6, - /* 294: u7 */ screen_xterm_xfree86_s_u7, - /* 295: u8 */ screen_xterm_xfree86_s_u8, - /* 296: u9 */ screen_xterm_xfree86_s_u9, - /* 297: op */ screen_xterm_xfree86_s_op, - /* 298: oc */ ABSENT_STRING, - /* 299: initc */ ABSENT_STRING, - /* 300: initp */ ABSENT_STRING, - /* 301: scp */ ABSENT_STRING, - /* 302: setf */ screen_xterm_xfree86_s_setf, - /* 303: setb */ screen_xterm_xfree86_s_setb, - /* 304: cpi */ ABSENT_STRING, - /* 305: lpi */ ABSENT_STRING, - /* 306: chr */ ABSENT_STRING, - /* 307: cvr */ ABSENT_STRING, - /* 308: defc */ ABSENT_STRING, - /* 309: swidm */ ABSENT_STRING, - /* 310: sdrfq */ ABSENT_STRING, - /* 311: sitm */ ABSENT_STRING, - /* 312: slm */ ABSENT_STRING, - /* 313: smicm */ ABSENT_STRING, - /* 314: snlq */ ABSENT_STRING, - /* 315: snrmq */ ABSENT_STRING, - /* 316: sshm */ ABSENT_STRING, - /* 317: ssubm */ ABSENT_STRING, - /* 318: ssupm */ ABSENT_STRING, - /* 319: sum */ ABSENT_STRING, - /* 320: rwidm */ ABSENT_STRING, - /* 321: ritm */ ABSENT_STRING, - /* 322: rlm */ ABSENT_STRING, - /* 323: rmicm */ ABSENT_STRING, - /* 324: rshm */ ABSENT_STRING, - /* 325: rsubm */ ABSENT_STRING, - /* 326: rsupm */ ABSENT_STRING, - /* 327: rum */ ABSENT_STRING, - /* 328: mhpa */ ABSENT_STRING, - /* 329: mcud1 */ ABSENT_STRING, - /* 330: mcub1 */ ABSENT_STRING, - /* 331: mcuf1 */ ABSENT_STRING, - /* 332: mvpa */ ABSENT_STRING, - /* 333: mcuu1 */ ABSENT_STRING, - /* 334: porder */ ABSENT_STRING, - /* 335: mcud */ ABSENT_STRING, - /* 336: mcub */ ABSENT_STRING, - /* 337: mcuf */ ABSENT_STRING, - /* 338: mcuu */ ABSENT_STRING, - /* 339: scs */ ABSENT_STRING, - /* 340: smgb */ ABSENT_STRING, - /* 341: smgbp */ ABSENT_STRING, - /* 342: smglp */ ABSENT_STRING, - /* 343: smgrp */ ABSENT_STRING, - /* 344: smgt */ ABSENT_STRING, - /* 345: smgtp */ ABSENT_STRING, - /* 346: sbim */ ABSENT_STRING, - /* 347: scsd */ ABSENT_STRING, - /* 348: rbim */ ABSENT_STRING, - /* 349: rcsd */ ABSENT_STRING, - /* 350: subcs */ ABSENT_STRING, - /* 351: supcs */ ABSENT_STRING, - /* 352: docr */ ABSENT_STRING, - /* 353: zerom */ ABSENT_STRING, - /* 354: csnm */ ABSENT_STRING, - /* 355: kmous */ screen_xterm_xfree86_s_kmous, - /* 356: minfo */ ABSENT_STRING, - /* 357: reqmp */ ABSENT_STRING, - /* 358: getm */ ABSENT_STRING, - /* 359: setaf */ screen_xterm_xfree86_s_setaf, - /* 360: setab */ screen_xterm_xfree86_s_setab, - /* 361: pfxl */ ABSENT_STRING, - /* 362: devt */ ABSENT_STRING, - /* 363: csin */ ABSENT_STRING, - /* 364: s0ds */ ABSENT_STRING, - /* 365: s1ds */ ABSENT_STRING, - /* 366: s2ds */ ABSENT_STRING, - /* 367: s3ds */ ABSENT_STRING, - /* 368: smglr */ ABSENT_STRING, - /* 369: smgtb */ ABSENT_STRING, - /* 370: birep */ ABSENT_STRING, - /* 371: binel */ ABSENT_STRING, - /* 372: bicr */ ABSENT_STRING, - /* 373: colornm */ ABSENT_STRING, - /* 374: defbi */ ABSENT_STRING, - /* 375: endbi */ ABSENT_STRING, - /* 376: setcolor */ ABSENT_STRING, - /* 377: slines */ ABSENT_STRING, - /* 378: dispc */ ABSENT_STRING, - /* 379: smpch */ ABSENT_STRING, - /* 380: rmpch */ ABSENT_STRING, - /* 381: smsc */ ABSENT_STRING, - /* 382: rmsc */ ABSENT_STRING, - /* 383: pctrm */ ABSENT_STRING, - /* 384: scesc */ ABSENT_STRING, - /* 385: scesa */ ABSENT_STRING, - /* 386: ehhlm */ ABSENT_STRING, - /* 387: elhlm */ ABSENT_STRING, - /* 388: elohlm */ ABSENT_STRING, - /* 389: erhlm */ ABSENT_STRING, - /* 390: ethlm */ ABSENT_STRING, - /* 391: evhlm */ ABSENT_STRING, - /* 392: sgr1 */ ABSENT_STRING, - /* 393: slength */ ABSENT_STRING, - /* 394: OTi2 */ ABSENT_STRING, - /* 395: OTrs */ ABSENT_STRING, - /* 396: OTnl */ ABSENT_STRING, - /* 397: OTbc */ ABSENT_STRING, - /* 398: OTko */ ABSENT_STRING, - /* 399: OTma */ ABSENT_STRING, - /* 400: OTG2 */ ABSENT_STRING, - /* 401: OTG3 */ ABSENT_STRING, - /* 402: OTG1 */ ABSENT_STRING, - /* 403: OTG4 */ ABSENT_STRING, - /* 404: OTGR */ ABSENT_STRING, - /* 405: OTGL */ ABSENT_STRING, - /* 406: OTGU */ ABSENT_STRING, - /* 407: OTGD */ ABSENT_STRING, - /* 408: OTGH */ ABSENT_STRING, - /* 409: OTGV */ ABSENT_STRING, - /* 410: OTGC */ ABSENT_STRING, - /* 411: meml */ CANCELLED_STRING, - /* 412: memu */ CANCELLED_STRING, - /* 413: box1 */ ABSENT_STRING, -}; -/* screen.xterm-256color */ - -static char screen_xterm_256color_alias_data[] = "screen.xterm-256color|GNU Screen with xterm using 256 colors"; - -static char screen_xterm_256color_s_cbt[] = "\033[Z"; -static char screen_xterm_256color_s_bel[] = "\007"; -static char screen_xterm_256color_s_cr[] = "\015"; -static char screen_xterm_256color_s_csr[] = "\033[%i%p1%d;%p2%dr"; -static char screen_xterm_256color_s_tbc[] = "\033[3g"; -static char screen_xterm_256color_s_clear[] = "\033[H\033[2J"; -static char screen_xterm_256color_s_el[] = "\033[K"; -static char screen_xterm_256color_s_ed[] = "\033[J"; -static char screen_xterm_256color_s_hpa[] = "\033[%i%p1%dG"; -static char screen_xterm_256color_s_cup[] = "\033[%i%p1%d;%p2%dH"; -static char screen_xterm_256color_s_cud1[] = "\012"; -static char screen_xterm_256color_s_home[] = "\033[H"; -static char screen_xterm_256color_s_civis[] = "\033[?25l"; -static char screen_xterm_256color_s_cub1[] = "\010"; -static char screen_xterm_256color_s_cnorm[] = "\033[?12l\033[?25h"; -static char screen_xterm_256color_s_cuf1[] = "\033[C"; -static char screen_xterm_256color_s_cuu1[] = "\033[A"; -static char screen_xterm_256color_s_cvvis[] = "\033[?12;25h"; -static char screen_xterm_256color_s_dch1[] = "\033[P"; -static char screen_xterm_256color_s_dl1[] = "\033[M"; -static char screen_xterm_256color_s_smacs[] = "\033(0"; -static char screen_xterm_256color_s_blink[] = "\033[5m"; -static char screen_xterm_256color_s_bold[] = "\033[1m"; -static char screen_xterm_256color_s_smcup[] = "\033[?1049h\033[22;0;0t"; -static char screen_xterm_256color_s_dim[] = "\033[2m"; -static char screen_xterm_256color_s_smir[] = "\033[4h"; -static char screen_xterm_256color_s_rev[] = "\033[7m"; -static char screen_xterm_256color_s_smso[] = "\033[7m"; -static char screen_xterm_256color_s_smul[] = "\033[4m"; -static char screen_xterm_256color_s_ech[] = "\033[%p1%dX"; -static char screen_xterm_256color_s_rmacs[] = "\033(B"; -static char screen_xterm_256color_s_sgr0[] = "\033(B\033[m"; -static char screen_xterm_256color_s_rmcup[] = "\033[?1049l\033[23;0;0t"; -static char screen_xterm_256color_s_rmir[] = "\033[4l"; -static char screen_xterm_256color_s_rmso[] = "\033[27m"; -static char screen_xterm_256color_s_rmul[] = "\033[24m"; -static char screen_xterm_256color_s_flash[] = "\033[?5h$<100/>\033[?5l"; -static char screen_xterm_256color_s_is2[] = "\033[!p\033[?3;4l\033[4l\033>"; -static char screen_xterm_256color_s_il1[] = "\033[L"; -static char screen_xterm_256color_s_kbs[] = "\010"; -static char screen_xterm_256color_s_kdch1[] = "\033[3~"; -static char screen_xterm_256color_s_kcud1[] = "\033OB"; -static char screen_xterm_256color_s_kf1[] = "\033OP"; -static char screen_xterm_256color_s_kf10[] = "\033[21~"; -static char screen_xterm_256color_s_kf2[] = "\033OQ"; -static char screen_xterm_256color_s_kf3[] = "\033OR"; -static char screen_xterm_256color_s_kf4[] = "\033OS"; -static char screen_xterm_256color_s_kf5[] = "\033[15~"; -static char screen_xterm_256color_s_kf6[] = "\033[17~"; -static char screen_xterm_256color_s_kf7[] = "\033[18~"; -static char screen_xterm_256color_s_kf8[] = "\033[19~"; -static char screen_xterm_256color_s_kf9[] = "\033[20~"; -static char screen_xterm_256color_s_khome[] = "\033[1~"; -static char screen_xterm_256color_s_kich1[] = "\033[2~"; -static char screen_xterm_256color_s_kcub1[] = "\033OD"; -static char screen_xterm_256color_s_knp[] = "\033[6~"; -static char screen_xterm_256color_s_kpp[] = "\033[5~"; -static char screen_xterm_256color_s_kcuf1[] = "\033OC"; -static char screen_xterm_256color_s_kind[] = "\033[1;2B"; -static char screen_xterm_256color_s_kri[] = "\033[1;2A"; -static char screen_xterm_256color_s_kcuu1[] = "\033OA"; -static char screen_xterm_256color_s_rmkx[] = "\033[?1l\033>"; -static char screen_xterm_256color_s_smkx[] = "\033[?1h\033="; -static char screen_xterm_256color_s_rmm[] = "\033[?1034l"; -static char screen_xterm_256color_s_smm[] = "\033[?1034h"; -static char screen_xterm_256color_s_dch[] = "\033[%p1%dP"; -static char screen_xterm_256color_s_dl[] = "\033[%p1%dM"; -static char screen_xterm_256color_s_cud[] = "\033[%p1%dB"; -static char screen_xterm_256color_s_ich[] = "\033[%p1%d@"; -static char screen_xterm_256color_s_indn[] = "\033[%p1%dS"; -static char screen_xterm_256color_s_il[] = "\033[%p1%dL"; -static char screen_xterm_256color_s_cub[] = "\033[%p1%dD"; -static char screen_xterm_256color_s_cuf[] = "\033[%p1%dC"; -static char screen_xterm_256color_s_rin[] = "\033[%p1%dT"; -static char screen_xterm_256color_s_cuu[] = "\033[%p1%dA"; -static char screen_xterm_256color_s_mc0[] = "\033[i"; -static char screen_xterm_256color_s_mc4[] = "\033[4i"; -static char screen_xterm_256color_s_mc5[] = "\033[5i"; -static char screen_xterm_256color_s_rs1[] = "\033c"; -static char screen_xterm_256color_s_rs2[] = "\033[!p\033[?3;4l\033[4l\033>"; -static char screen_xterm_256color_s_rc[] = "\0338"; -static char screen_xterm_256color_s_vpa[] = "\033[%i%p1%dd"; -static char screen_xterm_256color_s_sc[] = "\0337"; -static char screen_xterm_256color_s_ind[] = "\012"; -static char screen_xterm_256color_s_ri[] = "\033M"; -static char screen_xterm_256color_s_sgr[] = "%?%p9%t\033(0%e\033(B%;\033[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;m"; -static char screen_xterm_256color_s_hts[] = "\033H"; -static char screen_xterm_256color_s_ht[] = "\011"; -static char screen_xterm_256color_s_kb2[] = "\033OE"; -static char screen_xterm_256color_s_acsc[] = "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"; -static char screen_xterm_256color_s_kcbt[] = "\033[Z"; -static char screen_xterm_256color_s_smam[] = "\033[?7h"; -static char screen_xterm_256color_s_rmam[] = "\033[?7l"; -static char screen_xterm_256color_s_kend[] = "\033[4~"; -static char screen_xterm_256color_s_kent[] = "\033OM"; -static char screen_xterm_256color_s_kDC[] = "\033[3;2~"; -static char screen_xterm_256color_s_kEND[] = "\033[1;2F"; -static char screen_xterm_256color_s_kHOM[] = "\033[1;2H"; -static char screen_xterm_256color_s_kLFT[] = "\033[1;2D"; -static char screen_xterm_256color_s_kRIT[] = "\033[1;2C"; -static char screen_xterm_256color_s_kf11[] = "\033[23~"; -static char screen_xterm_256color_s_kf12[] = "\033[24~"; -static char screen_xterm_256color_s_kf13[] = "\033[1;2P"; -static char screen_xterm_256color_s_kf14[] = "\033[1;2Q"; -static char screen_xterm_256color_s_kf15[] = "\033[1;2R"; -static char screen_xterm_256color_s_kf16[] = "\033[1;2S"; -static char screen_xterm_256color_s_kf17[] = "\033[15;2~"; -static char screen_xterm_256color_s_kf18[] = "\033[17;2~"; -static char screen_xterm_256color_s_kf19[] = "\033[18;2~"; -static char screen_xterm_256color_s_kf20[] = "\033[19;2~"; -static char screen_xterm_256color_s_kf21[] = "\033[20;2~"; -static char screen_xterm_256color_s_kf22[] = "\033[21;2~"; -static char screen_xterm_256color_s_kf23[] = "\033[23;2~"; -static char screen_xterm_256color_s_kf24[] = "\033[24;2~"; -static char screen_xterm_256color_s_kf25[] = "\033[1;5P"; -static char screen_xterm_256color_s_kf26[] = "\033[1;5Q"; -static char screen_xterm_256color_s_kf27[] = "\033[1;5R"; -static char screen_xterm_256color_s_kf28[] = "\033[1;5S"; -static char screen_xterm_256color_s_kf29[] = "\033[15;5~"; -static char screen_xterm_256color_s_kf30[] = "\033[17;5~"; -static char screen_xterm_256color_s_kf31[] = "\033[18;5~"; -static char screen_xterm_256color_s_kf32[] = "\033[19;5~"; -static char screen_xterm_256color_s_kf33[] = "\033[20;5~"; -static char screen_xterm_256color_s_kf34[] = "\033[21;5~"; -static char screen_xterm_256color_s_kf35[] = "\033[23;5~"; -static char screen_xterm_256color_s_kf36[] = "\033[24;5~"; -static char screen_xterm_256color_s_kf37[] = "\033[1;6P"; -static char screen_xterm_256color_s_kf38[] = "\033[1;6Q"; -static char screen_xterm_256color_s_kf39[] = "\033[1;6R"; -static char screen_xterm_256color_s_kf40[] = "\033[1;6S"; -static char screen_xterm_256color_s_kf41[] = "\033[15;6~"; -static char screen_xterm_256color_s_kf42[] = "\033[17;6~"; -static char screen_xterm_256color_s_kf43[] = "\033[18;6~"; -static char screen_xterm_256color_s_kf44[] = "\033[19;6~"; -static char screen_xterm_256color_s_kf45[] = "\033[20;6~"; -static char screen_xterm_256color_s_kf46[] = "\033[21;6~"; -static char screen_xterm_256color_s_kf47[] = "\033[23;6~"; -static char screen_xterm_256color_s_kf48[] = "\033[24;6~"; -static char screen_xterm_256color_s_kf49[] = "\033[1;3P"; -static char screen_xterm_256color_s_kf50[] = "\033[1;3Q"; -static char screen_xterm_256color_s_kf51[] = "\033[1;3R"; -static char screen_xterm_256color_s_kf52[] = "\033[1;3S"; -static char screen_xterm_256color_s_kf53[] = "\033[15;3~"; -static char screen_xterm_256color_s_kf54[] = "\033[17;3~"; -static char screen_xterm_256color_s_kf55[] = "\033[18;3~"; -static char screen_xterm_256color_s_kf56[] = "\033[19;3~"; -static char screen_xterm_256color_s_kf57[] = "\033[20;3~"; -static char screen_xterm_256color_s_kf58[] = "\033[21;3~"; -static char screen_xterm_256color_s_kf59[] = "\033[23;3~"; -static char screen_xterm_256color_s_kf60[] = "\033[24;3~"; -static char screen_xterm_256color_s_kf61[] = "\033[1;4P"; -static char screen_xterm_256color_s_kf62[] = "\033[1;4Q"; -static char screen_xterm_256color_s_kf63[] = "\033[1;4R"; -static char screen_xterm_256color_s_el1[] = "\033[1K"; -static char screen_xterm_256color_s_u6[] = "\033[%i%d;%dR"; -static char screen_xterm_256color_s_u7[] = "\033[6n"; -static char screen_xterm_256color_s_u8[] = "\033[?%[;0123456789]c"; -static char screen_xterm_256color_s_u9[] = "\033[c"; -static char screen_xterm_256color_s_op[] = "\033[39;49m"; -static char screen_xterm_256color_s_kmous[] = "\033[M"; -static char screen_xterm_256color_s_setaf[] = "\033[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"; -static char screen_xterm_256color_s_setab[] = "\033[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m"; - -static char screen_xterm_256color_bool_data[] = { - /* 0: bw */ TRUE, - /* 1: am */ TRUE, - /* 2: xsb */ FALSE, - /* 3: xhp */ FALSE, - /* 4: xenl */ TRUE, - /* 5: eo */ FALSE, - /* 6: gn */ FALSE, - /* 7: hc */ FALSE, - /* 8: km */ TRUE, - /* 9: hs */ FALSE, - /* 10: in */ FALSE, - /* 11: da */ FALSE, - /* 12: db */ FALSE, - /* 13: mir */ TRUE, - /* 14: msgr */ TRUE, - /* 15: os */ FALSE, - /* 16: eslok */ FALSE, - /* 17: xt */ FALSE, - /* 18: hz */ FALSE, - /* 19: ul */ FALSE, - /* 20: xon */ FALSE, - /* 21: nxon */ FALSE, - /* 22: mc5i */ TRUE, - /* 23: chts */ FALSE, - /* 24: nrrmc */ FALSE, - /* 25: npc */ TRUE, - /* 26: ndscr */ FALSE, - /* 27: ccc */ FALSE, - /* 28: bce */ FALSE, - /* 29: hls */ FALSE, - /* 30: xhpa */ FALSE, - /* 31: crxm */ FALSE, - /* 32: daisy */ FALSE, - /* 33: xvpa */ FALSE, - /* 34: sam */ FALSE, - /* 35: cpix */ FALSE, - /* 36: lpix */ FALSE, - /* 37: OTbs */ TRUE, - /* 38: OTns */ FALSE, - /* 39: OTnc */ FALSE, - /* 40: OTMT */ FALSE, - /* 41: OTNL */ FALSE, - /* 42: OTpt */ FALSE, - /* 43: OTxr */ FALSE, -}; -static NCURSES_INT2 screen_xterm_256color_number_data[] = { - /* 0: cols */ 80, - /* 1: it */ 8, - /* 2: lines */ 24, - /* 3: lm */ ABSENT_NUMERIC, - /* 4: xmc */ ABSENT_NUMERIC, - /* 5: pb */ ABSENT_NUMERIC, - /* 6: vt */ ABSENT_NUMERIC, - /* 7: wsl */ ABSENT_NUMERIC, - /* 8: nlab */ ABSENT_NUMERIC, - /* 9: lh */ ABSENT_NUMERIC, - /* 10: lw */ ABSENT_NUMERIC, - /* 11: ma */ ABSENT_NUMERIC, - /* 12: wnum */ ABSENT_NUMERIC, - /* 13: colors */ 256, - /* 14: pairs */ 32767, - /* 15: ncv */ ABSENT_NUMERIC, - /* 16: bufsz */ ABSENT_NUMERIC, - /* 17: spinv */ ABSENT_NUMERIC, - /* 18: spinh */ ABSENT_NUMERIC, - /* 19: maddr */ ABSENT_NUMERIC, - /* 20: mjump */ ABSENT_NUMERIC, - /* 21: mcs */ ABSENT_NUMERIC, - /* 22: mls */ ABSENT_NUMERIC, - /* 23: npins */ ABSENT_NUMERIC, - /* 24: orc */ ABSENT_NUMERIC, - /* 25: orl */ ABSENT_NUMERIC, - /* 26: orhi */ ABSENT_NUMERIC, - /* 27: orvi */ ABSENT_NUMERIC, - /* 28: cps */ ABSENT_NUMERIC, - /* 29: widcs */ ABSENT_NUMERIC, - /* 30: btns */ ABSENT_NUMERIC, - /* 31: bitwin */ ABSENT_NUMERIC, - /* 32: bitype */ ABSENT_NUMERIC, - /* 33: OTug */ ABSENT_NUMERIC, - /* 34: OTdC */ ABSENT_NUMERIC, - /* 35: OTdN */ ABSENT_NUMERIC, - /* 36: OTdB */ ABSENT_NUMERIC, - /* 37: OTdT */ ABSENT_NUMERIC, - /* 38: OTkn */ ABSENT_NUMERIC, -}; -static char * screen_xterm_256color_string_data[] = { - /* 0: cbt */ screen_xterm_256color_s_cbt, - /* 1: bel */ screen_xterm_256color_s_bel, - /* 2: cr */ screen_xterm_256color_s_cr, - /* 3: csr */ screen_xterm_256color_s_csr, - /* 4: tbc */ screen_xterm_256color_s_tbc, - /* 5: clear */ screen_xterm_256color_s_clear, - /* 6: el */ screen_xterm_256color_s_el, - /* 7: ed */ screen_xterm_256color_s_ed, - /* 8: hpa */ screen_xterm_256color_s_hpa, - /* 9: cmdch */ ABSENT_STRING, - /* 10: cup */ screen_xterm_256color_s_cup, - /* 11: cud1 */ screen_xterm_256color_s_cud1, - /* 12: home */ screen_xterm_256color_s_home, - /* 13: civis */ screen_xterm_256color_s_civis, - /* 14: cub1 */ screen_xterm_256color_s_cub1, - /* 15: mrcup */ ABSENT_STRING, - /* 16: cnorm */ screen_xterm_256color_s_cnorm, - /* 17: cuf1 */ screen_xterm_256color_s_cuf1, - /* 18: ll */ ABSENT_STRING, - /* 19: cuu1 */ screen_xterm_256color_s_cuu1, - /* 20: cvvis */ screen_xterm_256color_s_cvvis, - /* 21: dch1 */ screen_xterm_256color_s_dch1, - /* 22: dl1 */ screen_xterm_256color_s_dl1, - /* 23: dsl */ ABSENT_STRING, - /* 24: hd */ ABSENT_STRING, - /* 25: smacs */ screen_xterm_256color_s_smacs, - /* 26: blink */ screen_xterm_256color_s_blink, - /* 27: bold */ screen_xterm_256color_s_bold, - /* 28: smcup */ screen_xterm_256color_s_smcup, - /* 29: smdc */ ABSENT_STRING, - /* 30: dim */ screen_xterm_256color_s_dim, - /* 31: smir */ screen_xterm_256color_s_smir, - /* 32: invis */ ABSENT_STRING, - /* 33: prot */ ABSENT_STRING, - /* 34: rev */ screen_xterm_256color_s_rev, - /* 35: smso */ screen_xterm_256color_s_smso, - /* 36: smul */ screen_xterm_256color_s_smul, - /* 37: ech */ screen_xterm_256color_s_ech, - /* 38: rmacs */ screen_xterm_256color_s_rmacs, - /* 39: sgr0 */ screen_xterm_256color_s_sgr0, - /* 40: rmcup */ screen_xterm_256color_s_rmcup, - /* 41: rmdc */ ABSENT_STRING, - /* 42: rmir */ screen_xterm_256color_s_rmir, - /* 43: rmso */ screen_xterm_256color_s_rmso, - /* 44: rmul */ screen_xterm_256color_s_rmul, - /* 45: flash */ screen_xterm_256color_s_flash, - /* 46: ff */ ABSENT_STRING, - /* 47: fsl */ ABSENT_STRING, - /* 48: is1 */ ABSENT_STRING, - /* 49: is2 */ screen_xterm_256color_s_is2, - /* 50: is3 */ ABSENT_STRING, - /* 51: if */ ABSENT_STRING, - /* 52: ich1 */ ABSENT_STRING, - /* 53: il1 */ screen_xterm_256color_s_il1, - /* 54: ip */ ABSENT_STRING, - /* 55: kbs */ screen_xterm_256color_s_kbs, - /* 56: ktbc */ ABSENT_STRING, - /* 57: kclr */ ABSENT_STRING, - /* 58: kctab */ ABSENT_STRING, - /* 59: kdch1 */ screen_xterm_256color_s_kdch1, - /* 60: kdl1 */ ABSENT_STRING, - /* 61: kcud1 */ screen_xterm_256color_s_kcud1, - /* 62: krmir */ ABSENT_STRING, - /* 63: kel */ ABSENT_STRING, - /* 64: ked */ ABSENT_STRING, - /* 65: kf0 */ ABSENT_STRING, - /* 66: kf1 */ screen_xterm_256color_s_kf1, - /* 67: kf10 */ screen_xterm_256color_s_kf10, - /* 68: kf2 */ screen_xterm_256color_s_kf2, - /* 69: kf3 */ screen_xterm_256color_s_kf3, - /* 70: kf4 */ screen_xterm_256color_s_kf4, - /* 71: kf5 */ screen_xterm_256color_s_kf5, - /* 72: kf6 */ screen_xterm_256color_s_kf6, - /* 73: kf7 */ screen_xterm_256color_s_kf7, - /* 74: kf8 */ screen_xterm_256color_s_kf8, - /* 75: kf9 */ screen_xterm_256color_s_kf9, - /* 76: khome */ screen_xterm_256color_s_khome, - /* 77: kich1 */ screen_xterm_256color_s_kich1, - /* 78: kil1 */ ABSENT_STRING, - /* 79: kcub1 */ screen_xterm_256color_s_kcub1, - /* 80: kll */ ABSENT_STRING, - /* 81: knp */ screen_xterm_256color_s_knp, - /* 82: kpp */ screen_xterm_256color_s_kpp, - /* 83: kcuf1 */ screen_xterm_256color_s_kcuf1, - /* 84: kind */ screen_xterm_256color_s_kind, - /* 85: kri */ screen_xterm_256color_s_kri, - /* 86: khts */ ABSENT_STRING, - /* 87: kcuu1 */ screen_xterm_256color_s_kcuu1, - /* 88: rmkx */ screen_xterm_256color_s_rmkx, - /* 89: smkx */ screen_xterm_256color_s_smkx, - /* 90: lf0 */ ABSENT_STRING, - /* 91: lf1 */ ABSENT_STRING, - /* 92: lf10 */ ABSENT_STRING, - /* 93: lf2 */ ABSENT_STRING, - /* 94: lf3 */ ABSENT_STRING, - /* 95: lf4 */ ABSENT_STRING, - /* 96: lf5 */ ABSENT_STRING, - /* 97: lf6 */ ABSENT_STRING, - /* 98: lf7 */ ABSENT_STRING, - /* 99: lf8 */ ABSENT_STRING, - /* 100: lf9 */ ABSENT_STRING, - /* 101: rmm */ screen_xterm_256color_s_rmm, - /* 102: smm */ screen_xterm_256color_s_smm, - /* 103: nel */ ABSENT_STRING, - /* 104: pad */ ABSENT_STRING, - /* 105: dch */ screen_xterm_256color_s_dch, - /* 106: dl */ screen_xterm_256color_s_dl, - /* 107: cud */ screen_xterm_256color_s_cud, - /* 108: ich */ screen_xterm_256color_s_ich, - /* 109: indn */ screen_xterm_256color_s_indn, - /* 110: il */ screen_xterm_256color_s_il, - /* 111: cub */ screen_xterm_256color_s_cub, - /* 112: cuf */ screen_xterm_256color_s_cuf, - /* 113: rin */ screen_xterm_256color_s_rin, - /* 114: cuu */ screen_xterm_256color_s_cuu, - /* 115: pfkey */ ABSENT_STRING, - /* 116: pfloc */ ABSENT_STRING, - /* 117: pfx */ ABSENT_STRING, - /* 118: mc0 */ screen_xterm_256color_s_mc0, - /* 119: mc4 */ screen_xterm_256color_s_mc4, - /* 120: mc5 */ screen_xterm_256color_s_mc5, - /* 121: rep */ ABSENT_STRING, - /* 122: rs1 */ screen_xterm_256color_s_rs1, - /* 123: rs2 */ screen_xterm_256color_s_rs2, - /* 124: rs3 */ ABSENT_STRING, - /* 125: rf */ ABSENT_STRING, - /* 126: rc */ screen_xterm_256color_s_rc, - /* 127: vpa */ screen_xterm_256color_s_vpa, - /* 128: sc */ screen_xterm_256color_s_sc, - /* 129: ind */ screen_xterm_256color_s_ind, - /* 130: ri */ screen_xterm_256color_s_ri, - /* 131: sgr */ screen_xterm_256color_s_sgr, - /* 132: hts */ screen_xterm_256color_s_hts, - /* 133: wind */ ABSENT_STRING, - /* 134: ht */ screen_xterm_256color_s_ht, - /* 135: tsl */ ABSENT_STRING, - /* 136: uc */ ABSENT_STRING, - /* 137: hu */ ABSENT_STRING, - /* 138: iprog */ ABSENT_STRING, - /* 139: ka1 */ ABSENT_STRING, - /* 140: ka3 */ ABSENT_STRING, - /* 141: kb2 */ screen_xterm_256color_s_kb2, - /* 142: kc1 */ ABSENT_STRING, - /* 143: kc3 */ ABSENT_STRING, - /* 144: mc5p */ ABSENT_STRING, - /* 145: rmp */ ABSENT_STRING, - /* 146: acsc */ screen_xterm_256color_s_acsc, - /* 147: pln */ ABSENT_STRING, - /* 148: kcbt */ screen_xterm_256color_s_kcbt, - /* 149: smxon */ ABSENT_STRING, - /* 150: rmxon */ ABSENT_STRING, - /* 151: smam */ screen_xterm_256color_s_smam, - /* 152: rmam */ screen_xterm_256color_s_rmam, - /* 153: xonc */ ABSENT_STRING, - /* 154: xoffc */ ABSENT_STRING, - /* 155: enacs */ ABSENT_STRING, - /* 156: smln */ ABSENT_STRING, - /* 157: rmln */ ABSENT_STRING, - /* 158: kbeg */ ABSENT_STRING, - /* 159: kcan */ ABSENT_STRING, - /* 160: kclo */ ABSENT_STRING, - /* 161: kcmd */ ABSENT_STRING, - /* 162: kcpy */ ABSENT_STRING, - /* 163: kcrt */ ABSENT_STRING, - /* 164: kend */ screen_xterm_256color_s_kend, - /* 165: kent */ screen_xterm_256color_s_kent, - /* 166: kext */ ABSENT_STRING, - /* 167: kfnd */ ABSENT_STRING, - /* 168: khlp */ ABSENT_STRING, - /* 169: kmrk */ ABSENT_STRING, - /* 170: kmsg */ ABSENT_STRING, - /* 171: kmov */ ABSENT_STRING, - /* 172: knxt */ ABSENT_STRING, - /* 173: kopn */ ABSENT_STRING, - /* 174: kopt */ ABSENT_STRING, - /* 175: kprv */ ABSENT_STRING, - /* 176: kprt */ ABSENT_STRING, - /* 177: krdo */ ABSENT_STRING, - /* 178: kref */ ABSENT_STRING, - /* 179: krfr */ ABSENT_STRING, - /* 180: krpl */ ABSENT_STRING, - /* 181: krst */ ABSENT_STRING, - /* 182: kres */ ABSENT_STRING, - /* 183: ksav */ ABSENT_STRING, - /* 184: kspd */ ABSENT_STRING, - /* 185: kund */ ABSENT_STRING, - /* 186: kBEG */ ABSENT_STRING, - /* 187: kCAN */ ABSENT_STRING, - /* 188: kCMD */ ABSENT_STRING, - /* 189: kCPY */ ABSENT_STRING, - /* 190: kCRT */ ABSENT_STRING, - /* 191: kDC */ screen_xterm_256color_s_kDC, - /* 192: kDL */ ABSENT_STRING, - /* 193: kslt */ ABSENT_STRING, - /* 194: kEND */ screen_xterm_256color_s_kEND, - /* 195: kEOL */ ABSENT_STRING, - /* 196: kEXT */ ABSENT_STRING, - /* 197: kFND */ ABSENT_STRING, - /* 198: kHLP */ ABSENT_STRING, - /* 199: kHOM */ screen_xterm_256color_s_kHOM, - /* 200: kIC */ ABSENT_STRING, - /* 201: kLFT */ screen_xterm_256color_s_kLFT, - /* 202: kMSG */ ABSENT_STRING, - /* 203: kMOV */ ABSENT_STRING, - /* 204: kNXT */ ABSENT_STRING, - /* 205: kOPT */ ABSENT_STRING, - /* 206: kPRV */ ABSENT_STRING, - /* 207: kPRT */ ABSENT_STRING, - /* 208: kRDO */ ABSENT_STRING, - /* 209: kRPL */ ABSENT_STRING, - /* 210: kRIT */ screen_xterm_256color_s_kRIT, - /* 211: kRES */ ABSENT_STRING, - /* 212: kSAV */ ABSENT_STRING, - /* 213: kSPD */ ABSENT_STRING, - /* 214: kUND */ ABSENT_STRING, - /* 215: rfi */ ABSENT_STRING, - /* 216: kf11 */ screen_xterm_256color_s_kf11, - /* 217: kf12 */ screen_xterm_256color_s_kf12, - /* 218: kf13 */ screen_xterm_256color_s_kf13, - /* 219: kf14 */ screen_xterm_256color_s_kf14, - /* 220: kf15 */ screen_xterm_256color_s_kf15, - /* 221: kf16 */ screen_xterm_256color_s_kf16, - /* 222: kf17 */ screen_xterm_256color_s_kf17, - /* 223: kf18 */ screen_xterm_256color_s_kf18, - /* 224: kf19 */ screen_xterm_256color_s_kf19, - /* 225: kf20 */ screen_xterm_256color_s_kf20, - /* 226: kf21 */ screen_xterm_256color_s_kf21, - /* 227: kf22 */ screen_xterm_256color_s_kf22, - /* 228: kf23 */ screen_xterm_256color_s_kf23, - /* 229: kf24 */ screen_xterm_256color_s_kf24, - /* 230: kf25 */ screen_xterm_256color_s_kf25, - /* 231: kf26 */ screen_xterm_256color_s_kf26, - /* 232: kf27 */ screen_xterm_256color_s_kf27, - /* 233: kf28 */ screen_xterm_256color_s_kf28, - /* 234: kf29 */ screen_xterm_256color_s_kf29, - /* 235: kf30 */ screen_xterm_256color_s_kf30, - /* 236: kf31 */ screen_xterm_256color_s_kf31, - /* 237: kf32 */ screen_xterm_256color_s_kf32, - /* 238: kf33 */ screen_xterm_256color_s_kf33, - /* 239: kf34 */ screen_xterm_256color_s_kf34, - /* 240: kf35 */ screen_xterm_256color_s_kf35, - /* 241: kf36 */ screen_xterm_256color_s_kf36, - /* 242: kf37 */ screen_xterm_256color_s_kf37, - /* 243: kf38 */ screen_xterm_256color_s_kf38, - /* 244: kf39 */ screen_xterm_256color_s_kf39, - /* 245: kf40 */ screen_xterm_256color_s_kf40, - /* 246: kf41 */ screen_xterm_256color_s_kf41, - /* 247: kf42 */ screen_xterm_256color_s_kf42, - /* 248: kf43 */ screen_xterm_256color_s_kf43, - /* 249: kf44 */ screen_xterm_256color_s_kf44, - /* 250: kf45 */ screen_xterm_256color_s_kf45, - /* 251: kf46 */ screen_xterm_256color_s_kf46, - /* 252: kf47 */ screen_xterm_256color_s_kf47, - /* 253: kf48 */ screen_xterm_256color_s_kf48, - /* 254: kf49 */ screen_xterm_256color_s_kf49, - /* 255: kf50 */ screen_xterm_256color_s_kf50, - /* 256: kf51 */ screen_xterm_256color_s_kf51, - /* 257: kf52 */ screen_xterm_256color_s_kf52, - /* 258: kf53 */ screen_xterm_256color_s_kf53, - /* 259: kf54 */ screen_xterm_256color_s_kf54, - /* 260: kf55 */ screen_xterm_256color_s_kf55, - /* 261: kf56 */ screen_xterm_256color_s_kf56, - /* 262: kf57 */ screen_xterm_256color_s_kf57, - /* 263: kf58 */ screen_xterm_256color_s_kf58, - /* 264: kf59 */ screen_xterm_256color_s_kf59, - /* 265: kf60 */ screen_xterm_256color_s_kf60, - /* 266: kf61 */ screen_xterm_256color_s_kf61, - /* 267: kf62 */ screen_xterm_256color_s_kf62, - /* 268: kf63 */ screen_xterm_256color_s_kf63, - /* 269: el1 */ screen_xterm_256color_s_el1, - /* 270: mgc */ ABSENT_STRING, - /* 271: smgl */ ABSENT_STRING, - /* 272: smgr */ ABSENT_STRING, - /* 273: fln */ ABSENT_STRING, - /* 274: sclk */ ABSENT_STRING, - /* 275: dclk */ ABSENT_STRING, - /* 276: rmclk */ ABSENT_STRING, - /* 277: cwin */ ABSENT_STRING, - /* 278: wingo */ ABSENT_STRING, - /* 279: hup */ ABSENT_STRING, - /* 280: dial */ ABSENT_STRING, - /* 281: qdial */ ABSENT_STRING, - /* 282: tone */ ABSENT_STRING, - /* 283: pulse */ ABSENT_STRING, - /* 284: hook */ ABSENT_STRING, - /* 285: pause */ ABSENT_STRING, - /* 286: wait */ ABSENT_STRING, - /* 287: u0 */ ABSENT_STRING, - /* 288: u1 */ ABSENT_STRING, - /* 289: u2 */ ABSENT_STRING, - /* 290: u3 */ ABSENT_STRING, - /* 291: u4 */ ABSENT_STRING, - /* 292: u5 */ ABSENT_STRING, - /* 293: u6 */ screen_xterm_256color_s_u6, - /* 294: u7 */ screen_xterm_256color_s_u7, - /* 295: u8 */ screen_xterm_256color_s_u8, - /* 296: u9 */ screen_xterm_256color_s_u9, - /* 297: op */ screen_xterm_256color_s_op, - /* 298: oc */ ABSENT_STRING, - /* 299: initc */ ABSENT_STRING, - /* 300: initp */ ABSENT_STRING, - /* 301: scp */ ABSENT_STRING, - /* 302: setf */ ABSENT_STRING, - /* 303: setb */ ABSENT_STRING, - /* 304: cpi */ ABSENT_STRING, - /* 305: lpi */ ABSENT_STRING, - /* 306: chr */ ABSENT_STRING, - /* 307: cvr */ ABSENT_STRING, - /* 308: defc */ ABSENT_STRING, - /* 309: swidm */ ABSENT_STRING, - /* 310: sdrfq */ ABSENT_STRING, - /* 311: sitm */ ABSENT_STRING, - /* 312: slm */ ABSENT_STRING, - /* 313: smicm */ ABSENT_STRING, - /* 314: snlq */ ABSENT_STRING, - /* 315: snrmq */ ABSENT_STRING, - /* 316: sshm */ ABSENT_STRING, - /* 317: ssubm */ ABSENT_STRING, - /* 318: ssupm */ ABSENT_STRING, - /* 319: sum */ ABSENT_STRING, - /* 320: rwidm */ ABSENT_STRING, - /* 321: ritm */ ABSENT_STRING, - /* 322: rlm */ ABSENT_STRING, - /* 323: rmicm */ ABSENT_STRING, - /* 324: rshm */ ABSENT_STRING, - /* 325: rsubm */ ABSENT_STRING, - /* 326: rsupm */ ABSENT_STRING, - /* 327: rum */ ABSENT_STRING, - /* 328: mhpa */ ABSENT_STRING, - /* 329: mcud1 */ ABSENT_STRING, - /* 330: mcub1 */ ABSENT_STRING, - /* 331: mcuf1 */ ABSENT_STRING, - /* 332: mvpa */ ABSENT_STRING, - /* 333: mcuu1 */ ABSENT_STRING, - /* 334: porder */ ABSENT_STRING, - /* 335: mcud */ ABSENT_STRING, - /* 336: mcub */ ABSENT_STRING, - /* 337: mcuf */ ABSENT_STRING, - /* 338: mcuu */ ABSENT_STRING, - /* 339: scs */ ABSENT_STRING, - /* 340: smgb */ ABSENT_STRING, - /* 341: smgbp */ ABSENT_STRING, - /* 342: smglp */ ABSENT_STRING, - /* 343: smgrp */ ABSENT_STRING, - /* 344: smgt */ ABSENT_STRING, - /* 345: smgtp */ ABSENT_STRING, - /* 346: sbim */ ABSENT_STRING, - /* 347: scsd */ ABSENT_STRING, - /* 348: rbim */ ABSENT_STRING, - /* 349: rcsd */ ABSENT_STRING, - /* 350: subcs */ ABSENT_STRING, - /* 351: supcs */ ABSENT_STRING, - /* 352: docr */ ABSENT_STRING, - /* 353: zerom */ ABSENT_STRING, - /* 354: csnm */ ABSENT_STRING, - /* 355: kmous */ screen_xterm_256color_s_kmous, - /* 356: minfo */ ABSENT_STRING, - /* 357: reqmp */ ABSENT_STRING, - /* 358: getm */ ABSENT_STRING, - /* 359: setaf */ screen_xterm_256color_s_setaf, - /* 360: setab */ screen_xterm_256color_s_setab, - /* 361: pfxl */ ABSENT_STRING, - /* 362: devt */ ABSENT_STRING, - /* 363: csin */ ABSENT_STRING, - /* 364: s0ds */ ABSENT_STRING, - /* 365: s1ds */ ABSENT_STRING, - /* 366: s2ds */ ABSENT_STRING, - /* 367: s3ds */ ABSENT_STRING, - /* 368: smglr */ ABSENT_STRING, - /* 369: smgtb */ ABSENT_STRING, - /* 370: birep */ ABSENT_STRING, - /* 371: binel */ ABSENT_STRING, - /* 372: bicr */ ABSENT_STRING, - /* 373: colornm */ ABSENT_STRING, - /* 374: defbi */ ABSENT_STRING, - /* 375: endbi */ ABSENT_STRING, - /* 376: setcolor */ ABSENT_STRING, - /* 377: slines */ ABSENT_STRING, - /* 378: dispc */ ABSENT_STRING, - /* 379: smpch */ ABSENT_STRING, - /* 380: rmpch */ ABSENT_STRING, - /* 381: smsc */ ABSENT_STRING, - /* 382: rmsc */ ABSENT_STRING, - /* 383: pctrm */ ABSENT_STRING, - /* 384: scesc */ ABSENT_STRING, - /* 385: scesa */ ABSENT_STRING, - /* 386: ehhlm */ ABSENT_STRING, - /* 387: elhlm */ ABSENT_STRING, - /* 388: elohlm */ ABSENT_STRING, - /* 389: erhlm */ ABSENT_STRING, - /* 390: ethlm */ ABSENT_STRING, - /* 391: evhlm */ ABSENT_STRING, - /* 392: sgr1 */ ABSENT_STRING, - /* 393: slength */ ABSENT_STRING, - /* 394: OTi2 */ ABSENT_STRING, - /* 395: OTrs */ ABSENT_STRING, - /* 396: OTnl */ ABSENT_STRING, - /* 397: OTbc */ ABSENT_STRING, - /* 398: OTko */ ABSENT_STRING, - /* 399: OTma */ ABSENT_STRING, - /* 400: OTG2 */ ABSENT_STRING, - /* 401: OTG3 */ ABSENT_STRING, - /* 402: OTG1 */ ABSENT_STRING, - /* 403: OTG4 */ ABSENT_STRING, - /* 404: OTGR */ ABSENT_STRING, - /* 405: OTGL */ ABSENT_STRING, - /* 406: OTGU */ ABSENT_STRING, - /* 407: OTGD */ ABSENT_STRING, - /* 408: OTGH */ ABSENT_STRING, - /* 409: OTGV */ ABSENT_STRING, - /* 410: OTGC */ ABSENT_STRING, - /* 411: meml */ ABSENT_STRING, - /* 412: memu */ ABSENT_STRING, - /* 413: box1 */ ABSENT_STRING, -}; -static const TERMTYPE2 fallbacks[10] = -{ - /* linux */ - { - linux_alias_data, - (char *)0, /* pointer to string table */ - linux_bool_data, - linux_number_data, - linux_string_data, -#if NCURSES_XNAMES - (char *)0, /* pointer to extended string table */ - (char **)0, /* ...corresponding names */ - 44, /* count total Booleans */ - 39, /* count total Numbers */ - 414, /* count total Strings */ - 0, /* count extensions to Booleans */ - 0, /* count extensions to Numbers */ - 0, /* count extensions to Strings */ -#endif /* NCURSES_XNAMES */ - } -, /* rxvt */ - { - rxvt_alias_data, - (char *)0, /* pointer to string table */ - rxvt_bool_data, - rxvt_number_data, - rxvt_string_data, -#if NCURSES_XNAMES - (char *)0, /* pointer to extended string table */ - (char **)0, /* ...corresponding names */ - 44, /* count total Booleans */ - 39, /* count total Numbers */ - 414, /* count total Strings */ - 0, /* count extensions to Booleans */ - 0, /* count extensions to Numbers */ - 0, /* count extensions to Strings */ -#endif /* NCURSES_XNAMES */ - } -, /* vt100 */ - { - vt100_alias_data, - (char *)0, /* pointer to string table */ - vt100_bool_data, - vt100_number_data, - vt100_string_data, -#if NCURSES_XNAMES - (char *)0, /* pointer to extended string table */ - (char **)0, /* ...corresponding names */ - 44, /* count total Booleans */ - 39, /* count total Numbers */ - 414, /* count total Strings */ - 0, /* count extensions to Booleans */ - 0, /* count extensions to Numbers */ - 0, /* count extensions to Strings */ -#endif /* NCURSES_XNAMES */ - } -, /* xterm */ - { - xterm_alias_data, - (char *)0, /* pointer to string table */ - xterm_bool_data, - xterm_number_data, - xterm_string_data, -#if NCURSES_XNAMES - (char *)0, /* pointer to extended string table */ - (char **)0, /* ...corresponding names */ - 44, /* count total Booleans */ - 39, /* count total Numbers */ - 414, /* count total Strings */ - 0, /* count extensions to Booleans */ - 0, /* count extensions to Numbers */ - 0, /* count extensions to Strings */ -#endif /* NCURSES_XNAMES */ - } -, /* xterm-256color */ - { - xterm_256color_alias_data, - (char *)0, /* pointer to string table */ - xterm_256color_bool_data, - xterm_256color_number_data, - xterm_256color_string_data, -#if NCURSES_XNAMES - (char *)0, /* pointer to extended string table */ - (char **)0, /* ...corresponding names */ - 44, /* count total Booleans */ - 39, /* count total Numbers */ - 414, /* count total Strings */ - 0, /* count extensions to Booleans */ - 0, /* count extensions to Numbers */ - 0, /* count extensions to Strings */ -#endif /* NCURSES_XNAMES */ - } -, /* screen */ - { - screen_alias_data, - (char *)0, /* pointer to string table */ - screen_bool_data, - screen_number_data, - screen_string_data, -#if NCURSES_XNAMES - (char *)0, /* pointer to extended string table */ - (char **)0, /* ...corresponding names */ - 44, /* count total Booleans */ - 39, /* count total Numbers */ - 414, /* count total Strings */ - 0, /* count extensions to Booleans */ - 0, /* count extensions to Numbers */ - 0, /* count extensions to Strings */ -#endif /* NCURSES_XNAMES */ - } -, /* screen.linux */ - { - screen_linux_alias_data, - (char *)0, /* pointer to string table */ - screen_linux_bool_data, - screen_linux_number_data, - screen_linux_string_data, -#if NCURSES_XNAMES - (char *)0, /* pointer to extended string table */ - (char **)0, /* ...corresponding names */ - 44, /* count total Booleans */ - 39, /* count total Numbers */ - 414, /* count total Strings */ - 0, /* count extensions to Booleans */ - 0, /* count extensions to Numbers */ - 0, /* count extensions to Strings */ -#endif /* NCURSES_XNAMES */ - } -, /* screen.rxvt */ - { - screen_rxvt_alias_data, - (char *)0, /* pointer to string table */ - screen_rxvt_bool_data, - screen_rxvt_number_data, - screen_rxvt_string_data, -#if NCURSES_XNAMES - (char *)0, /* pointer to extended string table */ - (char **)0, /* ...corresponding names */ - 44, /* count total Booleans */ - 39, /* count total Numbers */ - 414, /* count total Strings */ - 0, /* count extensions to Booleans */ - 0, /* count extensions to Numbers */ - 0, /* count extensions to Strings */ -#endif /* NCURSES_XNAMES */ - } -, /* screen.xterm-new */ - { - screen_xterm_xfree86_alias_data, - (char *)0, /* pointer to string table */ - screen_xterm_xfree86_bool_data, - screen_xterm_xfree86_number_data, - screen_xterm_xfree86_string_data, -#if NCURSES_XNAMES - (char *)0, /* pointer to extended string table */ - (char **)0, /* ...corresponding names */ - 44, /* count total Booleans */ - 39, /* count total Numbers */ - 414, /* count total Strings */ - 0, /* count extensions to Booleans */ - 0, /* count extensions to Numbers */ - 0, /* count extensions to Strings */ -#endif /* NCURSES_XNAMES */ - } -, /* screen.xterm-256color */ - { - screen_xterm_256color_alias_data, - (char *)0, /* pointer to string table */ - screen_xterm_256color_bool_data, - screen_xterm_256color_number_data, - screen_xterm_256color_string_data, -#if NCURSES_XNAMES - (char *)0, /* pointer to extended string table */ - (char **)0, /* ...corresponding names */ - 44, /* count total Booleans */ - 39, /* count total Numbers */ - 414, /* count total Strings */ - 0, /* count extensions to Booleans */ - 0, /* count extensions to Numbers */ - 0, /* count extensions to Strings */ -#endif /* NCURSES_XNAMES */ - } -}; - -NCURSES_EXPORT(const TERMTYPE2 *) -_nc_fallback2 (const char *name GCC_UNUSED) -{ - const TERMTYPE2 *tp; - - for (tp = fallbacks; - tp < fallbacks + sizeof(fallbacks)/sizeof(TERMTYPE2); - tp++) { - if (_nc_name_match(tp->term_names, name, "|")) { - return(tp); - } - } - return((const TERMTYPE2 *)0); -} - -#if NCURSES_EXT_NUMBERS -#undef _nc_fallback - -/* - * This entrypoint is used by tack. - */ -NCURSES_EXPORT(const TERMTYPE *) -_nc_fallback (const char *name) -{ - const TERMTYPE2 *tp = _nc_fallback2(name); - const TERMTYPE *result = 0; - if (tp != 0) { - static TERMTYPE temp; - _nc_export_termtype2(&temp, tp); - result = &temp; - } - return result; -} -#endif diff --git a/contrib/depends/patches/qt/MacToolchain.cmake b/contrib/depends/patches/qt/MacToolchain.cmake new file mode 100644 index 0000000..ffb3a03 --- /dev/null +++ b/contrib/depends/patches/qt/MacToolchain.cmake @@ -0,0 +1,25 @@ +# Targeted operating system. +set(CMAKE_SYSTEM_NAME Darwin) + +# TODO: don't hardcode this +set(TARGET_SYSROOT /feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers) +set(CMAKE_SYSROOT ${TARGET_SYSROOT}) +set(CMAKE_OSX_SYSROOT ${TARGET_SYSROOT}) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) + +# TODO: don't hardcode this +set(CMAKE_C_FLAGS "--target=x86_64-apple-darwin -mmacosx-version-min=10.15 -B/feather/contrib/depends/x86_64-apple-darwin/native/bin -mlinker-version=609 -isysroot/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers -Xclang -internal-externc-isystem/gnu/store/rwsysyzpxzwi7g1jv4hxwi3m8i36iwcc-clang-10.0.1/lib/clang/10.0.1/include -Xclang -internal-externc-isystem/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include") +set(CMAKE_CXX_FLAGS "--target=x86_64-apple-darwin -mmacosx-version-min=10.15 -B/feather/contrib/depends/x86_64-apple-darwin/native/bin -mlinker-version=609 -isysroot/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers -stdlib=libc++ -stdlib++-isystem/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include/c++/v1 -isystem/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include/c++/v1 -isystem/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include -Xclang -internal-externc-isystem/gnu/store/rwsysyzpxzwi7g1jv4hxwi3m8i36iwcc-clang-10.0.1/lib/clang/10.0.1/include -Xclang -internal-externc-isystem/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include") + +set(CMAKE_INSTALL_NAME_TOOL x86_64-apple-darwin-install_name_tool) +set(CMAKE_FIND_ROOT_PATH /feather/contrib/depends/x86_64-apple-darwin/) + +# Adjust the default behavior of the find commands: +# search headers and libraries in the target environment +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + +# Search programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/contrib/depends/patches/qt/QTBUG-92199-fix.patch b/contrib/depends/patches/qt/QTBUG-92199-fix.patch new file mode 100644 index 0000000..c04fa73 --- /dev/null +++ b/contrib/depends/patches/qt/QTBUG-92199-fix.patch @@ -0,0 +1,59 @@ +From c765bc51864b90ebc46c11780ccc20ad16eddd6a Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Tue, 8 Nov 2022 00:59:36 +0100 +Subject: [PATCH] Fix QTBUG-92199 + +--- + src/widgets/styles/qstylesheetstyle.cpp | 1 - + .../qstylesheetstyle/tst_qstylesheetstyle.cpp | 16 ---------------- + 2 files changed, 17 deletions(-) + +diff --git a/qtbase/src/widgets/styles/qstylesheetstyle.cpp b/qtbase/src/widgets/styles/qstylesheetstyle.cpp +index 6abef62835..7aca4d5788 100644 +--- a/qtbase/src/widgets/styles/qstylesheetstyle.cpp ++++ b/qtbase/src/widgets/styles/qstylesheetstyle.cpp +@@ -1474,7 +1474,6 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q + p->setBrush(cg, w->foregroundRole(), pal->foreground); + p->setBrush(cg, QPalette::WindowText, pal->foreground); + p->setBrush(cg, QPalette::Text, pal->foreground); +- p->setBrush(cg, QPalette::PlaceholderText, pal->foreground); + } + if (pal->selectionBackground.style() != Qt::NoBrush) + p->setBrush(cg, QPalette::Highlight, pal->selectionBackground); +diff --git a/qtbase/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/qtbase/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +index 82d48b1692..9add99325b 100644 +--- a/qtbase/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp ++++ b/qtbase/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +@@ -103,7 +103,6 @@ private slots: + void QTBUG15910_crashNullWidget(); + void QTBUG36933_brokenPseudoClassLookup(); + void styleSheetChangeBeforePolish(); +- void placeholderColor(); + void enumPropertySelector_data(); + void enumPropertySelector(); + //at the end because it mess with the style. +@@ -2331,21 +2330,6 @@ void tst_QStyleSheetStyle::highdpiImages() + QHighDpiScaling::updateHighDpiScaling(); // reset to normal + } + +-void tst_QStyleSheetStyle::placeholderColor() +-{ +- const QColor red(Qt::red); +- qApp->setStyleSheet("* { color: red; }"); +- QLineEdit le1; +- QLineEdit le2; +- le2.setEnabled(false); +- le1.ensurePolished(); +- QCOMPARE(le1.palette().placeholderText(), red); +- le2.ensurePolished(); +- QCOMPARE(le2.palette().placeholderText(), red); +- le2.setEnabled(true); +- QCOMPARE(le2.palette().placeholderText(), red); +-} +- + void tst_QStyleSheetStyle::enumPropertySelector_data() + { + QTest::addColumn("styleSheet"); +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/WindowsToolchain.cmake b/contrib/depends/patches/qt/WindowsToolchain.cmake new file mode 100644 index 0000000..7674061 --- /dev/null +++ b/contrib/depends/patches/qt/WindowsToolchain.cmake @@ -0,0 +1,15 @@ +# Targeted operating system. +set(CMAKE_SYSTEM_NAME Windows) + +# Use mingw 64-bit compilers. +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) +set(CMAKE_FIND_ROOT_PATH /feather/contrib/depends/x86_64-w64-mingw32/) + +# Adjust the default behavior of the find commands: +# search headers and libraries in the target environment +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + +# Search programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/contrib/depends/patches/qt/___isOSVersionAtLeast_hack.patch b/contrib/depends/patches/qt/___isOSVersionAtLeast_hack.patch new file mode 100644 index 0000000..02059dc --- /dev/null +++ b/contrib/depends/patches/qt/___isOSVersionAtLeast_hack.patch @@ -0,0 +1,151 @@ +From 3a7a87074b8c1efd93b587e25a0790708f43dc17 Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sat, 26 Nov 2022 19:50:04 +0100 +Subject: [PATCH] don't use @available + +--- + src/gui/rhi/qrhimetal.mm | 25 ++----------------------- + 1 file changed, 2 insertions(+), 23 deletions(-) + +diff --git a/qtbase/src/gui/rhi/qrhimetal.mm b/qtbase/src/gui/rhi/qrhimetal.mm +index bd761b4e15..deb584125c 100644 +--- a/qtbase/src/gui/rhi/qrhimetal.mm ++++ b/qtbase/src/gui/rhi/qrhimetal.mm +@@ -2545,119 +2545,102 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR + #else + case QRhiTexture::ETC2_RGB8: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatETC2_RGB8_sRGB : MTLPixelFormatETC2_RGB8; + } + qWarning("QRhiMetal: ETC2 compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ETC2_RGB8A1: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatETC2_RGB8A1_sRGB : MTLPixelFormatETC2_RGB8A1; + } + qWarning("QRhiMetal: ETC2 compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ETC2_RGBA8: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatEAC_RGBA8_sRGB : MTLPixelFormatEAC_RGBA8; + } + qWarning("QRhiMetal: ETC2 compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_4x4: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_4x4_sRGB : MTLPixelFormatASTC_4x4_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_5x4: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_5x4_sRGB : MTLPixelFormatASTC_5x4_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_5x5: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_5x5_sRGB : MTLPixelFormatASTC_5x5_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_6x5: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_6x5_sRGB : MTLPixelFormatASTC_6x5_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_6x6: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_6x6_sRGB : MTLPixelFormatASTC_6x6_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_8x5: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_8x5_sRGB : MTLPixelFormatASTC_8x5_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_8x6: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_8x6_sRGB : MTLPixelFormatASTC_8x6_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_8x8: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_8x8_sRGB : MTLPixelFormatASTC_8x8_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_10x5: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_10x5_sRGB : MTLPixelFormatASTC_10x5_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_10x6: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_10x6_sRGB : MTLPixelFormatASTC_10x6_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_10x8: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_10x8_sRGB : MTLPixelFormatASTC_10x8_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_10x10: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_10x10_sRGB : MTLPixelFormatASTC_10x10_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_12x10: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_12x10_sRGB : MTLPixelFormatASTC_12x10_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); + return MTLPixelFormatInvalid; + case QRhiTexture::ASTC_12x12: + if (d->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) + return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR; + } + qWarning("QRhiMetal: ASTC compression not supported on this platform"); +@@ -2727,12 +2710,8 @@ bool QMetalRenderBuffer::create() + case DepthStencil: + #ifdef Q_OS_MACOS + if (rhiD->caps.isAppleGPU) { +- if (@available(macOS 11.0, *)) { +- desc.storageMode = MTLStorageModeMemoryless; +- d->format = MTLPixelFormatDepth32Float_Stencil8; +- } else { +- Q_UNREACHABLE(); +- } ++ desc.storageMode = MTLStorageModeMemoryless; ++ d->format = MTLPixelFormatDepth32Float_Stencil8; + } else { + desc.storageMode = MTLStorageModePrivate; + d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/dont_capitalize_wmf_libs.patch b/contrib/depends/patches/qt/dont_capitalize_wmf_libs.patch new file mode 100644 index 0000000..af8dc33 --- /dev/null +++ b/contrib/depends/patches/qt/dont_capitalize_wmf_libs.patch @@ -0,0 +1,33 @@ +From 2c284ef4e533b4a0f10e337b2998884c381377e6 Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Wed, 16 Nov 2022 20:02:52 +0100 +Subject: [PATCH] don't capitalize WMF libs + +--- + cmake/FindWMF.cmake | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/qtmultimedia/cmake/FindWMF.cmake b/qtmultimedia/cmake/FindWMF.cmake +index 7c6923c1e..b69274be5 100644 +--- a/qtmultimedia/cmake/FindWMF.cmake ++++ b/qtmultimedia/cmake/FindWMF.cmake +@@ -22,11 +22,11 @@ find_library(WMF_UUID_LIBRARY uuid HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) + find_library(WMF_MSDMO_LIBRARY msdmo HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) + find_library(WMF_OLE32_LIBRARY ole32 HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) + find_library(WMF_OLEAUT32_LIBRARY oleaut32 HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) +-find_library(WMF_MF_LIBRARY Mf HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) +-find_library(WMF_MFUUID_LIBRARY Mfuuid HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) +-find_library(WMF_MFPLAT_LIBRARY Mfplat HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) +-find_library(WMF_MFCORE_LIBRARY Mfcore HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) +-find_library(WMF_PROPSYS_LIBRARY Propsys HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) ++find_library(WMF_MF_LIBRARY mf HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) ++find_library(WMF_MFUUID_LIBRARY mfuuid HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) ++find_library(WMF_MFPLAT_LIBRARY mfplat HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) ++find_library(WMF_MFCORE_LIBRARY mfcore HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) ++find_library(WMF_PROPSYS_LIBRARY propsys HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) + + + set(WMF_LIBRARIES ${WMF_STRMIIDS_LIBRARY} ${WMF_AMSTRMID_LIBRARY} ${WMF_DMOGUIDS_LIBRARY} ${WMF_UUID_LIBRARY} +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/dont_hardcode_pwd.patch b/contrib/depends/patches/qt/dont_hardcode_pwd.patch index a74e9cb..cf2c4d3 100644 --- a/contrib/depends/patches/qt/dont_hardcode_pwd.patch +++ b/contrib/depends/patches/qt/dont_hardcode_pwd.patch @@ -9,12 +9,10 @@ Date: Tue Aug 18 15:09:06 2020 +0800 See #15581. -diff --git a/qtbase/configure b/qtbase/configure -index 08b49a8d..faea5b55 100755 --- a/qtbase/configure +++ b/qtbase/configure -@@ -36,9 +36,9 @@ - relconf=`basename $0` +@@ -34,9 +34,9 @@ + # the directory of this script is the "source tree" relpath=`dirname $0` -relpath=`(cd "$relpath"; /bin/pwd)` @@ -22,6 +20,6 @@ index 08b49a8d..faea5b55 100755 # the current directory is the "build tree" or "object tree" -outpath=`/bin/pwd` +outpath=`pwd` - - WHICH="which" - + + # do this early so we don't store it in config.status + CFG_TOPLEVEL= diff --git a/contrib/depends/patches/qt/dont_hardcode_x86_64.patch b/contrib/depends/patches/qt/dont_hardcode_x86_64.patch deleted file mode 100644 index a664268..0000000 --- a/contrib/depends/patches/qt/dont_hardcode_x86_64.patch +++ /dev/null @@ -1,119 +0,0 @@ -macOS: Don't hard-code x86_64 as the architecture when using qmake - -Upstream commit: - - Qt 6.1: 9082cc8e8d5a6441dabe5e7a95bc0cd9085b95fe - -For other Qt branches see -https://codereview.qt-project.org/q/I70db7e4c27f0d3da5d0af33cb491d72c312d3fa8 - - ---- old/qtbase/configure.json -+++ new/qtbase/configure.json -@@ -244,11 +244,18 @@ - - "testTypeDependencies": { - "linkerSupportsFlag": [ "use_bfd_linker", "use_gold_linker", "use_lld_linker" ], -- "verifySpec": [ "shared", "use_bfd_linker", "use_gold_linker", "use_lld_linker", "compiler-flags", "qmakeargs", "commit" ], -+ "verifySpec": [ -+ "shared", -+ "use_bfd_linker", "use_gold_linker", "use_lld_linker", -+ "compiler-flags", "qmakeargs", -+ "simulator_and_device", -+ "thread", -+ "commit" ], - "compile": [ "verifyspec" ], - "detectPkgConfig": [ "cross_compile", "machineTuple" ], - "library": [ "pkg-config", "compiler-flags" ], -- "getPkgConfigVariable": [ "pkg-config" ] -+ "getPkgConfigVariable": [ "pkg-config" ], -+ "architecture" : [ "verifyspec" ] - }, - - "testTypeAliases": { -@@ -762,7 +769,7 @@ - }, - "architecture": { - "label": "Architecture", -- "output": [ "architecture" ] -+ "output": [ "architecture", "commitConfig" ] - }, - "pkg-config": { - "label": "Using pkg-config", -diff --git a/configure.pri b/configure.pri -index 49755f7abfd..8be9b10d7d4 100644 ---- old/qtbase/configure.pri -+++ new/qtbase/configure.pri -@@ -662,6 +662,13 @@ defineTest(qtConfOutput_commitOptions) { - write_file($$QT_BUILD_TREE/mkspecs/qdevice.pri, $${currentConfig}.output.devicePro)|error() - } - -+# Output is written after configuring each Qt module, -+# but some tests within a module might depend on the -+# configuration output of previous tests. -+defineTest(qtConfOutput_commitConfig) { -+ qtConfProcessOutput() -+} -+ - # type (empty or 'host'), option name, default value - defineTest(processQtPath) { - out_var = config.rel_input.$${2} -diff --git a/mkspecs/common/macx.conf b/mkspecs/common/macx.conf -index d16b77acb8e..4ba0a8eaa36 100644 ---- old/qtbase/mkspecs/common/macx.conf -+++ new/qtbase/mkspecs/common/macx.conf -@@ -6,7 +6,6 @@ QMAKE_PLATFORM += macos osx macx - QMAKE_MAC_SDK = macosx - - QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.13 --QMAKE_APPLE_DEVICE_ARCHS = x86_64 - - # Should be 10.15, but as long as the CI builds with - # older SDKs we have to keep this. -diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf -index 92a9112bca6..d888731ec8d 100644 ---- old/qtbase/mkspecs/features/mac/default_post.prf -+++ new/qtbase/mkspecs/features/mac/default_post.prf -@@ -95,6 +95,11 @@ app_extension_api_only { - QMAKE_LFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION - } - -+# Non-universal builds do not set QMAKE_APPLE_DEVICE_ARCHS, -+# so we pick it up from what the arch test resolved instead. -+isEmpty(QMAKE_APPLE_DEVICE_ARCHS): \ -+ QMAKE_APPLE_DEVICE_ARCHS = $$QT_ARCH -+ - macx-xcode { - qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO - !isEmpty(QMAKE_PKGINFO_TYPEINFO): \ -@@ -150,9 +155,6 @@ macx-xcode { - simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS - VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS - -- isEmpty(VALID_ARCHS): \ -- error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture") -- - single_arch: VALID_ARCHS = $$first(VALID_ARCHS) - - ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS)) -diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf -index efbe7c1e55b..8add6dc8043 100644 ---- old/qtbase/mkspecs/features/toolchain.prf -+++ new/qtbase/mkspecs/features/toolchain.prf -@@ -182,9 +182,14 @@ isEmpty($${target_prefix}.INCDIRS) { - # UIKit simulator platforms will see the device SDK's sysroot in - # QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass. - darwin { -- # Clang doesn't pick up the architecture from the sysroot, and will -- # default to the host architecture, so we need to manually set it. -- cxx_flags += -arch $$QMAKE_APPLE_DEVICE_ARCHS -+ uikit { -+ # Clang doesn't automatically pick up the architecture, just because -+ # we're passing the iOS sysroot below, and we will end up building the -+ # test for the host architecture, resulting in linker errors when -+ # linking against the iOS libraries. We work around this by passing -+ # the architecture explicitly. -+ cxx_flags += -arch $$first(QMAKE_APPLE_DEVICE_ARCHS) -+ } - - uikit:macx-xcode: \ - cxx_flags += -isysroot $$sdk_path_device.value diff --git a/contrib/depends/patches/qt/duplicate_lcqpafonts.patch b/contrib/depends/patches/qt/duplicate_lcqpafonts.patch deleted file mode 100644 index c460b51..0000000 --- a/contrib/depends/patches/qt/duplicate_lcqpafonts.patch +++ /dev/null @@ -1,104 +0,0 @@ -QtGui: Fix duplication of logging category lcQpaFonts - -Move it to qplatformfontdatabase.h. - -Upstream commit: - - Qt 6.0: ab01885e48873fb2ad71841a3f1627fe4d9cd835 - ---- a/qtbase/src/gui/text/qplatformfontdatabase.cpp -+++ b/qtbase/src/gui/text/qplatformfontdatabase.cpp -@@ -52,6 +52,8 @@ - - QT_BEGIN_NAMESPACE - -+Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts") -+ - void qt_registerFont(const QString &familyname, const QString &stylename, - const QString &foundryname, int weight, - QFont::Style style, int stretch, bool antialiased, - ---- a/qtbase/src/gui/text/qplatformfontdatabase.h -+++ b/qtbase/src/gui/text/qplatformfontdatabase.h -@@ -50,6 +50,7 @@ - // - - #include -+#include - #include - #include - #include -@@ -62,6 +63,7 @@ - - QT_BEGIN_NAMESPACE - -+Q_DECLARE_LOGGING_CATEGORY(lcQpaFonts) - - class QWritingSystemsPrivate; - - ---- a/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm -+++ b/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm -@@ -86,8 +86,6 @@ - - QT_BEGIN_NAMESPACE - --Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts") -- - static float SYNTHETIC_ITALIC_SKEW = std::tan(14.f * std::acos(0.f) / 90.f); - - bool QCoreTextFontEngine::ct_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *length) - ---- a/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h -+++ b/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h -@@ -64,8 +64,6 @@ - - QT_BEGIN_NAMESPACE - --Q_DECLARE_LOGGING_CATEGORY(lcQpaFonts) -- - class QCoreTextFontEngine : public QFontEngine - { - Q_GADGET - ---- a/qtbase/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp -+++ b/qtbase/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp -@@ -68,8 +68,6 @@ - - QT_BEGIN_NAMESPACE - --Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts") -- - #ifndef QT_NO_DIRECTWRITE - // ### fixme: Consider direct linking of dwrite.dll once Windows Vista pre SP2 is dropped (QTBUG-49711) - - ---- a/qtbase/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h -+++ b/qtbase/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h -@@ -63,8 +63,6 @@ - - QT_BEGIN_NAMESPACE - --Q_DECLARE_LOGGING_CATEGORY(lcQpaFonts) -- - class QWindowsFontEngineData - { - Q_DISABLE_COPY_MOVE(QWindowsFontEngineData) - ---- a/qtbase/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp -+++ b/qtbase/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp -@@ -40,6 +40,7 @@ - #include "qgenericunixthemes_p.h" - - #include "qpa/qplatformtheme_p.h" -+#include "qpa/qplatformfontdatabase.h" - - #include - #include -@@ -76,7 +77,6 @@ - QT_BEGIN_NAMESPACE - - Q_DECLARE_LOGGING_CATEGORY(qLcTray) --Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts") - - ResourceHelper::ResourceHelper() - { diff --git a/contrib/depends/patches/qt/fast_fixed_dtoa_no_optimize.patch b/contrib/depends/patches/qt/fast_fixed_dtoa_no_optimize.patch index d4d6539..6bf4a43 100644 --- a/contrib/depends/patches/qt/fast_fixed_dtoa_no_optimize.patch +++ b/contrib/depends/patches/qt/fast_fixed_dtoa_no_optimize.patch @@ -3,8 +3,8 @@ This fixes a non-determinism issue in the asm produced for this function when cross-compiling on x86_64 and aarch64 for the arm-linux-gnueabihf HOST. ---- a/qtbase/src/3rdparty/double-conversion/fixed-dtoa.h -+++ b/qtbase/src/3rdparty/double-conversion/fixed-dtoa.h +--- a/qtbase/src/3rdparty/double-conversion/double-conversion/fixed-dtoa.h ++++ b/qtbase/src/3rdparty/double-conversion/double-conversion/fixed-dtoa.h @@ -48,9 +48,12 @@ namespace double_conversion { // // This method only works for some parameters. If it can't handle the input it diff --git a/contrib/depends/patches/qt/fix_android_jni_static.patch b/contrib/depends/patches/qt/fix_android_jni_static.patch deleted file mode 100644 index 936b82e..0000000 --- a/contrib/depends/patches/qt/fix_android_jni_static.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- old/qtbase/src/plugins/platforms/android/androidjnimain.cpp -+++ new/qtbase/src/plugins/platforms/android/androidjnimain.cpp -@@ -943,6 +943,14 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) - __android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed"); - return -1; - } -+ -+ const jint ret = QT_PREPEND_NAMESPACE(QtAndroidPrivate::initJNI(vm, env)); -+ if (ret != 0) -+ { -+ __android_log_print(ANDROID_LOG_FATAL, "Qt", "initJNI failed"); -+ return ret; -+ } -+ - QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false); - - m_javaVM = vm; - diff --git a/contrib/depends/patches/qt/fix_include_capitalization.patch b/contrib/depends/patches/qt/fix_include_capitalization.patch new file mode 100644 index 0000000..ff1d4bb --- /dev/null +++ b/contrib/depends/patches/qt/fix_include_capitalization.patch @@ -0,0 +1,159 @@ +From 97148cac4d938d426d410815ac3488ae8a970cad Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Wed, 16 Nov 2022 19:19:16 +0100 +Subject: [PATCH] Fix include capitalization + +--- + src/multimedia/windows/qwindowsmediadevices.cpp | 2 +- + src/multimedia/windows/qwindowsresampler.cpp | 2 +- + src/plugins/multimedia/ffmpeg/qwindowscamera.cpp | 4 ++-- + src/plugins/multimedia/windows/common/mfmetadata_p.h | 2 +- + .../multimedia/windows/decoder/mfaudiodecodercontrol.cpp | 2 +- + .../windows/mediacapture/qwindowsmediadevicereader_p.h | 4 ++-- + .../multimedia/windows/mediacapture/qwindowsmediaencoder.cpp | 2 +- + src/plugins/multimedia/windows/player/mfplayercontrol_p.h | 2 +- + src/plugins/multimedia/windows/player/mfplayersession.cpp | 2 +- + src/plugins/multimedia/windows/player/mftvideo.cpp | 2 +- + src/plugins/multimedia/windows/qwindowsvideodevices.cpp | 4 ++-- + 11 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/qtmultimedia/src/multimedia/windows/qwindowsmediadevices.cpp b/qtmultimedia/src/multimedia/windows/qwindowsmediadevices.cpp +index c91597102..8c2df5816 100644 +--- a/qtmultimedia/src/multimedia/windows/qwindowsmediadevices.cpp ++++ b/qtmultimedia/src/multimedia/windows/qwindowsmediadevices.cpp +@@ -13,7 +13,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + +diff --git a/qtmultimedia/src/multimedia/windows/qwindowsresampler.cpp b/qtmultimedia/src/multimedia/windows/qwindowsresampler.cpp +index 16249af84..97e8558f0 100644 +--- a/qtmultimedia/src/multimedia/windows/qwindowsresampler.cpp ++++ b/qtmultimedia/src/multimedia/windows/qwindowsresampler.cpp +@@ -5,7 +5,7 @@ + #include + #include + +-#include ++#include + #include + #include + #include +diff --git a/qtmultimedia/src/plugins/multimedia/windows/common/mfmetadata_p.h b/qtmultimedia/src/plugins/multimedia/windows/common/mfmetadata_p.h +index 81a03b126..9ff196240 100644 +--- a/qtmultimedia/src/plugins/multimedia/windows/common/mfmetadata_p.h ++++ b/qtmultimedia/src/plugins/multimedia/windows/common/mfmetadata_p.h +@@ -16,7 +16,7 @@ + // + + #include +-#include "Mfidl.h" ++#include "mfidl.h" + + QT_USE_NAMESPACE + +diff --git a/qtmultimedia/src/plugins/multimedia/windows/decoder/mfaudiodecodercontrol.cpp b/qtmultimedia/src/plugins/multimedia/windows/decoder/mfaudiodecodercontrol.cpp +index 45bc70d65..0e27a2779 100644 +--- a/qtmultimedia/src/plugins/multimedia/windows/decoder/mfaudiodecodercontrol.cpp ++++ b/qtmultimedia/src/plugins/multimedia/windows/decoder/mfaudiodecodercontrol.cpp +@@ -4,7 +4,7 @@ + #include + #include + #include +-#include "Wmcodecdsp.h" ++#include "wmcodecdsp.h" + #include "mfaudiodecodercontrol_p.h" + #include + +diff --git a/qtmultimedia/src/plugins/multimedia/windows/mediacapture/qwindowsmediadevicereader_p.h b/qtmultimedia/src/plugins/multimedia/windows/mediacapture/qwindowsmediadevicereader_p.h +index 0205eafe2..4699a463a 100644 +--- a/qtmultimedia/src/plugins/multimedia/windows/mediacapture/qwindowsmediadevicereader_p.h ++++ b/qtmultimedia/src/plugins/multimedia/windows/mediacapture/qwindowsmediadevicereader_p.h +@@ -17,8 +17,8 @@ + + #include + #include +-#include +-#include ++#include ++#include + + #include + #include +diff --git a/qtmultimedia/src/plugins/multimedia/windows/mediacapture/qwindowsmediaencoder.cpp b/qtmultimedia/src/plugins/multimedia/windows/mediacapture/qwindowsmediaencoder.cpp +index d5eb07980..dc87afc4b 100644 +--- a/qtmultimedia/src/plugins/multimedia/windows/mediacapture/qwindowsmediaencoder.cpp ++++ b/qtmultimedia/src/plugins/multimedia/windows/mediacapture/qwindowsmediaencoder.cpp +@@ -8,7 +8,7 @@ + #include "mfmetadata_p.h" + #include + #include +-#include ++#include + #include + #include + #include +diff --git a/qtmultimedia/src/plugins/multimedia/windows/player/mfplayercontrol_p.h b/qtmultimedia/src/plugins/multimedia/windows/player/mfplayercontrol_p.h +index ac60e8c29..78ff71439 100644 +--- a/qtmultimedia/src/plugins/multimedia/windows/player/mfplayercontrol_p.h ++++ b/qtmultimedia/src/plugins/multimedia/windows/player/mfplayercontrol_p.h +@@ -15,7 +15,7 @@ + // We mean it. + // + +-#include "QUrl.h" ++#include "qurl.h" + #include "private/qplatformmediaplayer_p.h" + + #include +diff --git a/qtmultimedia/src/plugins/multimedia/windows/player/mfplayersession.cpp b/qtmultimedia/src/plugins/multimedia/windows/player/mfplayersession.cpp +index 152604f1d..301315b59 100644 +--- a/qtmultimedia/src/plugins/multimedia/windows/player/mfplayersession.cpp ++++ b/qtmultimedia/src/plugins/multimedia/windows/player/mfplayersession.cpp +@@ -32,7 +32,7 @@ + + #include + #include +-#include ++#include + + //#define DEBUG_MEDIAFOUNDATION + +diff --git a/qtmultimedia/src/plugins/multimedia/windows/player/mftvideo.cpp b/qtmultimedia/src/plugins/multimedia/windows/player/mftvideo.cpp +index 601c51e42..06a8769a7 100644 +--- a/qtmultimedia/src/plugins/multimedia/windows/player/mftvideo.cpp ++++ b/qtmultimedia/src/plugins/multimedia/windows/player/mftvideo.cpp +@@ -7,7 +7,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + +diff --git a/qtmultimedia/src/plugins/multimedia/windows/qwindowsvideodevices.cpp b/qtmultimedia/src/plugins/multimedia/windows/qwindowsvideodevices.cpp +index a6f933bd9..be52b3633 100644 +--- a/qtmultimedia/src/plugins/multimedia/windows/qwindowsvideodevices.cpp ++++ b/qtmultimedia/src/plugins/multimedia/windows/qwindowsvideodevices.cpp +@@ -8,11 +8,11 @@ + #include + #include + +-#include ++#include + + #include + #include +-#include ++#include + + QT_BEGIN_NAMESPACE + +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/fix_limits_header.patch b/contrib/depends/patches/qt/fix_limits_header.patch deleted file mode 100644 index 258128c..0000000 --- a/contrib/depends/patches/qt/fix_limits_header.patch +++ /dev/null @@ -1,33 +0,0 @@ -Fix compiling with GCC 11 - -Upstream: - - bug report: https://bugreports.qt.io/browse/QTBUG-89977 - - fix in Qt 6.1: 813a928c7c3cf98670b6043149880ed5c955efb9 - ---- old/qtbase/src/corelib/text/qbytearraymatcher.h -+++ new/qtbase/src/corelib/text/qbytearraymatcher.h -@@ -42,6 +42,8 @@ - - #include - -+#include -+ - QT_BEGIN_NAMESPACE - - - -Upstream fix and backports: - - Qt 6.1: 3eab20ad382569cb2c9e6ccec2322c3d08c0f716 - - Qt 6.2: 380294a5971da85010a708dc23b0edec192cbf27 - - Qt 6.3: 2b2b3155d9f6ba1e4f859741468fbc47db09292b - ---- old/qtbase/src/corelib/tools/qoffsetstringarray_p.h -+++ new/qtbase/src/corelib/tools/qoffsetstringarray_p.h -@@ -55,6 +55,7 @@ - - #include - #include -+#include - - QT_BEGIN_NAMESPACE - diff --git a/contrib/depends/patches/qt/fix_montery_include.patch b/contrib/depends/patches/qt/fix_montery_include.patch deleted file mode 100644 index 38b700a..0000000 --- a/contrib/depends/patches/qt/fix_montery_include.patch +++ /dev/null @@ -1,21 +0,0 @@ -From dece6f5840463ae2ddf927d65eb1b3680e34a547 -From: Øystein Heskestad -Date: Wed, 27 Oct 2021 13:07:46 +0200 -Subject: [PATCH] Add missing macOS header file that was indirectly included before - -See: https://bugreports.qt.io/browse/QTBUG-97855 - -Upstream Commits: - - Qt 6.2: c884bf138a21dd7320e35cef34d24e22e74d7ce0 - -diff --git a/qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h b/qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -index e070ba97..07c75b04 100644 ---- a/qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -+++ b/qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -@@ -40,6 +40,7 @@ - #ifndef QIOSURFACEGRAPHICSBUFFER_H - #define QIOSURFACEGRAPHICSBUFFER_H - -+#include - #include - #include diff --git a/contrib/depends/patches/qt/fix_no_printer.patch b/contrib/depends/patches/qt/fix_no_printer.patch deleted file mode 100644 index 1372356..0000000 --- a/contrib/depends/patches/qt/fix_no_printer.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- x/qtbase/src/plugins/platforms/cocoa/qprintengine_mac_p.h -+++ y/qtbase/src/plugins/platforms/cocoa/qprintengine_mac_p.h -@@ -52,6 +52,7 @@ - // - - #include -+#include - - #ifndef QT_NO_PRINTER - ---- x/qtbase/src/plugins/plugins.pro -+++ y/qtbase/src/plugins/plugins.pro -@@ -9,6 +9,3 @@ qtHaveModule(gui) { - !android:qtConfig(library): SUBDIRS *= generic - } - qtHaveModule(widgets): SUBDIRS += styles -- --!winrt:qtHaveModule(printsupport): \ -- SUBDIRS += printsupport diff --git a/contrib/depends/patches/qt/fix_qt_pkgconfig.patch b/contrib/depends/patches/qt/fix_qt_pkgconfig.patch deleted file mode 100644 index 73f4d89..0000000 --- a/contrib/depends/patches/qt/fix_qt_pkgconfig.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- old/qtbase/mkspecs/features/qt_module.prf -+++ new/qtbase/mkspecs/features/qt_module.prf -@@ -269,7 +269,7 @@ load(qt_installs) - load(qt_targets) - - # this builds on top of qt_common --!internal_module:if(unix|mingw):!if(darwin:debug_and_release:CONFIG(debug, debug|release)) { -+if(unix|mingw):!if(darwin:debug_and_release:CONFIG(debug, debug|release)) { - CONFIG += create_pc - QMAKE_PKGCONFIG_DESTDIR = pkgconfig - host_build: \ diff --git a/contrib/depends/patches/qt/guix_cross_lib_path.patch b/contrib/depends/patches/qt/guix_cross_lib_path.patch index 0c67743..7911dc2 100644 --- a/contrib/depends/patches/qt/guix_cross_lib_path.patch +++ b/contrib/depends/patches/qt/guix_cross_lib_path.patch @@ -4,7 +4,7 @@ See discussion in https://github.com/bitcoin/bitcoin/pull/15277. --- a/qtbase/mkspecs/features/toolchain.prf +++ b/qtbase/mkspecs/features/toolchain.prf -@@ -231,8 +231,8 @@ isEmpty($${target_prefix}.INCDIRS) { +@@ -236,8 +236,8 @@ isEmpty($${target_prefix}.INCDIRS) { add_libraries = false for (line, output) { line ~= s/^[ \\t]*// # remove leading spaces diff --git a/contrib/depends/patches/qt/missing-include.patch b/contrib/depends/patches/qt/missing-include.patch new file mode 100644 index 0000000..0b9fa57 --- /dev/null +++ b/contrib/depends/patches/qt/missing-include.patch @@ -0,0 +1,24 @@ +From 34d17721428fbf74340a25acc057fe96ed418d7c Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sat, 26 Nov 2022 21:34:39 +0100 +Subject: [PATCH] missing include + +--- + src/plugins/multimedia/darwin/camera/qavfcamerabase.mm | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/qtmultimedia/src/plugins/multimedia/darwin/camera/qavfcamerabase.mm b/qtmultimedia/src/plugins/multimedia/darwin/camera/qavfcamerabase.mm +index f9e353558..271849508 100644 +--- a/qtmultimedia/src/plugins/multimedia/darwin/camera/qavfcamerabase.mm ++++ b/qtmultimedia/src/plugins/multimedia/darwin/camera/qavfcamerabase.mm +@@ -7,6 +7,7 @@ + #include + #include "qavfhelpers_p.h" + #include ++#include + + QT_USE_NAMESPACE + +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/no-__builtin_available.patch b/contrib/depends/patches/qt/no-__builtin_available.patch new file mode 100644 index 0000000..c78145c --- /dev/null +++ b/contrib/depends/patches/qt/no-__builtin_available.patch @@ -0,0 +1,26 @@ +From fa539c42901922c1b5dfde96030b3fe38490c7ee Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sat, 26 Nov 2022 21:53:33 +0100 +Subject: [PATCH] no __builtin_available + +--- + src/plugins/multimedia/darwin/qdarwinintegration.mm | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/qtmultimedia/src/plugins/multimedia/darwin/qdarwinintegration.mm b/qtmultimedia/src/plugins/multimedia/darwin/qdarwinintegration.mm +index 314ceaff6..32d8a2f6e 100644 +--- a/qtmultimedia/src/plugins/multimedia/darwin/qdarwinintegration.mm ++++ b/qtmultimedia/src/plugins/multimedia/darwin/qdarwinintegration.mm +@@ -39,8 +39,7 @@ public: + QDarwinIntegration::QDarwinIntegration() + { + #if defined(Q_OS_MACOS) && QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_11_0) +- if (__builtin_available(macOS 11.0, *)) +- VTRegisterSupplementalVideoDecoderIfAvailable(kCMVideoCodecType_VP9); ++ VTRegisterSupplementalVideoDecoderIfAvailable(kCMVideoCodecType_VP9); + #endif + m_videoDevices = new QAVFVideoDevices(this); + } +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/no-ffmpeg.patch b/contrib/depends/patches/qt/no-ffmpeg.patch new file mode 100644 index 0000000..f6d1896 --- /dev/null +++ b/contrib/depends/patches/qt/no-ffmpeg.patch @@ -0,0 +1,8973 @@ +From c39453a479896aab03aa9251bfd330709d702aeb Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sat, 26 Nov 2022 12:27:16 +0100 +Subject: [PATCH] No FFmpeg + +--- + src/multimedia/configure.cmake | 3 +- + src/plugins/multimedia/ffmpeg/CMakeLists.txt | 87 +- + src/plugins/multimedia/ffmpeg/qavfcamera.mm | 413 ----- + src/plugins/multimedia/ffmpeg/qavfcamera_p.h | 87 -- + src/plugins/multimedia/ffmpeg/qffmpeg_p.h | 47 - + .../multimedia/ffmpeg/qffmpegaudiodecoder.cpp | 241 --- + .../multimedia/ffmpeg/qffmpegaudiodecoder_p.h | 68 - + .../multimedia/ffmpeg/qffmpegaudioinput.cpp | 189 --- + .../multimedia/ffmpeg/qffmpegaudioinput_p.h | 54 - + .../multimedia/ffmpeg/qffmpegclock.cpp | 209 --- + .../multimedia/ffmpeg/qffmpegclock_p.h | 120 -- + .../multimedia/ffmpeg/qffmpegdecoder.cpp | 1368 ----------------- + .../multimedia/ffmpeg/qffmpegdecoder_p.h | 513 ------- + .../multimedia/ffmpeg/qffmpegencoder.cpp | 553 ------- + .../multimedia/ffmpeg/qffmpegencoder_p.h | 197 --- + .../ffmpeg/qffmpegencoderoptions.cpp | 272 ---- + .../ffmpeg/qffmpegencoderoptions_p.h | 32 - + .../multimedia/ffmpeg/qffmpeghwaccel.cpp | 399 ----- + .../ffmpeg/qffmpeghwaccel_d3d11.cpp | 178 --- + .../ffmpeg/qffmpeghwaccel_d3d11_p.h | 43 - + .../ffmpeg/qffmpeghwaccel_mediacodec.cpp | 70 - + .../ffmpeg/qffmpeghwaccel_mediacodec_p.h | 35 - + .../multimedia/ffmpeg/qffmpeghwaccel_p.h | 125 -- + .../ffmpeg/qffmpeghwaccel_vaapi.cpp | 346 ----- + .../ffmpeg/qffmpeghwaccel_vaapi_p.h | 48 - + .../ffmpeg/qffmpeghwaccel_videotoolbox.mm | 280 ---- + .../ffmpeg/qffmpeghwaccel_videotoolbox_p.h | 59 - + .../ffmpeg/qffmpegmediacapturesession.cpp | 15 +- + .../ffmpeg/qffmpegmediacapturesession_p.h | 1 - + .../ffmpeg/qffmpegmediaformatinfo.cpp | 474 ------ + .../ffmpeg/qffmpegmediaformatinfo_p.h | 18 - + .../ffmpeg/qffmpegmediaintegration.cpp | 31 - + .../ffmpeg/qffmpegmediaintegration_p.h | 6 - + .../ffmpeg/qffmpegmediametadata.cpp | 105 -- + .../ffmpeg/qffmpegmediametadata_p.h | 5 - + .../multimedia/ffmpeg/qffmpegmediaplayer.cpp | 206 --- + .../multimedia/ffmpeg/qffmpegmediaplayer_p.h | 89 -- + .../ffmpeg/qffmpegmediarecorder.cpp | 157 -- + .../ffmpeg/qffmpegmediarecorder_p.h | 68 - + .../multimedia/ffmpeg/qffmpegresampler.cpp | 95 -- + .../multimedia/ffmpeg/qffmpegresampler_p.h | 46 - + .../multimedia/ffmpeg/qffmpegthread.cpp | 57 - + .../multimedia/ffmpeg/qffmpegthread_p.h | 68 - + .../multimedia/ffmpeg/qffmpegvideobuffer.cpp | 357 ----- + .../multimedia/ffmpeg/qffmpegvideobuffer_p.h | 73 - + .../ffmpeg/qffmpegvideoframeencoder.cpp | 370 ----- + .../ffmpeg/qffmpegvideoframeencoder_p.h | 76 - + .../multimedia/ffmpeg/qffmpegvideosink.cpp | 14 - + .../multimedia/ffmpeg/qffmpegvideosink_p.h | 10 +- + .../multimedia/ffmpeg/qwindowscamera.cpp | 4 +- + 50 files changed, 12 insertions(+), 8369 deletions(-) + delete mode 100644 src/plugins/multimedia/ffmpeg/qavfcamera.mm + delete mode 100644 src/plugins/multimedia/ffmpeg/qavfcamera_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeg_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegaudiodecoder.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegaudiodecoder_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegaudioinput.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegaudioinput_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegclock.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegclock_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegdecoder.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegdecoder_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegencoder.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegencoder_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegencoderoptions.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegencoderoptions_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeghwaccel.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeghwaccel_mediacodec.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeghwaccel_mediacodec_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeghwaccel_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeghwaccel_vaapi.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeghwaccel_vaapi_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeghwaccel_videotoolbox.mm + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpeghwaccel_videotoolbox_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegmediaplayer.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegmediaplayer_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegmediarecorder.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegmediarecorder_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegresampler.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegresampler_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegthread.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegthread_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegvideobuffer_p.h + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegvideoframeencoder.cpp + delete mode 100644 src/plugins/multimedia/ffmpeg/qffmpegvideoframeencoder_p.h + +diff --git a/src/multimedia/configure.cmake b/src/multimedia/configure.cmake +index efcadfc5c..29b056003 100644 +--- a/src/multimedia/configure.cmake ++++ b/src/multimedia/configure.cmake +@@ -21,7 +21,6 @@ qt_find_package(WrapPulseAudio PROVIDED_TARGETS WrapPulseAudio::WrapPulseAudio M + qt_find_package(WMF PROVIDED_TARGETS WMF::WMF MODULE_NAME multimedia QMAKE_LIB wmf) + qt_find_package(EGL) + +-qt_find_package(FFmpeg OPTIONAL_COMPONENTS AVCODEC AVFORMAT AVUTIL AVDEVICE SWRESAMPLE SWSCALE PROVIDED_TARGETS FFmpeg::avcodec FFmpeg::avformat FFmpeg::avutil FFmpeg::avdevice FFmpeg::swresample FFmpeg::swscale MODULE_NAME multimedia QMAKE_LIB ffmpeg) + qt_find_package(VAAPI COMPONENTS VA DRM PROVIDED_TARGETS VAAPI::VA VAAPI::DRM MODULE_NAME multimedia QMAKE_LIB vaapi) + + #### Tests +@@ -73,7 +72,7 @@ qt_feature("ffmpeg" PRIVATE + LABEL "FFmpeg" + ENABLE INPUT_ffmpeg STREQUAL 'yes' + DISABLE INPUT_ffmpeg STREQUAL 'no' +- CONDITION FFmpeg_FOUND AND (APPLE OR WIN32 OR ANDROID OR QNX OR QT_FEATURE_pulseaudio) ++ CONDITION UNIX OR WIN32 + ) + qt_feature("alsa" PUBLIC PRIVATE + LABEL "ALSA (experimental)" +diff --git a/src/plugins/multimedia/ffmpeg/CMakeLists.txt b/src/plugins/multimedia/ffmpeg/CMakeLists.txt +index 5d6c0a8c3..6c83b9cb2 100644 +--- a/src/plugins/multimedia/ffmpeg/CMakeLists.txt ++++ b/src/plugins/multimedia/ffmpeg/CMakeLists.txt +@@ -1,107 +1,32 @@ +-qt_find_package(EGL) +-qt_find_package(VAAPI COMPONENTS VA DRM PROVIDED_TARGETS VAAPI::VA VAAPI::DRM MODULE_NAME multimedia QMAKE_LIB vaapi) +- +-qt_internal_find_apple_system_framework(FWCoreMedia CoreMedia) # special case +-qt_internal_find_apple_system_framework(FWCoreAudio CoreAudio) # special case +-qt_internal_find_apple_system_framework(FWAudioUnit AudioUnit) # special case +-qt_internal_find_apple_system_framework(FWVideoToolbox VideoToolbox) # special case +-qt_internal_find_apple_system_framework(FWAVFoundation AVFoundation) # special case +- + qt_internal_add_plugin(QFFmpegMediaPlugin + OUTPUT_NAME ffmpegmediaplugin + PLUGIN_TYPE multimedia + SOURCES +- qffmpeg_p.h +- qffmpegaudiodecoder.cpp qffmpegaudiodecoder_p.h +- qffmpegaudioinput.cpp qffmpegaudioinput_p.h +- qffmpegclock.cpp qffmpegclock_p.h +- qffmpegdecoder.cpp qffmpegdecoder_p.h +- qffmpeghwaccel.cpp qffmpeghwaccel_p.h +- qffmpegencoderoptions.cpp qffmpegencoderoptions_p.h + qffmpegmediametadata.cpp qffmpegmediametadata_p.h +- qffmpegmediaplayer.cpp qffmpegmediaplayer_p.h + qffmpegvideosink.cpp qffmpegvideosink_p.h + qffmpegmediaformatinfo.cpp qffmpegmediaformatinfo_p.h + qffmpegmediaintegration.cpp qffmpegmediaintegration_p.h +- qffmpegvideobuffer.cpp qffmpegvideobuffer_p.h + qffmpegimagecapture.cpp qffmpegimagecapture_p.h + qffmpegmediacapturesession.cpp qffmpegmediacapturesession_p.h +- qffmpegmediarecorder.cpp qffmpegmediarecorder_p.h +- qffmpegencoder.cpp qffmpegencoder_p.h +- qffmpegthread.cpp qffmpegthread_p.h +- qffmpegresampler.cpp qffmpegresampler_p.h +- qffmpegvideoframeencoder.cpp qffmpegvideoframeencoder_p.h + DEFINES + QT_COMPILING_FFMPEG + LIBRARIES + Qt::MultimediaPrivate + Qt::CorePrivate +- FFmpeg::avformat FFmpeg::avcodec FFmpeg::swresample FFmpeg::swscale FFmpeg::avutil +-) +- +-qt_internal_extend_target(QFFmpegMediaPlugin CONDITION QT_FEATURE_ffmpeg AND QT_FEATURE_vaapi +- SOURCES +- qffmpeghwaccel_vaapi.cpp qffmpeghwaccel_vaapi_p.h +- LIBRARIES +- VAAPI::VAAPI +- EGL::EGL + ) + +-qt_internal_extend_target(QFFmpegMediaPlugin CONDITION APPLE ++qt_internal_extend_target(QFFmpegMediaPlugin CONDITION QT_FEATURE_linux_v4l + SOURCES +- ../darwin/qavfhelpers.mm ../darwin/qavfhelpers_p.h +- ../darwin/camera/qavfcamerabase_p.h ../darwin/camera/qavfcamerabase.mm +- ../darwin/camera/avfcamerautility_p.h ../darwin/camera/avfcamerautility.mm +- qffmpeghwaccel_videotoolbox.mm qffmpeghwaccel_videotoolbox_p.h +- qavfcamera.mm qavfcamera_p.h +- INCLUDE_DIRECTORIES +- ../darwin +- ../darwin/camera +- LIBRARIES +- ${FWAudioToolbox} +- ${FWCoreAudio} +- ${FWCoreFoundation} +- ${FWCoreMedia} +- ${FWCoreVideo} +- ${FWVideoToolbox} +- AVFoundation::AVFoundation ++ qv4l2camera.cpp qv4l2camera_p.h + ) + + qt_internal_extend_target(QFFmpegMediaPlugin CONDITION WIN32 +- SOURCES ++ SOURCES + ../windows/qwindowsvideodevices.cpp ../windows/qwindowsvideodevices_p.h + qwindowscamera.cpp qwindowscamera_p.h +- qffmpeghwaccel_d3d11.cpp qffmpeghwaccel_d3d11_p.h +- INCLUDE_DIRECTORIES ++ INCLUDE_DIRECTORIES + ../windows +- LIBRARIES ++ LIBRARIES + WMF::WMF + mfreadwrite +-) +- +-qt_internal_extend_target(QFFmpegMediaPlugin CONDITION QT_FEATURE_linux_v4l +- SOURCES +- qv4l2camera.cpp qv4l2camera_p.h +-) +- +-if (ANDROID) +- qt_internal_extend_target(QFFmpegMediaPlugin +- SOURCES +- qffmpeghwaccel_mediacodec.cpp qffmpeghwaccel_mediacodec_p.h +- ../android/wrappers/jni/androidsurfacetexture_p.h +- ../android/wrappers/jni/androidsurfacetexture.cpp +- INCLUDE_DIRECTORIES +- ${FFMPEG_DIR}/include +- ../android/wrappers/jni/ +- ) +- +- set_property(TARGET QFFmpegMediaPlugin APPEND PROPERTY QT_ANDROID_LIB_DEPENDENCIES +- plugins/multimedia/libplugins_multimedia_ffmpegmediaplugin.so +- ) +- +- set_property(TARGET QFFmpegMediaPlugin APPEND PROPERTY QT_ANDROID_PERMISSIONS +- android.permission.CAMERA android.permission.RECORD_AUDIO +- android.permission.BLUETOOTH +- android.permission.MODIFY_AUDIO_SETTINGS +- ) +-endif() ++) +\ No newline at end of file +diff --git a/src/plugins/multimedia/ffmpeg/qavfcamera.mm b/src/plugins/multimedia/ffmpeg/qavfcamera.mm +deleted file mode 100644 +index fbe29296e..000000000 +--- a/src/plugins/multimedia/ffmpeg/qavfcamera.mm ++++ /dev/null +@@ -1,413 +0,0 @@ +-// Copyright (C) 2022 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#include +-#include +-#include +-#include +-#include "avfcamerautility_p.h" +-#include "qavfhelpers_p.h" +-#include +-#include +-#define AVMediaType XAVMediaType +-#include "qffmpegvideobuffer_p.h" +-#include "qffmpegvideosink_p.h" +-extern "C" { +-#include +-#include +-} +-#undef AVMediaType +- +- +- +-#import +-#include +- +-static void releaseHwFrame(void */*opaque*/, uint8_t *data) +-{ +- CVPixelBufferRelease(CVPixelBufferRef(data)); +-} +- +-// Make sure this is compatible with the layout used in ffmpeg's hwcontext_videotoolbox +-static AVFrame *allocHWFrame(AVBufferRef *hwContext, const CVPixelBufferRef &pixbuf) +-{ +- AVHWFramesContext *ctx = (AVHWFramesContext*)hwContext->data; +- AVFrame *frame = av_frame_alloc(); +- frame->hw_frames_ctx = av_buffer_ref(hwContext); +- frame->extended_data = frame->data; +- +- frame->buf[0] = av_buffer_create((uint8_t *)pixbuf, 1, releaseHwFrame, NULL, 0); +- frame->data[3] = (uint8_t *)pixbuf; +- CVPixelBufferRetain(pixbuf); +- frame->width = ctx->width; +- frame->height = ctx->height; +- frame->format = AV_PIX_FMT_VIDEOTOOLBOX; +- if (frame->width != (int)CVPixelBufferGetWidth(pixbuf) || +- frame->height != (int)CVPixelBufferGetHeight(pixbuf)) { +- // This can happen while changing camera format +- av_frame_free(&frame); +- return nullptr; +- } +- return frame; +-} +- +-static AVAuthorizationStatus m_cameraAuthorizationStatus = AVAuthorizationStatusNotDetermined; +- +-@interface QAVFSampleBufferDelegate : NSObject +- +-- (QAVFSampleBufferDelegate *) initWithCamera:(QAVFCamera *)renderer; +- +-- (void) captureOutput:(AVCaptureOutput *)captureOutput +- didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer +- fromConnection:(AVCaptureConnection *)connection; +- +-- (void) setHWAccel:(QFFmpeg::HWAccel *)accel; +- +-@end +- +-@implementation QAVFSampleBufferDelegate +-{ +-@private +- QAVFCamera *m_camera; +- AVBufferRef *hwFramesContext; +- QFFmpeg::HWAccel m_accel; +- qint64 startTime; +- qint64 baseTime; +-} +- +-- (QAVFSampleBufferDelegate *) initWithCamera:(QAVFCamera *)renderer +-{ +- if (!(self = [super init])) +- return nil; +- +- m_camera = renderer; +- hwFramesContext = nullptr; +- startTime = 0; +- baseTime = 0; +- return self; +-} +- +-- (void)captureOutput:(AVCaptureOutput *)captureOutput +- didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer +- fromConnection:(AVCaptureConnection *)connection +-{ +- Q_UNUSED(connection); +- Q_UNUSED(captureOutput); +- +- // NB: on iOS captureOutput/connection can be nil (when recording a video - +- // avfmediaassetwriter). +- +- CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); +- +- CMTime time = CMSampleBufferGetPresentationTimeStamp(sampleBuffer); +- qint64 frameTime = time.timescale ? time.value*1000/time.timescale : 0; +- if (baseTime == 0) { +- // drop the first frame to get a valid frame start time +- baseTime = frameTime; +- startTime = 0; +- return; +- } +- +- AVFrame *avFrame = allocHWFrame(m_accel.hwFramesContextAsBuffer(), imageBuffer); +- if (!avFrame) +- return; +- +-#ifdef USE_SW_FRAMES +- auto *swFrame = av_frame_alloc(); +- /* retrieve data from GPU to CPU */ +- int ret = av_hwframe_transfer_data(swFrame, avFrame, 0); +- if (ret < 0) { +- qWarning() << "Error transferring the data to system memory\n"; +- av_frame_unref(swFrame); +- } else { +- av_frame_unref(avFrame); +- avFrame = swFrame; +- } +-#endif +- +- QVideoFrameFormat format = QAVFHelpers::videoFormatForImageBuffer(imageBuffer); +- if (!format.isValid()) { +- av_frame_unref(avFrame); +- return; +- } +- +- avFrame->pts = startTime; +- +- QFFmpegVideoBuffer *buffer = new QFFmpegVideoBuffer(avFrame); +- QVideoFrame frame(buffer, format); +- frame.setStartTime(startTime); +- frame.setEndTime(frameTime); +- startTime = frameTime; +- +- m_camera->syncHandleFrame(frame); +-} +- +-- (void) setHWAccel:(QFFmpeg::HWAccel *)accel +-{ +- m_accel = *accel; +-} +- +-@end +- +-QT_BEGIN_NAMESPACE +- +-QAVFCamera::QAVFCamera(QCamera *parent) +- : QAVFCameraBase(parent) +-{ +- m_captureSession = [[AVCaptureSession alloc] init]; +- m_sampleBufferDelegate = [[QAVFSampleBufferDelegate alloc] initWithCamera:this]; +-} +- +-QAVFCamera::~QAVFCamera() +-{ +- [m_sampleBufferDelegate release]; +- [m_videoInput release]; +- [m_videoDataOutput release]; +- [m_captureSession release]; +-} +- +-void QAVFCamera::requestCameraPermissionIfNeeded() +-{ +- if (m_cameraAuthorizationStatus == AVAuthorizationStatusAuthorized) +- return; +- +- switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]) +- { +- case AVAuthorizationStatusAuthorized: +- { +- m_cameraAuthorizationStatus = AVAuthorizationStatusAuthorized; +- break; +- } +- case AVAuthorizationStatusNotDetermined: +- { +- m_cameraAuthorizationStatus = AVAuthorizationStatusNotDetermined; +- QPointer guard(this); +- [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { +- dispatch_async(dispatch_get_main_queue(), ^{ +- if (guard) +- cameraAuthorizationChanged(granted); +- }); +- }]; +- break; +- } +- case AVAuthorizationStatusDenied: +- case AVAuthorizationStatusRestricted: +- { +- m_cameraAuthorizationStatus = AVAuthorizationStatusDenied; +- return; +- } +- } +-} +- +-void QAVFCamera::cameraAuthorizationChanged(bool authorized) +-{ +- if (authorized) { +- m_cameraAuthorizationStatus = AVAuthorizationStatusAuthorized; +- } else { +- m_cameraAuthorizationStatus = AVAuthorizationStatusDenied; +- qWarning() << "User has denied access to camera"; +- } +-} +- +-void QAVFCamera::updateVideoInput() +-{ +- requestCameraPermissionIfNeeded(); +- if (m_cameraAuthorizationStatus != AVAuthorizationStatusAuthorized) +- return; +- +- [m_captureSession beginConfiguration]; +- +- attachVideoInputDevice(); +- +- if (!m_videoDataOutput) { +- m_videoDataOutput = [[[AVCaptureVideoDataOutput alloc] init] autorelease]; +- +- // Configure video output +- m_delegateQueue = dispatch_queue_create("vf_queue", nullptr); +- [m_videoDataOutput +- setSampleBufferDelegate:m_sampleBufferDelegate +- queue:m_delegateQueue]; +- +- [m_captureSession addOutput:m_videoDataOutput]; +- } +- [m_captureSession commitConfiguration]; +- deviceOrientationChanged(); +-} +- +-void QAVFCamera::deviceOrientationChanged(int angle) +-{ +- AVCaptureConnection *connection = [m_videoDataOutput connectionWithMediaType:AVMediaTypeVideo]; +- if (connection == nil || !m_videoDataOutput) +- return; +- +- if (!connection.supportsVideoOrientation) +- return; +- +- if (angle < 0) +- angle = m_orientationHandler.currentOrientation(); +- +- AVCaptureVideoOrientation orientation = AVCaptureVideoOrientationPortrait; +- switch (angle) { +- default: +- break; +- case 90: +- orientation = AVCaptureVideoOrientationLandscapeRight; +- break; +- case 180: +- // this keeps the last orientation, don't do anything +- return; +- case 270: +- orientation = AVCaptureVideoOrientationLandscapeLeft; +- break; +- } +- +- connection.videoOrientation = orientation; +-} +- +-void QAVFCamera::attachVideoInputDevice() +-{ +- if (m_videoInput) { +- [m_captureSession removeInput:m_videoInput]; +- [m_videoInput release]; +- m_videoInput = nullptr; +- } +- +- QByteArray deviceId = m_cameraDevice.id(); +- if (deviceId.isEmpty()) +- return; +- +- AVCaptureDevice *videoDevice = [AVCaptureDevice deviceWithUniqueID: +- [NSString stringWithUTF8String: deviceId.constData()]]; +- +- if (!videoDevice) +- return; +- +- m_videoInput = [AVCaptureDeviceInput +- deviceInputWithDevice:videoDevice +- error:nil]; +- if (m_videoInput && [m_captureSession canAddInput:m_videoInput]) { +- [m_videoInput retain]; +- [m_captureSession addInput:m_videoInput]; +- } else { +- qWarning() << "Failed to create video device input"; +- } +-} +- +-AVCaptureDevice *QAVFCamera::device() const +-{ +- return m_videoInput ? m_videoInput.device : nullptr; +-} +- +-bool QAVFCamera::isActive() const +-{ +- return m_active; +-} +- +-void QAVFCamera::setActive(bool active) +-{ +- if (m_active == active) +- return; +- requestCameraPermissionIfNeeded(); +- if (m_cameraAuthorizationStatus != AVAuthorizationStatusAuthorized) +- return; +- +- m_active = active; +- +- if (active) { +- // According to the doc, the capture device must be locked before +- // startRunning to prevent the format we set to be overridden by the +- // session preset. +- [m_videoInput.device lockForConfiguration:nil]; +- [m_captureSession startRunning]; +- [m_videoInput.device unlockForConfiguration]; +- } else { +- [m_captureSession stopRunning]; +- } +- +- emit activeChanged(active); +-} +- +-void QAVFCamera::setCaptureSession(QPlatformMediaCaptureSession *session) +-{ +- m_session = session ? session->captureSession() : nullptr; +-} +- +-void QAVFCamera::setCamera(const QCameraDevice &camera) +-{ +- if (m_cameraDevice == camera) +- return; +- +- m_cameraDevice = camera; +- +- requestCameraPermissionIfNeeded(); +- if (m_cameraAuthorizationStatus == AVAuthorizationStatusAuthorized) +- updateVideoInput(); +- setCameraFormat({}); +-} +- +-bool QAVFCamera::setCameraFormat(const QCameraFormat &format) +-{ +- if (m_cameraFormat == format && !format.isNull()) +- return true; +- +- QAVFCameraBase::setCameraFormat(format); +- updateCameraFormat(); +- return true; +-} +- +-void QAVFCamera::updateCameraFormat() +-{ +- AVCaptureDevice *captureDevice = device(); +- if (!captureDevice) +- return; +- +- uint avPixelFormat = 0; +- AVCaptureDeviceFormat *newFormat = qt_convert_to_capture_device_format(captureDevice, m_cameraFormat); +- if (newFormat) { +- qt_set_active_format(captureDevice, newFormat, false); +- avPixelFormat = setPixelFormat(m_cameraFormat.pixelFormat()); +- } +- +- hwAccel = QFFmpeg::HWAccel(AV_HWDEVICE_TYPE_VIDEOTOOLBOX); +- hwAccel.createFramesContext(av_map_videotoolbox_format_to_pixfmt(avPixelFormat), m_cameraFormat.resolution()); +- [m_sampleBufferDelegate setHWAccel:&hwAccel]; +-} +- +-uint QAVFCamera::setPixelFormat(const QVideoFrameFormat::PixelFormat pixelFormat) +-{ +- // Default to 32BGRA pixel formats on the viewfinder, in case the requested +- // format can't be used (shouldn't happen unless the developers sets a wrong camera +- // format on the camera). +- unsigned avPixelFormat = kCVPixelFormatType_32BGRA; +- if (!QAVFHelpers::toCVPixelFormat(pixelFormat, avPixelFormat)) +- qWarning() << "QCamera::setCameraFormat: couldn't convert requested pixel format, using ARGB32"; +- +- bool isSupported = false; +- NSArray *supportedPixelFormats = m_videoDataOutput.availableVideoCVPixelFormatTypes; +- for (NSNumber *currentPixelFormat in supportedPixelFormats) +- { +- if ([currentPixelFormat unsignedIntValue] == avPixelFormat) { +- isSupported = true; +- break; +- } +- } +- +- if (isSupported) { +- NSDictionary* outputSettings = @{ +- (NSString *)kCVPixelBufferPixelFormatTypeKey: [NSNumber numberWithUnsignedInt:avPixelFormat], +- (NSString *)kCVPixelBufferMetalCompatibilityKey: @true +- }; +- m_videoDataOutput.videoSettings = outputSettings; +- } else { +- qWarning() << "QCamera::setCameraFormat: requested pixel format not supported. Did you use a camera format from another camera?"; +- } +- return avPixelFormat; +-} +- +-void QAVFCamera::syncHandleFrame(const QVideoFrame &frame) +-{ +- Q_EMIT newVideoFrame(frame); +-} +- +-QT_END_NAMESPACE +- +-#include "moc_qavfcamera_p.cpp" +diff --git a/src/plugins/multimedia/ffmpeg/qavfcamera_p.h b/src/plugins/multimedia/ffmpeg/qavfcamera_p.h +deleted file mode 100644 +index 281ebf672..000000000 +--- a/src/plugins/multimedia/ffmpeg/qavfcamera_p.h ++++ /dev/null +@@ -1,87 +0,0 @@ +-// Copyright (C) 2022 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#ifndef QAVFCAMERA_H +-#define QAVFCAMERA_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qavfcamerabase_p.h" +-#include +-#include +-#define AVMediaType XAVMediaType +-#include "qffmpeghwaccel_p.h" +-#undef AVMediaType +- +-#include +-#include +-#include +- +-#include +- +-Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureSession); +-Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureDeviceInput); +-Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureVideoDataOutput); +-Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureDevice); +-Q_FORWARD_DECLARE_OBJC_CLASS(QAVFSampleBufferDelegate); +- +-QT_BEGIN_NAMESPACE +- +-class QFFmpegVideoSink; +- +-class QAVFCamera : public QAVFCameraBase +-{ +- Q_OBJECT +- +-public: +- explicit QAVFCamera(QCamera *parent); +- ~QAVFCamera(); +- +- bool isActive() const override; +- void setActive(bool active) override; +- +- void setCaptureSession(QPlatformMediaCaptureSession *) override; +- +- void setCamera(const QCameraDevice &camera) override; +- bool setCameraFormat(const QCameraFormat &format) override; +- +- void syncHandleFrame(const QVideoFrame &frame); +- +- void deviceOrientationChanged(int angle = -1); +- +- const void *ffmpegHWAccel() const override { return &hwAccel; } +- +-private: +- void requestCameraPermissionIfNeeded(); +- void cameraAuthorizationChanged(bool authorized); +- void updateCameraFormat(); +- void updateVideoInput(); +- void attachVideoInputDevice(); +- uint setPixelFormat(const QVideoFrameFormat::PixelFormat pixelFormat); +- +- AVCaptureDevice *device() const; +- +- QMediaCaptureSession *m_session = nullptr; +- AVCaptureSession *m_captureSession = nullptr; +- AVCaptureDeviceInput *m_videoInput = nullptr; +- AVCaptureVideoDataOutput *m_videoDataOutput = nullptr; +- QAVFSampleBufferDelegate *m_sampleBufferDelegate = nullptr; +- dispatch_queue_t m_delegateQueue; +- QVideoOutputOrientationHandler m_orientationHandler; +- QFFmpeg::HWAccel hwAccel; +-}; +- +-QT_END_NAMESPACE +- +- +-#endif // QFFMPEGCAMERA_H +- +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeg_p.h b/src/plugins/multimedia/ffmpeg/qffmpeg_p.h +deleted file mode 100644 +index 3f06f5f56..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeg_p.h ++++ /dev/null +@@ -1,47 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEG_P_H +-#define QFFMPEG_P_H +- +-#include +-#include +- +-extern "C" { +-#include +-#include +-#include +-#include +-#include +-} +- +-#define QT_FFMPEG_OLD_CHANNEL_LAYOUT (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)) +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg +-{ +- +-inline qint64 timeStamp(qint64 ts, AVRational base) +-{ +- return (1000*ts*base.num + 500)/base.den; +-} +- +-inline qint64 timeStampUs(qint64 ts, AVRational base) +-{ +- return (1000000*ts*base.num + 500000)/base.den; +-} +- +-inline float toFloat(AVRational r) { return float(r.num)/float(r.den); } +- +-inline QString err2str(int errnum) +-{ +- char buffer[AV_ERROR_MAX_STRING_SIZE + 1] = {}; +- av_make_error_string(buffer, AV_ERROR_MAX_STRING_SIZE, errnum); +- return QString::fromLocal8Bit(buffer); +-} +- +-QT_END_NAMESPACE +- +-} +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegaudiodecoder.cpp b/src/plugins/multimedia/ffmpeg/qffmpegaudiodecoder.cpp +deleted file mode 100644 +index 28e9044ed..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegaudiodecoder.cpp ++++ /dev/null +@@ -1,241 +0,0 @@ +-// Copyright (C) 2020 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-//#define DEBUG_DECODER +- +-#include "qffmpegaudiodecoder_p.h" +-#include "qffmpegdecoder_p.h" +-#include "qffmpegmediaformatinfo_p.h" +-#include "qffmpegresampler_p.h" +-#include "qaudiobuffer.h" +- +-#include +- +-Q_LOGGING_CATEGORY(qLcAudioDecoder, "qt.multimedia.ffmpeg.audioDecoder") +- +-#define MAX_BUFFERS_IN_QUEUE 4 +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg +-{ +- +-class SteppingAudioRenderer : public Renderer +-{ +-public: +- SteppingAudioRenderer(AudioDecoder *decoder, const QAudioFormat &format); +- ~SteppingAudioRenderer() +- { +- } +- +- void loop() override; +- AudioDecoder *m_decoder; +- QAudioFormat m_format; +- std::unique_ptr resampler; +- bool atEndEmitted = false; +-}; +- +-class AudioDecoder : public Decoder +-{ +- Q_OBJECT +-public: +- explicit AudioDecoder(QFFmpegAudioDecoder *audioDecoder) +- : Decoder(audioDecoder) +- {} +- +- void setup(const QAudioFormat &format) +- { +- connect(this, &AudioDecoder::newAudioBuffer, audioDecoder, &QFFmpegAudioDecoder::newAudioBuffer); +- connect(this, &AudioDecoder::isAtEnd, audioDecoder, &QFFmpegAudioDecoder::done); +- m_format = format; +- audioRenderer = new SteppingAudioRenderer(this, format); +- audioRenderer->start(); +- auto *stream = demuxer->addStream(m_currentAVStreamIndex[QPlatformMediaPlayer::AudioStream]); +- audioRenderer->setStream(stream); +- } +- +- void nextBuffer() +- { +- audioRenderer->setPaused(false); +- } +- +-Q_SIGNALS: +- void newAudioBuffer(const QAudioBuffer &b); +- void isAtEnd(); +- +-private: +- QAudioFormat m_format; +-}; +- +-SteppingAudioRenderer::SteppingAudioRenderer(AudioDecoder *decoder, const QAudioFormat &format) +- : Renderer(QPlatformMediaPlayer::AudioStream) +- , m_decoder(decoder) +- , m_format(format) +-{ +-} +- +- +-void SteppingAudioRenderer::loop() +-{ +- if (!streamDecoder) { +- qCDebug(qLcAudioDecoder) << "no stream"; +- timeOut = -1; // Avoid CPU load before play() +- return; +- } +- +- Frame frame = streamDecoder->takeFrame(); +- if (!frame.isValid()) { +- if (streamDecoder->isAtEnd()) { +- if (!atEndEmitted) +- emit m_decoder->isAtEnd(); +- atEndEmitted = true; +- paused = true; +- doneStep(); +- timeOut = -1; +- return; +- } +- timeOut = 10; +- streamDecoder->wake(); +- return; +- } +- qCDebug(qLcAudioDecoder) << " got frame"; +- +- doneStep(); +- +- if (!resampler) +- resampler.reset(new Resampler(frame.codec(), m_format)); +- +- auto buffer = resampler->resample(frame.avFrame()); +- paused = true; +- timeOut = -1; +- +- emit m_decoder->newAudioBuffer(buffer); +-} +- +-} +- +- +-QFFmpegAudioDecoder::QFFmpegAudioDecoder(QAudioDecoder *parent) +- : QPlatformAudioDecoder(parent) +-{ +-} +- +-QFFmpegAudioDecoder::~QFFmpegAudioDecoder() +-{ +- delete decoder; +-} +- +-QUrl QFFmpegAudioDecoder::source() const +-{ +- return m_url; +-} +- +-void QFFmpegAudioDecoder::setSource(const QUrl &fileName) +-{ +- stop(); +- m_sourceDevice = nullptr; +- +- if (m_url == fileName) +- return; +- m_url = fileName; +- +- emit sourceChanged(); +-} +- +-QIODevice *QFFmpegAudioDecoder::sourceDevice() const +-{ +- return m_sourceDevice; +-} +- +-void QFFmpegAudioDecoder::setSourceDevice(QIODevice *device) +-{ +- stop(); +- m_url.clear(); +- bool isSignalRequired = (m_sourceDevice != device); +- m_sourceDevice = device; +- if (isSignalRequired) +- sourceChanged(); +-} +- +-void QFFmpegAudioDecoder::start() +-{ +- qCDebug(qLcAudioDecoder) << "start"; +- delete decoder; +- decoder = new QFFmpeg::AudioDecoder(this); +- decoder->setMedia(m_url, m_sourceDevice); +- if (error() != QAudioDecoder::NoError) +- goto error; +- +- decoder->setup(m_audioFormat); +- if (error() != QAudioDecoder::NoError) +- goto error; +- decoder->play(); +- if (error() != QAudioDecoder::NoError) +- goto error; +- decoder->nextBuffer(); +- if (error() != QAudioDecoder::NoError) +- goto error; +- +- setIsDecoding(true); +- return; +- +- error: +- durationChanged(-1); +- positionChanged(-1); +- delete decoder; +- decoder = nullptr; +- +-} +- +-void QFFmpegAudioDecoder::stop() +-{ +- qCDebug(qLcAudioDecoder) << ">>>>> stop"; +- if (decoder) { +- decoder->stop(); +- done(); +- } +-} +- +-QAudioFormat QFFmpegAudioDecoder::audioFormat() const +-{ +- return m_audioFormat; +-} +- +-void QFFmpegAudioDecoder::setAudioFormat(const QAudioFormat &format) +-{ +- if (m_audioFormat == format) +- return; +- +- m_audioFormat = format; +- formatChanged(m_audioFormat); +-} +- +-QAudioBuffer QFFmpegAudioDecoder::read() +-{ +- auto b = m_audioBuffer; +- qCDebug(qLcAudioDecoder) << "reading buffer" << b.startTime(); +- m_audioBuffer = {}; +- bufferAvailableChanged(false); +- if (decoder) +- decoder->nextBuffer(); +- return b; +-} +- +-void QFFmpegAudioDecoder::newAudioBuffer(const QAudioBuffer &b) +-{ +- qCDebug(qLcAudioDecoder) << "new audio buffer" << b.startTime(); +- m_audioBuffer = b; +- const qint64 pos = b.startTime(); +- positionChanged(pos/1000); +- bufferAvailableChanged(b.isValid()); +- bufferReady(); +-} +- +-void QFFmpegAudioDecoder::done() +-{ +- qCDebug(qLcAudioDecoder) << ">>>>> DONE!"; +- finished(); +-} +- +-QT_END_NAMESPACE +- +-#include "qffmpegaudiodecoder.moc" +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegaudiodecoder_p.h b/src/plugins/multimedia/ffmpeg/qffmpegaudiodecoder_p.h +deleted file mode 100644 +index 252784984..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegaudiodecoder_p.h ++++ /dev/null +@@ -1,68 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#ifndef QFFMPEGAUDIODECODER_H +-#define QFFMPEGAUDIODECODER_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "private/qplatformaudiodecoder_p.h" +-#include +- +-#include +-#include +-#include +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg { +-class AudioDecoder; +-} +- +-class QFFmpegAudioDecoder : public QPlatformAudioDecoder +-{ +- Q_OBJECT +- +-public: +- QFFmpegAudioDecoder(QAudioDecoder *parent); +- virtual ~QFFmpegAudioDecoder(); +- +- QUrl source() const override; +- void setSource(const QUrl &fileName) override; +- +- QIODevice *sourceDevice() const override; +- void setSourceDevice(QIODevice *device) override; +- +- void start() override; +- void stop() override; +- +- QAudioFormat audioFormat() const override; +- void setAudioFormat(const QAudioFormat &format) override; +- +- QAudioBuffer read() override; +- +-public Q_SLOTS: +- void newAudioBuffer(const QAudioBuffer &b); +- void done(); +- +-private: +- QUrl m_url; +- QIODevice *m_sourceDevice = nullptr; +- QFFmpeg::AudioDecoder *decoder = nullptr; +- QAudioFormat m_audioFormat; +- +- QAudioBuffer m_audioBuffer; +-}; +- +-QT_END_NAMESPACE +- +-#endif // QFFMPEGAUDIODECODER_H +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegaudioinput.cpp b/src/plugins/multimedia/ffmpeg/qffmpegaudioinput.cpp +deleted file mode 100644 +index 5c769d524..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegaudioinput.cpp ++++ /dev/null +@@ -1,189 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#include "qffmpegaudioinput_p.h" +-#include +-#include +-#include +-#include +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg { +- +-class AudioSourceIO : public QIODevice +-{ +- Q_OBJECT +- public: +- AudioSourceIO(QFFmpegAudioInput *audioInput) +- : QIODevice() +- , input(audioInput) +- { +- m_muted = input->muted; +- m_volume = input->volume; +- updateVolume(); +- open(QIODevice::WriteOnly); +- } +- ~AudioSourceIO() +- { +- delete m_src; +- } +- +- void setDevice(const QAudioDevice &device) +- { +- QMutexLocker locker(&mutex); +- if (m_device == device) +- return; +- m_device = device; +- QMetaObject::invokeMethod(this, "updateSource"); +- } +- void setFrameSize(int s) +- { +- QMutexLocker locker(&mutex); +- frameSize = s; +- bufferSize = m_format.bytesForFrames(frameSize); +- } +- void setRunning(bool r) { +- QMutexLocker locker(&mutex); +- if (m_running == r) +- return; +- m_running = r; +- QMetaObject::invokeMethod(this, "updateRunning"); +- } +- +- void setVolume(float vol) { +- QMutexLocker locker(&mutex); +- m_volume = vol; +- QMetaObject::invokeMethod(this, "updateVolume"); +- } +- void setMuted(bool muted) { +- QMutexLocker locker(&mutex); +- m_muted = muted; +- QMetaObject::invokeMethod(this, "updateVolume"); +- } +- +- +-protected: +- qint64 readData(char *, qint64) override +- { +- return 0; +- } +- qint64 writeData(const char *data, qint64 len) override +- { +- int l = len; +- while (len > 0) { +- int toAppend = qMin(len, bufferSize - pcm.size()); +- pcm.append(data, toAppend); +- data += toAppend; +- len -= toAppend; +- if (pcm.size() == bufferSize) +- sendBuffer(); +- } +- +- return l; +- } +- +-private Q_SLOTS: +- void updateSource() { +- QMutexLocker locker(&mutex); +- m_format = m_device.preferredFormat(); +- if (m_src) { +- delete m_src; +- pcm.clear(); +- } +- m_src = new QAudioSource(m_device, m_format); +- updateVolume(); +- if (m_running) +- m_src->start(this); +- } +- void updateVolume() +- { +- if (m_src) +- m_src->setVolume(m_muted ? 0. : m_volume); +- } +- void updateRunning() +- { +- QMutexLocker locker(&mutex); +- if (m_running) { +- if (!m_src) +- updateSource(); +- m_src->start(this); +- } else { +- m_src->stop(); +- } +- } +- +-private: +- +- void sendBuffer() +- { +- QAudioFormat fmt = m_src->format(); +- qint64 time = fmt.durationForBytes(processed); +- QAudioBuffer buffer(pcm, fmt, time); +- emit input->newAudioBuffer(buffer); +- processed += bufferSize; +- pcm.clear(); +- } +- +- QMutex mutex; +- QAudioDevice m_device; +- float m_volume = 1.; +- bool m_muted = false; +- bool m_running = false; +- +- QFFmpegAudioInput *input = nullptr; +- QAudioSource *m_src = nullptr; +- QAudioFormat m_format; +- int frameSize = 0; +- int bufferSize = 0; +- qint64 processed = 0; +- QByteArray pcm; +-}; +- +-} +- +-QFFmpegAudioInput::QFFmpegAudioInput(QAudioInput *qq) +- : QPlatformAudioInput(qq) +-{ +- qRegisterMetaType(); +- +- inputThread = new QThread; +- audioIO = new QFFmpeg::AudioSourceIO(this); +- audioIO->moveToThread(inputThread); +- inputThread->start(); +-} +- +-QFFmpegAudioInput::~QFFmpegAudioInput() +-{ +- inputThread->exit(); +- inputThread->wait(); +- delete inputThread; +-} +- +-void QFFmpegAudioInput::setAudioDevice(const QAudioDevice &device) +-{ +- audioIO->setDevice(device); +-} +- +-void QFFmpegAudioInput::setMuted(bool muted) +-{ +- audioIO->setMuted(muted); +-} +- +-void QFFmpegAudioInput::setVolume(float volume) +-{ +- audioIO->setVolume(volume); +-} +- +-void QFFmpegAudioInput::setFrameSize(int s) +-{ +- audioIO->setFrameSize(s); +-} +- +-void QFFmpegAudioInput::setRunning(bool b) +-{ +- audioIO->setRunning(b); +-} +- +-QT_END_NAMESPACE +- +-#include "qffmpegaudioinput.moc" +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegaudioinput_p.h b/src/plugins/multimedia/ffmpeg/qffmpegaudioinput_p.h +deleted file mode 100644 +index f81549748..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegaudioinput_p.h ++++ /dev/null +@@ -1,54 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGAUDIOINPUT_H +-#define QFFMPEGAUDIOINPUT_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include +-#include "qffmpegthread_p.h" +-#include +- +-QT_BEGIN_NAMESPACE +- +-class QAudioSource; +-class QAudioBuffer; +-namespace QFFmpeg { +-class AudioSourceIO; +-} +- +-class QFFmpegAudioInput : public QObject, public QPlatformAudioInput +-{ +- Q_OBJECT +-public: +- QFFmpegAudioInput(QAudioInput *qq); +- ~QFFmpegAudioInput(); +- +- void setAudioDevice(const QAudioDevice &/*device*/) override; +- void setMuted(bool /*muted*/) override; +- void setVolume(float /*volume*/) override; +- +- void setFrameSize(int s); +- void setRunning(bool b); +- +-Q_SIGNALS: +- void newAudioBuffer(const QAudioBuffer &buffer); +- +-private: +- QThread *inputThread = nullptr; +- QFFmpeg::AudioSourceIO *audioIO = nullptr; +-}; +- +-QT_END_NAMESPACE +- +- +-#endif // QPLATFORMAUDIOINPUT_H +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegclock.cpp b/src/plugins/multimedia/ffmpeg/qffmpegclock.cpp +deleted file mode 100644 +index c080c55df..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegclock.cpp ++++ /dev/null +@@ -1,209 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#include +-#include +- +-Q_LOGGING_CATEGORY(qLcClock, "qt.multimedia.ffmpeg.clock") +- +-QT_BEGIN_NAMESPACE +- +-static bool compareClocks(const QFFmpeg::Clock *a, const QFFmpeg::Clock *b) +-{ +- if (!b) +- return false; +- +- if (!a) +- return true; +- +- return a->type() < b->type(); +-} +- +-QFFmpeg::Clock::Clock(ClockController *controller) +- : controller(controller) +-{ +- Q_ASSERT(controller); +- controller->addClock(this); +-} +- +-QFFmpeg::Clock::~Clock() +-{ +- if (controller) +- controller->removeClock(this); +-} +- +-qint64 QFFmpeg::Clock::currentTime() const +-{ +- return controller ? controller->currentTime() : 0; +-} +- +-void QFFmpeg::Clock::syncTo(qint64 time) +-{ +- qCDebug(qLcClock) << "syncTo" << time << isMaster(); +-} +- +-void QFFmpeg::Clock::setPlaybackRate(float rate, qint64 currentTime) +-{ +- qCDebug(qLcClock) << "Clock::setPlaybackRate" << rate; +- Q_UNUSED(rate) +- Q_UNUSED(currentTime) +-} +- +-void QFFmpeg::Clock::setPaused(bool paused) +-{ +- qCDebug(qLcClock) << "Clock::setPaused" << paused; +- Q_UNUSED(paused) +-} +- +-qint64 QFFmpeg::Clock::timeUpdated(qint64 currentTime) +-{ +- if (controller) +- return controller->timeUpdated(this, currentTime); +- return currentTime; +-} +- +-qint64 QFFmpeg::Clock::usecsTo(qint64 currentTime, qint64 displayTime) +-{ +- if (!controller || controller->m_isPaused) +- return -1; +- const qint64 t = qRound64((displayTime - currentTime) / playbackRate()); +- return t < 0 ? 0 : t; +-} +- +-QFFmpeg::Clock::Type QFFmpeg::Clock::type() const +-{ +- return SystemClock; +-} +- +-QFFmpeg::ClockController::~ClockController() +-{ +- for (auto *p : qAsConst(m_clocks)) +- p->setController(nullptr); +-} +- +-qint64 QFFmpeg::ClockController::timeUpdated(Clock *clock, qint64 time) +-{ +- QMutexLocker l(&m_mutex); +- if (!isMaster(clock)) { +- // If the clock isn't the master clock, simply return the current time +- // so we can make adjustments as needed +- return currentTimeNoLock(); +- } +- +- // if the clock is the master, adjust our base timing +- m_baseTime = time; +- m_elapsedTimer.restart(); +- +- // Avoid posting too many updates to the notifyObject, or we can overload +- // the event queue with too many notifications +- if (qAbs(time - m_lastMasterTime) < 5000) +- return time; +- m_lastMasterTime = time; +-// qCDebug(qLcClock) << "ClockController::timeUpdated(master)" << time << "skew" << skew(); +- if (notifyObject) +- notify.invoke(notifyObject, Qt::QueuedConnection, Q_ARG(qint64, time)); +- return time; +-} +- +-void QFFmpeg::ClockController::addClock(Clock *clock) +-{ +- qCDebug(qLcClock) << "addClock" << clock; +- Q_ASSERT(clock != nullptr); +- +- if (m_clocks.contains(clock)) +- return; +- +- m_clocks.append(clock); +- m_master = std::max(m_master.loadAcquire(), clock, compareClocks); +- +- clock->syncTo(currentTime()); +- clock->setPaused(m_isPaused); +-} +- +-void QFFmpeg::ClockController::removeClock(Clock *clock) +-{ +- qCDebug(qLcClock) << "removeClock" << clock; +- m_clocks.removeAll(clock); +- if (m_master == clock) { +- // find a new master clock +- m_master = m_clocks.empty() +- ? nullptr +- : *std::max_element(m_clocks.begin(), m_clocks.end(), compareClocks); +- } +-} +- +-bool QFFmpeg::ClockController::isMaster(const Clock *clock) const +-{ +- return m_master.loadAcquire() == clock; +-} +- +-qint64 QFFmpeg::ClockController::currentTimeNoLock() const +-{ +- return m_isPaused ? m_baseTime : m_baseTime + m_elapsedTimer.elapsed() / m_playbackRate; +-} +- +-qint64 QFFmpeg::ClockController::currentTime() const +-{ +- QMutexLocker l(&m_mutex); +- return currentTimeNoLock(); +-} +- +-void QFFmpeg::ClockController::syncTo(qint64 usecs) +-{ +- { +- QMutexLocker l(&m_mutex); +- qCDebug(qLcClock) << "syncTo" << usecs; +- m_baseTime = usecs; +- m_seekTime = usecs; +- m_elapsedTimer.restart(); +- } +- +- for (auto *p : qAsConst(m_clocks)) +- p->syncTo(usecs); +-} +- +-void QFFmpeg::ClockController::setPlaybackRate(float rate) +-{ +- qint64 baseTime = 0; +- { +- qCDebug(qLcClock) << "setPlaybackRate" << rate; +- +- QMutexLocker l(&m_mutex); +- +- m_baseTime = baseTime = currentTimeNoLock(); +- m_elapsedTimer.restart(); +- m_playbackRate = rate; +- } +- +- for (auto *p : qAsConst(m_clocks)) +- p->setPlaybackRate(rate, baseTime); +-} +- +-void QFFmpeg::ClockController::setPaused(bool paused) +-{ +- { +- QMutexLocker l(&m_mutex); +- if (m_isPaused == paused) +- return; +- qCDebug(qLcClock) << "setPaused" << paused; +- m_isPaused = paused; +- if (m_isPaused) { +- m_baseTime = currentTimeNoLock(); +- m_seekTime = m_baseTime; +- } else { +- m_elapsedTimer.restart(); +- } +- } +- +- for (auto *p : qAsConst(m_clocks)) +- p->setPaused(paused); +-} +- +-void QFFmpeg::ClockController::setNotify(QObject *object, QMetaMethod method) +-{ +- QMutexLocker l(&m_mutex); +- +- notifyObject = object; +- notify = method; +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegclock_p.h b/src/plugins/multimedia/ffmpeg/qffmpegclock_p.h +deleted file mode 100644 +index b09f7bd6d..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegclock_p.h ++++ /dev/null +@@ -1,120 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGCLOCK_P_H +-#define QFFMPEGCLOCK_P_H +- +-#include "qffmpeg_p.h" +- +-#include +-#include +-#include +-#include +-#include +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg { +- +-class ClockController; +- +-// Clock runs in displayTime, ie. if playbackRate is not 1, it runs faster or slower +-// than a regular clock. All methods take displayTime +-// Exception: usecsTo() will return the real time that should pass until we will +-// hit the requested display time +-class Clock +-{ +- ClockController *controller = nullptr; +-public: +- enum Type { +- SystemClock, +- AudioClock +- }; +- Clock(ClockController *controller); +- virtual ~Clock(); +- virtual Type type() const; +- +- float playbackRate() const; +- bool isMaster() const; +- +- // all times in usecs +- qint64 currentTime() const; +- qint64 seekTime() const; +- qint64 usecsTo(qint64 currentTime, qint64 displayTime); +- +-protected: +- virtual void syncTo(qint64 usecs); +- virtual void setPlaybackRate(float rate, qint64 currentTime); +- virtual void setPaused(bool paused); +- +- qint64 timeUpdated(qint64 currentTime); +- +-private: +- friend class ClockController; +- void setController(ClockController *c) +- { +- controller = c; +- } +-}; +- +-class ClockController +-{ +- mutable QMutex m_mutex; +- QList m_clocks; +- QAtomicPointer m_master = nullptr; +- +- QElapsedTimer m_elapsedTimer; +- qint64 m_baseTime = 0; +- qint64 m_seekTime = 0; +- float m_playbackRate = 1.; +- bool m_isPaused = true; +- +- qint64 m_lastMasterTime = 0; +- QObject *notifyObject = nullptr; +- QMetaMethod notify; +- qint64 currentTimeNoLock() const; +- +- friend class Clock; +- qint64 timeUpdated(Clock *clock, qint64 time); +- void addClock(Clock *provider); +- void removeClock(Clock *provider); +- bool isMaster(const Clock *clock) const; +- +-public: +- // max 5 msecs tolerance for the clock +- enum { NotificationTolerance = 5000 }; +- ClockController() = default; +- ~ClockController(); +- +- +- qint64 currentTime() const; +- +- void syncTo(qint64 usecs); +- +- void setPlaybackRate(float s); +- float playbackRate() const { return m_playbackRate; } +- void setPaused(bool paused); +- +- void setNotify(QObject *object, QMetaMethod method); +-}; +- +-inline float Clock::playbackRate() const +-{ +- return controller ? controller->m_playbackRate : 1.; +-} +- +-inline bool Clock::isMaster() const +-{ +- return controller && controller->isMaster(this); +-} +- +-inline qint64 Clock::seekTime() const +-{ +- return controller ? controller->m_seekTime : 0; +-} +- +- +-} +- +-QT_END_NAMESPACE +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegdecoder.cpp b/src/plugins/multimedia/ffmpeg/qffmpegdecoder.cpp +deleted file mode 100644 +index f37a10174..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegdecoder.cpp ++++ /dev/null +@@ -1,1368 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpegdecoder_p.h" +-#include "qffmpegmediaformatinfo_p.h" +-#include "qffmpeg_p.h" +-#include "qffmpegmediametadata_p.h" +-#include "qffmpegvideobuffer_p.h" +-#include "private/qplatformaudiooutput_p.h" +-#include "qffmpeghwaccel_p.h" +-#include "qffmpegvideosink_p.h" +-#include "qvideosink.h" +-#include "qaudiosink.h" +-#include "qaudiooutput.h" +-#include "qffmpegaudiodecoder_p.h" +-#include "qffmpegresampler_p.h" +- +-#include +-#include +- +-#include +- +-extern "C" { +-#include +-} +- +-QT_BEGIN_NAMESPACE +- +-using namespace QFFmpeg; +- +-Q_LOGGING_CATEGORY(qLcDemuxer, "qt.multimedia.ffmpeg.demuxer") +-Q_LOGGING_CATEGORY(qLcDecoder, "qt.multimedia.ffmpeg.decoder") +-Q_LOGGING_CATEGORY(qLcVideoRenderer, "qt.multimedia.ffmpeg.videoRenderer") +-Q_LOGGING_CATEGORY(qLcAudioRenderer, "qt.multimedia.ffmpeg.audioRenderer") +- +-Codec::Data::Data(AVCodecContext *context, AVStream *stream, const HWAccel &hwAccel) +- : context(context) +- , stream(stream) +- , hwAccel(hwAccel) +-{ +-} +- +-Codec::Data::~Data() +-{ +- if (!context) +- return; +- avcodec_close(context); +- avcodec_free_context(&context); +-} +- +-Codec::Codec(AVFormatContext *format, int streamIndex) +-{ +- qCDebug(qLcDecoder) << "Codec::Codec" << streamIndex; +- Q_ASSERT(streamIndex >= 0 && streamIndex < (int)format->nb_streams); +- +- AVStream *stream = format->streams[streamIndex]; +- const AVCodec *decoder = +- QFFmpeg::HWAccel::hardwareDecoderForCodecId(stream->codecpar->codec_id); +- +- if (!decoder) { +- qCDebug(qLcDecoder) << "Failed to find a valid FFmpeg decoder"; +- return; +- } +- +- QFFmpeg::HWAccel hwAccel; +- if (decoder->type == AVMEDIA_TYPE_VIDEO) { +- hwAccel = QFFmpeg::HWAccel(decoder); +- } +- +- auto *context = avcodec_alloc_context3(decoder); +- if (!context) { +- qCDebug(qLcDecoder) << "Failed to allocate a FFmpeg codec context"; +- return; +- } +- +- int ret = avcodec_parameters_to_context(context, stream->codecpar); +- if (ret < 0) { +- qCDebug(qLcDecoder) << "Failed to set FFmpeg codec parameters"; +- return; +- } +- +- auto *buf = hwAccel.hwDeviceContextAsBuffer(); +- if (buf) +- context->hw_device_ctx = av_buffer_ref(buf); +- // ### This still gives errors about wrong HW formats (as we accept all of them) +- // But it would be good to get so we can filter out pixel format we don't support natively +- context->get_format = QFFmpeg::getFormat; +- +- /* Init the decoder, with reference counting and threading */ +- AVDictionary *opts = nullptr; +- av_dict_set(&opts, "refcounted_frames", "1", 0); +- av_dict_set(&opts, "threads", "auto", 0); +- ret = avcodec_open2(context, decoder, &opts); +- if (ret < 0) { +- qCDebug(qLcDecoder) << "Failed to open FFmpeg codec context."; +- avcodec_free_context(&context); +- return; +- } +- +- d = new Data(context, stream, hwAccel); +-} +- +- +-Demuxer::Demuxer(Decoder *decoder, AVFormatContext *context) +- : Thread() +- , decoder(decoder) +- , context(context) +-{ +- QString objectName = QLatin1String("Demuxer"); +- setObjectName(objectName); +- +- streamDecoders.resize(context->nb_streams); +-} +- +-Demuxer::~Demuxer() +-{ +- if (context) { +- if (context->pb) { +- av_free(context->pb); +- context->pb = nullptr; +- } +- avformat_free_context(context); +- } +-} +- +-StreamDecoder *Demuxer::addStream(int streamIndex) +-{ +- if (streamIndex < 0) +- return nullptr; +- QMutexLocker locker(&mutex); +- Codec codec(context, streamIndex); +- if (!codec.isValid()) { +- decoder->error(QMediaPlayer::FormatError, "Invalid media file"); +- return nullptr; +- } +- +- Q_ASSERT(codec.context()->codec_type == AVMEDIA_TYPE_AUDIO || +- codec.context()->codec_type == AVMEDIA_TYPE_VIDEO || +- codec.context()->codec_type == AVMEDIA_TYPE_SUBTITLE); +- auto *stream = new StreamDecoder(this, codec); +- Q_ASSERT(!streamDecoders.at(streamIndex)); +- streamDecoders[streamIndex] = stream; +- stream->start(); +- updateEnabledStreams(); +- return stream; +-} +- +-void Demuxer::removeStream(int streamIndex) +-{ +- if (streamIndex < 0) +- return; +- QMutexLocker locker(&mutex); +- Q_ASSERT(streamIndex < (int)context->nb_streams); +- Q_ASSERT(streamDecoders.at(streamIndex) != nullptr); +- streamDecoders[streamIndex] = nullptr; +- updateEnabledStreams(); +-} +- +-void Demuxer::stopDecoding() +-{ +- qCDebug(qLcDemuxer) << "StopDecoding"; +- QMutexLocker locker(&mutex); +- sendFinalPacketToStreams(); +-} +-int Demuxer::seek(qint64 pos) +-{ +- QMutexLocker locker(&mutex); +- for (StreamDecoder *d : qAsConst(streamDecoders)) { +- if (d) +- d->mutex.lock(); +- } +- for (StreamDecoder *d : qAsConst(streamDecoders)) { +- if (d) +- d->flush(); +- } +- for (StreamDecoder *d : qAsConst(streamDecoders)) { +- if (d) +- d->mutex.unlock(); +- } +- qint64 seekPos = pos*AV_TIME_BASE/1000000; // usecs to AV_TIME_BASE +- av_seek_frame(context, -1, seekPos, AVSEEK_FLAG_BACKWARD); +- last_pts = -1; +- loop(); +- qCDebug(qLcDemuxer) << "Demuxer::seek" << pos << last_pts; +- return last_pts; +-} +- +-void Demuxer::updateEnabledStreams() +-{ +- if (isStopped()) +- return; +- for (uint i = 0; i < context->nb_streams; ++i) { +- AVDiscard discard = AVDISCARD_DEFAULT; +- if (!streamDecoders.at(i)) +- discard = AVDISCARD_ALL; +- context->streams[i]->discard = discard; +- } +-} +- +-void Demuxer::sendFinalPacketToStreams() +-{ +- if (m_isStopped.loadAcquire()) +- return; +- for (auto *streamDecoder : qAsConst(streamDecoders)) { +- qCDebug(qLcDemuxer) << "Demuxer: sending last packet to stream" << streamDecoder; +- if (!streamDecoder) +- continue; +- streamDecoder->addPacket(nullptr); +- } +- m_isStopped.storeRelease(true); +-} +- +-void Demuxer::init() +-{ +- qCDebug(qLcDemuxer) << "Demuxer started"; +-} +- +-void Demuxer::cleanup() +-{ +- qCDebug(qLcDemuxer) << "Demuxer::cleanup"; +-#ifndef QT_NO_DEBUG +- for (auto *streamDecoder : qAsConst(streamDecoders)) { +- Q_ASSERT(!streamDecoder); +- } +-#endif +- avformat_close_input(&context); +- Thread::cleanup(); +-} +- +-bool Demuxer::shouldWait() const +-{ +- if (m_isStopped) +- return true; +-// qCDebug(qLcDemuxer) << "XXXX Demuxer::shouldWait" << this << data->seek_pos.loadRelaxed(); +- // require a minimum of 200ms of data +- qint64 queueSize = 0; +- bool buffersFull = true; +- for (auto *d : streamDecoders) { +- if (!d) +- continue; +- if (d->queuedDuration() < 200) +- buffersFull = false; +- queueSize += d->queuedPacketSize(); +- } +-// qCDebug(qLcDemuxer) << " queue size" << queueSize << MaxQueueSize; +- if (queueSize > MaxQueueSize) +- return true; +-// qCDebug(qLcDemuxer) << " waiting!"; +- return buffersFull; +- +-} +- +-void Demuxer::loop() +-{ +- AVPacket *packet = av_packet_alloc(); +- if (av_read_frame(context, packet) < 0) { +- sendFinalPacketToStreams(); +- av_packet_free(&packet); +- return; +- } +- +- if (last_pts < 0 && packet->pts != AV_NOPTS_VALUE) { +- auto *stream = context->streams[packet->stream_index]; +- last_pts = timeStamp(packet->pts, stream->time_base); +- } +- +- auto *streamDecoder = streamDecoders.at(packet->stream_index); +- if (!streamDecoder) { +- av_packet_free(&packet); +- return; +- } +- streamDecoder->addPacket(packet); +-} +- +- +-StreamDecoder::StreamDecoder(Demuxer *demuxer, const Codec &codec) +- : Thread() +- , demuxer(demuxer) +- , codec(codec) +-{ +- Q_ASSERT(codec.context()->codec_type == AVMEDIA_TYPE_AUDIO || +- codec.context()->codec_type == AVMEDIA_TYPE_VIDEO || +- codec.context()->codec_type == AVMEDIA_TYPE_SUBTITLE); +- +- QString objectName; +- switch (codec.context()->codec_type) { +- case AVMEDIA_TYPE_AUDIO: +- objectName = QLatin1String("AudioDecoderThread"); +- // Queue size: 3 frames for video/subtitle, 9 for audio +- frameQueue.maxSize = 9; +- break; +- case AVMEDIA_TYPE_VIDEO: +- objectName = QLatin1String("VideoDecoderThread"); +- break; +- case AVMEDIA_TYPE_SUBTITLE: +- objectName = QLatin1String("SubtitleDecoderThread"); +- break; +- default: +- Q_UNREACHABLE(); +- } +- setObjectName(objectName); +-} +- +-void StreamDecoder::addPacket(AVPacket *packet) +-{ +- { +- QMutexLocker locker(&packetQueue.mutex); +-// qCDebug(qLcDecoder) << "enqueuing packet of type" << type() +-// << "size" << packet->size +-// << "stream index" << packet->stream_index +-// << "pts" << codec.toMs(packet->pts) +-// << "duration" << codec.toMs(packet->duration); +- packetQueue.queue.enqueue(Packet(packet)); +- if (packet) { +- packetQueue.size += packet->size; +- packetQueue.duration += codec.toMs(packet->duration); +- } +- eos.storeRelease(false); +- } +- wake(); +-} +- +-void StreamDecoder::flush() +-{ +- qCDebug(qLcDecoder) << ">>>> flushing stream decoder" << type(); +- avcodec_flush_buffers(codec.context()); +- { +- QMutexLocker locker(&packetQueue.mutex); +- packetQueue.queue.clear(); +- packetQueue.size = 0; +- packetQueue.duration = 0; +- } +- { +- QMutexLocker locker(&frameQueue.mutex); +- frameQueue.queue.clear(); +- } +- qCDebug(qLcDecoder) << ">>>> done flushing stream decoder" << type(); +-} +- +-void StreamDecoder::setRenderer(Renderer *r) +-{ +- QMutexLocker locker(&mutex); +- m_renderer = r; +- if (m_renderer) +- m_renderer->wake(); +-} +- +-void StreamDecoder::killHelper() +-{ +- m_renderer = nullptr; +- demuxer->removeStream(codec.streamIndex()); +-} +- +-Packet StreamDecoder::peekPacket() +-{ +- QMutexLocker locker(&packetQueue.mutex); +- if (packetQueue.queue.isEmpty()) { +- if (demuxer) +- demuxer->wake(); +- return {}; +- } +- auto packet = packetQueue.queue.first(); +- +- if (demuxer) +- demuxer->wake(); +- return packet; +-} +- +-Packet StreamDecoder::takePacket() +-{ +- QMutexLocker locker(&packetQueue.mutex); +- if (packetQueue.queue.isEmpty()) { +- if (demuxer) +- demuxer->wake(); +- return {}; +- } +- auto packet = packetQueue.queue.dequeue(); +- if (packet.avPacket()) { +- packetQueue.size -= packet.avPacket()->size; +- packetQueue.duration -= codec.toMs(packet.avPacket()->duration); +- } +-// qCDebug(qLcDecoder) << "<<<< dequeuing packet of type" << type() +-// << "size" << packet.avPacket()->size +-// << "stream index" << packet.avPacket()->stream_index +-// << "pts" << codec.toMs(packet.avPacket()->pts) +-// << "duration" << codec.toMs(packet.avPacket()->duration) +-// << "ts" << decoder->clockController.currentTime(); +- if (demuxer) +- demuxer->wake(); +- return packet; +-} +- +-void StreamDecoder::addFrame(const Frame &f) +-{ +- Q_ASSERT(f.isValid()); +- QMutexLocker locker(&frameQueue.mutex); +- frameQueue.queue.append(std::move(f)); +- if (m_renderer) +- m_renderer->wake(); +-} +- +-Frame StreamDecoder::takeFrame() +-{ +- QMutexLocker locker(&frameQueue.mutex); +- // wake up the decoder so it delivers more frames +- if (frameQueue.queue.isEmpty()) { +- wake(); +- return {}; +- } +- auto f = frameQueue.queue.dequeue(); +- wake(); +- return f; +-} +- +-void StreamDecoder::init() +-{ +- qCDebug(qLcDecoder) << "Starting decoder"; +-} +- +-bool StreamDecoder::shouldWait() const +-{ +- if (eos.loadAcquire() || (hasNoPackets() && decoderHasNoFrames) || hasEnoughFrames()) +- return true; +- return false; +-} +- +-void StreamDecoder::loop() +-{ +- if (codec.context()->codec->type == AVMEDIA_TYPE_SUBTITLE) +- decodeSubtitle(); +- else +- decode(); +-} +- +-void StreamDecoder::decode() +-{ +- Q_ASSERT(codec.context()); +- +- AVFrame *frame = av_frame_alloc(); +-// if (type() == 0) +-// qDebug() << "receiving frame"; +- int res = avcodec_receive_frame(codec.context(), frame); +- +- if (res >= 0) { +- qint64 pts; +- if (frame->pts != AV_NOPTS_VALUE) +- pts = codec.toUs(frame->pts); +- else +- pts = codec.toUs(frame->best_effort_timestamp); +- addFrame(Frame{frame, codec, pts}); +- } else if (res == AVERROR(EOF) || res == AVERROR_EOF) { +- eos.storeRelease(true); +- av_frame_free(&frame); +- timeOut = -1; +- return; +- } else if (res != AVERROR(EAGAIN)) { +- char buf[512]; +- av_make_error_string(buf, 512, res); +- qWarning() << "error in decoder" << res << buf; +- av_frame_free(&frame); +- return; +- } else { +- // EAGAIN +- decoderHasNoFrames = true; +- av_frame_free(&frame); +- } +- +- Packet packet = peekPacket(); +- if (!packet.isValid()) { +- timeOut = -1; +- return; +- } +- +- res = avcodec_send_packet(codec.context(), packet.avPacket()); +- if (res != AVERROR(EAGAIN)) { +- takePacket(); +- } +- decoderHasNoFrames = false; +-} +- +-void StreamDecoder::decodeSubtitle() +-{ +- // qCDebug(qLcDecoder) << " decoding subtitle" << "has delay:" << (codec->codec->capabilities & AV_CODEC_CAP_DELAY); +- AVSubtitle subtitle; +- memset(&subtitle, 0, sizeof(subtitle)); +- int gotSubtitle = 0; +- Packet packet = takePacket(); +- if (!packet.isValid()) +- return; +- +- int res = avcodec_decode_subtitle2(codec.context(), &subtitle, &gotSubtitle, packet.avPacket()); +- // qCDebug(qLcDecoder) << " subtitle got:" << res << gotSubtitle << subtitle.format << Qt::hex << (quint64)subtitle.pts; +- if (res >= 0 && gotSubtitle) { +- // apparently the timestamps in the AVSubtitle structure are not always filled in +- // if they are missing, use the packets pts and duration values instead +- qint64 start, end; +- if (subtitle.pts == AV_NOPTS_VALUE) { +- start = codec.toUs(packet.avPacket()->pts); +- end = start + codec.toUs(packet.avPacket()->duration); +- } else { +- qint64 pts = timeStampUs(subtitle.pts, AVRational{1, AV_TIME_BASE}); +- start = pts + qint64(subtitle.start_display_time)*1000; +- end = pts + qint64(subtitle.end_display_time)*1000; +- } +- // qCDebug(qLcDecoder) << " got subtitle (" << start << "--" << end << "):"; +- QString text; +- for (uint i = 0; i < subtitle.num_rects; ++i) { +- const auto *r = subtitle.rects[i]; +- // qCDebug(qLcDecoder) << " subtitletext:" << r->text << "/" << r->ass; +- if (i) +- text += QLatin1Char('\n'); +- if (r->text) +- text += QString::fromUtf8(r->text); +- else { +- const char *ass = r->ass; +- int nCommas = 0; +- while (*ass) { +- if (nCommas == 9) +- break; +- if (*ass == ',') +- ++nCommas; +- ++ass; +- } +- text += QString::fromUtf8(ass); +- } +- } +- text.replace(QLatin1String("\\N"), QLatin1String("\n")); +- text.replace(QLatin1String("\\n"), QLatin1String("\n")); +- text.replace(QLatin1String("\r\n"), QLatin1String("\n")); +- if (text.endsWith(QLatin1Char('\n'))) +- text.chop(1); +- +-// qCDebug(qLcDecoder) << " >>> subtitle adding" << text << start << end; +- Frame sub{text, start, end - start}; +- addFrame(sub); +- } +-} +- +-QPlatformMediaPlayer::TrackType StreamDecoder::type() const +-{ +- switch (codec.stream()->codecpar->codec_type) { +- case AVMEDIA_TYPE_AUDIO: +- return QPlatformMediaPlayer::AudioStream; +- case AVMEDIA_TYPE_VIDEO: +- return QPlatformMediaPlayer::VideoStream; +- case AVMEDIA_TYPE_SUBTITLE: +- return QPlatformMediaPlayer::SubtitleStream; +- default: +- return QPlatformMediaPlayer::NTrackTypes; +- } +-} +- +-Renderer::Renderer(QPlatformMediaPlayer::TrackType type) +- : Thread() +- , type(type) +-{ +- QString objectName; +- if (type == QPlatformMediaPlayer::AudioStream) +- objectName = QLatin1String("AudioRenderThread"); +- else +- objectName = QLatin1String("VideoRenderThread"); +- setObjectName(objectName); +-} +- +-void Renderer::setStream(StreamDecoder *stream) +-{ +- QMutexLocker locker(&mutex); +- if (streamDecoder == stream) +- return; +- if (streamDecoder) +- streamDecoder->kill(); +- streamDecoder = stream; +- if (streamDecoder) +- streamDecoder->setRenderer(this); +- streamChanged(); +- wake(); +-} +- +-void Renderer::killHelper() +-{ +- if (streamDecoder) +- streamDecoder->kill(); +- streamDecoder = nullptr; +-} +- +-bool Renderer::shouldWait() const +-{ +- if (!streamDecoder) +- return true; +- if (!paused) +- return false; +- if (step) +- return false; +- return true; +-} +- +- +-void ClockedRenderer::setPaused(bool paused) +-{ +- Clock::setPaused(paused); +- Renderer::setPaused(paused); +-} +- +-VideoRenderer::VideoRenderer(Decoder *decoder, QVideoSink *sink) +- : ClockedRenderer(decoder, QPlatformMediaPlayer::VideoStream) +- , sink(sink) +-{} +- +-void VideoRenderer::killHelper() +-{ +- if (subtitleStreamDecoder) +- subtitleStreamDecoder->kill(); +- subtitleStreamDecoder = nullptr; +- if (streamDecoder) +- streamDecoder->kill(); +- streamDecoder = nullptr; +-} +- +-void VideoRenderer::setSubtitleStream(StreamDecoder *stream) +-{ +- QMutexLocker locker(&mutex); +- qCDebug(qLcVideoRenderer) << "setting subtitle stream to" << stream; +- if (stream == subtitleStreamDecoder) +- return; +- if (subtitleStreamDecoder) +- subtitleStreamDecoder->kill(); +- subtitleStreamDecoder = stream; +- if (subtitleStreamDecoder) +- subtitleStreamDecoder->setRenderer(this); +- sink->setSubtitleText({}); +- wake(); +-} +- +-void VideoRenderer::init() +-{ +- qCDebug(qLcVideoRenderer) << "starting video renderer"; +- ClockedRenderer::init(); +-} +- +-void VideoRenderer::loop() +-{ +- if (!streamDecoder) { +- timeOut = -1; // Avoid 100% CPU load before play() +- return; +- } +- +- Frame frame = streamDecoder->takeFrame(); +- if (!frame.isValid()) { +- if (streamDecoder->isAtEnd()) { +- timeOut = -1; +- eos.storeRelease(true); +- mutex.unlock(); +- emit atEnd(); +- mutex.lock(); +- return; +- } +- timeOut = 1; +-// qDebug() << "no valid frame" << timer.elapsed(); +- return; +- } +- eos.storeRelease(false); +-// qCDebug(qLcVideoRenderer) << "received video frame" << frame.pts(); +- if (frame.pts() < seekTime()) { +- qCDebug(qLcVideoRenderer) << " discarding" << frame.pts() << seekTime(); +- return; +- } +- +- AVStream *stream = frame.codec()->stream(); +- qint64 startTime = frame.pts(); +- qint64 duration = (1000000*stream->avg_frame_rate.den + (stream->avg_frame_rate.num>>1)) +- /stream->avg_frame_rate.num; +- +- if (sink) { +- qint64 startTime = frame.pts(); +-// qDebug() << "RHI:" << accel.isNull() << accel.rhi() << sink->rhi(); +- +- // in practice this only happens with mediacodec +- if (!frame.codec()->hwAccel().isNull() && !frame.avFrame()->hw_frames_ctx) { +- HWAccel hwaccel = frame.codec()->hwAccel(); +- AVFrame *avframe = frame.avFrame(); +- if (!hwaccel.hwFramesContext()) +- hwaccel.createFramesContext(AVPixelFormat(avframe->format), +- { avframe->width, avframe->height }); +- +- avframe->hw_frames_ctx = av_buffer_ref(hwaccel.hwFramesContextAsBuffer()); +- } +- +- QFFmpegVideoBuffer *buffer = new QFFmpegVideoBuffer(frame.takeAVFrame()); +- QVideoFrameFormat format(buffer->size(), buffer->pixelFormat()); +- format.setColorSpace(buffer->colorSpace()); +- format.setColorTransfer(buffer->colorTransfer()); +- format.setColorRange(buffer->colorRange()); +- format.setMaxLuminance(buffer->maxNits()); +- QVideoFrame videoFrame(buffer, format); +- videoFrame.setStartTime(startTime); +- videoFrame.setEndTime(startTime + duration); +-// qDebug() << "Creating video frame" << startTime << (startTime + duration) << subtitleStreamDecoder; +- +- // add in subtitles +- const Frame *currentSubtitle = nullptr; +- if (subtitleStreamDecoder) +- currentSubtitle = subtitleStreamDecoder->lockAndPeekFrame(); +- +- if (currentSubtitle && currentSubtitle->isValid()) { +-// qDebug() << "frame: subtitle" << currentSubtitle->text() << currentSubtitle->pts() << currentSubtitle->duration(); +- qCDebug(qLcVideoRenderer) << " " << currentSubtitle->pts() << currentSubtitle->duration() << currentSubtitle->text(); +- if (currentSubtitle->pts() <= startTime && currentSubtitle->end() > startTime) { +-// qCDebug(qLcVideoRenderer) << " setting text"; +- sink->setSubtitleText(currentSubtitle->text()); +- } +- if (currentSubtitle->end() < startTime) { +-// qCDebug(qLcVideoRenderer) << " removing subtitle item"; +- sink->setSubtitleText({}); +- subtitleStreamDecoder->removePeekedFrame(); +- } +- } else { +- sink->setSubtitleText({}); +- } +- if (subtitleStreamDecoder) +- subtitleStreamDecoder->unlockAndReleaseFrame(); +- +-// qCDebug(qLcVideoRenderer) << " sending a video frame" << startTime << duration << decoder->baseTimer.elapsed(); +- sink->setVideoFrame(videoFrame); +- doneStep(); +- } +- const Frame *nextFrame = streamDecoder->lockAndPeekFrame(); +- qint64 nextFrameTime = 0; +- if (nextFrame) +- nextFrameTime = nextFrame->pts(); +- else +- nextFrameTime = startTime + duration; +- streamDecoder->unlockAndReleaseFrame(); +- qint64 mtime = timeUpdated(startTime); +- timeOut = usecsTo(mtime, nextFrameTime) / 1000; +- // qCDebug(qLcVideoRenderer) << " next video frame in" << startTime << nextFrameTime << +- // currentTime() << timeOut; +-} +- +-AudioRenderer::AudioRenderer(Decoder *decoder, QAudioOutput *output) +- : ClockedRenderer(decoder, QPlatformMediaPlayer::AudioStream) +- , output(output) +-{ +- connect(output, &QAudioOutput::deviceChanged, this, &AudioRenderer::updateAudio); +- connect(output, &QAudioOutput::volumeChanged, this, &AudioRenderer::setSoundVolume); +-} +- +-void AudioRenderer::syncTo(qint64 usecs) +-{ +- QMutexLocker locker(&mutex); +- +- Clock::syncTo(usecs); +- audioBaseTime = usecs; +- processedBase = processedUSecs; +-} +- +-void AudioRenderer::setPlaybackRate(float rate, qint64 currentTime) +-{ +- QMutexLocker locker(&mutex); +- +- audioBaseTime = currentTime; +- processedBase = processedUSecs; +- Clock::setPlaybackRate(rate, currentTime); +- deviceChanged = true; +-} +- +-void AudioRenderer::updateOutput(const Codec *codec) +-{ +- qCDebug(qLcAudioRenderer) << ">>>>>> updateOutput" << currentTime() << seekTime() << processedUSecs << isMaster(); +- freeOutput(); +- qCDebug(qLcAudioRenderer) << " " << currentTime() << seekTime() << processedUSecs; +- +- AVStream *audioStream = codec->stream(); +- +- auto dev = output->device(); +- format = QFFmpegMediaFormatInfo::audioFormatFromCodecParameters(audioStream->codecpar); +- format.setChannelConfig(dev.channelConfiguration()); +- +- initResempler(codec); +- +- audioSink = new QAudioSink(dev, format); +- audioSink->setVolume(output->volume()); +- +- audioSink->setBufferSize(format.bytesForDuration(100000)); +- audioDevice = audioSink->start(); +- +- latencyUSecs = format.durationForBytes(audioSink->bufferSize()); // ### ideally get full latency +- qCDebug(qLcAudioRenderer) << " -> have an audio sink" << audioDevice; +-} +- +-void AudioRenderer::initResempler(const Codec *codec) +-{ +- // init resampler. It's ok to always do this, as the resampler will be a no-op if +- // formats agree. +- AVSampleFormat requiredFormat = QFFmpegMediaFormatInfo::avSampleFormat(format.sampleFormat()); +- +-#if QT_FFMPEG_OLD_CHANNEL_LAYOUT +- qCDebug(qLcAudioRenderer) << "init resampler" << requiredFormat +- << codec->stream()->codecpar->channels; +-#else +- qCDebug(qLcAudioRenderer) << "init resampler" << requiredFormat +- << codec->stream()->codecpar->ch_layout.nb_channels; +-#endif +- +- auto resamplerFormat = format; +- resamplerFormat.setSampleRate(qRound(format.sampleRate() / playbackRate())); +- resampler.reset(new Resampler(codec, resamplerFormat)); +-} +- +-void AudioRenderer::freeOutput() +-{ +- if (audioSink) { +- audioSink->reset(); +- delete audioSink; +- audioSink = nullptr; +- audioDevice = nullptr; +- } +- +- bufferedData = {}; +- bufferWritten = 0; +- +- audioBaseTime = currentTime(); +- processedBase = 0; +- processedUSecs = writtenUSecs = 0; +-} +- +-void AudioRenderer::init() +-{ +- qCDebug(qLcAudioRenderer) << "Starting audio renderer"; +- ClockedRenderer::init(); +-} +- +-void AudioRenderer::cleanup() +-{ +- freeOutput(); +-} +- +-void AudioRenderer::loop() +-{ +- if (!streamDecoder) { +- timeOut = -1; // Avoid 100% CPU load before play() +- return; +- } +- +- if (deviceChanged) +- freeOutput(); +- deviceChanged = false; +- doneStep(); +- +- qint64 bytesWritten = 0; +- if (bufferedData.isValid()) { +- bytesWritten = audioDevice->write(bufferedData.constData() + bufferWritten, bufferedData.byteCount() - bufferWritten); +- bufferWritten += bytesWritten; +- if (bufferWritten == bufferedData.byteCount()) { +- bufferedData = {}; +- bufferWritten = 0; +- } +- processedUSecs = audioSink->processedUSecs(); +- } else { +- Frame frame = streamDecoder->takeFrame(); +- if (!frame.isValid()) { +- if (streamDecoder->isAtEnd()) { +- if (audioSink) +- processedUSecs = audioSink->processedUSecs(); +- timeOut = -1; +- eos.storeRelease(true); +- mutex.unlock(); +- emit atEnd(); +- mutex.lock(); +- return; +- } +- timeOut = 1; +- return; +- } +- eos.storeRelease(false); +- +- if (!audioSink) +- updateOutput(frame.codec()); +- +- qint64 startTime = frame.pts(); +- if (startTime < seekTime()) +- return; +- +- if (!paused) { +- auto buffer = resampler->resample(frame.avFrame()); +- +- if (output->isMuted()) +- // This is somewhat inefficient, but it'll work +- memset(buffer.data(), 0, buffer.byteCount()); +- +- bytesWritten = audioDevice->write(buffer.constData(), buffer.byteCount()); +- if (bytesWritten < buffer.byteCount()) { +- bufferedData = buffer; +- bufferWritten = bytesWritten; +- } +- +- processedUSecs = audioSink->processedUSecs(); +- } +- } +- +- qint64 duration = format.durationForBytes(bytesWritten); +- writtenUSecs += duration; +- +- timeOut = (writtenUSecs - processedUSecs - latencyUSecs)/1000; +- if (timeOut < 0) +- // Don't use a zero timeout if the sink didn't want any more data, rather wait for 10ms. +- timeOut = bytesWritten > 0 ? 0 : 10; +- +-// if (!bufferedData.isEmpty()) +-// qDebug() << ">>>>>>>>>>>>>>>>>>>>>>>> could not write all data" << (bufferedData.size() - bufferWritten); +-// qDebug() << "Audio: processed" << processedUSecs << "written" << writtenUSecs +-// << "delta" << (writtenUSecs - processedUSecs) << "timeOut" << timeOut; +-// qCDebug(qLcAudioRenderer) << " updating time to" << currentTimeNoLock(); +- timeUpdated(audioBaseTime + qRound((processedUSecs - processedBase) * playbackRate())); +-} +- +-void AudioRenderer::streamChanged() +-{ +- // mutex is already locked +- deviceChanged = true; +-} +- +-void AudioRenderer::updateAudio() +-{ +- QMutexLocker locker(&mutex); +- deviceChanged = true; +-} +- +-void AudioRenderer::setSoundVolume(float volume) +-{ +- QMutexLocker locker(&mutex); +- +- if (audioSink) +- audioSink->setVolume(volume); +-} +- +-Decoder::Decoder() +-{ +-} +- +-Decoder::~Decoder() +-{ +- pause(); +- if (videoRenderer) +- videoRenderer->kill(); +- if (audioRenderer) +- audioRenderer->kill(); +- if (demuxer) +- demuxer->kill(); +-} +- +-static int read(void *opaque, uint8_t *buf, int buf_size) +-{ +- auto *dev = static_cast(opaque); +- if (dev->atEnd()) +- return AVERROR_EOF; +- return dev->read(reinterpret_cast(buf), buf_size); +-} +- +-static int64_t seek(void *opaque, int64_t offset, int whence) +-{ +- QIODevice *dev = static_cast(opaque); +- +- if (dev->isSequential()) +- return AVERROR(EINVAL); +- +- if (whence & AVSEEK_SIZE) +- return dev->size(); +- +- whence &= ~AVSEEK_FORCE; +- +- if (whence == SEEK_CUR) +- offset += dev->pos(); +- else if (whence == SEEK_END) +- offset += dev->size(); +- +- if (!dev->seek(offset)) +- return AVERROR(EINVAL); +- return offset; +-} +- +-void Decoder::setMedia(const QUrl &media, QIODevice *stream) +-{ +- QByteArray url = media.toEncoded(QUrl::PreferLocalFile); +- +- AVFormatContext *context = nullptr; +- +- if (stream) { +- if (!stream->isOpen()) { +- if (!stream->open(QIODevice::ReadOnly)) { +- emitError(QMediaPlayer::ResourceError, QLatin1String("Could not open source device.")); +- return; +- } +- } +- if (!stream->isSequential()) +- stream->seek(0); +- context = avformat_alloc_context(); +- constexpr int bufferSize = 32768; +- unsigned char *buffer = (unsigned char *)av_malloc(bufferSize); +- context->pb = avio_alloc_context(buffer, bufferSize, false, stream, ::read, nullptr, ::seek); +- } +- +- int ret = avformat_open_input(&context, url.constData(), nullptr, nullptr); +- if (ret < 0) { +- auto code = QMediaPlayer::ResourceError; +- if (ret == AVERROR(EACCES)) +- code = QMediaPlayer::AccessDeniedError; +- else if (ret == AVERROR(EINVAL)) +- code = QMediaPlayer::FormatError; +- +- emitError(code, QMediaPlayer::tr("Could not open file")); +- return; +- } +- +- ret = avformat_find_stream_info(context, nullptr); +- if (ret < 0) { +- emitError(QMediaPlayer::FormatError, QMediaPlayer::tr("Could not find stream information for media file")); +- return; +- } +- +-#ifndef QT_NO_DEBUG +- av_dump_format(context, 0, url.constData(), 0); +-#endif +- +- m_metaData = QFFmpegMetaData::fromAVMetaData(context->metadata); +- m_metaData.insert(QMediaMetaData::FileFormat, +- QVariant::fromValue(QFFmpegMediaFormatInfo::fileFormatForAVInputFormat(context->iformat))); +- +- checkStreams(context); +- +- m_isSeekable = !(context->ctx_flags & AVFMTCTX_UNSEEKABLE); +- +- demuxer = new Demuxer(this, context); +- demuxer->start(); +- +- qCDebug(qLcDecoder) << ">>>>>> index:" << metaObject()->indexOfSlot("updateCurrentTime(qint64)"); +- clockController.setNotify(this, metaObject()->method(metaObject()->indexOfSlot("updateCurrentTime(qint64)"))); +-} +- +-static void insertVideoData(QMediaMetaData &metaData, AVStream *stream) +-{ +- Q_ASSERT(stream); +- auto *codecPar = stream->codecpar; +- metaData.insert(QMediaMetaData::VideoBitRate, (int)codecPar->bit_rate); +- metaData.insert(QMediaMetaData::VideoCodec, QVariant::fromValue(QFFmpegMediaFormatInfo::videoCodecForAVCodecId(codecPar->codec_id))); +- metaData.insert(QMediaMetaData::Resolution, QSize(codecPar->width, codecPar->height)); +- metaData.insert(QMediaMetaData::VideoFrameRate, +- qreal(stream->avg_frame_rate.num)/qreal(stream->avg_frame_rate.den)); +-}; +- +-static void insertAudioData(QMediaMetaData &metaData, AVStream *stream) +-{ +- Q_ASSERT(stream); +- auto *codecPar = stream->codecpar; +- metaData.insert(QMediaMetaData::AudioBitRate, (int)codecPar->bit_rate); +- metaData.insert(QMediaMetaData::AudioCodec, +- QVariant::fromValue(QFFmpegMediaFormatInfo::audioCodecForAVCodecId(codecPar->codec_id))); +-}; +- +-void Decoder::checkStreams(AVFormatContext *context) +-{ +- qint64 duration = 0; +- AVStream *firstAudioStream = nullptr; +- AVStream *defaultAudioStream = nullptr; +- AVStream *firstVideoStream = nullptr; +- AVStream *defaultVideoStream = nullptr; +- +- for (unsigned int i = 0; i < context->nb_streams; ++i) { +- auto *stream = context->streams[i]; +- +- QMediaMetaData metaData = QFFmpegMetaData::fromAVMetaData(stream->metadata); +- QPlatformMediaPlayer::TrackType type = QPlatformMediaPlayer::VideoStream; +- auto *codecPar = stream->codecpar; +- +- bool isDefault = stream->disposition & AV_DISPOSITION_DEFAULT; +- switch (codecPar->codec_type) { +- case AVMEDIA_TYPE_UNKNOWN: +- case AVMEDIA_TYPE_DATA: ///< Opaque data information usually continuous +- case AVMEDIA_TYPE_ATTACHMENT: ///< Opaque data information usually sparse +- case AVMEDIA_TYPE_NB: +- continue; +- case AVMEDIA_TYPE_VIDEO: +- type = QPlatformMediaPlayer::VideoStream; +- insertVideoData(metaData, stream); +- if (!firstVideoStream) +- firstVideoStream = stream; +- if (isDefault && !defaultVideoStream) +- defaultVideoStream = stream; +- break; +- case AVMEDIA_TYPE_AUDIO: +- type = QPlatformMediaPlayer::AudioStream; +- insertAudioData(metaData, stream); +- if (!firstAudioStream) +- firstAudioStream = stream; +- if (isDefault && !defaultAudioStream) +- defaultAudioStream = stream; +- break; +- case AVMEDIA_TYPE_SUBTITLE: +- type = QPlatformMediaPlayer::SubtitleStream; +- break; +- } +- if (isDefault && m_requestedStreams[type] < 0) +- m_requestedStreams[type] = m_streamMap[type].size(); +- +- m_streamMap[type].append({ (int)i, isDefault, metaData }); +- duration = qMax(duration, 1000000*stream->duration*stream->time_base.num/stream->time_base.den); +- } +- +- if (m_requestedStreams[QPlatformMediaPlayer::VideoStream] < 0 && m_streamMap[QPlatformMediaPlayer::VideoStream].size()) { +- m_requestedStreams[QPlatformMediaPlayer::VideoStream] = 0; +- defaultVideoStream = firstVideoStream; +- } +- if (m_requestedStreams[QPlatformMediaPlayer::AudioStream] < 0 && m_streamMap[QPlatformMediaPlayer::AudioStream].size()) { +- m_requestedStreams[QPlatformMediaPlayer::AudioStream] = 0; +- defaultAudioStream = firstAudioStream; +- } +- if (defaultVideoStream) { +- insertVideoData(m_metaData, defaultVideoStream); +- m_currentAVStreamIndex[QPlatformMediaPlayer::VideoStream] = defaultVideoStream->index; +- } +- if (defaultAudioStream) { +- insertAudioData(m_metaData, defaultAudioStream); +- m_currentAVStreamIndex[QPlatformMediaPlayer::AudioStream] = defaultAudioStream->index; +- } +- m_requestedStreams[QPlatformMediaPlayer::SubtitleStream] = -1; +- m_currentAVStreamIndex[QPlatformMediaPlayer::SubtitleStream] = -1; +- +- if (player) +- player->tracksChanged(); +- +- if (m_duration != duration) { +- m_duration = duration; +- if (player) +- player->durationChanged(duration/1000); +- else if (audioDecoder) +- audioDecoder->durationChanged(duration/1000); +- } +-} +- +-int Decoder::activeTrack(QPlatformMediaPlayer::TrackType type) +-{ +- return m_requestedStreams[type]; +-} +- +-void Decoder::setActiveTrack(QPlatformMediaPlayer::TrackType type, int streamNumber) +-{ +- if (streamNumber < 0 || streamNumber >= m_streamMap[type].size()) +- streamNumber = -1; +- if (m_requestedStreams[type] == streamNumber) +- return; +- m_requestedStreams[type] = streamNumber; +- int avStreamIndex = m_streamMap[type].value(streamNumber).avStreamIndex; +- changeAVTrack(type, avStreamIndex); +-} +- +-void Decoder::error(int errorCode, const QString &errorString) +-{ +- QMetaObject::invokeMethod(this, "emitError", Q_ARG(int, errorCode), Q_ARG(QString, errorString)); +-} +- +-void Decoder::emitError(int error, const QString &errorString) +-{ +- if (player) +- player->error(error, errorString); +- else if (audioDecoder) { +- // unfortunately the error enums for QAudioDecoder and QMediaPlayer aren't identical. +- // Map them. +- switch (QMediaPlayer::Error(error)) { +- case QMediaPlayer::NoError: +- error = QAudioDecoder::NoError; +- break; +- case QMediaPlayer::ResourceError: +- error = QAudioDecoder::ResourceError; +- break; +- case QMediaPlayer::FormatError: +- error = QAudioDecoder::FormatError; +- break; +- case QMediaPlayer::NetworkError: +- // fall through, Network error doesn't exist in QAudioDecoder +- case QMediaPlayer::AccessDeniedError: +- error = QAudioDecoder::AccessDeniedError; +- break; +- } +- +- audioDecoder->error(error, errorString); +- } +-} +- +-void Decoder::setState(QMediaPlayer::PlaybackState state) +-{ +- if (m_state == state) +- return; +- +- switch (state) { +- case QMediaPlayer::StoppedState: +- qCDebug(qLcDecoder) << "Decoder::stop"; +- setPaused(true); +- if (demuxer) +- demuxer->stopDecoding(); +- seek(0); +- if (videoSink) +- videoSink->setVideoFrame({}); +- updateCurrentTime(0); +- qCDebug(qLcDecoder) << "Decoder::stop: done"; +- break; +- case QMediaPlayer::PausedState: +- qCDebug(qLcDecoder) << "Decoder::pause"; +- setPaused(true); +- if (demuxer) { +- demuxer->startDecoding(); +- demuxer->wake(); +- if (m_state == QMediaPlayer::StoppedState) +- triggerStep(); +- } +- break; +- case QMediaPlayer::PlayingState: +- qCDebug(qLcDecoder) << "Decoder::play"; +- setPaused(false); +- if (demuxer) +- demuxer->startDecoding(); +- break; +- } +- m_state = state; +-} +- +-void Decoder::setPaused(bool b) +-{ +- clockController.setPaused(b); +-} +- +-void Decoder::triggerStep() +-{ +- if (audioRenderer) +- audioRenderer->singleStep(); +- if (videoRenderer) +- videoRenderer->singleStep(); +-} +- +-void Decoder::setVideoSink(QVideoSink *sink) +-{ +- qCDebug(qLcDecoder) << "setVideoSink" << sink; +- if (sink == videoSink) +- return; +- videoSink = sink; +- if (!videoSink || m_currentAVStreamIndex[QPlatformMediaPlayer::VideoStream] < 0) { +- if (videoRenderer) { +- videoRenderer->kill(); +- videoRenderer = nullptr; +- } +- } else if (!videoRenderer) { +- videoRenderer = new VideoRenderer(this, sink); +- connect(audioRenderer, &Renderer::atEnd, this, &Decoder::streamAtEnd); +- videoRenderer->start(); +- StreamDecoder *stream = demuxer->addStream(m_currentAVStreamIndex[QPlatformMediaPlayer::VideoStream]); +- videoRenderer->setStream(stream); +- stream = demuxer->addStream(m_currentAVStreamIndex[QPlatformMediaPlayer::SubtitleStream]); +- videoRenderer->setSubtitleStream(stream); +- } +-} +- +-void Decoder::setAudioSink(QPlatformAudioOutput *output) +-{ +- if (audioOutput == output) +- return; +- +- qCDebug(qLcDecoder) << "setAudioSink" << audioOutput; +- audioOutput = output; +- if (!output || m_currentAVStreamIndex[QPlatformMediaPlayer::AudioStream] < 0) { +- if (audioRenderer) { +- audioRenderer->kill(); +- audioRenderer = nullptr; +- } +- } else if (!audioRenderer) { +- audioRenderer = new AudioRenderer(this, output->q); +- connect(audioRenderer, &Renderer::atEnd, this, &Decoder::streamAtEnd); +- audioRenderer->start(); +- auto *stream = demuxer->addStream(m_currentAVStreamIndex[QPlatformMediaPlayer::AudioStream]); +- audioRenderer->setStream(stream); +- } +-} +- +-void Decoder::changeAVTrack(QPlatformMediaPlayer::TrackType type, int streamIndex) +-{ +- int oldIndex = m_currentAVStreamIndex[type]; +- qCDebug(qLcDecoder) << ">>>>> change track" << type << "from" << oldIndex << "to" << streamIndex << clockController.currentTime(); +- m_currentAVStreamIndex[type] = streamIndex; +- if (!demuxer) +- return; +- qCDebug(qLcDecoder) << " applying to renderer."; +- if (m_state == QMediaPlayer::PlayingState) +- setPaused(true); +- auto *streamDecoder = demuxer->addStream(streamIndex); +- switch (type) { +- case QPlatformMediaPlayer::AudioStream: +- audioRenderer->setStream(streamDecoder); +- break; +- case QPlatformMediaPlayer::VideoStream: +- videoRenderer->setStream(streamDecoder); +- break; +- case QPlatformMediaPlayer::SubtitleStream: +- videoRenderer->setSubtitleStream(streamDecoder); +- break; +- default: +- Q_UNREACHABLE(); +- } +- demuxer->seek(clockController.currentTime()); +- if (m_state == QMediaPlayer::PlayingState) +- setPaused(false); +- else +- triggerStep(); +-} +- +-QPlatformMediaPlayer::TrackType trackType(AVMediaType mediaType) +-{ +- switch (mediaType) { +- case AVMEDIA_TYPE_VIDEO: +- return QPlatformMediaPlayer::VideoStream; +- case AVMEDIA_TYPE_AUDIO: +- return QPlatformMediaPlayer::AudioStream; +- case AVMEDIA_TYPE_SUBTITLE: +- return QPlatformMediaPlayer::SubtitleStream; +- default: +- break; +- } +- return QPlatformMediaPlayer::NTrackTypes; +-} +- +-void Decoder::seek(qint64 pos) +-{ +- if (!demuxer) +- return; +- pos = qBound(0, pos, m_duration); +- demuxer->seek(pos); +- clockController.syncTo(pos); +- if (player) +- player->positionChanged(pos/1000); +- demuxer->wake(); +- if (m_state == QMediaPlayer::PausedState) +- triggerStep(); +-} +- +-void Decoder::setPlaybackRate(float rate) +-{ +- clockController.setPlaybackRate(rate); +-} +- +-void Decoder::updateCurrentTime(qint64 time) +-{ +- if (player) +- player->positionChanged(time/1000); +-} +- +-void Decoder::streamAtEnd() +-{ +- if (audioRenderer && !audioRenderer->isAtEnd()) +- return; +- if (videoRenderer && !videoRenderer->isAtEnd()) +- return; +- pause(); +- // take a local copy, as the signals below could lead to this object being deleted +- auto *p = player; +- if (p) { +- p->positionChanged(m_duration/1000); +- p->stateChanged(QMediaPlayer::StoppedState); +- p->mediaStatusChanged(QMediaPlayer::EndOfMedia); +- } +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegdecoder_p.h b/src/plugins/multimedia/ffmpeg/qffmpegdecoder_p.h +deleted file mode 100644 +index 01763911d..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegdecoder_p.h ++++ /dev/null +@@ -1,513 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGDECODER_P_H +-#define QFFMPEGDECODER_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qffmpegthread_p.h" +-#include "qffmpeg_p.h" +-#include "qffmpegmediaplayer_p.h" +-#include "qffmpeghwaccel_p.h" +-#include "qffmpegclock_p.h" +-#include "qaudiobuffer.h" +-#include "qffmpegresampler_p.h" +- +-#include +-#include +-#include +- +-QT_BEGIN_NAMESPACE +- +-class QAudioSink; +-class QFFmpegAudioDecoder; +-class QFFmpegMediaPlayer; +- +-namespace QFFmpeg +-{ +- +-class Resampler; +- +-// queue up max 16M of encoded data, that should always be enough +-// (it's around 2 secs of 4K HDR video, longer for almost all other formats) +-enum { MaxQueueSize = 16*1024*1024 }; +- +-struct Packet +-{ +- struct Data { +- Data(AVPacket *p) +- : packet(p) +- {} +- ~Data() { +- if (packet) +- av_packet_free(&packet); +- } +- QAtomicInt ref; +- AVPacket *packet = nullptr; +- }; +- Packet() = default; +- Packet(AVPacket *p) +- : d(new Data(p)) +- {} +- +- bool isValid() const { return !!d; } +- AVPacket *avPacket() const { return d->packet; } +-private: +- QExplicitlySharedDataPointer d; +-}; +- +-struct Codec +-{ +- struct Data { +- Data(AVCodecContext *context, AVStream *stream, const QFFmpeg::HWAccel &hwAccel); +- ~Data(); +- QAtomicInt ref; +- AVCodecContext *context = nullptr; +- AVStream *stream = nullptr; +- QFFmpeg::HWAccel hwAccel; +- int streamIndex = -1; +- }; +- +- Codec() = default; +- Codec(AVFormatContext *format, int streamIndex); +- bool isValid() const { return !!d; } +- +- AVCodecContext *context() const { return d->context; } +- AVStream *stream() const { return d->stream; } +- uint streamIndex() const { return d->stream->index; } +- HWAccel hwAccel() const { return d->hwAccel; } +- qint64 toMs(qint64 ts) const { return timeStamp(ts, d->stream->time_base); } +- qint64 toUs(qint64 ts) const { return timeStampUs(ts, d->stream->time_base); } +- +-private: +- QExplicitlySharedDataPointer d; +-}; +- +- +-struct Frame +-{ +- struct Data { +- Data(AVFrame *f, const Codec &codec, qint64 pts) +- : codec(codec) +- , frame(f) +- , pts(pts) +- {} +- Data(const QString &text, qint64 pts, qint64 duration) +- : text(text), pts(pts), duration(duration) +- {} +- ~Data() { +- if (frame) +- av_frame_free(&frame); +- } +- QAtomicInt ref; +- Codec codec; +- AVFrame *frame = nullptr; +- QString text; +- qint64 pts = -1; +- qint64 duration = -1; +- }; +- Frame() = default; +- Frame(AVFrame *f, const Codec &codec, qint64 pts) +- : d(new Data(f, codec, pts)) +- {} +- Frame(const QString &text, qint64 pts, qint64 duration) +- : d(new Data(text, pts, duration)) +- {} +- bool isValid() const { return !!d; } +- +- AVFrame *avFrame() const { return d->frame; } +- AVFrame *takeAVFrame() const { +- AVFrame *f = d->frame; +- d->frame = nullptr; +- return f; +- } +- const Codec *codec() const { return &d->codec; } +- qint64 pts() const { return d->pts; } +- qint64 duration() const { return d->duration; } +- qint64 end() const { return d->pts + d->duration; } +- QString text() const { return d->text; } +-private: +- QExplicitlySharedDataPointer d; +-}; +- +-class Demuxer; +-class StreamDecoder; +-class Renderer; +-class AudioRenderer; +-class VideoRenderer; +- +-class Decoder : public QObject +-{ +- Q_OBJECT +-public: +- Decoder(); +- Decoder(QFFmpegMediaPlayer *player) +- : player(player) +- { +- } +- Decoder(QFFmpegAudioDecoder *decoder) +- : audioDecoder(decoder) +- { +- } +- ~Decoder(); +- +- void setMedia(const QUrl &media, QIODevice *stream); +- +- void init(); +- void setState(QMediaPlayer::PlaybackState state); +- void play() { +- setState(QMediaPlayer::PlayingState); +- } +- void pause() { +- setState(QMediaPlayer::PausedState); +- } +- void stop() { +- setState(QMediaPlayer::StoppedState); +- } +- +- void triggerStep(); +- +- void setVideoSink(QVideoSink *sink); +- void setAudioSink(QPlatformAudioOutput *output); +- +- void changeAVTrack(QPlatformMediaPlayer::TrackType type, int index); +- +- void seek(qint64 pos); +- void setPlaybackRate(float rate); +- +- void checkStreams(AVFormatContext *context); +- +- int activeTrack(QPlatformMediaPlayer::TrackType type); +- void setActiveTrack(QPlatformMediaPlayer::TrackType type, int streamNumber); +- +- bool isSeekable() const +- { +- return m_isSeekable; +- } +- +- // threadsafe +- void error(int errorCode, const QString &errorString); +- +-public Q_SLOTS: +- void emitError(int error, const QString &errorString); +- void updateCurrentTime(qint64 time); +- void streamAtEnd(); +- +-public: +- +- // Accessed from multiple threads, but API is threadsafe +- ClockController clockController; +- +-private: +- void setPaused(bool b); +- +-protected: +- friend QFFmpegMediaPlayer; +- +- QFFmpegMediaPlayer *player = nullptr; +- QFFmpegAudioDecoder *audioDecoder = nullptr; +- +- QMediaPlayer::PlaybackState m_state = QMediaPlayer::StoppedState; +- bool m_isSeekable = false; +- +- Demuxer *demuxer = nullptr; +- int m_currentAVStreamIndex[QPlatformMediaPlayer::NTrackTypes] = { -1, -1, -1 }; +- +- QVideoSink *videoSink = nullptr; +- Renderer *videoRenderer = nullptr; +- +- QPlatformAudioOutput *audioOutput = nullptr; +- Renderer *audioRenderer = nullptr; +- +- bool playing = false; +- +- struct StreamInfo { +- int avStreamIndex = -1; +- bool isDefault = false; +- QMediaMetaData metaData; +- }; +- +- QList m_streamMap[QPlatformMediaPlayer::NTrackTypes]; +- int m_requestedStreams[3] = { -1, -1, -1 }; +- qint64 m_duration = 0; +- QMediaMetaData m_metaData; +-}; +- +-class Demuxer : public Thread +-{ +- Q_OBJECT +-public: +- Demuxer(Decoder *decoder, AVFormatContext *context); +- ~Demuxer(); +- +- StreamDecoder *addStream(int streamIndex); +- void removeStream(int streamIndex); +- +- bool isStopped() const +- { +- return m_isStopped.loadRelaxed(); +- } +- void startDecoding() +- { +- m_isStopped.storeRelaxed(false); +- updateEnabledStreams(); +- wake(); +- } +- void stopDecoding(); +- +- int seek(qint64 pos); +- +-private: +- void updateEnabledStreams(); +- void sendFinalPacketToStreams(); +- +- void init() override; +- void cleanup() override; +- bool shouldWait() const override; +- void loop() override; +- +- Decoder *decoder; +- AVFormatContext *context = nullptr; +- QList streamDecoders; +- +- QAtomicInteger m_isStopped = true; +- qint64 last_pts = -1; +-}; +- +- +-class StreamDecoder : public Thread +-{ +- Q_OBJECT +-protected: +- Demuxer *demuxer = nullptr; +- Renderer *m_renderer = nullptr; +- +- struct PacketQueue { +- mutable QMutex mutex; +- QQueue queue; +- qint64 size = 0; +- qint64 duration = 0; +- }; +- PacketQueue packetQueue; +- +- struct FrameQueue { +- mutable QMutex mutex; +- QQueue queue; +- int maxSize = 3; +- }; +- FrameQueue frameQueue; +- QAtomicInteger eos = false; +- bool decoderHasNoFrames = false; +- +-public: +- StreamDecoder(Demuxer *demuxer, const Codec &codec); +- +- void addPacket(AVPacket *packet); +- +- qint64 queuedPacketSize() const { +- QMutexLocker locker(&packetQueue.mutex); +- return packetQueue.size; +- } +- qint64 queuedDuration() const { +- QMutexLocker locker(&packetQueue.mutex); +- return packetQueue.duration; +- } +- +- const Frame *lockAndPeekFrame() +- { +- frameQueue.mutex.lock(); +- return frameQueue.queue.isEmpty() ? nullptr : &frameQueue.queue.first(); +- } +- void removePeekedFrame() +- { +- frameQueue.queue.takeFirst(); +- wake(); +- } +- void unlockAndReleaseFrame() +- { +- frameQueue.mutex.unlock(); +- } +- Frame takeFrame(); +- +- void flush(); +- +- Codec codec; +- +- void setRenderer(Renderer *r); +- Renderer *renderer() const { return m_renderer; } +- +- bool isAtEnd() const { return eos.loadAcquire(); } +- +- void killHelper() override; +- +-private: +- Packet takePacket(); +- Packet peekPacket(); +- +- void addFrame(const Frame &f); +- +- bool hasEnoughFrames() const +- { +- QMutexLocker locker(&frameQueue.mutex); +- return frameQueue.queue.size() >= frameQueue.maxSize; +- } +- bool hasNoPackets() const +- { +- QMutexLocker locker(&packetQueue.mutex); +- return packetQueue.queue.isEmpty(); +- } +- +- void init() override; +- bool shouldWait() const override; +- void loop() override; +- +- void decode(); +- void decodeSubtitle(); +- +- QPlatformMediaPlayer::TrackType type() const; +-}; +- +-class Renderer : public Thread +-{ +- Q_OBJECT +-protected: +- QPlatformMediaPlayer::TrackType type; +- +- bool step = false; +- bool paused = true; +- StreamDecoder *streamDecoder = nullptr; +- QAtomicInteger eos = false; +- +-public: +- Renderer(QPlatformMediaPlayer::TrackType type); +- +- void setPaused(bool p) { +- QMutexLocker locker(&mutex); +- paused = p; +- if (!p) +- wake(); +- } +- void singleStep() { +- QMutexLocker locker(&mutex); +- if (!paused) +- return; +- step = true; +- wake(); +- } +- void doneStep() { +- step = false; +- } +- bool isAtEnd() { return !streamDecoder || eos.loadAcquire(); } +- +- void setStream(StreamDecoder *stream); +- virtual void setSubtitleStream(StreamDecoder *) {} +- +- void killHelper() override; +- +- virtual void streamChanged() {} +- +-Q_SIGNALS: +- void atEnd(); +- +-protected: +- bool shouldWait() const override; +- +-public: +-}; +- +-class ClockedRenderer : public Renderer, public Clock +-{ +-public: +- ClockedRenderer(Decoder *decoder, QPlatformMediaPlayer::TrackType type) +- : Renderer(type) +- , Clock(&decoder->clockController) +- { +- } +- ~ClockedRenderer() +- { +- } +- void setPaused(bool paused) override; +-}; +- +-class VideoRenderer : public ClockedRenderer +-{ +- Q_OBJECT +- +- StreamDecoder *subtitleStreamDecoder = nullptr; +-public: +- VideoRenderer(Decoder *decoder, QVideoSink *sink); +- +- void killHelper() override; +- +- void setSubtitleStream(StreamDecoder *stream) override; +-private: +- +- void init() override; +- void loop() override; +- +- QVideoSink *sink; +-}; +- +-class AudioRenderer : public ClockedRenderer +-{ +- Q_OBJECT +-public: +- AudioRenderer(Decoder *decoder, QAudioOutput *output); +- ~AudioRenderer() = default; +- +- // Clock interface +- void syncTo(qint64 usecs) override; +- void setPlaybackRate(float rate, qint64 currentTime) override; +- +-private slots: +- void updateAudio(); +- void setSoundVolume(float volume); +- +-private: +- void updateOutput(const Codec *codec); +- void initResempler(const Codec *codec); +- void freeOutput(); +- +- void init() override; +- void cleanup() override; +- void loop() override; +- void streamChanged() override; +- Type type() const override { return AudioClock; } +- +- int outputSamples(int inputSamples) { +- return qRound(inputSamples/playbackRate()); +- } +- +- // Used for timing update calculations based on processed data +- qint64 audioBaseTime = 0; +- qint64 processedBase = 0; +- qint64 processedUSecs = 0; +- +- bool deviceChanged = false; +- QAudioOutput *output = nullptr; +- qint64 writtenUSecs = 0; +- qint64 latencyUSecs = 0; +- +- QAudioFormat format; +- QAudioSink *audioSink = nullptr; +- QIODevice *audioDevice = nullptr; +- std::unique_ptr resampler; +- QAudioBuffer bufferedData; +- qsizetype bufferWritten = 0; +-}; +- +-} +- +-QT_END_NAMESPACE +- +-#endif +- +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegencoder.cpp b/src/plugins/multimedia/ffmpeg/qffmpegencoder.cpp +deleted file mode 100644 +index 186e254fd..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegencoder.cpp ++++ /dev/null +@@ -1,553 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#include "qffmpegencoder_p.h" +-#include "qffmpegmediaformatinfo_p.h" +-#include "qffmpegvideoframeencoder_p.h" +-#include "private/qmultimediautils_p.h" +- +-#include +-#include +-#include +-#include +-#include "qffmpegaudioinput_p.h" +-#include +-#include "qffmpegvideobuffer_p.h" +-#include "qffmpegmediametadata_p.h" +-#include "qffmpegencoderoptions_p.h" +- +-#include +- +-extern "C" { +-#include +-#include +-} +- +-QT_BEGIN_NAMESPACE +- +-Q_LOGGING_CATEGORY(qLcFFmpegEncoder, "qt.multimedia.ffmpeg.encoder") +- +-namespace QFFmpeg +-{ +- +-Encoder::Encoder(const QMediaEncoderSettings &settings, const QUrl &url) +- : settings(settings) +-{ +- const AVOutputFormat *avFormat = QFFmpegMediaFormatInfo::outputFormatForFileFormat(settings.fileFormat()); +- +- formatContext = avformat_alloc_context(); +- formatContext->oformat = const_cast(avFormat); // constness varies +- +- QByteArray encoded = url.toEncoded(); +- formatContext->url = (char *)av_malloc(encoded.size() + 1); +- memcpy(formatContext->url, encoded.constData(), encoded.size() + 1); +- formatContext->pb = nullptr; +- avio_open2(&formatContext->pb, formatContext->url, AVIO_FLAG_WRITE, nullptr, nullptr); +- qCDebug(qLcFFmpegEncoder) << "opened" << formatContext->url; +- +- muxer = new Muxer(this); +-} +- +-Encoder::~Encoder() +-{ +-} +- +-void Encoder::addAudioInput(QFFmpegAudioInput *input) +-{ +- audioEncode = new AudioEncoder(this, input, settings); +- connect(input, &QFFmpegAudioInput::newAudioBuffer, this, &Encoder::newAudioBuffer); +- input->setRunning(true); +-} +- +-void Encoder::addVideoSource(QPlatformCamera *source) +-{ +- videoEncode = new VideoEncoder(this, source, settings); +- connect(source, &QPlatformCamera::newVideoFrame, this, &Encoder::newVideoFrame); +-} +- +-void Encoder::start() +-{ +- qCDebug(qLcFFmpegEncoder) << "Encoder::start!"; +- +- formatContext->metadata = QFFmpegMetaData::toAVMetaData(metaData); +- +- int res = avformat_write_header(formatContext, nullptr); +- if (res < 0) +- qWarning() << "could not write header" << res; +- +- muxer->start(); +- if (audioEncode) +- audioEncode->start(); +- if (videoEncode) +- videoEncode->start(); +- isRecording = true; +-} +- +-void EncodingFinalizer::run() +-{ +- if (encoder->audioEncode) +- encoder->audioEncode->kill(); +- if (encoder->videoEncode) +- encoder->videoEncode->kill(); +- encoder->muxer->kill(); +- +- int res = av_write_trailer(encoder->formatContext); +- if (res < 0) +- qWarning() << "could not write trailer" << res; +- +- avformat_free_context(encoder->formatContext); +- qDebug() << " done finalizing."; +- emit encoder->finalizationDone(); +- delete encoder; +- deleteLater(); +-} +- +-void Encoder::finalize() +-{ +- qDebug() << ">>>>>>>>>>>>>>> finalize"; +- +- isRecording = false; +- auto *finalizer = new EncodingFinalizer(this); +- finalizer->start(); +-} +- +-void Encoder::setPaused(bool p) +-{ +- if (audioEncode) +- audioEncode->setPaused(p); +- if (videoEncode) +- videoEncode->setPaused(p); +-} +- +-void Encoder::setMetaData(const QMediaMetaData &metaData) +-{ +- this->metaData = metaData; +-} +- +-void Encoder::newAudioBuffer(const QAudioBuffer &buffer) +-{ +- if (audioEncode && isRecording) +- audioEncode->addBuffer(buffer); +-} +- +-void Encoder::newVideoFrame(const QVideoFrame &frame) +-{ +- if (videoEncode && isRecording) +- videoEncode->addFrame(frame); +-} +- +-void Encoder::newTimeStamp(qint64 time) +-{ +- QMutexLocker locker(&timeMutex); +- if (time > timeRecorded) { +- timeRecorded = time; +- emit durationChanged(time); +- } +-} +- +-Muxer::Muxer(Encoder *encoder) +- : encoder(encoder) +-{ +- setObjectName(QLatin1String("Muxer")); +-} +- +-void Muxer::addPacket(AVPacket *packet) +-{ +-// qCDebug(qLcFFmpegEncoder) << "Muxer::addPacket" << packet->pts << packet->stream_index; +- QMutexLocker locker(&queueMutex); +- packetQueue.enqueue(packet); +- wake(); +-} +- +-AVPacket *Muxer::takePacket() +-{ +- QMutexLocker locker(&queueMutex); +- if (packetQueue.isEmpty()) +- return nullptr; +-// qCDebug(qLcFFmpegEncoder) << "Muxer::takePacket" << packetQueue.first()->pts; +- return packetQueue.dequeue(); +-} +- +-void Muxer::init() +-{ +-} +- +-void Muxer::cleanup() +-{ +-} +- +-bool QFFmpeg::Muxer::shouldWait() const +-{ +- QMutexLocker locker(&queueMutex); +- return packetQueue.isEmpty(); +-} +- +-void Muxer::loop() +-{ +- auto *packet = takePacket(); +-// qCDebug(qLcFFmpegEncoder) << "writing packet to file" << packet->pts << packet->duration << packet->stream_index; +- av_interleaved_write_frame(encoder->formatContext, packet); +-} +- +- +-static AVSampleFormat bestMatchingSampleFormat(AVSampleFormat requested, const AVSampleFormat *available) +-{ +- if (!available) +- return requested; +- +- const AVSampleFormat *f = available; +- AVSampleFormat best = *f; +-/* +- enum { +- First, +- Planar, +- Exact, +- } score = First; +-*/ +- for (; *f != AV_SAMPLE_FMT_NONE; ++f) { +- qCDebug(qLcFFmpegEncoder) << "format:" << *f; +- if (*f == requested) { +- best = *f; +-// score = Exact; +- break; +- } +- +- if (av_get_planar_sample_fmt(requested) == *f) { +-// score = Planar; +- best = *f; +- } +- } +- return best; +-} +- +-AudioEncoder::AudioEncoder(Encoder *encoder, QFFmpegAudioInput *input, const QMediaEncoderSettings &settings) +- : input(input) +-{ +- this->encoder = encoder; +- +- setObjectName(QLatin1String("AudioEncoder")); +- qCDebug(qLcFFmpegEncoder) << "AudioEncoder" << settings.audioCodec(); +- +- format = input->device.preferredFormat(); +- auto codecID = QFFmpegMediaFormatInfo::codecIdForAudioCodec(settings.audioCodec()); +- Q_ASSERT(avformat_query_codec(encoder->formatContext->oformat, codecID, FF_COMPLIANCE_NORMAL)); +- +- auto *avCodec = avcodec_find_encoder(codecID); +- +- AVSampleFormat requested = QFFmpegMediaFormatInfo::avSampleFormat(format.sampleFormat()); +- AVSampleFormat bestSampleFormat = bestMatchingSampleFormat(requested, avCodec->sample_fmts); +- +- stream = avformat_new_stream(encoder->formatContext, nullptr); +- stream->id = encoder->formatContext->nb_streams - 1; +- stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; +- stream->codecpar->codec_id = codecID; +-#if QT_FFMPEG_OLD_CHANNEL_LAYOUT +- stream->codecpar->channel_layout = av_get_default_channel_layout(format.channelCount()); +- stream->codecpar->channels = format.channelCount(); +-#else +- av_channel_layout_default(&stream->codecpar->ch_layout, format.channelCount()); +-#endif +- stream->codecpar->sample_rate = format.sampleRate(); +- stream->codecpar->frame_size = 1024; +- stream->codecpar->format = bestSampleFormat; +- stream->time_base = AVRational{ 1, format.sampleRate() }; +- +- Q_ASSERT(avCodec); +- codec = avcodec_alloc_context3(avCodec); +- avcodec_parameters_to_context(codec, stream->codecpar); +- +- AVDictionary *opts = nullptr; +- applyAudioEncoderOptions(settings, avCodec->name, codec, &opts); +- +- int res = avcodec_open2(codec, avCodec, &opts); +- qCDebug(qLcFFmpegEncoder) << "audio codec opened" << res; +- qCDebug(qLcFFmpegEncoder) << "audio codec params: fmt=" << codec->sample_fmt << "rate=" << codec->sample_rate; +- +- if (codec->sample_fmt != requested) { +-#if QT_FFMPEG_OLD_CHANNEL_LAYOUT +- resampler = swr_alloc_set_opts(nullptr, // we're allocating a new context +- codec->channel_layout, // out_ch_layout +- codec->sample_fmt, // out_sample_fmt +- codec->sample_rate, // out_sample_rate +- av_get_default_channel_layout(format.channelCount()), // in_ch_layout +- requested, // in_sample_fmt +- format.sampleRate(), // in_sample_rate +- 0, // log_offset +- nullptr); +-#else +- AVChannelLayout in_ch_layout = {}; +- av_channel_layout_default(&in_ch_layout, format.channelCount()); +- swr_alloc_set_opts2(&resampler, // we're allocating a new context +- &codec->ch_layout, codec->sample_fmt, codec->sample_rate, +- &in_ch_layout, requested, format.sampleRate(), +- 0, nullptr); +-#endif +- +- swr_init(resampler); +- } +-} +- +-void AudioEncoder::addBuffer(const QAudioBuffer &buffer) +-{ +- QMutexLocker locker(&queueMutex); +- if (!paused.loadRelaxed()) { +- audioBufferQueue.enqueue(buffer); +- wake(); +- } +-} +- +-QAudioBuffer AudioEncoder::takeBuffer() +-{ +- QMutexLocker locker(&queueMutex); +- if (audioBufferQueue.isEmpty()) +- return QAudioBuffer(); +- return audioBufferQueue.dequeue(); +-} +- +-void AudioEncoder::init() +-{ +- if (input) { +- input->setFrameSize(codec->frame_size); +- } +- qCDebug(qLcFFmpegEncoder) << "AudioEncoder::init started audio device thread."; +-} +- +-void AudioEncoder::cleanup() +-{ +- while (!audioBufferQueue.isEmpty()) +- loop(); +- while (avcodec_send_frame(codec, nullptr) == AVERROR(EAGAIN)) +- retrievePackets(); +- retrievePackets(); +-} +- +-bool AudioEncoder::shouldWait() const +-{ +- QMutexLocker locker(&queueMutex); +- return audioBufferQueue.isEmpty(); +-} +- +-void AudioEncoder::retrievePackets() +-{ +- while (1) { +- AVPacket *packet = av_packet_alloc(); +- int ret = avcodec_receive_packet(codec, packet); +- if (ret < 0) { +- av_packet_unref(packet); +- if (ret != AVERROR(EOF)) +- break; +- if (ret != AVERROR(EAGAIN)) { +- char errStr[1024]; +- av_strerror(ret, errStr, 1024); +- qCDebug(qLcFFmpegEncoder) << "receive packet" << ret << errStr; +- } +- break; +- } +- +- // qCDebug(qLcFFmpegEncoder) << "writing video packet" << packet->size << packet->pts << timeStamp(packet->pts, stream->time_base) << packet->stream_index; +- packet->stream_index = stream->id; +- encoder->muxer->addPacket(packet); +- } +-} +- +-void AudioEncoder::loop() +-{ +- QAudioBuffer buffer = takeBuffer(); +- if (!buffer.isValid() || paused.loadAcquire()) +- return; +- +-// qCDebug(qLcFFmpegEncoder) << "new audio buffer" << buffer.byteCount() << buffer.format() << buffer.frameCount() << codec->frame_size; +- retrievePackets(); +- +- AVFrame *frame = av_frame_alloc(); +- frame->format = codec->sample_fmt; +-#if QT_FFMPEG_OLD_CHANNEL_LAYOUT +- frame->channel_layout = codec->channel_layout; +- frame->channels = codec->channels; +-#else +- frame->ch_layout = codec->ch_layout; +-#endif +- frame->sample_rate = codec->sample_rate; +- frame->nb_samples = buffer.frameCount(); +- if (frame->nb_samples) +- av_frame_get_buffer(frame, 0); +- +- if (resampler) { +- const uint8_t *data = buffer.constData(); +- swr_convert(resampler, frame->extended_data, frame->nb_samples, &data, frame->nb_samples); +- } else { +- memcpy(frame->buf[0]->data, buffer.constData(), buffer.byteCount()); +- } +- +- frame->pts = samplesWritten; +- samplesWritten += buffer.frameCount(); +- +- qint64 time = format.durationForFrames(samplesWritten); +- encoder->newTimeStamp(time/1000); +- +-// qCDebug(qLcFFmpegEncoder) << "sending audio frame" << buffer.byteCount() << frame->pts << ((double)buffer.frameCount()/frame->sample_rate); +- int ret = avcodec_send_frame(codec, frame); +- if (ret < 0) { +- char errStr[1024]; +- av_strerror(ret, errStr, 1024); +-// qCDebug(qLcFFmpegEncoder) << "error sending frame" << ret << errStr; +- } +-} +- +-VideoEncoder::VideoEncoder(Encoder *encoder, QPlatformCamera *camera, const QMediaEncoderSettings &settings) +- : m_encoderSettings(settings) +- , m_camera(camera) +-{ +- this->encoder = encoder; +- +- setObjectName(QLatin1String("VideoEncoder")); +- qCDebug(qLcFFmpegEncoder) << "VideoEncoder" << settings.videoCodec(); +- +- auto format = m_camera->cameraFormat(); +- auto *hwAccel = static_cast(camera->ffmpegHWAccel()); +- AVPixelFormat swFormat = QFFmpegVideoBuffer::toAVPixelFormat(format.pixelFormat()); +- AVPixelFormat pixelFormat = hwAccel ? hwAccel->hwFormat() : swFormat; +- frameEncoder = new VideoFrameEncoder(settings, format.resolution(), format.maxFrameRate(), pixelFormat, swFormat); +- frameEncoder->initWithFormatContext(encoder->formatContext); +-} +- +-VideoEncoder::~VideoEncoder() +-{ +- delete frameEncoder; +-} +- +-void VideoEncoder::addFrame(const QVideoFrame &frame) +-{ +- QMutexLocker locker(&queueMutex); +- if (!paused.loadRelaxed()) { +- videoFrameQueue.enqueue(frame); +- wake(); +- } +-} +- +-QVideoFrame VideoEncoder::takeFrame() +-{ +- QMutexLocker locker(&queueMutex); +- if (videoFrameQueue.isEmpty()) +- return QVideoFrame(); +- return videoFrameQueue.dequeue(); +-} +- +-void VideoEncoder::retrievePackets() +-{ +- if (!frameEncoder) +- return; +- while (AVPacket *packet = frameEncoder->retrievePacket()) +- encoder->muxer->addPacket(packet); +-} +- +-void VideoEncoder::init() +-{ +- qCDebug(qLcFFmpegEncoder) << "VideoEncoder::init started video device thread."; +- bool ok = frameEncoder->open(); +- if (!ok) +- encoder->error(QMediaRecorder::ResourceError, "Could not initialize encoder"); +-} +- +-void VideoEncoder::cleanup() +-{ +- while (!videoFrameQueue.isEmpty()) +- loop(); +- if (frameEncoder) { +- while (frameEncoder->sendFrame(nullptr) == AVERROR(EAGAIN)) +- retrievePackets(); +- retrievePackets(); +- } +-} +- +-bool VideoEncoder::shouldWait() const +-{ +- QMutexLocker locker(&queueMutex); +- return videoFrameQueue.isEmpty(); +-} +- +-struct QVideoFrameHolder +-{ +- QVideoFrame f; +- QImage i; +-}; +- +-static void freeQVideoFrame(void *opaque, uint8_t *) +-{ +- delete reinterpret_cast(opaque); +-} +- +-void VideoEncoder::loop() +-{ +- if (paused.loadAcquire()) +- return; +- +- retrievePackets(); +- +- auto frame = takeFrame(); +- if (!frame.isValid()) +- return; +- +- if (frameEncoder->isNull()) +- return; +- +-// qCDebug(qLcFFmpegEncoder) << "new video buffer" << frame.startTime(); +- +- AVFrame *avFrame = nullptr; +- +- auto *videoBuffer = dynamic_cast(frame.videoBuffer()); +- if (videoBuffer) { +- // ffmpeg video buffer, let's use the native AVFrame stored in there +- auto *hwFrame = videoBuffer->getHWFrame(); +- if (hwFrame && hwFrame->format == frameEncoder->sourceFormat()) +- avFrame = av_frame_clone(hwFrame); +- } +- +- if (!avFrame) { +- frame.map(QVideoFrame::ReadOnly); +- auto size = frame.size(); +- avFrame = av_frame_alloc(); +- avFrame->format = frameEncoder->sourceFormat(); +- avFrame->width = size.width(); +- avFrame->height = size.height(); +- av_frame_get_buffer(avFrame, 0); +- +- for (int i = 0; i < 4; ++i) { +- avFrame->data[i] = const_cast(frame.bits(i)); +- avFrame->linesize[i] = frame.bytesPerLine(i); +- } +- +- QImage img; +- if (frame.pixelFormat() == QVideoFrameFormat::Format_Jpeg) { +- // the QImage is cached inside the video frame, so we can take the pointer to the image data here +- img = frame.toImage(); +- avFrame->data[0] = (uint8_t *)img.bits(); +- avFrame->linesize[0] = img.bytesPerLine(); +- } +- +- Q_ASSERT(avFrame->data[0]); +- // ensure the video frame and it's data is alive as long as it's being used in the encoder +- avFrame->opaque_ref = av_buffer_create(nullptr, 0, freeQVideoFrame, new QVideoFrameHolder{frame, img}, 0); +- } +- +- if (baseTime.loadAcquire() < 0) { +- baseTime.storeRelease(frame.startTime() - lastFrameTime); +-// qCDebug(qLcFFmpegEncoder) << ">>>> adjusting base time to" << baseTime.loadAcquire() << frame.startTime() << lastFrameTime; +- } +- +- qint64 time = frame.startTime() - baseTime.loadAcquire(); +- lastFrameTime = frame.endTime() - baseTime.loadAcquire(); +- avFrame->pts = frameEncoder->getPts(time); +- +- encoder->newTimeStamp(time/1000); +- +-// qCDebug(qLcFFmpegEncoder) << ">>> sending frame" << avFrame->pts << time; +- int ret = frameEncoder->sendFrame(avFrame); +- if (ret < 0) { +- qCDebug(qLcFFmpegEncoder) << "error sending frame" << ret << err2str(ret); +- encoder->error(QMediaRecorder::ResourceError, err2str(ret)); +- } +-} +- +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegencoder_p.h b/src/plugins/multimedia/ffmpeg/qffmpegencoder_p.h +deleted file mode 100644 +index b673b718c..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegencoder_p.h ++++ /dev/null +@@ -1,197 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGENCODER_P_H +-#define QFFMPEGENCODER_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qffmpegthread_p.h" +-#include "qffmpeg_p.h" +-#include "qffmpeghwaccel_p.h" +- +-#include +-#include +-#include +- +-#include +- +-QT_BEGIN_NAMESPACE +- +-class QFFmpegAudioInput; +-class QVideoFrame; +-class QPlatformCamera; +- +-namespace QFFmpeg +-{ +- +-class Encoder; +-class Muxer; +-class AudioEncoder; +-class VideoEncoder; +-class VideoFrameEncoder; +- +-class EncodingFinalizer : public QThread +-{ +-public: +- EncodingFinalizer(Encoder *e) +- : encoder(e) +- {} +- void run() override; +- +- Encoder *encoder = nullptr; +-}; +- +-class Encoder : public QObject +-{ +- Q_OBJECT +-public: +- Encoder(const QMediaEncoderSettings &settings, const QUrl &url); +- ~Encoder(); +- +- void addAudioInput(QFFmpegAudioInput *input); +- void addVideoSource(QPlatformCamera *source); +- +- void start(); +- void finalize(); +- +- void setPaused(bool p); +- +- void setMetaData(const QMediaMetaData &metaData); +- +-public Q_SLOTS: +- void newAudioBuffer(const QAudioBuffer &buffer); +- void newVideoFrame(const QVideoFrame &frame); +- void newTimeStamp(qint64 time); +- +-Q_SIGNALS: +- void durationChanged(qint64 duration); +- void error(QMediaRecorder::Error code, const QString &description); +- void finalizationDone(); +- +-public: +- +- QMediaEncoderSettings settings; +- QMediaMetaData metaData; +- AVFormatContext *formatContext = nullptr; +- Muxer *muxer = nullptr; +- bool isRecording = false; +- +- AudioEncoder *audioEncode = nullptr; +- VideoEncoder *videoEncode = nullptr; +- +- QMutex timeMutex; +- qint64 timeRecorded = 0; +-}; +- +- +-class Muxer : public Thread +-{ +- mutable QMutex queueMutex; +- QQueue packetQueue; +-public: +- Muxer(Encoder *encoder); +- +- void addPacket(AVPacket *); +- +-private: +- AVPacket *takePacket(); +- +- void init() override; +- void cleanup() override; +- bool shouldWait() const override; +- void loop() override; +- +- Encoder *encoder; +-}; +- +-class EncoderThread : public Thread +-{ +-public: +- virtual void setPaused(bool b) +- { +- paused.storeRelease(b); +- } +- +-protected: +- QAtomicInteger paused = false; +- Encoder *encoder = nullptr; +-}; +- +-class AudioEncoder : public EncoderThread +-{ +- mutable QMutex queueMutex; +- QQueue audioBufferQueue; +-public: +- AudioEncoder(Encoder *encoder, QFFmpegAudioInput *input, const QMediaEncoderSettings &settings); +- +- void addBuffer(const QAudioBuffer &buffer); +- +- QFFmpegAudioInput *audioInput() const { return input; } +- +-private: +- QAudioBuffer takeBuffer(); +- void retrievePackets(); +- +- void init() override; +- void cleanup() override; +- bool shouldWait() const override; +- void loop() override; +- +- AVStream *stream = nullptr; +- AVCodecContext *codec = nullptr; +- QFFmpegAudioInput *input; +- QAudioFormat format; +- +- SwrContext *resampler = nullptr; +- qint64 samplesWritten = 0; +-}; +- +- +-class VideoEncoder : public EncoderThread +-{ +- mutable QMutex queueMutex; +- QQueue videoFrameQueue; +-public: +- VideoEncoder(Encoder *encoder, QPlatformCamera *camera, const QMediaEncoderSettings &settings); +- ~VideoEncoder(); +- +- void addFrame(const QVideoFrame &frame); +- +- void setPaused(bool b) override +- { +- EncoderThread::setPaused(b); +- if (b) +- baseTime.storeRelease(-1); +- } +- +-private: +- QVideoFrame takeFrame(); +- void retrievePackets(); +- +- void init() override; +- void cleanup() override; +- bool shouldWait() const override; +- void loop() override; +- +- QMediaEncoderSettings m_encoderSettings; +- QPlatformCamera *m_camera = nullptr; +- VideoFrameEncoder *frameEncoder = nullptr; +- +- QAtomicInteger baseTime = -1; +- qint64 lastFrameTime = 0; +-}; +- +-} +- +-QT_END_NAMESPACE +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegencoderoptions.cpp b/src/plugins/multimedia/ffmpeg/qffmpegencoderoptions.cpp +deleted file mode 100644 +index 2535048c3..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegencoderoptions.cpp ++++ /dev/null +@@ -1,272 +0,0 @@ +-// Copyright (C) 2022 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#include "qffmpegencoderoptions_p.h" +- +-#if QT_CONFIG(vaapi) +-#include +-#endif +- +-QT_BEGIN_NAMESPACE +- +-// unfortunately there is no common way to specify options for the encoders. The code here tries to map our settings sensibly +-// to options available in different encoders +- +-// For constant quality options, we're trying to map things to approx those bit rates for 1080p@30fps (in Mbps): +-// VeryLow Low Normal High VeryHigh +-// H264: 0.8M 1.5M 3.5M 6M 10M +-// H265: 0.5M 1.0M 2.5M 4M 7M +- +-[[maybe_unused]] +-static int bitrateForSettings(const QMediaEncoderSettings &settings, bool hdr = false) +-{ +- // calculate an acceptable bitrate depending on video codec, resolution, framerate and requested quality +- // The calculations are rather heuristic here, trying to take into account how well codecs compress using +- // the tables above. +- +- // The table here is for 30FPS +- const double bitsPerPixel[int(QMediaFormat::VideoCodec::LastVideoCodec)+1][QMediaRecorder::VeryHighQuality+1] = { +- { 1.2, 2.25, 5, 9, 15 }, // MPEG1, +- { 0.8, 1.5, 3.5, 6, 10 }, // MPEG2 +- { 0.4, 0.75, 1.75, 3, 5 }, // MPEG4 +- { 0.4, 0.75, 1.75, 3, 5 }, // H264 +- { 0.3, 0.5, 0.2, 2, 3 }, // H265 +- { 0.4, 0.75, 1.75, 3, 5 }, // VP8 +- { 0.3, 0.5, 0.2, 2, 3 }, // VP9 +- { 0.2, 0.4, 0.9, 1.5, 2.5 }, // AV1 +- { 0.4, 0.75, 1.75, 3, 5 }, // Theora +- { 0.8, 1.5, 3.5, 6, 10 }, // WMV +- { 16, 24, 32, 40, 48 }, // MotionJPEG +- }; +- +- QSize s = settings.videoResolution(); +- double bitrate = bitsPerPixel[int(settings.videoCodec())][settings.quality()]*s.width()*s.height(); +- +- if (settings.videoCodec() != QMediaFormat::VideoCodec::MotionJPEG) { +- // We assume that doubling the framerate requires 1.5 times the amount of data (not twice, as intraframe +- // differences will be smaller). 4 times the frame rate uses thus 2.25 times the data, etc. +- float rateMultiplier = log2(settings.videoFrameRate()/30.); +- bitrate *= pow(1.5, rateMultiplier); +- } else { +- // MotionJPEG doesn't optimize between frames, so we have a linear dependency on framerate +- bitrate *= settings.videoFrameRate()/30.; +- } +- +- // HDR requires 10bits per pixel instead of 8, so apply a factor of 1.25. +- if (hdr) +- bitrate *= 1.25; +- return bitrate; +-} +- +-static void apply_x264(const QMediaEncoderSettings &settings, AVCodecContext *codec, AVDictionary **opts) +-{ +- if (settings.encodingMode() == QMediaRecorder::ConstantBitRateEncoding || settings.encodingMode() == QMediaRecorder::AverageBitRateEncoding) { +- codec->bit_rate = settings.videoBitRate(); +- } else { +- const char *scales[] = { +- "29", "26", "23", "21", "19" +- }; +- av_dict_set(opts, "crf", scales[settings.quality()], 0); +- } +-} +- +-static void apply_x265(const QMediaEncoderSettings &settings, AVCodecContext *codec, AVDictionary **opts) +-{ +- if (settings.encodingMode() == QMediaRecorder::ConstantBitRateEncoding || settings.encodingMode() == QMediaRecorder::AverageBitRateEncoding) { +- codec->bit_rate = settings.videoBitRate(); +- } else { +- const char *scales[QMediaRecorder::VeryHighQuality+1] = { +- "40", "34", "28", "26", "24", +- }; +- av_dict_set(opts, "crf", scales[settings.quality()], 0); +- } +-} +- +-static void apply_libvpx(const QMediaEncoderSettings &settings, AVCodecContext *codec, AVDictionary **opts) +-{ +- if (settings.encodingMode() == QMediaRecorder::ConstantBitRateEncoding || settings.encodingMode() == QMediaRecorder::AverageBitRateEncoding) { +- codec->bit_rate = settings.videoBitRate(); +- } else { +- const char *scales[QMediaRecorder::VeryHighQuality+1] = { +- "38", "34", "31", "28", "25", +- }; +- av_dict_set(opts, "crf", scales[settings.quality()], 0); +- av_dict_set(opts, "b", 0, 0); +- } +- av_dict_set(opts, "row-mt", "1", 0); // better multithreading +-} +- +-#ifdef Q_OS_DARWIN +-static void apply_videotoolbox(const QMediaEncoderSettings &settings, AVCodecContext *codec, AVDictionary **) +-{ +- if (settings.encodingMode() == QMediaRecorder::ConstantBitRateEncoding || settings.encodingMode() == QMediaRecorder::AverageBitRateEncoding) { +- codec->bit_rate = settings.videoBitRate(); +- } else { +- // only use quality on macOS/ARM, as FFmpeg doesn't support it on the other platforms and would throw +- // an error when initializing the codec +-#if defined(Q_OS_MACOS) && defined(Q_PROCESSOR_ARM_64) +- // Videotoolbox describes quality as a number from 0 to 1, with low == 0.25, normal 0.5, high 0.75 and lossless = 1 +- // ffmpeg uses a different scale going from 0 to 11800. +- // Values here are adjusted to agree approximately with the target bit rates listed above +- const int scales[] = { +- 3000, 4800, 5900, 6900, 7700, +- }; +- codec->global_quality = scales[settings.quality()]; +- codec->flags |= AV_CODEC_FLAG_QSCALE; +-#else +- codec->bit_rate = bitrateForSettings(settings); +-#endif +- } +-} +-#endif +- +-#if QT_CONFIG(vaapi) +-static void apply_vaapi(const QMediaEncoderSettings &settings, AVCodecContext *codec, AVDictionary **/*opts*/) +-{ +- // See also vaapi_encode_init_rate_control() in libavcodec +- if (settings.encodingMode() == QMediaRecorder::ConstantBitRateEncoding) { +- codec->bit_rate = settings.videoBitRate(); +- codec->rc_max_rate = settings.videoBitRate(); +- } else if (settings.encodingMode() == QMediaRecorder::AverageBitRateEncoding) { +- codec->bit_rate = settings.videoBitRate(); +- } else { +- const int *quality = nullptr; +- // unfortunately, all VA codecs use different quality scales :/ +- switch (settings.videoCodec()) { +- case QMediaFormat::VideoCodec::MPEG2: { +- static const int q[] = { 20, 15, 10, 8, 6 }; +- quality = q; +- break; +- } +- case QMediaFormat::VideoCodec::MPEG4: +- case QMediaFormat::VideoCodec::H264: { +- static const int q[] = { 29, 26, 23, 21, 19 }; +- quality = q; +- break; +- } +- case QMediaFormat::VideoCodec::H265: { +- static const int q[] = { 40, 34, 28, 26, 24 }; +- quality = q; +- break; +- } +- case QMediaFormat::VideoCodec::VP8: { +- static const int q[] = { 56, 48, 40, 34, 28 }; +- quality = q; +- break; +- } +- case QMediaFormat::VideoCodec::VP9: { +- static const int q[] = { 124, 112, 100, 88, 76 }; +- quality = q; +- break; +- } +- case QMediaFormat::VideoCodec::MotionJPEG: { +- static const int q[] = { 40, 60, 80, 90, 95 }; +- quality = q; +- break; +- } +- case QMediaFormat::VideoCodec::AV1: +- case QMediaFormat::VideoCodec::Theora: +- case QMediaFormat::VideoCodec::WMV: +- default: +- break; +- } +- +- if (quality) { +- qDebug() << "using quality" << settings.quality() << quality[settings.quality()]; +- codec->global_quality = quality[settings.quality()]; +- } +- } +-} +-#endif +- +-#ifdef Q_OS_WINDOWS +-static void apply_mf(const QMediaEncoderSettings &settings, AVCodecContext *codec, AVDictionary **opts) +-{ +- if (settings.encodingMode() == QMediaRecorder::ConstantBitRateEncoding || settings.encodingMode() == QMediaRecorder::AverageBitRateEncoding) { +- codec->bit_rate = settings.videoBitRate(); +- av_dict_set(opts, "rate_control", "cbr", 0); +- } else { +- av_dict_set(opts, "rate_control", "quality", 0); +- const char *scales[] = { +- "25", "50", "75", "90", "100" +- }; +- av_dict_set(opts, "quality", scales[settings.quality()], 0); +- } +-} +-#endif +- +-namespace QFFmpeg { +- +-using ApplyOptions = void (*)(const QMediaEncoderSettings &settings, AVCodecContext *codec, AVDictionary **opts); +- +-const struct { +- const char *name; +- ApplyOptions apply; +-} videoCodecOptionTable[] = { +- { "libx264", apply_x264 }, +- { "libx265xx", apply_x265 }, +- { "libvpx", apply_libvpx }, +- { "libvpx_vp9", apply_libvpx }, +-#ifdef Q_OS_DARWIN +- { "h264_videotoolbox", apply_videotoolbox }, +- { "hevc_videotoolbox", apply_videotoolbox }, +- { "prores_videotoolbox", apply_videotoolbox }, +- { "vp9_videotoolbox", apply_videotoolbox }, +-#endif +-#if QT_CONFIG(vaapi) +- { "mpeg2_vaapi", apply_vaapi }, +- { "mjpeg_vaapi", apply_vaapi }, +- { "h264_vaapi", apply_vaapi }, +- { "hevc_vaapi", apply_vaapi }, +- { "vp8_vaapi", apply_vaapi }, +- { "vp9_vaapi", apply_vaapi }, +-#endif +-#ifdef Q_OS_WINDOWS +- { "hevc_mf", apply_mf }, +- { "h264_mf", apply_mf }, +-#endif +- { nullptr, nullptr } +-}; +- +-const struct { +- const char *name; +- ApplyOptions apply; +-} audioCodecOptionTable[] = { +- { nullptr, nullptr } +-}; +- +-void applyVideoEncoderOptions(const QMediaEncoderSettings &settings, const QByteArray &codecName, AVCodecContext *codec, AVDictionary **opts) +-{ +- av_dict_set(opts, "threads", "auto", 0); // we always want automatic threading +- +- auto *table = videoCodecOptionTable; +- while (table->name) { +- if (codecName == table->name) { +- table->apply(settings, codec, opts); +- return; +- } +- +- ++table; +- } +-} +- +-void applyAudioEncoderOptions(const QMediaEncoderSettings &settings, const QByteArray &codecName, AVCodecContext *codec, AVDictionary **opts) +-{ +- codec->thread_count = -1; // we always want automatic threading +- if (settings.encodingMode() == QMediaRecorder::ConstantBitRateEncoding || settings.encodingMode() == QMediaRecorder::AverageBitRateEncoding) +- codec->bit_rate = settings.audioBitRate(); +- +- auto *table = audioCodecOptionTable; +- while (table->name) { +- if (codecName == table->name) { +- table->apply(settings, codec, opts); +- return; +- } +- +- ++table; +- } +- +-} +- +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegencoderoptions_p.h b/src/plugins/multimedia/ffmpeg/qffmpegencoderoptions_p.h +deleted file mode 100644 +index 005ad7652..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegencoderoptions_p.h ++++ /dev/null +@@ -1,32 +0,0 @@ +-// Copyright (C) 2022 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGENCODEROPTIONS_P_H +-#define QFFMPEGENCODEROPTIONS_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qffmpeghwaccel_p.h" +-#include "qvideoframeformat.h" +-#include "private/qplatformmediarecorder_p.h" +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg { +- +-void applyVideoEncoderOptions(const QMediaEncoderSettings &settings, const QByteArray &codecName, AVCodecContext *codec, AVDictionary **opts); +-void applyAudioEncoderOptions(const QMediaEncoderSettings &settings, const QByteArray &codecName, AVCodecContext *codec, AVDictionary **opts); +- +-} +- +-QT_END_NAMESPACE +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel.cpp b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel.cpp +deleted file mode 100644 +index c2bc4f6e1..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel.cpp ++++ /dev/null +@@ -1,399 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpeghwaccel_p.h" +-#if QT_CONFIG(vaapi) +-#include "qffmpeghwaccel_vaapi_p.h" +-#endif +-#ifdef Q_OS_DARWIN +-#include "qffmpeghwaccel_videotoolbox_p.h" +-#endif +-#if QT_CONFIG(wmf) +-#include "qffmpeghwaccel_d3d11_p.h" +-#endif +-#ifdef Q_OS_ANDROID +-# include "qffmpeghwaccel_mediacodec_p.h" +-#endif +-#include "qffmpeg_p.h" +-#include "qffmpegvideobuffer_p.h" +- +-#include +-#include +- +-/* Infrastructure for HW acceleration goes into this file. */ +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg { +- +-// HW context initialization +- +-// preferred order of HW accelerators to use +-static const AVHWDeviceType preferredHardwareAccelerators[] = { +-// Linux/Unix +-#if defined(Q_OS_LINUX) +- AV_HWDEVICE_TYPE_VAAPI, +-// AV_HWDEVICE_TYPE_DRM, +-#elif defined (Q_OS_WIN) +- AV_HWDEVICE_TYPE_D3D11VA, +-#elif defined (Q_OS_DARWIN) +- AV_HWDEVICE_TYPE_VIDEOTOOLBOX, +-#elif defined (Q_OS_ANDROID) +- AV_HWDEVICE_TYPE_MEDIACODEC, +-#endif +- AV_HWDEVICE_TYPE_NONE +-}; +- +-static AVBufferRef *loadHWContext(const AVHWDeviceType type) +-{ +- AVBufferRef *hwContext = nullptr; +- int ret = av_hwdevice_ctx_create(&hwContext, type, nullptr, nullptr, 0); +- qDebug() << " Checking HW context:" << av_hwdevice_get_type_name(type); +- if (ret == 0) { +- qDebug() << " Using above hw context."; +- return hwContext; +- } +- qDebug() << " Could not create hw context:" << ret << strerror(-ret); +- return nullptr; +-} +- +-static AVBufferRef *hardwareContextForCodec(const AVCodec *codec) +-{ +- qDebug() << "Checking HW acceleration for decoder" << codec->name; +- +- // First try our preferred accelerators. Those are the ones where we can +- // set up a zero copy pipeline +- auto *preferred = preferredHardwareAccelerators; +- while (*preferred != AV_HWDEVICE_TYPE_NONE) { +- for (int i = 0;; ++i) { +- const AVCodecHWConfig *config = avcodec_get_hw_config(codec, i); +- if (!config) +- break; +- if (config->device_type == *preferred) { +- auto *hwContext = loadHWContext(config->device_type); +- if (hwContext) +- return hwContext; +- break; +- } +- } +- ++preferred; +- } +- +- // Ok, let's see if we can get any HW acceleration at all. It'll still involve one buffer copy, +- // as we can't move the data into RHI textures without a CPU copy +- for (int i = 0;; ++i) { +- const AVCodecHWConfig *config = avcodec_get_hw_config(codec, i); +- if (!config) +- break; +- +- auto *hwContext = loadHWContext(config->device_type); +- if (hwContext) +- return hwContext; +- } +- qDebug() << " No HW accelerators found, using SW decoding."; +- return nullptr; +- +-} +- +-// Used for the AVCodecContext::get_format callback +-AVPixelFormat getFormat(AVCodecContext *s, const AVPixelFormat *fmt) +-{ +- // First check HW accelerated codecs, the HW device context must be set +- if (s->hw_device_ctx) { +- auto *device_ctx = (AVHWDeviceContext*)s->hw_device_ctx->data; +- for (int i = 0; const AVCodecHWConfig *config = avcodec_get_hw_config(s->codec, i); i++) { +- if (!(config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX)) +- continue; +- if (device_ctx->type != config->device_type) +- continue; +- for (int n = 0; fmt[n] != AV_PIX_FMT_NONE; n++) { +- if (config->pix_fmt == fmt[n]) { +-#if QT_CONFIG(wmf) +- if (fmt[n] == AV_PIX_FMT_D3D11) +- QFFmpeg::D3D11TextureConverter::SetupDecoderTextures(s); +-#endif +-#ifdef Q_OS_ANDROID +- if (fmt[n] == AV_PIX_FMT_MEDIACODEC) +- QFFmpeg::MediaCodecTextureConverter::setupDecoderSurface(s); +-#endif +- return fmt[n]; +- } +- } +- } +- } +- +- // prefer video formats we can handle directly +- for (int n = 0; fmt[n] != AV_PIX_FMT_NONE; n++) { +- bool needsConversion = true; +- QFFmpegVideoBuffer::toQtPixelFormat(fmt[n], &needsConversion); +- if (!needsConversion) +- return fmt[n]; +- } +- +- // take the native format, this will involve one additional format conversion on the CPU side +- return *fmt; +-} +- +-TextureConverter::Data::~Data() +-{ +- delete backend; +-} +- +- +- +-HWAccel::Data::~Data() +-{ +- if (hwDeviceContext) +- av_buffer_unref(&hwDeviceContext); +- if (hwFramesContext) +- av_buffer_unref(&hwFramesContext); +-} +- +- +-HWAccel::HWAccel(const AVCodec *codec) +-{ +- if (codec->type != AVMEDIA_TYPE_VIDEO) +- return; +- auto *ctx = hardwareContextForCodec(codec); +- if (!ctx) +- return; +- d = new Data; +- d->hwDeviceContext = ctx; +-} +- +-HWAccel::HWAccel(AVHWDeviceType deviceType) +-{ +- auto *ctx = loadHWContext(deviceType); +- if (!ctx) +- return; +- d = new Data; +- d->hwDeviceContext = ctx; +-} +- +-HWAccel::~HWAccel() = default; +- +-AVPixelFormat HWAccel::format(AVFrame *frame) +-{ +- if (!frame->hw_frames_ctx) +- return AVPixelFormat(frame->format); +- +- auto *hwFramesContext = (AVHWFramesContext *)frame->hw_frames_ctx->data; +- Q_ASSERT(hwFramesContext); +- return AVPixelFormat(hwFramesContext->sw_format); +-} +- +-const AVHWDeviceType *HWAccel::preferredDeviceTypes() +-{ +- return preferredHardwareAccelerators; +-} +- +-AVHWDeviceContext *HWAccel::hwDeviceContext() const +-{ +- if (!d || !d->hwDeviceContext) +- return nullptr; +- return (AVHWDeviceContext *)d->hwDeviceContext->data; +-} +- +-AVPixelFormat HWAccel::hwFormat() const +-{ +- switch (deviceType()) { +- case AV_HWDEVICE_TYPE_VIDEOTOOLBOX: +- return AV_PIX_FMT_VIDEOTOOLBOX; +- case AV_HWDEVICE_TYPE_VAAPI: +- return AV_PIX_FMT_VAAPI; +- case AV_HWDEVICE_TYPE_MEDIACODEC: +- return AV_PIX_FMT_MEDIACODEC; +- default: +- return AV_PIX_FMT_NONE; +- } +-} +- +-const AVCodec *HWAccel::hardwareDecoderForCodecId(AVCodecID id) +-{ +- const AVCodec *codec = nullptr; +-#ifdef Q_OS_ANDROID +- const auto getDecoder = [](AVCodecID id) { +- switch (id) { +- case AV_CODEC_ID_H264: +- return avcodec_find_decoder_by_name("h264_mediacodec"); +- case AV_CODEC_ID_HEVC: +- return avcodec_find_decoder_by_name("hevc_mediacodec"); +- case AV_CODEC_ID_MPEG2VIDEO: +- return avcodec_find_decoder_by_name("mpeg2_mediacodec"); +- case AV_CODEC_ID_MPEG4: +- return avcodec_find_decoder_by_name("mpeg4_mediacodec"); +- case AV_CODEC_ID_VP8: +- return avcodec_find_decoder_by_name("vp8_mediacodec"); +- case AV_CODEC_ID_VP9: +- return avcodec_find_decoder_by_name("vp9_mediacodec"); +- default: +- return avcodec_find_decoder(id); +- } +- }; +- codec = getDecoder(id); +-#endif +- +- if (!codec) +- codec = avcodec_find_decoder(id); +- +- return codec; +-} +- +-const AVCodec *HWAccel::hardwareEncoderForCodecId(AVCodecID id) const +-{ +- const char *codec = nullptr; +- switch (deviceType()) { +-#ifdef Q_OS_DARWIN +- case AV_HWDEVICE_TYPE_VIDEOTOOLBOX: +- switch (id) { +- case AV_CODEC_ID_H264: +- codec = "h264_videotoolbox"; +- break; +- case AV_CODEC_ID_HEVC: +- codec = "hevc_videotoolbox"; +- break; +- case AV_CODEC_ID_PRORES: +- codec = "prores_videotoolbox"; +- break; +- case AV_CODEC_ID_VP9: +- codec = "vp9_videotoolbox"; +- break; +- default: +- break; +- } +- break; +-#endif +- case AV_HWDEVICE_TYPE_VAAPI: +- switch (id) { +- case AV_CODEC_ID_H264: +- codec = "h264_vaapi"; +- break; +- case AV_CODEC_ID_HEVC: +- codec = "hevc_vaapi"; +- break; +- case AV_CODEC_ID_MJPEG: +- codec = "mjpeg_vaapi"; +- break; +- case AV_CODEC_ID_MPEG2VIDEO: +- codec = "mpeg2_vaapi"; +- break; +- case AV_CODEC_ID_VP8: +- codec = "vp8_vaapi"; +- break; +- case AV_CODEC_ID_VP9: +- codec = "vp9_vaapi"; +- break; +- default: +- break; +- } +- break; +- default: +- break; +- } +- if (!codec) +- return nullptr; +- const AVCodec *c = avcodec_find_encoder_by_name(codec); +- qDebug() << "searching for HW codec" << codec << "got" << c; +- return c; +-} +- +-HWAccel HWAccel::findHardwareAccelForCodecID(AVCodecID id) +-{ +- auto *accels = preferredHardwareAccelerators; +- while (*accels != AV_HWDEVICE_TYPE_NONE) { +- auto accel = HWAccel(*accels); +- if (accel.hardwareEncoderForCodecId(id) != nullptr) +- return accel; +- ++accels; +- } +- return {}; +-} +- +-AVHWDeviceType HWAccel::deviceType() const +-{ +- if (!d || !d->hwDeviceContext) +- return AV_HWDEVICE_TYPE_NONE; +- return hwDeviceContext()->type; +-} +- +-void HWAccel::createFramesContext(AVPixelFormat swFormat, const QSize &size) +-{ +- if (!d || !d->hwDeviceContext) +- return; +- d->hwFramesContext = av_hwframe_ctx_alloc(d->hwDeviceContext); +- auto *c = (AVHWFramesContext *)d->hwFramesContext->data; +- c->format = hwFormat(); +- c->sw_format = swFormat; +- c->width = size.width(); +- c->height = size.height(); +- qDebug() << "init frames context"; +- int err = av_hwframe_ctx_init(d->hwFramesContext); +- if (err < 0) +- qWarning() << "failed to init HW frame context" << err << err2str(err); +- else +- qDebug() << "Initialized frames context" << size << c->format << c->sw_format; +-} +- +-AVHWFramesContext *HWAccel::hwFramesContext() const +-{ +- if (!d || !d->hwFramesContext) +- return nullptr; +- return (AVHWFramesContext *)d->hwFramesContext->data; +-} +- +- +-TextureConverter::TextureConverter(QRhi *rhi) +- : d(new Data) +-{ +- d->rhi = rhi; +-} +- +-TextureSet *TextureConverter::getTextures(AVFrame *frame) +-{ +- if (!frame || isNull()) +- return nullptr; +- +- Q_ASSERT(frame->format == d->format); +- return d->backend->getTextures(frame); +-} +- +-void TextureConverter::updateBackend(AVPixelFormat fmt) +-{ +- d->backend = nullptr; +- if (!d->rhi) +- return; +- switch (fmt) { +-#if QT_CONFIG(vaapi) +- case AV_PIX_FMT_VAAPI: +- d->backend = new VAAPITextureConverter(d->rhi); +- break; +-#endif +-#ifdef Q_OS_DARWIN +- case AV_PIX_FMT_VIDEOTOOLBOX: +- d->backend = new VideoToolBoxTextureConverter(d->rhi); +- break; +-#endif +-#if QT_CONFIG(wmf) +- case AV_PIX_FMT_D3D11: +- d->backend = new D3D11TextureConverter(d->rhi); +- break; +-#endif +-#ifdef Q_OS_ANDROID +- case AV_PIX_FMT_MEDIACODEC: +- d->backend = new MediaCodecTextureConverter(d->rhi); +- break; +-#endif +- default: +- break; +- } +- d->format = fmt; +-} +- +-std::unique_ptr TextureSet::texture(int /*plane*/) +-{ +- return {}; +-} +- +-} // namespace QFFmpeg +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11.cpp b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11.cpp +deleted file mode 100644 +index ff06fee54..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11.cpp ++++ /dev/null +@@ -1,178 +0,0 @@ +-// Copyright (C) 2022 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpeghwaccel_d3d11_p.h" +- +-#include +-#include "qffmpegvideobuffer_p.h" +- +- +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +- +-#include +- +-QT_BEGIN_NAMESPACE +- +-Q_LOGGING_CATEGORY(qLcMediaFFmpegHWAccel, "qt.multimedia.hwaccel") +- +-namespace QFFmpeg { +- +-class D3D11TextureSet : public TextureSet +-{ +-public: +- D3D11TextureSet(QRhi *rhi, QVideoFrameFormat::PixelFormat format, QWindowsIUPointer &&tex) +- : m_rhi(rhi) +- , m_format(format) +- , m_tex(tex) +- {} +- +- std::unique_ptr texture(int plane) override { +- auto desc = QVideoTextureHelper::textureDescription(m_format); +- if (!m_tex || !m_rhi || !desc || plane >= desc->nplanes) +- return {}; +- +- D3D11_TEXTURE2D_DESC d3d11desc = {}; +- m_tex->GetDesc(&d3d11desc); +- +- QSize planeSize(desc->widthForPlane(int(d3d11desc.Width), plane), +- desc->heightForPlane(int(d3d11desc.Height), plane)); +- +- std::unique_ptr tex(m_rhi->newTextureArray(desc->textureFormat[plane], +- int(d3d11desc.ArraySize), +- planeSize, 1, {})); +- if (tex) { +- if (!tex->createFrom({quint64(m_tex.get()), 0})) +- tex.reset(); +- } +- return tex; +- } +- +-private: +- QRhi *m_rhi = nullptr; +- QVideoFrameFormat::PixelFormat m_format; +- QWindowsIUPointer m_tex; +-}; +- +- +-D3D11TextureConverter::D3D11TextureConverter(QRhi *rhi) +- : TextureConverterBackend(rhi) +-{ +-} +- +-static QWindowsIUPointer getSharedTextureForDevice(ID3D11Device *dev, ID3D11Texture2D *tex) +-{ +- QWindowsIUPointer dxgiResource; +- HRESULT hr = tex->QueryInterface(__uuidof(IDXGIResource), reinterpret_cast(dxgiResource.address())); +- if (FAILED(hr)) { +- qCDebug(qLcMediaFFmpegHWAccel) << "Failed to obtain resource handle from FFMpeg texture" << hr; +- return {}; +- } +- HANDLE shared = nullptr; +- hr = dxgiResource->GetSharedHandle(&shared); +- if (FAILED(hr)) { +- qCDebug(qLcMediaFFmpegHWAccel) << "Failed to obtain shared handle for FFmpeg texture" << hr; +- return {}; +- } +- +- QWindowsIUPointer sharedTex; +- hr = dev->OpenSharedResource(shared, __uuidof(ID3D11Texture2D), reinterpret_cast(sharedTex.address())); +- if (FAILED(hr)) +- qCDebug(qLcMediaFFmpegHWAccel) << "Failed to share FFmpeg texture" << hr; +- return sharedTex; +-} +- +-static QWindowsIUPointer copyTextureFromArray(ID3D11Device *dev, ID3D11Texture2D *array, int index) +-{ +- D3D11_TEXTURE2D_DESC arrayDesc = {}; +- array->GetDesc(&arrayDesc); +- +- D3D11_TEXTURE2D_DESC texDesc = {}; +- texDesc.Width = arrayDesc.Width; +- texDesc.Height = arrayDesc.Height; +- texDesc.Format = arrayDesc.Format; +- texDesc.ArraySize = 1; +- texDesc.MipLevels = 1; +- texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE; +- texDesc.MiscFlags = 0; +- texDesc.SampleDesc = { 1, 0}; +- +- QWindowsIUPointer texCopy; +- HRESULT hr = dev->CreateTexture2D(&texDesc, nullptr, texCopy.address()); +- if (FAILED(hr)) { +- qCDebug(qLcMediaFFmpegHWAccel) << "Failed to create texture" << hr; +- return {}; +- } +- +- QWindowsIUPointer ctx; +- dev->GetImmediateContext(ctx.address()); +- ctx->CopySubresourceRegion(texCopy.get(), 0, 0, 0, 0, array, index, nullptr); +- +- return texCopy; +-} +- +-TextureSet *D3D11TextureConverter::getTextures(AVFrame *frame) +-{ +- if (!frame || !frame->hw_frames_ctx || frame->format != AV_PIX_FMT_D3D11) +- return nullptr; +- +- auto *fCtx = (AVHWFramesContext *)frame->hw_frames_ctx->data; +- auto *ctx = fCtx->device_ctx; +- if (!ctx || ctx->type != AV_HWDEVICE_TYPE_D3D11VA) +- return nullptr; +- +- auto nh = static_cast(rhi->nativeHandles()); +- if (!nh) +- return nullptr; +- +- auto ffmpegTex = (ID3D11Texture2D *)frame->data[0]; +- int index = (intptr_t)frame->data[1]; +- +- if (rhi->backend() == QRhi::D3D11) { +- auto dev = reinterpret_cast(nh->dev); +- if (!dev) +- return nullptr; +- auto sharedTex = getSharedTextureForDevice(dev, ffmpegTex); +- if (sharedTex) { +- auto tex = copyTextureFromArray(dev, sharedTex.get(), index); +- if (tex) { +- QVideoFrameFormat::PixelFormat format = QFFmpegVideoBuffer::toQtPixelFormat(AVPixelFormat(fCtx->sw_format)); +- return new D3D11TextureSet(rhi, format, std::move(tex)); +- } +- } +- } +- +- return nullptr; +-} +- +-void D3D11TextureConverter::SetupDecoderTextures(AVCodecContext *s) +-{ +- int ret = avcodec_get_hw_frames_parameters(s, +- s->hw_device_ctx, +- AV_PIX_FMT_D3D11, +- &s->hw_frames_ctx); +- if (ret < 0) { +- qCDebug(qLcMediaFFmpegHWAccel) << "Failed to allocate HW frames context" << ret; +- return; +- } +- +- auto *frames_ctx = (AVHWFramesContext *)s->hw_frames_ctx->data; +- auto *hwctx = (AVD3D11VAFramesContext *)frames_ctx->hwctx; +- hwctx->MiscFlags = D3D11_RESOURCE_MISC_SHARED; +- hwctx->BindFlags = D3D11_BIND_DECODER | D3D11_BIND_SHADER_RESOURCE; +- ret = av_hwframe_ctx_init(s->hw_frames_ctx); +- if (ret < 0) { +- qCDebug(qLcMediaFFmpegHWAccel) << "Failed to initialize HW frames context" << ret; +- av_buffer_unref(&s->hw_frames_ctx); +- } +-} +- +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11_p.h b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11_p.h +deleted file mode 100644 +index 2e9c77f5b..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11_p.h ++++ /dev/null +@@ -1,43 +0,0 @@ +-// Copyright (C) 2022 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGHWACCEL_D3D11_P_H +-#define QFFMPEGHWACCEL_D3D11_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qffmpeghwaccel_p.h" +- +-#if QT_CONFIG(wmf) +- +-QT_BEGIN_NAMESPACE +- +-class QRhi; +- +-namespace QFFmpeg { +- +-class D3D11TextureConverter : public TextureConverterBackend +-{ +-public: +- D3D11TextureConverter(QRhi *rhi); +- +- TextureSet *getTextures(AVFrame *frame) override; +- +- static void SetupDecoderTextures(AVCodecContext *s); +-}; +- +-} +- +-QT_END_NAMESPACE +- +-#endif +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_mediacodec.cpp b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_mediacodec.cpp +deleted file mode 100644 +index 20a06c3ab..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_mediacodec.cpp ++++ /dev/null +@@ -1,70 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpeghwaccel_mediacodec_p.h" +- +-#include +-#include +- +-extern "C" { +-#include +-} +- +-#if !defined(Q_OS_ANDROID) +-# error "Configuration error" +-#endif +- +-namespace QFFmpeg { +- +-Q_GLOBAL_STATIC(AndroidSurfaceTexture, androidSurfaceTexture, 0); +- +-class MediaCodecTextureSet : public TextureSet +-{ +-public: +- MediaCodecTextureSet(qint64 textureHandle) : handle(textureHandle) { } +- +- qint64 textureHandle(int plane) override { return (plane == 0) ? handle : 0; } +- +-private: +- qint64 handle; +-}; +- +-void MediaCodecTextureConverter::setupDecoderSurface(AVCodecContext *avCodecContext) +-{ +- AVMediaCodecContext *mediacodecContext = av_mediacodec_alloc_context(); +- av_mediacodec_default_init(avCodecContext, mediacodecContext, androidSurfaceTexture->surface()); +-} +- +-TextureSet *MediaCodecTextureConverter::getTextures(AVFrame *frame) +-{ +- if (!androidSurfaceTexture->isValid()) +- return {}; +- +- if (!externalTexture) { +- androidSurfaceTexture->detachFromGLContext(); +- externalTexture = std::unique_ptr( +- rhi->newTexture(QRhiTexture::Format::RGBA8, { frame->width, frame->height }, 1, +- QRhiTexture::ExternalOES)); +- +- if (!externalTexture->create()) { +- qWarning() << "Failed to create the external texture!"; +- return {}; +- } +- +- quint64 textureHandle = externalTexture->nativeTexture().object; +- androidSurfaceTexture->attachToGLContext(textureHandle); +- } +- +- // release a MediaCodec buffer and render it to the surface +- AVMediaCodecBuffer *buffer = (AVMediaCodecBuffer *)frame->data[3]; +- int result = av_mediacodec_release_buffer(buffer, 1); +- if (result < 0) { +- qWarning() << "Failed to render buffer to surface."; +- return {}; +- } +- +- androidSurfaceTexture->updateTexImage(); +- +- return new MediaCodecTextureSet(externalTexture->nativeTexture().object); +-} +-} +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_mediacodec_p.h b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_mediacodec_p.h +deleted file mode 100644 +index 95982ba4d..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_mediacodec_p.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#ifndef QFFMPEGHWACCEL_MEDIACODEC_P_H +-#define QFFMPEGHWACCEL_MEDIACODEC_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qffmpeghwaccel_p.h" +-#include +- +-namespace QFFmpeg { +-struct Frame; +- +-class MediaCodecTextureConverter : public TextureConverterBackend +-{ +-public: +- MediaCodecTextureConverter(QRhi *rhi) : TextureConverterBackend(rhi){}; +- TextureSet *getTextures(AVFrame *frame) override; +- +- static void setupDecoderSurface(AVCodecContext *s); +-private: +- std::unique_ptr externalTexture; +-}; +-} +-#endif // QFFMPEGHWACCEL_MEDIACODEC_P_H +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_p.h b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_p.h +deleted file mode 100644 +index 1170e9fb4..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_p.h ++++ /dev/null +@@ -1,125 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGHWACCEL_P_H +-#define QFFMPEGHWACCEL_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qffmpeg_p.h" +-#include "qvideoframeformat.h" +-#include +-#include +- +-QT_BEGIN_NAMESPACE +- +-class QRhi; +-class QRhiTexture; +-class QFFmpegVideoBuffer; +- +-namespace QFFmpeg { +- +-// used for the get_format callback for the decoder +-enum AVPixelFormat getFormat(struct AVCodecContext *s, const enum AVPixelFormat * fmt); +- +-class HWAccel; +- +-class TextureSet { +-public: +- // ### Should add QVideoFrameFormat::PixelFormat here +- virtual ~TextureSet() {} +- virtual qint64 textureHandle(int /*plane*/) { return 0; } +- virtual std::unique_ptr texture(int plane); +-}; +- +-class TextureConverterBackend +-{ +-public: +- TextureConverterBackend(QRhi *rhi) +- : rhi(rhi) +- {} +- virtual ~TextureConverterBackend() {} +- virtual TextureSet *getTextures(AVFrame * /*frame*/) { return nullptr; } +- +- QRhi *rhi = nullptr; +-}; +- +-class TextureConverter +-{ +- class Data final +- { +- public: +- ~Data(); +- QAtomicInt ref = 0; +- QRhi *rhi = nullptr; +- AVPixelFormat format = AV_PIX_FMT_NONE; +- TextureConverterBackend *backend = nullptr; +- }; +-public: +- TextureConverter(QRhi *rhi = nullptr); +- +- void init(AVFrame *frame) { +- AVPixelFormat fmt = frame ? AVPixelFormat(frame->format) : AV_PIX_FMT_NONE; +- if (fmt != d->format) +- updateBackend(fmt); +- } +- TextureSet *getTextures(AVFrame *frame); +- bool isNull() const { return !d->backend || !d->backend->rhi; } +- +-private: +- void updateBackend(AVPixelFormat format); +- +- QExplicitlySharedDataPointer d; +-}; +- +-class HWAccel +-{ +- struct Data { +- ~Data(); +- QAtomicInt ref = 0; +- AVBufferRef *hwDeviceContext = nullptr; +- AVBufferRef *hwFramesContext = nullptr; +- }; +- +-public: +- HWAccel() = default; +- explicit HWAccel(AVHWDeviceType deviceType); +- explicit HWAccel(const AVCodec *codec); +- ~HWAccel(); +- +- bool isNull() const { return !d || !d->hwDeviceContext; } +- +- AVHWDeviceType deviceType() const; +- +- AVBufferRef *hwDeviceContextAsBuffer() const { return d ? d->hwDeviceContext : nullptr; } +- AVHWDeviceContext *hwDeviceContext() const; +- AVPixelFormat hwFormat() const; +- +- const AVCodec *hardwareEncoderForCodecId(AVCodecID id) const; +- static HWAccel findHardwareAccelForCodecID(AVCodecID id); +- +- static const AVCodec *hardwareDecoderForCodecId(AVCodecID id); +- +- void createFramesContext(AVPixelFormat swFormat, const QSize &size); +- AVBufferRef *hwFramesContextAsBuffer() const { return d ? d->hwFramesContext : nullptr; } +- AVHWFramesContext *hwFramesContext() const; +- +- static AVPixelFormat format(AVFrame *frame); +- static const AVHWDeviceType *preferredDeviceTypes(); +-private: +- QExplicitlySharedDataPointer d; +-}; +- +-} +- +-QT_END_NAMESPACE +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_vaapi.cpp b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_vaapi.cpp +deleted file mode 100644 +index 7b9976fe0..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_vaapi.cpp ++++ /dev/null +@@ -1,346 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpeghwaccel_vaapi_p.h" +- +-#if !QT_CONFIG(vaapi) +-#error "Configuration error" +-#endif +- +-#include +- +-#include +-#include "qffmpegvideobuffer_p.h" +-#include "private/qvideotexturehelper_p.h" +- +-#include +-#include +- +-#include +-#include +- +-#include +- +-//#define VA_EXPORT_USE_LAYERS +- +-#if __has_include("drm/drm_fourcc.h") +-#include +-#elif __has_include("libdrm/drm_fourcc.h") +-#include +-#else +-// keep things building without drm_fourcc.h +-#define fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \ +- ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) +- +-#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ +-#define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ +-#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */ +-#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ +-#define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ +-#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ +-#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ +-#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */ +-#define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ +-#define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */ +-#define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */ +-#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ +-#endif +- +-extern "C" { +-#include +-} +- +-#include +-#include +- +-#include +-#include +- +-#include +- +-#include +- +-namespace QFFmpeg { +- +-static const quint32 *fourccFromPixelFormat(const QVideoFrameFormat::PixelFormat format) +-{ +-#if G_BYTE_ORDER == G_LITTLE_ENDIAN +- const quint32 rgba_fourcc = DRM_FORMAT_ABGR8888; +- const quint32 rg_fourcc = DRM_FORMAT_GR88; +- const quint32 rg16_fourcc = DRM_FORMAT_GR1616; +-#else +- const quint32 rgba_fourcc = DRM_FORMAT_RGBA8888; +- const quint32 rg_fourcc = DRM_FORMAT_RG88; +- const quint32 rg16_fourcc = DRM_FORMAT_RG1616; +-#endif +- +-// qDebug() << "Getting DRM fourcc for pixel format" << format; +- +- switch (format) { +- case QVideoFrameFormat::Format_Invalid: +- case QVideoFrameFormat::Format_IMC1: +- case QVideoFrameFormat::Format_IMC2: +- case QVideoFrameFormat::Format_IMC3: +- case QVideoFrameFormat::Format_IMC4: +- case QVideoFrameFormat::Format_SamplerExternalOES: +- case QVideoFrameFormat::Format_Jpeg: +- case QVideoFrameFormat::Format_SamplerRect: +- return nullptr; +- +- case QVideoFrameFormat::Format_ARGB8888: +- case QVideoFrameFormat::Format_ARGB8888_Premultiplied: +- case QVideoFrameFormat::Format_XRGB8888: +- case QVideoFrameFormat::Format_BGRA8888: +- case QVideoFrameFormat::Format_BGRA8888_Premultiplied: +- case QVideoFrameFormat::Format_BGRX8888: +- case QVideoFrameFormat::Format_ABGR8888: +- case QVideoFrameFormat::Format_XBGR8888: +- case QVideoFrameFormat::Format_RGBA8888: +- case QVideoFrameFormat::Format_RGBX8888: +- case QVideoFrameFormat::Format_AYUV: +- case QVideoFrameFormat::Format_AYUV_Premultiplied: +- case QVideoFrameFormat::Format_UYVY: +- case QVideoFrameFormat::Format_YUYV: +- { +- static constexpr quint32 format[] = { rgba_fourcc, 0, 0, 0 }; +- return format; +- } +- +- case QVideoFrameFormat::Format_Y8: +- { +- static constexpr quint32 format[] = { DRM_FORMAT_R8, 0, 0, 0 }; +- return format; +- } +- case QVideoFrameFormat::Format_Y16: +- { +- static constexpr quint32 format[] = { DRM_FORMAT_R16, 0, 0, 0 }; +- return format; +- } +- +- case QVideoFrameFormat::Format_YUV420P: +- case QVideoFrameFormat::Format_YUV422P: +- case QVideoFrameFormat::Format_YV12: +- { +- static constexpr quint32 format[] = { DRM_FORMAT_R8, DRM_FORMAT_R8, DRM_FORMAT_R8, 0 }; +- return format; +- } +- case QVideoFrameFormat::Format_YUV420P10: +- { +- static constexpr quint32 format[] = { DRM_FORMAT_R16, DRM_FORMAT_R16, DRM_FORMAT_R16, 0 }; +- return format; +- } +- +- case QVideoFrameFormat::Format_NV12: +- case QVideoFrameFormat::Format_NV21: +- { +- static constexpr quint32 format[] = { DRM_FORMAT_R8, rg_fourcc, 0, 0 }; +- return format; +- } +- +- case QVideoFrameFormat::Format_P010: +- case QVideoFrameFormat::Format_P016: +- { +- static constexpr quint32 format[] = { DRM_FORMAT_R16, rg16_fourcc, 0, 0 }; +- return format; +- } +- } +- return nullptr; +-} +- +-class VAAPITextureSet : public TextureSet +-{ +-public: +- ~VAAPITextureSet(); +- qint64 textureHandle(int plane) override { +- return textures[plane]; +- } +- +- QRhi *rhi = nullptr; +- QOpenGLContext *glContext = nullptr; +- int nPlanes = 0; +- GLuint textures[4] = {}; +-}; +- +- +-VAAPITextureConverter::VAAPITextureConverter(QRhi *rhi) +- : TextureConverterBackend(nullptr) +-{ +- qDebug() << ">>>> Creating VAAPI HW accelerator"; +- +- if (!rhi || rhi->backend() != QRhi::OpenGLES2) { +- qWarning() << "VAAPITextureConverter: No rhi or non openGL based RHI"; +- this->rhi = nullptr; +- return; +- } +- +- auto *nativeHandles = static_cast(rhi->nativeHandles()); +- glContext = nativeHandles->context; +- if (!glContext) { +- qDebug() << " no GL context, disabling"; +- return; +- } +- const QString platform = QGuiApplication::platformName(); +- QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface(); +- eglDisplay = pni->nativeResourceForIntegration("egldisplay"); +- qDebug() << " platform is" << platform << eglDisplay; +- +- if (!eglDisplay) { +- qDebug() << " no egl display, disabling"; +- return; +- } +- eglImageTargetTexture2D = eglGetProcAddress("glEGLImageTargetTexture2DOES"); +- if (!eglDisplay) { +- qDebug() << " no eglImageTargetTexture2D, disabling"; +- return; +- } +- +- // everything ok, indicate that we can do zero copy +- this->rhi = rhi; +-} +- +-VAAPITextureConverter::~VAAPITextureConverter() +-{ +-} +- +-//#define VA_EXPORT_USE_LAYERS +-TextureSet *VAAPITextureConverter::getTextures(AVFrame *frame) +-{ +-// qDebug() << "VAAPIAccel::getTextures"; +- if (frame->format != AV_PIX_FMT_VAAPI || !eglDisplay) { +- qDebug() << "format/egl error" << frame->format << eglDisplay; +- return nullptr; +- } +- +- if (!frame->hw_frames_ctx) +- return nullptr; +- +- auto *fCtx = (AVHWFramesContext *)frame->hw_frames_ctx->data; +- auto *ctx = fCtx->device_ctx; +- if (!ctx) +- return nullptr; +- +- auto *vaCtx = (AVVAAPIDeviceContext *)ctx->hwctx; +- auto vaDisplay = vaCtx->display; +- if (!vaDisplay) { +- qDebug() << " no VADisplay, disabling"; +- return nullptr; +- } +- +- VASurfaceID vaSurface = (uintptr_t)frame->data[3]; +- +- VADRMPRIMESurfaceDescriptor prime; +- if (vaExportSurfaceHandle(vaDisplay, vaSurface, +- VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, +- VA_EXPORT_SURFACE_READ_ONLY | +-#ifdef VA_EXPORT_USE_LAYERS +- VA_EXPORT_SURFACE_SEPARATE_LAYERS, +-#else +- VA_EXPORT_SURFACE_COMPOSED_LAYERS, +-#endif +- &prime) != VA_STATUS_SUCCESS) +- { +- qWarning() << "vaExportSurfaceHandle failed"; +- return nullptr; +- } +- // ### Check that prime.fourcc is what we expect +- vaSyncSurface(vaDisplay, vaSurface); +- +-// qDebug() << "VAAPIAccel: vaSufraceDesc: width/height" << prime.width << prime.height << "num objects" +-// << prime.num_objects << "num layers" << prime.num_layers; +- +- QOpenGLFunctions functions(glContext); +- +- AVPixelFormat fmt = HWAccel::format(frame); +- bool needsConversion; +- auto qtFormat = QFFmpegVideoBuffer::toQtPixelFormat(fmt, &needsConversion); +- auto *drm_formats = fourccFromPixelFormat(qtFormat); +- if (!drm_formats || needsConversion) { +- qWarning() << "can't use DMA transfer for pixel format" << fmt << qtFormat; +- return nullptr; +- } +- +- auto *desc = QVideoTextureHelper::textureDescription(qtFormat); +- int nPlanes = 0; +- for (; nPlanes < 5; ++nPlanes) { +- if (drm_formats[nPlanes] == 0) +- break; +- } +- Q_ASSERT(nPlanes == desc->nplanes); +- nPlanes = desc->nplanes; +-// qDebug() << "VAAPIAccel: nPlanes" << nPlanes; +- +- rhi->makeThreadLocalNativeContextCurrent(); +- +- EGLImage images[4]; +- GLuint glTextures[4] = {}; +- functions.glGenTextures(nPlanes, glTextures); +- for (int i = 0; i < nPlanes; ++i) { +-#ifdef VA_EXPORT_USE_LAYERS +-#define LAYER i +-#define PLANE 0 +- if (prime.layers[i].drm_format != drm_formats[i]) { +- qWarning() << "expected DRM format check failed expected" +- << Qt::hex << drm_formats[i] << "got" << prime.layers[i].drm_format; +- } +-#else +-#define LAYER 0 +-#define PLANE i +-#endif +- +- EGLAttrib img_attr[] = { +- EGL_LINUX_DRM_FOURCC_EXT, (EGLint)drm_formats[i], +- EGL_WIDTH, desc->widthForPlane(frame->width, i), +- EGL_HEIGHT, desc->heightForPlane(frame->height, i), +- EGL_DMA_BUF_PLANE0_FD_EXT, prime.objects[prime.layers[LAYER].object_index[PLANE]].fd, +- EGL_DMA_BUF_PLANE0_OFFSET_EXT, (EGLint)prime.layers[LAYER].offset[PLANE], +- EGL_DMA_BUF_PLANE0_PITCH_EXT, (EGLint)prime.layers[LAYER].pitch[PLANE], +- EGL_NONE +- }; +- images[i] = eglCreateImage(eglDisplay, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, nullptr, img_attr); +- if (!images[i]) { +- qWarning() << "eglCreateImage failed for plane" << i << Qt::hex << eglGetError(); +- return nullptr; +- } +- functions.glActiveTexture(GL_TEXTURE0 + i); +- functions.glBindTexture(GL_TEXTURE_2D, glTextures[i]); +- +- PFNGLEGLIMAGETARGETTEXTURE2DOESPROC eglImageTargetTexture2D = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)this->eglImageTargetTexture2D; +- eglImageTargetTexture2D(GL_TEXTURE_2D, images[i]); +- if (glGetError()) { +- qWarning() << "eglImageTargetTexture2D failed"; +- } +- } +- +- for (int i = 0; i < (int)prime.num_objects; ++i) +- close(prime.objects[i].fd); +- +- for (int i = 0; i < nPlanes; ++i) { +- functions.glActiveTexture(GL_TEXTURE0 + i); +- functions.glBindTexture(GL_TEXTURE_2D, 0); +- eglDestroyImage(eglDisplay, images[i]); +- } +- +- VAAPITextureSet *textureSet = new VAAPITextureSet; +- textureSet->nPlanes = nPlanes; +- textureSet->rhi = rhi; +- textureSet->glContext = glContext; +- +- for (int i = 0; i < 4; ++i) +- textureSet->textures[i] = glTextures[i]; +-// qDebug() << "VAAPIAccel: got textures" << textures[0] << textures[1] << textures[2] << textures[3]; +- +- return textureSet; +-} +- +-VAAPITextureSet::~VAAPITextureSet() +-{ +- if (rhi) { +- rhi->makeThreadLocalNativeContextCurrent(); +- QOpenGLFunctions functions(glContext); +- functions.glDeleteTextures(nPlanes, textures); +- } +-} +- +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_vaapi_p.h b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_vaapi_p.h +deleted file mode 100644 +index 03084cc72..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_vaapi_p.h ++++ /dev/null +@@ -1,48 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGHWACCEL_VAAPI_P_H +-#define QFFMPEGHWACCEL_VAAPI_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qffmpeghwaccel_p.h" +- +-#if QT_CONFIG(vaapi) +- +-#include +- +-QT_BEGIN_NAMESPACE +- +-class QRhi; +-class QOpenGLContext; +- +-namespace QFFmpeg { +- +-class VAAPITextureConverter : public TextureConverterBackend +-{ +-public: +- VAAPITextureConverter(QRhi *rhi); +- ~VAAPITextureConverter(); +- +- TextureSet *getTextures(AVFrame *frame) override; +- +- Qt::HANDLE eglDisplay = nullptr; +- QOpenGLContext *glContext = nullptr; +- QFunctionPointer eglImageTargetTexture2D = nullptr; +-}; +-} +- +-QT_END_NAMESPACE +- +-#endif +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_videotoolbox.mm b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_videotoolbox.mm +deleted file mode 100644 +index 7078c8f23..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_videotoolbox.mm ++++ /dev/null +@@ -1,280 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpeghwaccel_videotoolbox_p.h" +- +-#if !defined(Q_OS_DARWIN) +-#error "Configuration error" +-#endif +- +-#include +-#include +-#include "private/qvideotexturehelper_p.h" +- +-#include +-#include +-#include +- +-#include +-#include +- +-#include +- +-#import +-#import +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg +-{ +- +-static CVMetalTextureCacheRef &mtc(void *&cache) { return reinterpret_cast(cache); } +- +-class VideoToolBoxTextureSet : public TextureSet +-{ +-public: +- ~VideoToolBoxTextureSet(); +- qint64 textureHandle(int plane) override; +- +- QRhi *rhi = nullptr; +- CVMetalTextureRef cvMetalTexture[3] = {}; +- +-#if defined(Q_OS_MACOS) +- CVOpenGLTextureRef cvOpenGLTexture = nullptr; +-#elif defined(Q_OS_IOS) +- CVOpenGLESTextureRef cvOpenGLESTexture = nullptr; +-#endif +- +- CVImageBufferRef m_buffer = nullptr; +-}; +- +-VideoToolBoxTextureConverter::VideoToolBoxTextureConverter(QRhi *rhi) +- : TextureConverterBackend(rhi) +-{ +- if (!rhi) +- return; +- +- if (rhi->backend() == QRhi::Metal) { +- qDebug() << " using metal backend"; +- const auto *metal = static_cast(rhi->nativeHandles()); +- +- // Create a Metal Core Video texture cache from the pixel buffer. +- Q_ASSERT(!cvMetalTextureCache); +- if (CVMetalTextureCacheCreate( +- kCFAllocatorDefault, +- nil, +- (id)metal->dev, +- nil, +- &mtc(cvMetalTextureCache)) != kCVReturnSuccess) { +- qWarning() << "Metal texture cache creation failed"; +- rhi = nullptr; +- } +- } else if (rhi->backend() == QRhi::OpenGLES2) { +-#if QT_CONFIG(opengl) +-#ifdef Q_OS_MACOS +- const auto *gl = static_cast(rhi->nativeHandles()); +- +- auto nsGLContext = gl->context->nativeInterface()->nativeContext(); +- auto nsGLPixelFormat = nsGLContext.pixelFormat.CGLPixelFormatObj; +- +- // Create an OpenGL CoreVideo texture cache from the pixel buffer. +- if (CVOpenGLTextureCacheCreate( +- kCFAllocatorDefault, +- nullptr, +- reinterpret_cast(nsGLContext.CGLContextObj), +- nsGLPixelFormat, +- nil, +- &cvOpenGLTextureCache)) { +- qWarning() << "OpenGL texture cache creation failed"; +- rhi = nullptr; +- } +-#endif +-#ifdef Q_OS_IOS +- // Create an OpenGL CoreVideo texture cache from the pixel buffer. +- if (CVOpenGLESTextureCacheCreate( +- kCFAllocatorDefault, +- nullptr, +- [EAGLContext currentContext], +- nullptr, +- &cvOpenGLESTextureCache)) { +- qWarning() << "OpenGL texture cache creation failed"; +- rhi = nullptr; +- } +-#endif +-#else +- rhi = nullptr; +-#endif // QT_CONFIG(opengl) +- } +-} +- +-VideoToolBoxTextureConverter::~VideoToolBoxTextureConverter() +-{ +- freeTextureCaches(); +-} +- +-void VideoToolBoxTextureConverter::freeTextureCaches() +-{ +- if (cvMetalTextureCache) +- CFRelease(cvMetalTextureCache); +- cvMetalTextureCache = nullptr; +-#if defined(Q_OS_MACOS) +- if (cvOpenGLTextureCache) +- CFRelease(cvOpenGLTextureCache); +- cvOpenGLTextureCache = nullptr; +-#elif defined(Q_OS_IOS) +- if (cvOpenGLESTextureCache) +- CFRelease(cvOpenGLESTextureCache); +- cvOpenGLESTextureCache = nullptr; +-#endif +-} +- +-static MTLPixelFormat rhiTextureFormatToMetalFormat(QRhiTexture::Format f) +-{ +- switch (f) { +- default: +- case QRhiTexture::UnknownFormat: +- return MTLPixelFormatInvalid; +- case QRhiTexture::RGBA8: +- return MTLPixelFormatRGBA8Unorm; +- case QRhiTexture::BGRA8: +- return MTLPixelFormatBGRA8Unorm; +- case QRhiTexture::R8: +- return MTLPixelFormatR8Unorm; +- case QRhiTexture::RG8: +- return MTLPixelFormatRG8Unorm; +- case QRhiTexture::R16: +- return MTLPixelFormatR16Unorm; +- case QRhiTexture::RG16: +- return MTLPixelFormatRG16Unorm; +- +- case QRhiTexture::RGBA16F: +- return MTLPixelFormatRGBA16Float; +- case QRhiTexture::RGBA32F: +- return MTLPixelFormatRGBA32Float; +- case QRhiTexture::R16F: +- return MTLPixelFormatR16Float; +- case QRhiTexture::R32F: +- return MTLPixelFormatR32Float; +- } +-} +- +-TextureSet *VideoToolBoxTextureConverter::getTextures(AVFrame *frame) +-{ +- if (!rhi) +- return nullptr; +- +- bool needsConversion = false; +- QVideoFrameFormat::PixelFormat pixelFormat = QFFmpegVideoBuffer::toQtPixelFormat(HWAccel::format(frame), &needsConversion); +- if (needsConversion) { +- qDebug() << "XXXXXXXXXXXX pixel format needs conversion" << pixelFormat << HWAccel::format(frame); +- return nullptr; +- } +- +- CVPixelBufferRef buffer = (CVPixelBufferRef)frame->data[3]; +- +- VideoToolBoxTextureSet *textureSet = new VideoToolBoxTextureSet; +- textureSet->m_buffer = buffer; +- textureSet->rhi = rhi; +- CVPixelBufferRetain(buffer); +- +- auto *textureDescription = QVideoTextureHelper::textureDescription(pixelFormat); +- int bufferPlanes = CVPixelBufferGetPlaneCount(buffer); +-// qDebug() << "XXXXX getTextures" << pixelFormat << bufferPlanes << buffer; +- +- if (rhi->backend() == QRhi::Metal) { +- for (int plane = 0; plane < bufferPlanes; ++plane) { +- size_t width = CVPixelBufferGetWidth(buffer); +- size_t height = CVPixelBufferGetHeight(buffer); +- width = textureDescription->widthForPlane(width, plane); +- height = textureDescription->heightForPlane(height, plane); +- +- // Create a CoreVideo pixel buffer backed Metal texture image from the texture cache. +- auto ret = CVMetalTextureCacheCreateTextureFromImage( +- kCFAllocatorDefault, +- mtc(cvMetalTextureCache), +- buffer, nil, +- rhiTextureFormatToMetalFormat(textureDescription->textureFormat[plane]), +- width, height, +- plane, +- &textureSet->cvMetalTexture[plane]); +- +- if (ret != kCVReturnSuccess) +- qWarning() << "texture creation failed" << ret; +-// auto t = CVMetalTextureGetTexture(textureSet->cvMetalTexture[plane]); +-// qDebug() << " metal texture for plane" << plane << "is" << quint64(textureSet->cvMetalTexture[plane]) << width << height; +-// qDebug() << " " << t.iosurfacePlane << t.pixelFormat << t.width << t.height; +- } +- } else if (rhi->backend() == QRhi::OpenGLES2) { +-#if QT_CONFIG(opengl) +-#ifdef Q_OS_MACOS +- CVOpenGLTextureCacheFlush(cvOpenGLTextureCache, 0); +- // Create a CVPixelBuffer-backed OpenGL texture image from the texture cache. +- const CVReturn cvret = CVOpenGLTextureCacheCreateTextureFromImage( +- kCFAllocatorDefault, +- cvOpenGLTextureCache, +- buffer, +- nil, +- &textureSet->cvOpenGLTexture); +- if (cvret != kCVReturnSuccess) +- qWarning() << "OpenGL texture creation failed" << cvret; +- +- Q_ASSERT(CVOpenGLTextureGetTarget(textureSet->cvOpenGLTexture) == GL_TEXTURE_RECTANGLE); +-#endif +-#ifdef Q_OS_IOS +- CVOpenGLESTextureCacheFlush(cvOpenGLESTextureCache, 0); +- // Create a CVPixelBuffer-backed OpenGL texture image from the texture cache. +- const CVReturn cvret = CVOpenGLESTextureCacheCreateTextureFromImage( +- kCFAllocatorDefault, +- cvOpenGLESTextureCache, +- buffer, +- nil, +- GL_TEXTURE_2D, +- GL_RGBA, +- CVPixelBufferGetWidth(buffer), +- CVPixelBufferGetHeight(buffer), +- GL_RGBA, +- GL_UNSIGNED_BYTE, +- 0, +- &textureSet->cvOpenGLESTexture); +- if (cvret != kCVReturnSuccess) +- qWarning() << "OpenGL ES texture creation failed" << cvret; +-#endif +-#endif +- } +- +- return textureSet; +-} +- +-VideoToolBoxTextureSet::~VideoToolBoxTextureSet() +-{ +- for (int i = 0; i < 4; ++i) +- if (cvMetalTexture[i]) +- CFRelease(cvMetalTexture[i]); +-#if defined(Q_OS_MACOS) +- if (cvOpenGLTexture) +- CVOpenGLTextureRelease(cvOpenGLTexture); +-#elif defined(Q_OS_IOS) +- if (cvOpenGLESTexture) +- CFRelease(cvOpenGLESTexture); +-#endif +- CVPixelBufferRelease(m_buffer); +-} +- +-qint64 VideoToolBoxTextureSet::textureHandle(int plane) +-{ +- if (rhi->backend() == QRhi::Metal) +- return cvMetalTexture[plane] ? qint64(CVMetalTextureGetTexture(cvMetalTexture[plane])) : 0; +-#if QT_CONFIG(opengl) +- Q_ASSERT(plane == 0); +-#ifdef Q_OS_MACOS +- return CVOpenGLTextureGetName(cvOpenGLTexture); +-#endif +-#ifdef Q_OS_IOS +- return CVOpenGLESTextureGetName(cvOpenGLESTexture); +-#endif +-#endif +-} +- +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_videotoolbox_p.h b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_videotoolbox_p.h +deleted file mode 100644 +index f618d5dd9..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_videotoolbox_p.h ++++ /dev/null +@@ -1,59 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGHWACCEL_VIDEOTOOLBOX_P_H +-#define QFFMPEGHWACCEL_VIDEOTOOLBOX_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qffmpeghwaccel_p.h" +- +-#ifdef Q_OS_DARWIN +- +-#include +-#include +-#include +- +-#include +-#include +- +-QT_BEGIN_NAMESPACE +- +-class QRhi; +- +-namespace QFFmpeg { +- +-class VideoToolBoxTextureConverter : public TextureConverterBackend +-{ +-public: +- VideoToolBoxTextureConverter(QRhi *rhi); +- ~VideoToolBoxTextureConverter(); +- TextureSet *getTextures(AVFrame *frame) override; +- +-private: +- void freeTextureCaches(); +- +- // can not forward declare that type from C++ :/ +- void *cvMetalTextureCache = nullptr; +-#if defined(Q_OS_MACOS) +- CVOpenGLTextureCacheRef cvOpenGLTextureCache = nullptr; +-#elif defined(Q_OS_IOS) +- CVOpenGLESTextureCacheRef cvOpenGLESTextureCache = nullptr; +-#endif +-}; +- +-} +- +-QT_END_NAMESPACE +- +-#endif +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession.cpp b/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession.cpp +index 3d5fbc039..b6865761c 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession.cpp ++++ b/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession.cpp +@@ -6,7 +6,6 @@ + #include "private/qplatformaudioinput_p.h" + #include "private/qplatformaudiooutput_p.h" + #include "qffmpegimagecapture_p.h" +-#include "qffmpegmediarecorder_p.h" + #include "private/qplatformcamera_p.h" + #include "qvideosink.h" + +@@ -73,22 +72,12 @@ void QFFmpegMediaCaptureSession::setImageCapture(QPlatformImageCapture *imageCap + + void QFFmpegMediaCaptureSession::setMediaRecorder(QPlatformMediaRecorder *recorder) + { +- auto *r = static_cast(recorder); +- if (m_mediaRecorder == r) +- return; +- +- if (m_mediaRecorder) +- m_mediaRecorder->setCaptureSession(nullptr); +- m_mediaRecorder = r; +- if (m_mediaRecorder) +- m_mediaRecorder->setCaptureSession(this); +- +- emit encoderChanged(); ++ return; + } + + QPlatformMediaRecorder *QFFmpegMediaCaptureSession::mediaRecorder() + { +- return m_mediaRecorder; ++ return nullptr; + } + + void QFFmpegMediaCaptureSession::setAudioInput(QPlatformAudioInput *input) +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession_p.h b/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession_p.h +index 9e9c77551..858a537cc 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession_p.h ++++ b/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession_p.h +@@ -54,7 +54,6 @@ private: + QPlatformCamera *m_camera = nullptr; + QPlatformAudioInput *m_audioInput = nullptr; + QFFmpegImageCapture *m_imageCapture = nullptr; +- QFFmpegMediaRecorder *m_mediaRecorder = nullptr; + QPlatformAudioOutput *m_audioOutput = nullptr; + QVideoSink *m_videoSink = nullptr; + }; +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediaformatinfo.cpp b/src/plugins/multimedia/ffmpeg/qffmpegmediaformatinfo.cpp +index 2561d564d..00b838d50 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediaformatinfo.cpp ++++ b/src/plugins/multimedia/ffmpeg/qffmpegmediaformatinfo.cpp +@@ -2,236 +2,13 @@ + // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + + #include "qffmpegmediaformatinfo_p.h" +-#include "qffmpeg_p.h" + #include "qaudioformat.h" + #include "qimagewriter.h" + + QT_BEGIN_NAMESPACE + +-static struct { +- AVCodecID id; +- QMediaFormat::VideoCodec codec; +-} videoCodecMap [] = { +- { AV_CODEC_ID_MPEG1VIDEO, QMediaFormat::VideoCodec::MPEG1 }, +- { AV_CODEC_ID_MPEG2VIDEO, QMediaFormat::VideoCodec::MPEG2 }, +- { AV_CODEC_ID_MPEG4, QMediaFormat::VideoCodec::MPEG4 }, +- { AV_CODEC_ID_H264, QMediaFormat::VideoCodec::H264 }, +- { AV_CODEC_ID_HEVC, QMediaFormat::VideoCodec::H265 }, +- { AV_CODEC_ID_VP8, QMediaFormat::VideoCodec::VP8 }, +- { AV_CODEC_ID_VP9, QMediaFormat::VideoCodec::VP9 }, +- { AV_CODEC_ID_AV1, QMediaFormat::VideoCodec::AV1 }, +- { AV_CODEC_ID_THEORA, QMediaFormat::VideoCodec::Theora }, +- { AV_CODEC_ID_WMV3, QMediaFormat::VideoCodec::WMV }, +- { AV_CODEC_ID_MJPEG, QMediaFormat::VideoCodec::MotionJPEG } +-}; +- +-static AVCodecID codecId(QMediaFormat::VideoCodec codec) +-{ +- for (const auto &c : videoCodecMap) { +- if (c.codec == codec) +- return c.id; +- } +- return AV_CODEC_ID_NONE; +-} +- +-static struct { +- AVCodecID id; +- QMediaFormat::AudioCodec codec; +-} audioCodecMap [] = { +- { AV_CODEC_ID_MP3, QMediaFormat::AudioCodec::MP3 }, +- { AV_CODEC_ID_AAC, QMediaFormat::AudioCodec::AAC }, +- { AV_CODEC_ID_AC3, QMediaFormat::AudioCodec::AC3 }, +- { AV_CODEC_ID_EAC3, QMediaFormat::AudioCodec::EAC3 }, +- { AV_CODEC_ID_FLAC, QMediaFormat::AudioCodec::FLAC }, +- { AV_CODEC_ID_TRUEHD, QMediaFormat::AudioCodec::DolbyTrueHD }, +- { AV_CODEC_ID_OPUS, QMediaFormat::AudioCodec::Opus }, +- { AV_CODEC_ID_VORBIS, QMediaFormat::AudioCodec::Vorbis }, +- { AV_CODEC_ID_PCM_S16LE, QMediaFormat::AudioCodec::Wave }, +- { AV_CODEC_ID_WMAPRO, QMediaFormat::AudioCodec::WMA }, +- { AV_CODEC_ID_ALAC, QMediaFormat::AudioCodec::ALAC } +-}; +- +-static AVCodecID codecId(QMediaFormat::AudioCodec codec) +-{ +- for (const auto &c : audioCodecMap) { +- if (c.codec == codec) +- return c.id; +- } +- return AV_CODEC_ID_NONE; +-} +- +-// mimetypes are mostly copied from qmediaformat.cpp. Unfortunately, FFmpeg uses +-// in some cases slightly different mimetypes +-static const struct +-{ +- QMediaFormat::FileFormat fileFormat; +- const char *mimeType; +- const char *name; // disambiguate if we have several muxers/demuxers +-} map[QMediaFormat::LastFileFormat + 1] = { +- { QMediaFormat::WMV, "video/x-ms-asf", "asf" }, +- { QMediaFormat::AVI, "video/x-msvideo", nullptr }, +- { QMediaFormat::Matroska, "video/x-matroska", nullptr }, +- { QMediaFormat::MPEG4, "video/mp4", "mp4" }, +- { QMediaFormat::Ogg, "video/ogg", nullptr }, +- // QuickTime is the same as MP4 +- { QMediaFormat::WebM, "video/webm", "webm" }, +- // Audio Formats +- // Mpeg4Audio is the same as MP4 without the video codecs +- { QMediaFormat::AAC, "audio/aac", nullptr }, +- // WMA is the same as WMV +- { QMediaFormat::FLAC, "audio/x-flac", nullptr }, +- { QMediaFormat::MP3, "audio/mpeg", "mp3" }, +- { QMediaFormat::Wave, "audio/x-wav", nullptr }, +- { QMediaFormat::UnspecifiedFormat, nullptr, nullptr } +-}; +- +-template +-static QMediaFormat::FileFormat formatForAVFormat(AVFormat *format) +-{ +- +- if (!format->mime_type || !*format->mime_type) +- return QMediaFormat::UnspecifiedFormat; +- +- auto *m = map; +- while (m->fileFormat != QMediaFormat::UnspecifiedFormat) { +- if (m->mimeType && !strcmp(m->mimeType, format->mime_type)) { +- // check if the name matches. This is used to disambiguate where FFmpeg provides +- // multiple muxers or demuxers +- if (!m->name || !strcmp(m->name, format->name)) +- return m->fileFormat; +- } +- ++m; +- } +- +- return QMediaFormat::UnspecifiedFormat; +-} +- +-static const AVOutputFormat *avFormatForFormat(QMediaFormat::FileFormat format) +-{ +- if (format == QMediaFormat::QuickTime || format == QMediaFormat::Mpeg4Audio) +- format = QMediaFormat::MPEG4; +- if (format == QMediaFormat::WMA) +- format = QMediaFormat::WMV; +- +- auto *m = map; +- while (m->fileFormat != QMediaFormat::UnspecifiedFormat) { +- if (m->fileFormat == format) +- return av_guess_format(m->name, nullptr, m->mimeType); +- ++m; +- } +- +- return nullptr; +-} +- +- + QFFmpegMediaFormatInfo::QFFmpegMediaFormatInfo() + { +- qDebug() << ">>>> listing codecs"; +- +- QList audioEncoders; +- QList extraAudioDecoders; +- QList videoEncoders; +- QList extraVideoDecoders; +- +- const AVCodecDescriptor *descriptor = nullptr; +- while ((descriptor = avcodec_descriptor_next(descriptor))) { +- bool canEncode = (avcodec_find_encoder(descriptor->id) != nullptr); +- bool canDecode = (avcodec_find_decoder(descriptor->id) != nullptr); +- auto videoCodec = videoCodecForAVCodecId(descriptor->id); +- auto audioCodec = audioCodecForAVCodecId(descriptor->id); +- if (descriptor->type == AVMEDIA_TYPE_VIDEO && videoCodec != QMediaFormat::VideoCodec::Unspecified) { +- if (canEncode) { +- if (!videoEncoders.contains(videoCodec)) +- videoEncoders.append(videoCodec); +- } else if (canDecode) { +- if (!extraVideoDecoders.contains(videoCodec)) +- extraVideoDecoders.append(videoCodec); +- } +- } +- +- else if (descriptor->type == AVMEDIA_TYPE_AUDIO && audioCodec != QMediaFormat::AudioCodec::Unspecified) { +- if (canEncode) { +- if (!audioEncoders.contains(audioCodec)) +- audioEncoders.append(audioCodec); +- } else if (canDecode) { +- if (!extraAudioDecoders.contains(audioCodec)) +- extraAudioDecoders.append(audioCodec); +- } +- } +- } +- +- // get demuxers +-// qDebug() << ">>>> Muxers"; +- void *opaque = nullptr; +- const AVOutputFormat *outputFormat = nullptr; +- while ((outputFormat = av_muxer_iterate(&opaque))) { +- auto mediaFormat = formatForAVFormat(outputFormat); +- if (mediaFormat == QMediaFormat::UnspecifiedFormat) +- continue; +-// qDebug() << " mux:" << outputFormat->name << outputFormat->long_name << outputFormat->mime_type << outputFormat->extensions << mediaFormat; +- +- CodecMap encoder; +- encoder.format = mediaFormat; +- +- for (auto codec : audioEncoders) { +- auto id = codecId(codec); +- // only add the codec if it can be used with this container +- if (avformat_query_codec(outputFormat, id, FF_COMPLIANCE_NORMAL) == 1) { +- // add codec for container +-// qDebug() << " " << codec << Qt::hex << av_codec_get_tag(outputFormat->codec_tag, id); +- encoder.audio.append(codec); +- } +- } +- for (auto codec : videoEncoders) { +- auto id = codecId(codec); +- // only add the codec if it can be used with this container +- if (avformat_query_codec(outputFormat, id, FF_COMPLIANCE_NORMAL) == 1) { +- // add codec for container +-// qDebug() << " " << codec << Qt::hex << av_codec_get_tag(outputFormat->codec_tag, id); +- encoder.video.append(codec); +- } +- } +- +- // sanity checks and handling special cases +- if (encoder.audio.isEmpty() && encoder.video.isEmpty()) +- continue; +- switch (encoder.format) { +- case QMediaFormat::WMV: +- // add WMA +- encoders.append({ QMediaFormat::WMA, encoder.audio, {} }); +- break; +- case QMediaFormat::MPEG4: +- // add Mpeg4Audio and QuickTime +- encoders.append({ QMediaFormat::QuickTime, encoder.audio, encoder.video }); +- encoders.append({ QMediaFormat::Mpeg4Audio, encoder.audio, {} }); +- break; +- case QMediaFormat::Wave: +- // FFmpeg allows other encoded formats in WAV containers, but we do not want that +- if (!encoder.audio.contains(QMediaFormat::AudioCodec::Wave)) +- continue; +- encoder.audio = { QMediaFormat::AudioCodec::Wave }; +- break; +- default: +- break; +- } +- encoders.append(encoder); +- } +- +- // FFmpeg doesn't allow querying supported codecs for decoders +- // we take a simple approximation stating that we can decode what we +- // can encode. That's a safe subset. +- decoders = encoders; +- +-// qDebug() << "extraDecoders:" << extraAudioDecoders << extraVideoDecoders; +- // FFmpeg can currently only decode WMA and WMV, not encode +- if (extraAudioDecoders.contains(QMediaFormat::AudioCodec::WMA)) { +- decoders[QMediaFormat::WMA].audio.append(QMediaFormat::AudioCodec::WMA); +- decoders[QMediaFormat::WMV].audio.append(QMediaFormat::AudioCodec::WMA); +- } +- if (extraVideoDecoders.contains(QMediaFormat::VideoCodec::WMV)) { +- decoders[QMediaFormat::WMV].video.append(QMediaFormat::VideoCodec::WMV); +- } +- + // Add image formats we support. We currently simply use Qt's built-in image write + // to save images. That doesn't give us HDR support or support for larger bit depths, + // but most cameras can currently not generate those anyway. +@@ -251,256 +28,5 @@ QFFmpegMediaFormatInfo::QFFmpegMediaFormatInfo() + + QFFmpegMediaFormatInfo::~QFFmpegMediaFormatInfo() = default; + +-QMediaFormat::AudioCodec QFFmpegMediaFormatInfo::audioCodecForAVCodecId(AVCodecID id) +-{ +- for (const auto &c : audioCodecMap) { +- if (c.id == id) +- return c.codec; +- } +- return QMediaFormat::AudioCodec::Unspecified; +-} +- +-QMediaFormat::VideoCodec QFFmpegMediaFormatInfo::videoCodecForAVCodecId(AVCodecID id) +-{ +- for (const auto &c : videoCodecMap) { +- if (c.id == id) +- return c.codec; +- } +- return QMediaFormat::VideoCodec::Unspecified; +-} +- +-QMediaFormat::FileFormat +-QFFmpegMediaFormatInfo::fileFormatForAVInputFormat(const AVInputFormat *format) +-{ +- // Seems like FFmpeg uses different names for muxers and demuxers of the same format. +- // that makes it somewhat cumbersome to detect things correctly. +- // The input formats have a comma separated list of short names. We check the first one of those +- // as the docs specify that you only append to the list +- static const struct +- { +- QMediaFormat::FileFormat fileFormat; +- const char *name; +- } map[QMediaFormat::LastFileFormat + 1] = { +- { QMediaFormat::WMV, "asf" }, +- { QMediaFormat::AVI, "avi" }, +- { QMediaFormat::Matroska, "matroska" }, +- { QMediaFormat::MPEG4, "mov" }, +- { QMediaFormat::Ogg, "ogg" }, +- { QMediaFormat::WebM, "webm" }, +- // Audio Formats +- // Mpeg4Audio is the same as MP4 without the video codecs +- { QMediaFormat::AAC, "aac"}, +- // WMA is the same as WMV +- { QMediaFormat::FLAC, "flac" }, +- { QMediaFormat::MP3, "mp3" }, +- { QMediaFormat::Wave, "wav" }, +- { QMediaFormat::UnspecifiedFormat, nullptr } +- }; +- +- if (!format->name) +- return QMediaFormat::UnspecifiedFormat; +- +- auto *m = map; +- while (m->fileFormat != QMediaFormat::UnspecifiedFormat) { +- if (!strncmp(m->name, format->name, strlen(m->name))) +- return m->fileFormat; +- ++m; +- } +- +- return QMediaFormat::UnspecifiedFormat; +-} +- +-const AVOutputFormat * +-QFFmpegMediaFormatInfo::outputFormatForFileFormat(QMediaFormat::FileFormat format) +-{ +- return avFormatForFormat(format); +-} +- +-AVCodecID QFFmpegMediaFormatInfo::codecIdForVideoCodec(QMediaFormat::VideoCodec codec) +-{ +- return codecId(codec); +-} +- +-AVCodecID QFFmpegMediaFormatInfo::codecIdForAudioCodec(QMediaFormat::AudioCodec codec) +-{ +- return codecId(codec); +-} +- +-QAudioFormat::SampleFormat QFFmpegMediaFormatInfo::sampleFormat(AVSampleFormat format) +-{ +- switch (format) { +- case AV_SAMPLE_FMT_NONE: +- default: +- return QAudioFormat::Unknown; +- case AV_SAMPLE_FMT_U8: ///< unsigned 8 bits +- case AV_SAMPLE_FMT_U8P: ///< unsigned 8 bits: planar +- return QAudioFormat::UInt8; +- case AV_SAMPLE_FMT_S16: ///< signed 16 bits +- case AV_SAMPLE_FMT_S16P: ///< signed 16 bits: planar +- return QAudioFormat::Int16; +- case AV_SAMPLE_FMT_S32: ///< signed 32 bits +- case AV_SAMPLE_FMT_S32P: ///< signed 32 bits: planar +- return QAudioFormat::Int32; +- case AV_SAMPLE_FMT_FLT: ///< float +- case AV_SAMPLE_FMT_FLTP: ///< float: planar +- return QAudioFormat::Float; +- case AV_SAMPLE_FMT_DBL: ///< double +- case AV_SAMPLE_FMT_DBLP: ///< double: planar +- case AV_SAMPLE_FMT_S64: ///< signed 64 bits +- case AV_SAMPLE_FMT_S64P: ///< signed 64 bits, planar +- // let's use float +- return QAudioFormat::Float; +- } +-} +- +-AVSampleFormat QFFmpegMediaFormatInfo::avSampleFormat(QAudioFormat::SampleFormat format) +-{ +- switch (format) { +- case QAudioFormat::UInt8: +- return AV_SAMPLE_FMT_U8; +- case QAudioFormat::Int16: +- return AV_SAMPLE_FMT_S16; +- case QAudioFormat::Int32: +- return AV_SAMPLE_FMT_S32; +- case QAudioFormat::Float: +- return AV_SAMPLE_FMT_FLT; +- default: +- return AV_SAMPLE_FMT_NONE; +- } +-} +- +-int64_t QFFmpegMediaFormatInfo::avChannelLayout(QAudioFormat::ChannelConfig channelConfig) +-{ +- int64_t avChannelLayout = 0; +- if (channelConfig & (1 << QAudioFormat::FrontLeft)) +- avChannelLayout |= AV_CH_FRONT_LEFT; +- if (channelConfig & (1 << QAudioFormat::FrontRight)) +- avChannelLayout |= AV_CH_FRONT_RIGHT; +- if (channelConfig & (1 << QAudioFormat::FrontCenter)) +- avChannelLayout |= AV_CH_FRONT_CENTER; +- if (channelConfig & (1 << QAudioFormat::LFE)) +- avChannelLayout |= AV_CH_LOW_FREQUENCY; +- if (channelConfig & (1 << QAudioFormat::BackLeft)) +- avChannelLayout |= AV_CH_BACK_LEFT; +- if (channelConfig & (1 << QAudioFormat::BackRight)) +- avChannelLayout |= AV_CH_BACK_RIGHT; +- if (channelConfig & (1 << QAudioFormat::FrontLeftOfCenter)) +- avChannelLayout |= AV_CH_FRONT_LEFT_OF_CENTER; +- if (channelConfig & (1 << QAudioFormat::FrontRightOfCenter)) +- avChannelLayout |= AV_CH_FRONT_RIGHT_OF_CENTER; +- if (channelConfig & (1 << QAudioFormat::BackCenter)) +- avChannelLayout |= AV_CH_BACK_CENTER; +- if (channelConfig & (1 << QAudioFormat::LFE2)) +- avChannelLayout |= AV_CH_LOW_FREQUENCY_2; +- if (channelConfig & (1 << QAudioFormat::SideLeft)) +- avChannelLayout |= AV_CH_SIDE_LEFT; +- if (channelConfig & (1 << QAudioFormat::SideRight)) +- avChannelLayout |= AV_CH_SIDE_RIGHT; +- if (channelConfig & (1 << QAudioFormat::TopFrontLeft)) +- avChannelLayout |= AV_CH_TOP_FRONT_LEFT; +- if (channelConfig & (1 << QAudioFormat::TopFrontRight)) +- avChannelLayout |= AV_CH_TOP_FRONT_RIGHT; +- if (channelConfig & (1 << QAudioFormat::TopFrontCenter)) +- avChannelLayout |= AV_CH_TOP_FRONT_CENTER; +- if (channelConfig & (1 << QAudioFormat::TopCenter)) +- avChannelLayout |= AV_CH_TOP_CENTER; +- if (channelConfig & (1 << QAudioFormat::TopBackLeft)) +- avChannelLayout |= AV_CH_TOP_BACK_LEFT; +- if (channelConfig & (1 << QAudioFormat::TopBackRight)) +- avChannelLayout |= AV_CH_TOP_BACK_RIGHT; +- if (channelConfig & (1 << QAudioFormat::TopBackCenter)) +- avChannelLayout |= AV_CH_TOP_BACK_CENTER; +- // The defines used below got added together for FFmpeg 4.4 +-#ifdef AV_CH_TOP_SIDE_LEFT +- if (channelConfig & (1 << QAudioFormat::TopSideLeft)) +- avChannelLayout |= AV_CH_TOP_SIDE_LEFT; +- if (channelConfig & (1 << QAudioFormat::TopSideRight)) +- avChannelLayout |= AV_CH_TOP_SIDE_RIGHT; +- if (channelConfig & (1 << QAudioFormat::BottomFrontCenter)) +- avChannelLayout |= AV_CH_BOTTOM_FRONT_CENTER; +- if (channelConfig & (1 << QAudioFormat::BottomFrontLeft)) +- avChannelLayout |= AV_CH_BOTTOM_FRONT_LEFT; +- if (channelConfig & (1 << QAudioFormat::BottomFrontRight)) +- avChannelLayout |= AV_CH_BOTTOM_FRONT_RIGHT; +-#endif +- return avChannelLayout; +-} +- +-QAudioFormat::ChannelConfig QFFmpegMediaFormatInfo::channelConfigForAVLayout(int64_t avChannelLayout) +-{ +- quint32 channelConfig = 0; +- if (avChannelLayout & AV_CH_FRONT_LEFT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::FrontLeft); +- if (avChannelLayout & AV_CH_FRONT_RIGHT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::FrontRight); +- if (avChannelLayout & AV_CH_FRONT_CENTER) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::FrontCenter); +- if (avChannelLayout & AV_CH_LOW_FREQUENCY) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::LFE); +- if (avChannelLayout & AV_CH_BACK_LEFT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::BackLeft); +- if (avChannelLayout & AV_CH_BACK_RIGHT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::BackRight); +- if (avChannelLayout & AV_CH_FRONT_LEFT_OF_CENTER) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::FrontLeftOfCenter); +- if (avChannelLayout & AV_CH_FRONT_RIGHT_OF_CENTER) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::FrontRightOfCenter); +- if (avChannelLayout & AV_CH_BACK_CENTER) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::BackCenter); +- if (avChannelLayout & AV_CH_LOW_FREQUENCY_2) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::LFE2); +- if (avChannelLayout & AV_CH_SIDE_LEFT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::SideLeft); +- if (avChannelLayout & AV_CH_SIDE_RIGHT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::SideRight); +- if (avChannelLayout & AV_CH_TOP_FRONT_LEFT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::TopFrontLeft); +- if (avChannelLayout & AV_CH_TOP_FRONT_RIGHT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::TopFrontRight); +- if (avChannelLayout & AV_CH_TOP_FRONT_CENTER) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::TopFrontCenter); +- if (avChannelLayout & AV_CH_TOP_CENTER) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::TopCenter); +- if (avChannelLayout & AV_CH_TOP_BACK_LEFT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::TopBackLeft); +- if (avChannelLayout & AV_CH_TOP_BACK_RIGHT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::TopBackRight); +- if (avChannelLayout & AV_CH_TOP_BACK_CENTER) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::TopBackCenter); +- // The defines used below got added together for FFmpeg 4.4 +-#ifdef AV_CH_TOP_SIDE_LEFT +- if (avChannelLayout & AV_CH_TOP_SIDE_LEFT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::TopSideLeft); +- if (avChannelLayout & AV_CH_TOP_SIDE_RIGHT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::TopSideRight); +- if (avChannelLayout & AV_CH_BOTTOM_FRONT_CENTER) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::BottomFrontCenter); +- if (avChannelLayout & AV_CH_BOTTOM_FRONT_LEFT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::BottomFrontLeft); +- if (avChannelLayout & AV_CH_BOTTOM_FRONT_RIGHT) +- channelConfig |= QAudioFormat::channelConfig(QAudioFormat::BottomFrontRight); +-#endif +- return QAudioFormat::ChannelConfig(channelConfig); +-} +- +-QAudioFormat QFFmpegMediaFormatInfo::audioFormatFromCodecParameters(AVCodecParameters *codecpar) +-{ +- QAudioFormat format; +- format.setSampleFormat(sampleFormat(AVSampleFormat(codecpar->format))); +- format.setSampleRate(codecpar->sample_rate); +-#if QT_FFMPEG_OLD_CHANNEL_LAYOUT +- uint64_t channelLayout = codecpar->channel_layout; +- if (!channelLayout) +- channelLayout = avChannelLayout(QAudioFormat::defaultChannelConfigForChannelCount(codecpar->channels)); +-#else +- uint64_t channelLayout = 0; +- if (codecpar->ch_layout.order == AV_CHANNEL_ORDER_NATIVE) +- channelLayout = codecpar->ch_layout.u.mask; +- else +- channelLayout = avChannelLayout(QAudioFormat::defaultChannelConfigForChannelCount(codecpar->ch_layout.nb_channels)); +-#endif +- format.setChannelConfig(channelConfigForAVLayout(channelLayout)); +- return format; +-} + + QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediaformatinfo_p.h b/src/plugins/multimedia/ffmpeg/qffmpegmediaformatinfo_p.h +index 52fcf6f72..e34005bbf 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediaformatinfo_p.h ++++ b/src/plugins/multimedia/ffmpeg/qffmpegmediaformatinfo_p.h +@@ -19,7 +19,6 @@ + #include + #include + #include +-#include "qffmpeg_p.h" + + QT_BEGIN_NAMESPACE + +@@ -28,23 +27,6 @@ class QFFmpegMediaFormatInfo : public QPlatformMediaFormatInfo + public: + QFFmpegMediaFormatInfo(); + ~QFFmpegMediaFormatInfo(); +- +- static QMediaFormat::VideoCodec videoCodecForAVCodecId(AVCodecID id); +- static QMediaFormat::AudioCodec audioCodecForAVCodecId(AVCodecID id); +- static QMediaFormat::FileFormat fileFormatForAVInputFormat(const AVInputFormat *format); +- +- static const AVOutputFormat *outputFormatForFileFormat(QMediaFormat::FileFormat format); +- +- static AVCodecID codecIdForVideoCodec(QMediaFormat::VideoCodec codec); +- static AVCodecID codecIdForAudioCodec(QMediaFormat::AudioCodec codec); +- +- static QAudioFormat::SampleFormat sampleFormat(AVSampleFormat format); +- static AVSampleFormat avSampleFormat(QAudioFormat::SampleFormat format); +- +- static int64_t avChannelLayout(QAudioFormat::ChannelConfig channelConfig); +- static QAudioFormat::ChannelConfig channelConfigForAVLayout(int64_t avChannelLayout); +- +- static QAudioFormat audioFormatFromCodecParameters(AVCodecParameters *codecPar); + }; + + QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration.cpp b/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration.cpp +index b51a9996f..3aee26f6d 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration.cpp ++++ b/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration.cpp +@@ -5,13 +5,9 @@ + #include + #include "qffmpegmediaintegration_p.h" + #include "qffmpegmediaformatinfo_p.h" +-#include "qffmpegmediaplayer_p.h" + #include "qffmpegvideosink_p.h" + #include "qffmpegmediacapturesession_p.h" +-#include "qffmpegmediarecorder_p.h" + #include "qffmpegimagecapture_p.h" +-#include "qffmpegaudioinput_p.h" +-#include "qffmpegaudiodecoder_p.h" + + #ifdef Q_OS_MACOS + #include +@@ -24,13 +20,6 @@ + #include "qwindowsvideodevices_p.h" + #endif + +-#ifdef Q_OS_ANDROID +-# include "jni.h" +-extern "C" { +-# include +-} +-#endif +- + #if QT_CONFIG(linux_v4l) + #include "qv4l2camera_p.h" + #endif +@@ -86,21 +75,11 @@ QPlatformMediaFormatInfo *QFFmpegMediaIntegration::formatInfo() + return m_formatsInfo; + } + +-QPlatformAudioDecoder *QFFmpegMediaIntegration::createAudioDecoder(QAudioDecoder *decoder) +-{ +- return new QFFmpegAudioDecoder(decoder); +-} +- + QPlatformMediaCaptureSession *QFFmpegMediaIntegration::createCaptureSession() + { + return new QFFmpegMediaCaptureSession(); + } + +-QPlatformMediaPlayer *QFFmpegMediaIntegration::createPlayer(QMediaPlayer *player) +-{ +- return new QFFmpegMediaPlayer(player); +-} +- + QPlatformCamera *QFFmpegMediaIntegration::createCamera(QCamera *camera) + { + #ifdef Q_OS_DARWIN +@@ -115,11 +94,6 @@ QPlatformCamera *QFFmpegMediaIntegration::createCamera(QCamera *camera) + #endif + } + +-QPlatformMediaRecorder *QFFmpegMediaIntegration::createRecorder(QMediaRecorder *recorder) +-{ +- return new QFFmpegMediaRecorder(recorder); +-} +- + QPlatformImageCapture *QFFmpegMediaIntegration::createImageCapture(QImageCapture *imageCapture) + { + return new QFFmpegImageCapture(imageCapture); +@@ -130,11 +104,6 @@ QPlatformVideoSink *QFFmpegMediaIntegration::createVideoSink(QVideoSink *sink) + return new QFFmpegVideoSink(sink); + } + +-QPlatformAudioInput *QFFmpegMediaIntegration::createAudioInput(QAudioInput *input) +-{ +- return new QFFmpegAudioInput(input); +-} +- + #ifdef Q_OS_ANDROID + Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/) + { +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration_p.h b/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration_p.h +index 08ca227a2..682f9a14e 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration_p.h ++++ b/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration_p.h +@@ -30,18 +30,12 @@ public: + static QFFmpegMediaIntegration *instance() { return static_cast(QPlatformMediaIntegration::instance()); } + QPlatformMediaFormatInfo *formatInfo() override; + +- QPlatformAudioDecoder *createAudioDecoder(QAudioDecoder *decoder) override; + QPlatformMediaCaptureSession *createCaptureSession() override; +- QPlatformMediaPlayer *createPlayer(QMediaPlayer *player) override; + QPlatformCamera *createCamera(QCamera *) override; +- QPlatformMediaRecorder *createRecorder(QMediaRecorder *) override; + QPlatformImageCapture *createImageCapture(QImageCapture *) override; + + QPlatformVideoSink *createVideoSink(QVideoSink *sink) override; + +- QPlatformAudioInput *createAudioInput(QAudioInput *input) override; +-// QPlatformAudioOutput *createAudioOutput(QAudioOutput *) override; +- + QFFmpegMediaFormatInfo *m_formatsInfo = nullptr; + }; + +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediametadata.cpp b/src/plugins/multimedia/ffmpeg/qffmpegmediametadata.cpp +index fecce3f1b..dda577d44 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediametadata.cpp ++++ b/src/plugins/multimedia/ffmpeg/qffmpegmediametadata.cpp +@@ -64,114 +64,9 @@ static const char *keyToTag(QMediaMetaData::Key key) + return nullptr; + } + +-//internal +-void QFFmpegMetaData::addEntry(QMediaMetaData &metaData, AVDictionaryEntry *entry) +-{ +-// qDebug() << " checking:" << entry->key << entry->value; +- QByteArray tag(entry->key); +- QMediaMetaData::Key key = tagToKey(tag.toLower()); +- if (key == QMediaMetaData::Key(-1)) +- return; +-// qDebug() << " adding" << key; +- +- auto *map = &metaData; +- +- int metaTypeId = keyType(key).id(); +- switch (metaTypeId) { +- case qMetaTypeId(): +- map->insert(key, QString::fromUtf8(entry->value)); +- return; +- case qMetaTypeId(): +- map->insert(key, QString::fromUtf8(entry->value).split(QLatin1Char(','))); +- return; +- case qMetaTypeId(): { +- QDateTime date; +- if (!qstrcmp(entry->key, "year")) { +- if (map->keys().contains(QMediaMetaData::Date)) +- return; +- date = QDateTime(QDate(QByteArray(entry->value).toInt(), 1, 1), QTime(0, 0, 0)); +- } else { +- date = QDateTime::fromString(QString::fromUtf8(entry->value), Qt::ISODate); +- } +- map->insert(key, date); +- return; +- } +- case qMetaTypeId(): +- map->insert(key, QUrl::fromEncoded(entry->value)); +- return; +- case qMetaTypeId(): +- map->insert(key, (qint64)QByteArray(entry->value).toLongLong()); +- return; +- case qMetaTypeId(): +- map->insert(key, QByteArray(entry->value).toInt()); +- return; +- case qMetaTypeId(): +- map->insert(key, (qreal)QByteArray(entry->value).toDouble()); +- return; +- default: +- break; +- } +- if (metaTypeId == qMetaTypeId()) { +- map->insert(key, QVariant::fromValue(QLocale::codeToLanguage(QString::fromUtf8(entry->value), QLocale::ISO639Part2))); +- } +-} +- +- +-QMediaMetaData QFFmpegMetaData::fromAVMetaData(const AVDictionary *tags) +-{ +- QMediaMetaData metaData; +- AVDictionaryEntry *entry = nullptr; +- while ((entry = av_dict_get(tags, "", entry, AV_DICT_IGNORE_SUFFIX))) +- addEntry(metaData, entry); +- +- return metaData; +-} +- + QByteArray QFFmpegMetaData::value(const QMediaMetaData &metaData, QMediaMetaData::Key key) + { +-// qDebug() << " checking:" << entry->key << entry->value; +- +- const int metaTypeId = keyType(key).id(); +- const QVariant val = metaData.value(key); +- switch (metaTypeId) { +- case qMetaTypeId(): +- return val.toString().toUtf8(); +- case qMetaTypeId(): +- return val.toStringList().join(u",").toUtf8(); +- case qMetaTypeId(): +- return val.toDateTime().toString(Qt::ISODate).toUtf8(); +- case qMetaTypeId(): +- return val.toUrl().toEncoded(); +- case qMetaTypeId(): +- case qMetaTypeId(): +- return QByteArray::number(val.toLongLong()); +- case qMetaTypeId(): +- return QByteArray::number(val.toDouble()); +- default: +- break; +- } +- if (metaTypeId == qMetaTypeId()) +- return QLocale::languageToCode(val.value(), QLocale::ISO639Part2).toUtf8(); + return {}; + } + +- +-AVDictionary *QFFmpegMetaData::toAVMetaData(const QMediaMetaData &metaData) +-{ +- const QList keys = metaData.keys(); +- AVDictionary *dict = nullptr; +- for (const auto &k : keys) { +- const char *key = ::keyToTag(k); +- if (!key) +- continue; +- QByteArray val = value(metaData, k); +- if (val.isEmpty()) +- continue; +- av_dict_set(&dict, key, val.constData(), 0); +- } +- return dict; +-} +- +- +- + QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediametadata_p.h b/src/plugins/multimedia/ffmpeg/qffmpegmediametadata_p.h +index 201287495..95b069b64 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediametadata_p.h ++++ b/src/plugins/multimedia/ffmpeg/qffmpegmediametadata_p.h +@@ -16,18 +16,13 @@ + // + + #include +-#include + + QT_BEGIN_NAMESPACE + + class QFFmpegMetaData : public QMediaMetaData + { + public: +- static void addEntry(QMediaMetaData &metaData, AVDictionaryEntry *entry); +- static QMediaMetaData fromAVMetaData(const AVDictionary *tags); +- + static QByteArray value(const QMediaMetaData &metaData, QMediaMetaData::Key key); +- static AVDictionary *toAVMetaData(const QMediaMetaData &metaData); + }; + + QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediaplayer.cpp b/src/plugins/multimedia/ffmpeg/qffmpegmediaplayer.cpp +deleted file mode 100644 +index 1d5f5e11d..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediaplayer.cpp ++++ /dev/null +@@ -1,206 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpegmediaplayer_p.h" +-#include "qffmpegdecoder_p.h" +-#include "qffmpegmediaformatinfo_p.h" +-#include "qlocale.h" +-#include "qffmpeg_p.h" +-#include "qffmpegmediametadata_p.h" +-#include "qffmpegvideobuffer_p.h" +-#include "private/qplatformaudiooutput_p.h" +-#include "qvideosink.h" +-#include "qaudiosink.h" +-#include "qaudiooutput.h" +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-QT_BEGIN_NAMESPACE +- +-using namespace QFFmpeg; +- +-QFFmpegMediaPlayer::QFFmpegMediaPlayer(QMediaPlayer *player) +- : QPlatformMediaPlayer(player) +-{ +-} +- +-QFFmpegMediaPlayer::~QFFmpegMediaPlayer() +-{ +- delete decoder; +-} +- +-qint64 QFFmpegMediaPlayer::duration() const +-{ +- return decoder ? decoder->m_duration/1000 : 0; +-} +- +-void QFFmpegMediaPlayer::setPosition(qint64 position) +-{ +- if (decoder) +- decoder->seek(position*1000); +- if (state() == QMediaPlayer::StoppedState) +- mediaStatusChanged(QMediaPlayer::LoadedMedia); +-} +- +-float QFFmpegMediaPlayer::bufferProgress() const +-{ +- return 1.; +-} +- +-QMediaTimeRange QFFmpegMediaPlayer::availablePlaybackRanges() const +-{ +- return {}; +-} +- +-qreal QFFmpegMediaPlayer::playbackRate() const +-{ +- return m_playbackRate; +-} +- +-void QFFmpegMediaPlayer::setPlaybackRate(qreal rate) +-{ +- if (m_playbackRate == rate) +- return; +- m_playbackRate = rate; +- if (decoder) +- decoder->setPlaybackRate(rate); +-} +- +-QUrl QFFmpegMediaPlayer::media() const +-{ +- return m_url; +-} +- +-const QIODevice *QFFmpegMediaPlayer::mediaStream() const +-{ +- return m_device; +-} +- +-void QFFmpegMediaPlayer::setMedia(const QUrl &media, QIODevice *stream) +-{ +- m_url = media; +- m_device = stream; +- if (decoder) +- delete decoder; +- decoder = nullptr; +- +- positionChanged(0); +- +- if (media.isEmpty() && !stream) { +- seekableChanged(false); +- audioAvailableChanged(false); +- videoAvailableChanged(false); +- metaDataChanged(); +- mediaStatusChanged(QMediaPlayer::NoMedia); +- return; +- } +- +- mediaStatusChanged(QMediaPlayer::LoadingMedia); +- decoder = new Decoder(this); +- decoder->setMedia(media, stream); +- decoder->setAudioSink(m_audioOutput); +- decoder->setVideoSink(m_videoSink); +- +- metaDataChanged(); +- seekableChanged(decoder->isSeekable()); +- +- audioAvailableChanged(!decoder->m_streamMap[QPlatformMediaPlayer::AudioStream].isEmpty()); +- videoAvailableChanged(!decoder->m_streamMap[QPlatformMediaPlayer::VideoStream].isEmpty()); +- +- QMetaObject::invokeMethod(this, "delayedLoadedStatus", Qt::QueuedConnection); +-} +- +-void QFFmpegMediaPlayer::play() +-{ +- if (!decoder) +- return; +- +- if (mediaStatus() == QMediaPlayer::EndOfMedia && state() == QMediaPlayer::StoppedState) +- decoder->seek(0); +- decoder->play(); +- stateChanged(QMediaPlayer::PlayingState); +- mediaStatusChanged(QMediaPlayer::BufferedMedia); +-} +- +-void QFFmpegMediaPlayer::pause() +-{ +- if (!decoder) +- return; +- if (mediaStatus() == QMediaPlayer::EndOfMedia && state() == QMediaPlayer::StoppedState) +- decoder->seek(0); +- decoder->pause(); +- stateChanged(QMediaPlayer::PausedState); +- mediaStatusChanged(QMediaPlayer::BufferedMedia); +-} +- +-void QFFmpegMediaPlayer::stop() +-{ +- if (!decoder) +- return; +- decoder->stop(); +- stateChanged(QMediaPlayer::StoppedState); +- mediaStatusChanged(QMediaPlayer::LoadedMedia); +-} +- +-void QFFmpegMediaPlayer::setAudioOutput(QPlatformAudioOutput *output) +-{ +- if (m_audioOutput == output) +- return; +- +- m_audioOutput = output; +- if (decoder) +- decoder->setAudioSink(output); +-} +- +-QMediaMetaData QFFmpegMediaPlayer::metaData() const +-{ +- return decoder ? decoder->m_metaData : QMediaMetaData{}; +-} +- +-void QFFmpegMediaPlayer::setVideoSink(QVideoSink *sink) +-{ +- if (m_videoSink == sink) +- return; +- +- m_videoSink = sink; +- if (decoder) +- decoder->setVideoSink(sink); +-} +- +-QVideoSink *QFFmpegMediaPlayer::videoSink() const +-{ +- return m_videoSink; +-} +- +-int QFFmpegMediaPlayer::trackCount(TrackType type) +-{ +- return decoder ? decoder->m_streamMap[type].count() : 0; +-} +- +-QMediaMetaData QFFmpegMediaPlayer::trackMetaData(TrackType type, int streamNumber) +-{ +- if (!decoder || streamNumber < 0 || streamNumber >= decoder->m_streamMap[type].count()) +- return {}; +- return decoder->m_streamMap[type].at(streamNumber).metaData; +-} +- +-int QFFmpegMediaPlayer::activeTrack(TrackType type) +-{ +- return decoder ? decoder->m_requestedStreams[type] : -1; +-} +- +-void QFFmpegMediaPlayer::setActiveTrack(TrackType type, int streamNumber) +-{ +- if (decoder) +- decoder->setActiveTrack(type, streamNumber); +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediaplayer_p.h b/src/plugins/multimedia/ffmpeg/qffmpegmediaplayer_p.h +deleted file mode 100644 +index 6c7aff74c..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediaplayer_p.h ++++ /dev/null +@@ -1,89 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#ifndef QFFMPEGMEDIAPLAYER_H +-#define QFFMPEGMEDIAPLAYER_H +- +-#include +-#include +-#include "qffmpeg_p.h" +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg { +-class Decoder; +-} +-class QPlatformAudioOutput; +- +-class QFFmpegMediaPlayer : public QObject, public QPlatformMediaPlayer +-{ +- Q_OBJECT +-public: +- QFFmpegMediaPlayer(QMediaPlayer *player); +- ~QFFmpegMediaPlayer(); +- +- qint64 duration() const override; +- +- void setPosition(qint64 position) override; +- +- float bufferProgress() const override; +- +- QMediaTimeRange availablePlaybackRanges() const override; +- +- qreal playbackRate() const override; +- void setPlaybackRate(qreal rate) override; +- +- QUrl media() const override; +- const QIODevice *mediaStream() const override; +- void setMedia(const QUrl &media, QIODevice *stream) override; +- +- void play() override; +- void pause() override; +- void stop() override; +- +-// bool streamPlaybackSupported() const { return false; } +- +- void setAudioOutput(QPlatformAudioOutput *) override; +- +- QMediaMetaData metaData() const override; +- +- void setVideoSink(QVideoSink *sink) override; +- QVideoSink *videoSink() const; +- +- int trackCount(TrackType) override; +- QMediaMetaData trackMetaData(TrackType type, int streamNumber) override; +- int activeTrack(TrackType) override; +- void setActiveTrack(TrackType, int streamNumber) override; +- +- Q_INVOKABLE void delayedLoadedStatus() { mediaStatusChanged(QMediaPlayer::LoadedMedia); } +- +-private: +- friend class QFFmpeg::Decoder; +- +- QFFmpeg::Decoder *decoder = nullptr; +- void checkStreams(); +- +- QPlatformAudioOutput *m_audioOutput = nullptr; +- QVideoSink *m_videoSink = nullptr; +- +- QUrl m_url; +- QIODevice *m_device = nullptr; +- float m_playbackRate = 1.; +-}; +- +-QT_END_NAMESPACE +- +- +-#endif // QMEDIAPLAYERCONTROL_H +- +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediarecorder.cpp b/src/plugins/multimedia/ffmpeg/qffmpegmediarecorder.cpp +deleted file mode 100644 +index 870b8ad38..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediarecorder.cpp ++++ /dev/null +@@ -1,157 +0,0 @@ +-// Copyright (C) 2016 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpegmediarecorder_p.h" +-#include "qaudiodevice.h" +-#include +-#include +-#include "qaudiosource.h" +-#include "qffmpegaudioinput_p.h" +-#include "qaudiobuffer.h" +-#include "qffmpegencoder_p.h" +-#include "qffmpegmediaformatinfo_p.h" +- +-#include +-#include +-#include +-#include +-#include +- +-Q_LOGGING_CATEGORY(qLcMediaEncoder, "qt.multimedia.encoder") +- +-QFFmpegMediaRecorder::QFFmpegMediaRecorder(QMediaRecorder *parent) +- : QPlatformMediaRecorder(parent) +-{ +-} +- +-QFFmpegMediaRecorder::~QFFmpegMediaRecorder() +-{ +- if (encoder) +- encoder->finalize(); +-} +- +-bool QFFmpegMediaRecorder::isLocationWritable(const QUrl &) const +-{ +- return true; +-} +- +-void QFFmpegMediaRecorder::handleSessionError(QMediaRecorder::Error code, const QString &description) +-{ +- error(code, description); +- stop(); +-} +- +-void QFFmpegMediaRecorder::record(QMediaEncoderSettings &settings) +-{ +- if (!m_session || state() != QMediaRecorder::StoppedState) +- return; +- +- const auto hasVideo = m_session->camera() && m_session->camera()->isActive(); +- const auto hasAudio = m_session->audioInput() != nullptr; +- +- if (!hasVideo && !hasAudio) { +- error(QMediaRecorder::ResourceError, QMediaRecorder::tr("No camera or audio input")); +- return; +- } +- +- const auto audioOnly = settings.videoCodec() == QMediaFormat::VideoCodec::Unspecified; +- +- auto primaryLocation = audioOnly ? QStandardPaths::MusicLocation : QStandardPaths::MoviesLocation; +- auto container = settings.mimeType().preferredSuffix(); +- auto location = QMediaStorageLocation::generateFileName(outputLocation().toLocalFile(), primaryLocation, container); +- +- QUrl actualSink = QUrl::fromLocalFile(QDir::currentPath()).resolved(location); +- qCDebug(qLcMediaEncoder) << "recording new video to" << actualSink; +- qDebug() << "requested format:" << settings.fileFormat() << settings.audioCodec(); +- +- Q_ASSERT(!actualSink.isEmpty()); +- +- encoder = new QFFmpeg::Encoder(settings, actualSink); +- encoder->setMetaData(m_metaData); +- connect(encoder, &QFFmpeg::Encoder::durationChanged, this, &QFFmpegMediaRecorder::newDuration); +- connect(encoder, &QFFmpeg::Encoder::finalizationDone, this, &QFFmpegMediaRecorder::finalizationDone); +- connect(encoder, &QFFmpeg::Encoder::error, this, &QFFmpegMediaRecorder::handleSessionError); +- +- auto *audioInput = m_session->audioInput(); +- if (audioInput) +- encoder->addAudioInput(static_cast(audioInput)); +- +- auto *camera = m_session->camera(); +- if (camera) +- encoder->addVideoSource(camera); +- +- durationChanged(0); +- stateChanged(QMediaRecorder::RecordingState); +- actualLocationChanged(QUrl::fromLocalFile(location)); +- +- encoder->start(); +-} +- +-void QFFmpegMediaRecorder::pause() +-{ +- if (!m_session || state() != QMediaRecorder::RecordingState) +- return; +- +- Q_ASSERT(encoder); +- encoder->setPaused(true); +- +- stateChanged(QMediaRecorder::PausedState); +-} +- +-void QFFmpegMediaRecorder::resume() +-{ +- if (!m_session || state() != QMediaRecorder::PausedState) +- return; +- +- Q_ASSERT(encoder); +- encoder->setPaused(false); +- +- stateChanged(QMediaRecorder::RecordingState); +-} +- +-void QFFmpegMediaRecorder::stop() +-{ +- if (!m_session || state() == QMediaRecorder::StoppedState) +- return; +- auto * input = m_session ? m_session->audioInput() : nullptr; +- if (input) +- static_cast(input)->setRunning(false); +- qCDebug(qLcMediaEncoder) << "stop"; +- // ### all of the below should be done asynchronous. finalize() should do it's work in a thread +- // to avoid blocking the UI in case of slow codecs +- if (encoder) { +- encoder->finalize(); +- encoder = nullptr; +- } +-} +- +-void QFFmpegMediaRecorder::finalizationDone() +-{ +- stateChanged(QMediaRecorder::StoppedState); +-} +- +-void QFFmpegMediaRecorder::setMetaData(const QMediaMetaData &metaData) +-{ +- if (!m_session) +- return; +- m_metaData = metaData; +-} +- +-QMediaMetaData QFFmpegMediaRecorder::metaData() const +-{ +- return m_metaData; +-} +- +-void QFFmpegMediaRecorder::setCaptureSession(QPlatformMediaCaptureSession *session) +-{ +- auto *captureSession = static_cast(session); +- if (m_session == captureSession) +- return; +- +- if (m_session) +- stop(); +- +- m_session = captureSession; +- if (!m_session) +- return; +-} +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediarecorder_p.h b/src/plugins/multimedia/ffmpeg/qffmpegmediarecorder_p.h +deleted file mode 100644 +index 26f4c16ad..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegmediarecorder_p.h ++++ /dev/null +@@ -1,68 +0,0 @@ +-// Copyright (C) 2016 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +- +-#ifndef QFFMPEGMEDIARECODER_H +-#define QFFMPEGMEDIARECODER_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include +-#include "qffmpegmediacapturesession_p.h" +- +-#include "qffmpeg_p.h" +- +-QT_BEGIN_NAMESPACE +- +-class QAudioSource; +-class QAudioSourceIO; +-class QAudioBuffer; +-class QMediaMetaData; +- +-namespace QFFmpeg { +-class Encoder; +-} +- +-class QFFmpegMediaRecorder : public QObject, public QPlatformMediaRecorder +-{ +- Q_OBJECT +-public: +- QFFmpegMediaRecorder(QMediaRecorder *parent); +- virtual ~QFFmpegMediaRecorder(); +- +- bool isLocationWritable(const QUrl &sink) const override; +- +- void record(QMediaEncoderSettings &settings) override; +- void pause() override; +- void resume() override; +- void stop() override; +- +- void setMetaData(const QMediaMetaData &) override; +- QMediaMetaData metaData() const override; +- +- void setCaptureSession(QPlatformMediaCaptureSession *session); +- +-private Q_SLOTS: +- void newDuration(qint64 d) { durationChanged(d); } +- void finalizationDone(); +- void handleSessionError(QMediaRecorder::Error code, const QString &description); +- +-private: +- QFFmpegMediaCaptureSession *m_session = nullptr; +- QMediaMetaData m_metaData; +- +- QFFmpeg::Encoder *encoder = nullptr; +-}; +- +-QT_END_NAMESPACE +- +-#endif // QFFMPEGMEDIARECODER_H +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegresampler.cpp b/src/plugins/multimedia/ffmpeg/qffmpegresampler.cpp +deleted file mode 100644 +index bb15aa0e1..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegresampler.cpp ++++ /dev/null +@@ -1,95 +0,0 @@ +-// Copyright (C) 2022 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#include "qffmpegresampler_p.h" +-#include "qffmpegdecoder_p.h" +-#include "qffmpegmediaformatinfo_p.h" +-#include +- +-extern "C" { +-#include +-} +- +-Q_LOGGING_CATEGORY(qLcResampler, "qt.multimedia.ffmpeg.resampler") +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg +-{ +- +-Resampler::Resampler(const Codec *codec, const QAudioFormat &outputFormat) +- : m_outputFormat(outputFormat) +-{ +- qCDebug(qLcResampler) << "createResampler"; +- const AVStream *audioStream = codec->stream(); +- const auto *codecpar = audioStream->codecpar; +- +- if (!m_outputFormat.isValid()) +- // want the native format +- m_outputFormat = QFFmpegMediaFormatInfo::audioFormatFromCodecParameters(audioStream->codecpar); +- +- QAudioFormat::ChannelConfig config = m_outputFormat.channelConfig(); +- if (config == QAudioFormat::ChannelConfigUnknown) +- config = QAudioFormat::defaultChannelConfigForChannelCount(m_outputFormat.channelCount()); +- +- +- qCDebug(qLcResampler) << "init resampler" << m_outputFormat.sampleRate() << config << codecpar->sample_rate; +-#if QT_FFMPEG_OLD_CHANNEL_LAYOUT +- auto inConfig = codecpar->channel_layout; +- if (inConfig == 0) +- inConfig = QFFmpegMediaFormatInfo::avChannelLayout(QAudioFormat::defaultChannelConfigForChannelCount(codecpar->channels)); +- resampler = swr_alloc_set_opts(nullptr, // we're allocating a new context +- QFFmpegMediaFormatInfo::avChannelLayout(config), // out_ch_layout +- QFFmpegMediaFormatInfo::avSampleFormat(m_outputFormat.sampleFormat()), // out_sample_fmt +- m_outputFormat.sampleRate(), // out_sample_rate +- inConfig, // in_ch_layout +- AVSampleFormat(codecpar->format), // in_sample_fmt +- codecpar->sample_rate, // in_sample_rate +- 0, // log_offset +- nullptr); +-#else +- AVChannelLayout in_ch_layout = codecpar->ch_layout; +- AVChannelLayout out_ch_layout = {}; +- av_channel_layout_from_mask(&out_ch_layout, QFFmpegMediaFormatInfo::avChannelLayout(config)); +- swr_alloc_set_opts2(&resampler, // we're allocating a new context +- &out_ch_layout, +- QFFmpegMediaFormatInfo::avSampleFormat(m_outputFormat.sampleFormat()), +- m_outputFormat.sampleRate(), +- &in_ch_layout, +- AVSampleFormat(codecpar->format), +- codecpar->sample_rate, +- 0, +- nullptr); +-#endif +- // if we're not the master clock, we might need to handle clock adjustments, initialize for that +- av_opt_set_double(resampler, "async", m_outputFormat.sampleRate()/50, 0); +- +- swr_init(resampler); +-} +- +-Resampler::~Resampler() +-{ +- swr_free(&resampler); +-} +- +-QAudioBuffer Resampler::resample(const AVFrame *frame) +-{ +- const int outSamples = swr_get_out_samples(resampler, frame->nb_samples); +- QByteArray samples(m_outputFormat.bytesForFrames(outSamples), Qt::Uninitialized); +- auto **in = const_cast(frame->extended_data); +- auto *out = reinterpret_cast(samples.data()); +- const int out_samples = swr_convert(resampler, &out, outSamples, +- in, frame->nb_samples); +- samples.resize(m_outputFormat.bytesForFrames(out_samples)); +- +- qint64 startTime = m_outputFormat.durationForFrames(m_samplesProcessed); +- m_samplesProcessed += out_samples; +- +- qCDebug(qLcResampler) << " new frame" << startTime << "in_samples" << frame->nb_samples << out_samples << outSamples; +- QAudioBuffer buffer(samples, m_outputFormat, startTime); +- return buffer; +-} +- +- +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegresampler_p.h b/src/plugins/multimedia/ffmpeg/qffmpegresampler_p.h +deleted file mode 100644 +index 4b5b59537..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegresampler_p.h ++++ /dev/null +@@ -1,46 +0,0 @@ +-// Copyright (C) 2022 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGRESAMPLER_P_H +-#define QFFMPEGRESAMPLER_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qaudiobuffer.h" +-#include "qffmpeg_p.h" +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg +-{ +- +-struct Codec; +- +-class Resampler +-{ +-public: +- Resampler(const Codec *codec, const QAudioFormat &outputFormat); +- ~Resampler(); +- +- QAudioBuffer resample(const AVFrame *frame); +- qint64 samplesProcessed() const { return m_samplesProcessed; } +- +-private: +- QAudioFormat m_outputFormat; +- SwrContext *resampler = nullptr; +- qint64 m_samplesProcessed = 0; +-}; +- +-} +- +-QT_END_NAMESPACE +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegthread.cpp b/src/plugins/multimedia/ffmpeg/qffmpegthread.cpp +deleted file mode 100644 +index 804ba424f..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegthread.cpp ++++ /dev/null +@@ -1,57 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpegthread_p.h" +- +-#include +- +-QT_BEGIN_NAMESPACE +- +-using namespace QFFmpeg; +- +-void Thread::kill() +-{ +- { +- QMutexLocker locker(&mutex); +- exit.storeRelease(true); +- killHelper(); +- } +- wake(); +- wait(); +- delete this; +-} +- +-void Thread::maybePause() +-{ +- while (timeOut > 0 || shouldWait()) { +- if (exit.loadAcquire()) +- break; +- +- QElapsedTimer timer; +- timer.start(); +- if (condition.wait(&mutex, QDeadlineTimer(timeOut, Qt::PreciseTimer))) { +- if (timeOut >= 0) { +- timeOut -= timer.elapsed(); +- if (timeOut < 0) +- timeOut = -1; +- } +- } else { +- timeOut = -1; +- } +- } +-} +- +-void Thread::run() +-{ +- init(); +- QMutexLocker locker(&mutex); +- while (1) { +- maybePause(); +- if (exit.loadAcquire()) +- break; +- loop(); +- } +- cleanup(); +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegthread_p.h b/src/plugins/multimedia/ffmpeg/qffmpegthread_p.h +deleted file mode 100644 +index e5c87e237..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegthread_p.h ++++ /dev/null +@@ -1,68 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGTHREAD_P_H +-#define QFFMPEGTHREAD_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include +- +-#include +-#include +-#include +- +-QT_BEGIN_NAMESPACE +- +-class QAudioSink; +- +-namespace QFFmpeg +-{ +- +-class Thread : public QThread +-{ +-public: +- mutable QMutex mutex; +- qint64 timeOut = -1; +-private: +- QWaitCondition condition; +- +-protected: +- QAtomicInteger exit = false; +- +-public: +- // public API is thread-safe +- +- void kill(); +- virtual void killHelper() {} +- +- void wake() { +- condition.wakeAll(); +- } +- +-protected: +- virtual void init() {} +- virtual void cleanup() {} +- // loop() should never block, all blocking has to happen in shouldWait() +- virtual void loop() = 0; +- virtual bool shouldWait() const { return false; } +- +-private: +- void maybePause(); +- +- void run() override; +-}; +- +-} +- +-QT_END_NAMESPACE +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp b/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp +deleted file mode 100644 +index 1b718e43a..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp ++++ /dev/null +@@ -1,357 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpegvideobuffer_p.h" +-#include "private/qvideotexturehelper_p.h" +-#include "qffmpeghwaccel_p.h" +- +-extern "C" { +-#include +-#include +-#include +-} +- +-QT_BEGIN_NAMESPACE +- +-QFFmpegVideoBuffer::QFFmpegVideoBuffer(AVFrame *frame) +- : QAbstractVideoBuffer(QVideoFrame::NoHandle) +- , frame(frame) +-{ +- if (frame->hw_frames_ctx) { +- hwFrame = frame; +- m_pixelFormat = toQtPixelFormat(QFFmpeg::HWAccel::format(frame)); +- return; +- } +- +- swFrame = frame; +- m_pixelFormat = toQtPixelFormat(AVPixelFormat(swFrame->format)); +- +- convertSWFrame(); +-} +- +-QFFmpegVideoBuffer::~QFFmpegVideoBuffer() +-{ +- delete textures; +- if (swFrame) +- av_frame_free(&swFrame); +- if (hwFrame) +- av_frame_free(&hwFrame); +-} +- +-void QFFmpegVideoBuffer::convertSWFrame() +-{ +- Q_ASSERT(swFrame); +- bool needsConversion = false; +- auto pixelFormat = toQtPixelFormat(AVPixelFormat(swFrame->format), &needsConversion); +-// qDebug() << "SW frame format:" << pixelFormat << swFrame->format << needsConversion; +- +- if (pixelFormat != m_pixelFormat) { +- AVPixelFormat newFormat = toAVPixelFormat(m_pixelFormat); +- // convert the format into something we can handle +- SwsContext *c = sws_getContext(swFrame->width, swFrame->height, AVPixelFormat(swFrame->format), +- swFrame->width, swFrame->height, newFormat, +- SWS_BICUBIC, nullptr, nullptr, nullptr); +- +- AVFrame *newFrame = av_frame_alloc(); +- newFrame->width = swFrame->width; +- newFrame->height = swFrame->height; +- newFrame->format = newFormat; +- av_frame_get_buffer(newFrame, 0); +- +- sws_scale(c, swFrame->data, swFrame->linesize, 0, swFrame->height, newFrame->data, newFrame->linesize); +- av_frame_free(&swFrame); +- swFrame = newFrame; +- sws_freeContext(c); +- } +-} +- +-void QFFmpegVideoBuffer::setTextureConverter(const QFFmpeg::TextureConverter &converter) +-{ +- textureConverter = converter; +- textureConverter.init(hwFrame); +- m_type = converter.isNull() ? QVideoFrame::NoHandle : QVideoFrame::RhiTextureHandle; +-} +- +-QVideoFrameFormat::ColorSpace QFFmpegVideoBuffer::colorSpace() const +-{ +- switch (frame->colorspace) { +- default: +- case AVCOL_SPC_UNSPECIFIED: +- case AVCOL_SPC_RESERVED: +- case AVCOL_SPC_FCC: +- case AVCOL_SPC_SMPTE240M: +- case AVCOL_SPC_YCGCO: +- case AVCOL_SPC_SMPTE2085: +- case AVCOL_SPC_CHROMA_DERIVED_NCL: +- case AVCOL_SPC_CHROMA_DERIVED_CL: +- case AVCOL_SPC_ICTCP: // BT.2100 ICtCp +- return QVideoFrameFormat::ColorSpace_Undefined; +- case AVCOL_SPC_RGB: +- return QVideoFrameFormat::ColorSpace_AdobeRgb; +- case AVCOL_SPC_BT709: +- return QVideoFrameFormat::ColorSpace_BT709; +- case AVCOL_SPC_BT470BG: // BT601 +- case AVCOL_SPC_SMPTE170M: // Also BT601 +- return QVideoFrameFormat::ColorSpace_BT601; +- case AVCOL_SPC_BT2020_NCL: // Non constant luminence +- case AVCOL_SPC_BT2020_CL: // Constant luminence +- return QVideoFrameFormat::ColorSpace_BT2020; +- } +-} +- +-QVideoFrameFormat::ColorTransfer QFFmpegVideoBuffer::colorTransfer() const +-{ +- switch (frame->color_trc) { +- case AVCOL_TRC_BT709: +- // The following three cases have transfer characteristics identical to BT709 +- case AVCOL_TRC_BT1361_ECG: +- case AVCOL_TRC_BT2020_10: +- case AVCOL_TRC_BT2020_12: +- case AVCOL_TRC_SMPTE240M: // almost identical to bt709 +- return QVideoFrameFormat::ColorTransfer_BT709; +- case AVCOL_TRC_GAMMA22: +- case AVCOL_TRC_SMPTE428 : // No idea, let's hope for the best... +- case AVCOL_TRC_IEC61966_2_1: // sRGB, close enough to 2.2... +- case AVCOL_TRC_IEC61966_2_4: // not quite, but probably close enough +- return QVideoFrameFormat::ColorTransfer_Gamma22; +- case AVCOL_TRC_GAMMA28: +- return QVideoFrameFormat::ColorTransfer_Gamma28; +- case AVCOL_TRC_SMPTE170M: +- return QVideoFrameFormat::ColorTransfer_BT601; +- case AVCOL_TRC_LINEAR: +- return QVideoFrameFormat::ColorTransfer_Linear; +- case AVCOL_TRC_SMPTE2084: +- return QVideoFrameFormat::ColorTransfer_ST2084; +- case AVCOL_TRC_ARIB_STD_B67: +- return QVideoFrameFormat::ColorTransfer_STD_B67; +- default: +- break; +- } +- return QVideoFrameFormat::ColorTransfer_Unknown; +-} +- +-QVideoFrameFormat::ColorRange QFFmpegVideoBuffer::colorRange() const +-{ +- switch (frame->color_range) { +- case AVCOL_RANGE_MPEG: +- return QVideoFrameFormat::ColorRange_Video; +- case AVCOL_RANGE_JPEG: +- return QVideoFrameFormat::ColorRange_Full; +- default: +- return QVideoFrameFormat::ColorRange_Unknown; +- } +-} +- +-float QFFmpegVideoBuffer::maxNits() +-{ +- float maxNits = -1; +- for (int i = 0; i nb_side_data; ++i) { +- AVFrameSideData *sd = frame->side_data[i]; +- // TODO: Longer term we might want to also support HDR10+ dynamic metadata +- if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) { +- auto *data = reinterpret_cast(sd->data); +- maxNits = float(data->max_luminance.num)/float(data->max_luminance.den)*10000.; +- } +- } +- return maxNits; +-} +- +-QVideoFrame::MapMode QFFmpegVideoBuffer::mapMode() const +-{ +- return m_mode; +-} +- +-QAbstractVideoBuffer::MapData QFFmpegVideoBuffer::map(QVideoFrame::MapMode mode) +-{ +- if (!swFrame) { +- Q_ASSERT(hwFrame && hwFrame->hw_frames_ctx); +- swFrame = av_frame_alloc(); +- /* retrieve data from GPU to CPU */ +- int ret = av_hwframe_transfer_data(swFrame, hwFrame, 0); +- if (ret < 0) { +- qWarning() << "Error transferring the data to system memory\n"; +- return {}; +- } +- convertSWFrame(); +- } +- +- m_mode = mode; +- +-// qDebug() << "MAP:"; +- MapData mapData; +- auto *desc = QVideoTextureHelper::textureDescription(pixelFormat()); +- mapData.nPlanes = desc->nplanes; +- for (int i = 0; i < mapData.nPlanes; ++i) { +- mapData.data[i] = swFrame->data[i]; +- mapData.bytesPerLine[i] = swFrame->linesize[i]; +- mapData.size[i] = mapData.bytesPerLine[i]*desc->heightForPlane(swFrame->height, i); +-// qDebug() << " " << i << mapData.data[i] << mapData.size[i]; +- } +- return mapData; +-} +- +-void QFFmpegVideoBuffer::unmap() +-{ +- // nothing to do here for SW buffers +-} +- +-void QFFmpegVideoBuffer::mapTextures() +-{ +- if (textures || !hwFrame) +- return; +-// qDebug() << ">>>>> mapTextures"; +- textures = textureConverter.getTextures(hwFrame); +- if (!textures) +- qWarning() << " failed to get textures for frame" << textureConverter.isNull(); +-} +- +-quint64 QFFmpegVideoBuffer::textureHandle(int plane) const +-{ +- return textures ? textures->textureHandle(plane) : 0; +-} +- +-std::unique_ptr QFFmpegVideoBuffer::texture(int plane) const +-{ +- return textures ? textures->texture(plane) : std::unique_ptr(); +-} +- +-QVideoFrameFormat::PixelFormat QFFmpegVideoBuffer::pixelFormat() const +-{ +- return m_pixelFormat; +-} +- +-QSize QFFmpegVideoBuffer::size() const +-{ +- return QSize(frame->width, frame->height); +-} +- +-QVideoFrameFormat::PixelFormat QFFmpegVideoBuffer::toQtPixelFormat(AVPixelFormat avPixelFormat, bool *needsConversion) +-{ +- if (needsConversion) +- *needsConversion = false; +- +- switch (avPixelFormat) { +- default: +- break; +- case AV_PIX_FMT_ARGB: +- return QVideoFrameFormat::Format_ARGB8888; +- case AV_PIX_FMT_0RGB: +- return QVideoFrameFormat::Format_XRGB8888; +- case AV_PIX_FMT_BGRA: +- return QVideoFrameFormat::Format_BGRA8888; +- case AV_PIX_FMT_BGR0: +- return QVideoFrameFormat::Format_BGRX8888; +- case AV_PIX_FMT_ABGR: +- return QVideoFrameFormat::Format_ABGR8888; +- case AV_PIX_FMT_0BGR: +- return QVideoFrameFormat::Format_XBGR8888; +- case AV_PIX_FMT_RGBA: +- return QVideoFrameFormat::Format_RGBA8888; +- case AV_PIX_FMT_RGB0: +- return QVideoFrameFormat::Format_RGBX8888; +- +- case AV_PIX_FMT_YUV422P: +- return QVideoFrameFormat::Format_YUV422P; +- case AV_PIX_FMT_YUV420P: +- return QVideoFrameFormat::Format_YUV420P; +- case AV_PIX_FMT_YUV420P10: +- return QVideoFrameFormat::Format_YUV420P10; +- case AV_PIX_FMT_UYVY422: +- return QVideoFrameFormat::Format_UYVY; +- case AV_PIX_FMT_YUYV422: +- return QVideoFrameFormat::Format_YUYV; +- case AV_PIX_FMT_NV12: +- return QVideoFrameFormat::Format_NV12; +- case AV_PIX_FMT_NV21: +- return QVideoFrameFormat::Format_NV21; +- case AV_PIX_FMT_GRAY8: +- return QVideoFrameFormat::Format_Y8; +- case AV_PIX_FMT_GRAY16: +- return QVideoFrameFormat::Format_Y16; +- +- case AV_PIX_FMT_P010: +- return QVideoFrameFormat::Format_P010; +- case AV_PIX_FMT_P016: +- return QVideoFrameFormat::Format_P016; +- case AV_PIX_FMT_MEDIACODEC: +- return QVideoFrameFormat::Format_SamplerExternalOES; +- } +- +- if (needsConversion) +- *needsConversion = true; +- +- const AVPixFmtDescriptor *descriptor = av_pix_fmt_desc_get(avPixelFormat); +- +- if (descriptor->flags & AV_PIX_FMT_FLAG_RGB) +- return QVideoFrameFormat::Format_RGBA8888; +- +- if (descriptor->comp[0].depth > 8) +- return QVideoFrameFormat::Format_P016; +- return QVideoFrameFormat::Format_YUV420P; +-} +- +-AVPixelFormat QFFmpegVideoBuffer::toAVPixelFormat(QVideoFrameFormat::PixelFormat pixelFormat) +-{ +- switch (pixelFormat) { +- default: +- case QVideoFrameFormat::Format_Invalid: +- case QVideoFrameFormat::Format_AYUV: +- case QVideoFrameFormat::Format_AYUV_Premultiplied: +- case QVideoFrameFormat::Format_YV12: +- case QVideoFrameFormat::Format_IMC1: +- case QVideoFrameFormat::Format_IMC2: +- case QVideoFrameFormat::Format_IMC3: +- case QVideoFrameFormat::Format_IMC4: +- return AV_PIX_FMT_NONE; +- case QVideoFrameFormat::Format_Jpeg: +- // We're using the data from the converted QImage here, which is in BGRA. +- return AV_PIX_FMT_BGRA; +- case QVideoFrameFormat::Format_ARGB8888: +- case QVideoFrameFormat::Format_ARGB8888_Premultiplied: +- return AV_PIX_FMT_ARGB; +- case QVideoFrameFormat::Format_XRGB8888: +- return AV_PIX_FMT_0RGB; +- case QVideoFrameFormat::Format_BGRA8888: +- case QVideoFrameFormat::Format_BGRA8888_Premultiplied: +- return AV_PIX_FMT_BGRA; +- case QVideoFrameFormat::Format_BGRX8888: +- return AV_PIX_FMT_BGR0; +- case QVideoFrameFormat::Format_ABGR8888: +- return AV_PIX_FMT_ABGR; +- case QVideoFrameFormat::Format_XBGR8888: +- return AV_PIX_FMT_0BGR; +- case QVideoFrameFormat::Format_RGBA8888: +- return AV_PIX_FMT_RGBA; +- case QVideoFrameFormat::Format_RGBX8888: +- return AV_PIX_FMT_RGB0; +- +- case QVideoFrameFormat::Format_YUV422P: +- return AV_PIX_FMT_YUV422P; +- case QVideoFrameFormat::Format_YUV420P: +- return AV_PIX_FMT_YUV420P; +- case QVideoFrameFormat::Format_YUV420P10: +- return AV_PIX_FMT_YUV420P10; +- case QVideoFrameFormat::Format_UYVY: +- return AV_PIX_FMT_UYVY422; +- case QVideoFrameFormat::Format_YUYV: +- return AV_PIX_FMT_YUYV422; +- case QVideoFrameFormat::Format_NV12: +- return AV_PIX_FMT_NV12; +- case QVideoFrameFormat::Format_NV21: +- return AV_PIX_FMT_NV21; +- case QVideoFrameFormat::Format_Y8: +- return AV_PIX_FMT_GRAY8; +- case QVideoFrameFormat::Format_Y16: +- return AV_PIX_FMT_GRAY16; +- +- case QVideoFrameFormat::Format_P010: +- return AV_PIX_FMT_P010; +- case QVideoFrameFormat::Format_P016: +- return AV_PIX_FMT_P016; +- +- case QVideoFrameFormat::Format_SamplerExternalOES: +- return AV_PIX_FMT_MEDIACODEC; +- } +-} +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer_p.h b/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer_p.h +deleted file mode 100644 +index 0f82942c1..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer_p.h ++++ /dev/null +@@ -1,73 +0,0 @@ +-// Copyright (C) 2021 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#ifndef QFFMPEGVIDEOBUFFER_P_H +-#define QFFMPEGVIDEOBUFFER_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include +-#include +-#include +-#include +- +-#include "qffmpeg_p.h" +-#include "qffmpeghwaccel_p.h" +- +-QT_BEGIN_NAMESPACE +- +-class QFFmpegVideoBuffer : public QAbstractVideoBuffer +-{ +-public: +- +- QFFmpegVideoBuffer(AVFrame *frame); +- ~QFFmpegVideoBuffer(); +- +- QVideoFrame::MapMode mapMode() const override; +- MapData map(QVideoFrame::MapMode mode) override; +- void unmap() override; +- +- virtual void mapTextures() override; +- virtual quint64 textureHandle(int plane) const override; +- std::unique_ptr texture(int plane) const override; +- +- QVideoFrameFormat::PixelFormat pixelFormat() const; +- QSize size() const; +- +- static QVideoFrameFormat::PixelFormat toQtPixelFormat(AVPixelFormat avPixelFormat, bool *needsConversion = nullptr); +- static AVPixelFormat toAVPixelFormat(QVideoFrameFormat::PixelFormat pixelFormat); +- +- void convertSWFrame(); +- +- AVFrame *getHWFrame() const { return hwFrame; } +- +- void setTextureConverter(const QFFmpeg::TextureConverter &converter); +- +- QVideoFrameFormat::ColorSpace colorSpace() const; +- QVideoFrameFormat::ColorTransfer colorTransfer() const; +- QVideoFrameFormat::ColorRange colorRange() const; +- +- float maxNits(); +- +-private: +- QVideoFrameFormat::PixelFormat m_pixelFormat; +- AVFrame *frame = nullptr; +- AVFrame *hwFrame = nullptr; +- AVFrame *swFrame = nullptr; +- QFFmpeg::TextureConverter textureConverter; +- QVideoFrame::MapMode m_mode = QVideoFrame::NotMapped; +- QFFmpeg::TextureSet *textures = nullptr; +-}; +- +-QT_END_NAMESPACE +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegvideoframeencoder.cpp b/src/plugins/multimedia/ffmpeg/qffmpegvideoframeencoder.cpp +deleted file mode 100644 +index 374152bfa..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegvideoframeencoder.cpp ++++ /dev/null +@@ -1,370 +0,0 @@ +-// Copyright (C) 2022 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +- +-#include "qffmpegvideoframeencoder_p.h" +-#include "qffmpegvideobuffer_p.h" +-#include "qffmpegmediaformatinfo_p.h" +-#include "qffmpegencoderoptions_p.h" +-#include "private/qplatformmediarecorder_p.h" +-#include "private/qmultimediautils_p.h" +-#include +- +-extern "C" { +-#include +-} +- +-/* Infrastructure for HW acceleration goes into this file. */ +- +-QT_BEGIN_NAMESPACE +- +-Q_LOGGING_CATEGORY(qLcVideoFrameEncoder, "qt.multimedia.ffmpeg.videoencoder") +- +-namespace QFFmpeg { +- +-VideoFrameEncoder::Data::~Data() +-{ +- if (converter) +- sws_freeContext(converter); +- avcodec_free_context(&codecContext); +-} +- +-VideoFrameEncoder::VideoFrameEncoder(const QMediaEncoderSettings &encoderSettings, +- const QSize &sourceSize, float frameRate, AVPixelFormat sourceFormat, AVPixelFormat swFormat) +- : d(new Data) +-{ +- d->settings = encoderSettings; +- d->frameRate = frameRate; +- d->sourceSize = sourceSize; +- +- if (!d->settings.videoResolution().isValid()) +- d->settings.setVideoResolution(d->sourceSize); +- +- d->sourceFormat = sourceFormat; +- d->sourceSWFormat = swFormat; +- +- auto qVideoCodec = encoderSettings.videoCodec(); +- auto codecID = QFFmpegMediaFormatInfo::codecIdForVideoCodec(qVideoCodec); +- +-#ifndef QT_DISABLE_HW_ENCODING +- const auto *accels = HWAccel::preferredDeviceTypes(); +- while (*accels != AV_HWDEVICE_TYPE_NONE) { +- auto accel = HWAccel(*accels); +- ++accels; +- +- auto matchesSizeConstraints = [&]() -> bool { +- auto *constraints = av_hwdevice_get_hwframe_constraints(accel.hwDeviceContextAsBuffer(), nullptr); +- if (!constraints) +- return true; +- // Check size constraints +- bool result = (d->sourceSize.width() >= constraints->min_width && d->sourceSize.height() >= constraints->min_height && +- d->sourceSize.width() <= constraints->max_width && d->sourceSize.height() <= constraints->max_height); +- av_hwframe_constraints_free(&constraints); +- return result; +- }; +- +- if (!matchesSizeConstraints()) +- continue; +- +- d->codec = accel.hardwareEncoderForCodecId(codecID); +- if (!d->codec) +- continue; +- d->accel = accel; +- break; +- } +-#endif +- +- if (d->accel.isNull()) { +- d->codec = avcodec_find_encoder(codecID); +- if (!d->codec) { +- qWarning() << "Could not find encoder for codecId" << codecID; +- d = {}; +- return; +- } +- } +- auto supportsFormat = [&](AVPixelFormat fmt) { +- auto *f = d->codec->pix_fmts; +- while (*f != -1) { +- if (*f == fmt) +- return true; +- ++f; +- } +- return false; +- }; +- +- d->targetFormat = d->sourceFormat; +- +- if (!supportsFormat(d->sourceFormat)) { +- if (supportsFormat(swFormat)) +- d->targetFormat = swFormat; +- else +- // Take first format the encoder supports. Might want to improve upon this +- d->targetFormat = *d->codec->pix_fmts; +- } +- +- auto desc = av_pix_fmt_desc_get(d->sourceFormat); +- d->sourceFormatIsHWFormat = desc->flags & AV_PIX_FMT_FLAG_HWACCEL; +- desc = av_pix_fmt_desc_get(d->targetFormat); +- d->targetFormatIsHWFormat = desc->flags & AV_PIX_FMT_FLAG_HWACCEL; +- +- bool needToScale = d->sourceSize != d->settings.videoResolution(); +- bool zeroCopy = d->sourceFormatIsHWFormat && d->sourceFormat == d->targetFormat && !needToScale; +- +- if (zeroCopy) +- // no need to initialize any converters +- return; +- +- if (d->sourceFormatIsHWFormat) { +- // if source and target formats don't agree, but the source is a HW format or sizes do't agree, we need to download +- if (d->sourceFormat != d->targetFormat || needToScale) +- d->downloadFromHW = true; +- } else { +- d->sourceSWFormat = d->sourceFormat; +- } +- +- if (d->targetFormatIsHWFormat) { +- Q_ASSERT(!d->accel.isNull()); +- // if source and target formats don't agree, but the target is a HW format, we need to upload +- if (d->sourceFormat != d->targetFormat || needToScale) { +- d->uploadToHW = true; +- +- // determine the format used by the encoder. +- // We prefer YUV422 based formats such as NV12 or P010. Selection trues to find the best matching +- // format for the encoder depending on the bit depth of the source format +- auto desc = av_pix_fmt_desc_get(d->sourceSWFormat); +- int sourceDepth = desc->comp[0].depth; +- +- d->targetSWFormat = AV_PIX_FMT_NONE; +- +- auto *constraints = av_hwdevice_get_hwframe_constraints(d->accel.hwDeviceContextAsBuffer(), nullptr); +- auto *f = constraints->valid_sw_formats; +- int score = INT_MIN; +- while (*f != AV_PIX_FMT_NONE) { +- auto calcScore = [&](AVPixelFormat fmt) -> int { +- auto *desc = av_pix_fmt_desc_get(fmt); +- int s = 0; +- if (fmt == d->sourceSWFormat) +- // prefer exact matches +- s += 10; +- if (desc->comp[0].depth == sourceDepth) +- s += 100; +- else if (desc->comp[0].depth < sourceDepth) +- s -= 100; +- if (desc->log2_chroma_h == 1) +- s += 1; +- if (desc->log2_chroma_w == 1) +- s += 1; +- if (desc->flags & AV_PIX_FMT_FLAG_BE) +- s -= 10; +- if (desc->flags & AV_PIX_FMT_FLAG_PAL) +- // we don't want paletted formats +- s -= 10000; +- if (desc->flags & AV_PIX_FMT_FLAG_RGB) +- // we don't want RGB formats +- s -= 1000; +- if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) +- // we really don't want HW accelerated formats here +- s -= 1000000; +- qCDebug(qLcVideoFrameEncoder) << "checking format" << fmt << Qt::hex << desc->flags << desc->comp[0].depth +- << desc->log2_chroma_h << desc->log2_chroma_w << "score:" << s; +- return s; +- }; +- +- int s = calcScore(*f); +- if (s > score) { +- d->targetSWFormat = *f; +- score = s; +- } +- ++f; +- } +- if (d->targetSWFormat == AV_PIX_FMT_NONE) // shouldn't happen +- d->targetSWFormat = *constraints->valid_sw_formats; +- +- qCDebug(qLcVideoFrameEncoder) << "using format" << d->targetSWFormat << "as transfer format."; +- +- av_hwframe_constraints_free(&constraints); +- // need to create a frames context to convert the input data +- d->accel.createFramesContext(d->targetSWFormat, sourceSize); +- } +- } else { +- d->targetSWFormat = d->targetFormat; +- } +- +- if (d->sourceSWFormat != d->targetSWFormat || needToScale) { +- auto resolution = d->settings.videoResolution(); +- qCDebug(qLcVideoFrameEncoder) << "camera and encoder use different formats:" << d->sourceSWFormat << d->targetSWFormat; +- d->converter = sws_getContext(d->sourceSize.width(), d->sourceSize.height(), d->sourceSWFormat, +- resolution.width(), resolution.height(), d->targetSWFormat, +- SWS_FAST_BILINEAR, nullptr, nullptr, nullptr); +- } +-} +- +-VideoFrameEncoder::~VideoFrameEncoder() +-{ +-} +- +-void QFFmpeg::VideoFrameEncoder::initWithFormatContext(AVFormatContext *formatContext) +-{ +- d->stream = avformat_new_stream(formatContext, nullptr); +- d->stream->id = formatContext->nb_streams - 1; +- //qCDebug(qLcVideoFrameEncoder) << "Video stream: index" << d->stream->id; +- d->stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; +- d->stream->codecpar->codec_id = d->codec->id; +- +- // Apples HEVC decoders don't like the hev1 tag ffmpeg uses by default, use hvc1 as the more commonly accepted tag +- if (d->codec->id == AV_CODEC_ID_HEVC) +- d->stream->codecpar->codec_tag = MKTAG('h','v','c','1'); +- +- // ### Fix hardcoded values +- d->stream->codecpar->format = d->targetFormat; +- d->stream->codecpar->width = d->settings.videoResolution().width(); +- d->stream->codecpar->height = d->settings.videoResolution().height(); +- d->stream->codecpar->sample_aspect_ratio = AVRational{1, 1}; +- float requestedRate = d->frameRate; +- d->stream->time_base = AVRational{ 1, (int)(requestedRate*1000) }; +- +- float delta = 1e10; +- if (d->codec->supported_framerates) { +- // codec only supports fixed frame rates +- auto *f = d->codec->supported_framerates; +- auto *best = f; +- qCDebug(qLcVideoFrameEncoder) << "Finding fixed rate:"; +- while (f->num != 0) { +- float rate = float(f->num)/float(f->den); +- float d = qAbs(rate - requestedRate); +- qCDebug(qLcVideoFrameEncoder) << " " << f->num << f->den << d; +- if (d < delta) { +- best = f; +- delta = d; +- } +- ++f; +- } +- qCDebug(qLcVideoFrameEncoder) << "Fixed frame rate required. Requested:" << requestedRate << "Using:" << best->num << "/" << best->den; +- d->stream->time_base = { best->den, best->num }; +- requestedRate = float(best->num)/float(best->den); +- } +- +- Q_ASSERT(d->codec); +- d->codecContext = avcodec_alloc_context3(d->codec); +- if (!d->codecContext) { +- qWarning() << "Could not allocate codec context"; +- d = {}; +- return; +- } +- +- avcodec_parameters_to_context(d->codecContext, d->stream->codecpar); +- d->codecContext->time_base = d->stream->time_base; +- qCDebug(qLcVideoFrameEncoder) << "requesting time base" << d->codecContext->time_base.num << d->codecContext->time_base.den; +- auto [num, den] = qRealToFraction(requestedRate); +- d->codecContext->framerate = { num, den }; +- auto deviceContext = d->accel.hwDeviceContextAsBuffer(); +- if (deviceContext) +- d->codecContext->hw_device_ctx = av_buffer_ref(deviceContext); +- auto framesContext = d->accel.hwFramesContextAsBuffer(); +- if (framesContext) +- d->codecContext->hw_frames_ctx = av_buffer_ref(framesContext); +-} +- +-bool VideoFrameEncoder::open() +-{ +- AVDictionary *opts = nullptr; +- applyVideoEncoderOptions(d->settings, d->codec->name, d->codecContext, &opts); +- int res = avcodec_open2(d->codecContext, d->codec, &opts); +- if (res < 0) { +- avcodec_free_context(&d->codecContext); +- qWarning() << "Couldn't open codec for writing" << err2str(res); +- return false; +- } +- qCDebug(qLcVideoFrameEncoder) << "video codec opened" << res << "time base" << d->codecContext->time_base.num << d->codecContext->time_base.den; +- d->stream->time_base = d->codecContext->time_base; +- return true; +-} +- +-qint64 VideoFrameEncoder::getPts(qint64 us) +-{ +- Q_ASSERT(d); +- qint64 div = 1000000*d->stream->time_base.num; +- return (us*d->stream->time_base.den + (div>>1))/div; +-} +- +-int VideoFrameEncoder::sendFrame(AVFrame *frame) +-{ +- if (!frame) +- return avcodec_send_frame(d->codecContext, frame); +- auto pts = frame->pts; +- +- if (d->downloadFromHW) { +- auto *f = av_frame_alloc(); +- f->format = d->sourceSWFormat; +- int err = av_hwframe_transfer_data(f, frame, 0); +- if (err < 0) { +- qCDebug(qLcVideoFrameEncoder) << "Error transferring frame data to surface." << err2str(err); +- return err; +- } +- av_frame_free(&frame); +- frame = f; +- } +- +- if (d->converter) { +- auto *f = av_frame_alloc(); +- f->format = d->targetSWFormat; +- f->width = d->settings.videoResolution().width(); +- f->height = d->settings.videoResolution().height(); +- av_frame_get_buffer(f, 0); +- sws_scale(d->converter, frame->data, frame->linesize, 0, f->height, f->data, f->linesize); +- av_frame_free(&frame); +- frame = f; +- } +- +- if (d->uploadToHW) { +- auto *hwFramesContext = d->accel.hwFramesContextAsBuffer(); +- Q_ASSERT(hwFramesContext); +- auto *f = av_frame_alloc(); +- if (!f) +- return AVERROR(ENOMEM); +- int err = av_hwframe_get_buffer(hwFramesContext, f, 0); +- if (err < 0) { +- qCDebug(qLcVideoFrameEncoder) << "Error getting HW buffer" << err2str(err); +- return err; +- } else { +- qCDebug(qLcVideoFrameEncoder) << "got HW buffer"; +- } +- if (!f->hw_frames_ctx) { +- qCDebug(qLcVideoFrameEncoder) << "no hw frames context"; +- return AVERROR(ENOMEM); +- } +- err = av_hwframe_transfer_data(f, frame, 0); +- if (err < 0) { +- qCDebug(qLcVideoFrameEncoder) << "Error transferring frame data to surface." << err2str(err); +- return err; +- } +- av_frame_free(&frame); +- frame = f; +- } +- +- qCDebug(qLcVideoFrameEncoder) << "sending frame" << pts; +- frame->pts = pts; +- int ret = avcodec_send_frame(d->codecContext, frame); +- av_frame_free(&frame); +- return ret; +-} +- +-AVPacket *VideoFrameEncoder::retrievePacket() +-{ +- if (!d || !d->codecContext) +- return nullptr; +- AVPacket *packet = av_packet_alloc(); +- int ret = avcodec_receive_packet(d->codecContext, packet); +- if (ret < 0) { +- av_packet_free(&packet); +- if (ret != AVERROR(EOF) && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) +- qCDebug(qLcVideoFrameEncoder) << "Error receiving packet" << ret << err2str(ret); +- return nullptr; +- } +- qCDebug(qLcVideoFrameEncoder) << "got a packet" << packet->pts << timeStamp(packet->pts, d->stream->time_base); +- packet->stream_index = d->stream->id; +- return packet; +-} +- +-} // namespace QFFmpeg +- +-QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegvideoframeencoder_p.h b/src/plugins/multimedia/ffmpeg/qffmpegvideoframeencoder_p.h +deleted file mode 100644 +index 4dd9f05d7..000000000 +--- a/src/plugins/multimedia/ffmpeg/qffmpegvideoframeencoder_p.h ++++ /dev/null +@@ -1,76 +0,0 @@ +-// Copyright (C) 2022 The Qt Company Ltd. +-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +-#ifndef QFFMPEGVIDEOFRAMEENCODER_P_H +-#define QFFMPEGVIDEOFRAMEENCODER_P_H +- +-// +-// W A R N I N G +-// ------------- +-// +-// This file is not part of the Qt API. It exists purely as an +-// implementation detail. This header file may change from version to +-// version without notice, or even be removed. +-// +-// We mean it. +-// +- +-#include "qffmpeghwaccel_p.h" +-#include "qvideoframeformat.h" +-#include "private/qplatformmediarecorder_p.h" +- +-QT_BEGIN_NAMESPACE +- +-namespace QFFmpeg { +- +-class VideoFrameEncoder +-{ +- class Data final +- { +- public: +- ~Data(); +- QAtomicInt ref = 0; +- QMediaEncoderSettings settings; +- float frameRate = 0.; +- QSize sourceSize; +- +- HWAccel accel; +- const AVCodec *codec = nullptr; +- AVStream *stream = nullptr; +- AVCodecContext *codecContext = nullptr; +- SwsContext *converter = nullptr; +- AVPixelFormat sourceFormat = AV_PIX_FMT_NONE; +- AVPixelFormat sourceSWFormat = AV_PIX_FMT_NONE; +- AVPixelFormat targetFormat = AV_PIX_FMT_NONE; +- AVPixelFormat targetSWFormat = AV_PIX_FMT_NONE; +- bool sourceFormatIsHWFormat = false; +- bool targetFormatIsHWFormat = false; +- bool downloadFromHW = false; +- bool uploadToHW = false; +- }; +- +- QExplicitlySharedDataPointer d; +-public: +- VideoFrameEncoder() = default; +- VideoFrameEncoder(const QMediaEncoderSettings &encoderSettings, const QSize &sourceSize, float frameRate, AVPixelFormat sourceFormat, AVPixelFormat swFormat); +- ~VideoFrameEncoder(); +- +- void initWithFormatContext(AVFormatContext *formatContext); +- bool open(); +- +- bool isNull() const { return !d; } +- +- AVPixelFormat sourceFormat() const { return d ? d->sourceFormat : AV_PIX_FMT_NONE; } +- AVPixelFormat targetFormat() const { return d ? d->targetFormat : AV_PIX_FMT_NONE; } +- +- qint64 getPts(qint64 ms); +- +- int sendFrame(AVFrame *frame); +- AVPacket *retrievePacket(); +-}; +- +- +-} +- +-QT_END_NAMESPACE +- +-#endif +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegvideosink.cpp b/src/plugins/multimedia/ffmpeg/qffmpegvideosink.cpp +index 3cb31b473..93e7ceeed 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegvideosink.cpp ++++ b/src/plugins/multimedia/ffmpeg/qffmpegvideosink.cpp +@@ -1,7 +1,6 @@ + // Copyright (C) 2021 The Qt Company Ltd. + // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + #include +-#include + + QT_BEGIN_NAMESPACE + +@@ -10,21 +9,8 @@ QFFmpegVideoSink::QFFmpegVideoSink(QVideoSink *sink) + { + } + +-void QFFmpegVideoSink::setRhi(QRhi *rhi) +-{ +- if (m_rhi == rhi) +- return; +- m_rhi = rhi; +- textureConverter = QFFmpeg::TextureConverter(rhi); +- emit rhiChanged(rhi); +-} +- + void QFFmpegVideoSink::setVideoFrame(const QVideoFrame &frame) + { +- auto *buffer = dynamic_cast(frame.videoBuffer()); +- if (buffer) +- buffer->setTextureConverter(textureConverter); +- + QPlatformVideoSink::setVideoFrame(frame); + } + +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegvideosink_p.h b/src/plugins/multimedia/ffmpeg/qffmpegvideosink_p.h +index dbd9ac7f2..cbaa810d7 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegvideosink_p.h ++++ b/src/plugins/multimedia/ffmpeg/qffmpegvideosink_p.h +@@ -16,7 +16,7 @@ + // + + #include +-#include ++//#include + + QT_BEGIN_NAMESPACE + +@@ -29,16 +29,8 @@ class QFFmpegVideoSink : public QPlatformVideoSink + + public: + QFFmpegVideoSink(QVideoSink *sink); +- void setRhi(QRhi *rhi) override; + + void setVideoFrame(const QVideoFrame &frame) override; +- +-Q_SIGNALS: +- void rhiChanged(QRhi *rhi); +- +-private: +- QFFmpeg::TextureConverter textureConverter; +- QRhi *m_rhi = nullptr; + }; + + QT_END_NAMESPACE +diff --git a/src/plugins/multimedia/ffmpeg/qwindowscamera.cpp b/src/plugins/multimedia/ffmpeg/qwindowscamera.cpp +index a169e0873..de94e82b4 100644 +--- a/src/plugins/multimedia/ffmpeg/qwindowscamera.cpp ++++ b/src/plugins/multimedia/ffmpeg/qwindowscamera.cpp +@@ -10,8 +10,8 @@ + + #include + #include +-#include +-#include ++#include ++#include + + #include + +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/no-renameat2.patch b/contrib/depends/patches/qt/no-renameat2.patch new file mode 100644 index 0000000..d93dd0e --- /dev/null +++ b/contrib/depends/patches/qt/no-renameat2.patch @@ -0,0 +1,42 @@ +From 92ba295ee64a55c73c8a32b77c352a6181289fe8 Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sun, 30 Oct 2022 23:15:34 +0100 +Subject: [PATCH] no renameat2 + +--- + qtbase/src/corelib/configure.cmake | 2 -- + qtbase/src/corelib/global/qconfig-bootstrapped.h | 4 ---- + 2 files changed, 6 deletions(-) + +diff --git a/qtbase/src/corelib/configure.cmake b/qtbase/src/corelib/configure.cmake +index 183decb530..f8e9ad0e87 100644 +--- a/qtbase/src/corelib/configure.cmake ++++ b/qtbase/src/corelib/configure.cmake +@@ -434,8 +434,6 @@ qt_config_compile_test(renameat2 + LABEL "renameat2()" + CODE + "#define _ATFILE_SOURCE 1 +-#include +-#include + + int main(int, char **argv) + { +diff --git a/qtbase/src/corelib/global/qconfig-bootstrapped.h b/qtbase/src/corelib/global/qconfig-bootstrapped.h +index 61fd6479b1..06d06235d5 100644 +--- a/qtbase/src/corelib/global/qconfig-bootstrapped.h ++++ b/qtbase/src/corelib/global/qconfig-bootstrapped.h +@@ -74,11 +74,7 @@ + #define QT_NO_QOBJECT + #define QT_FEATURE_process -1 + #define QT_FEATURE_regularexpression 1 +-#ifdef __GLIBC_PREREQ +-# define QT_FEATURE_renameat2 (__GLIBC_PREREQ(2, 28) ? 1 : -1) +-#else + # define QT_FEATURE_renameat2 -1 +-#endif + #define QT_FEATURE_shortcut -1 + #define QT_FEATURE_signaling_nan -1 + #define QT_FEATURE_slog2 -1 +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/no-statx.patch b/contrib/depends/patches/qt/no-statx.patch new file mode 100644 index 0000000..d4c88ae --- /dev/null +++ b/contrib/depends/patches/qt/no-statx.patch @@ -0,0 +1,56 @@ +From ceb48fa2f01b9c421d880f6220778d830e5c5f7b Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sun, 30 Oct 2022 16:52:17 +0100 +Subject: [PATCH] Never use statx + +--- + src/corelib/configure.cmake | 1 - + src/corelib/global/qconfig-bootstrapped.h | 6 +----- + src/corelib/io/qfilesystemengine_unix.cpp | 2 +- + 3 files changed, 2 insertions(+), 7 deletions(-) + +diff --git a/qtbase/src/corelib/configure.cmake b/qtbase/src/corelib/configure.cmake +index 4ab122afd0..7b89fa3dd7 100644 +--- a/qtbase/src/corelib/configure.cmake ++++ b/qtbase/src/corelib/configure.cmake +@@ -428,7 +428,6 @@ qt_config_compile_test(statx + CODE + "#define _ATFILE_SOURCE 1 + #include +-#include + #include + #include + +diff --git a/qtbase/src/corelib/global/qconfig-bootstrapped.h b/qtbase/src/corelib/global/qconfig-bootstrapped.h +index 42d38d0d04..25b551210c 100644 +--- a/qtbase/src/corelib/global/qconfig-bootstrapped.h ++++ b/qtbase/src/corelib/global/qconfig-bootstrapped.h +@@ -119,11 +119,7 @@ + #define QT_FEATURE_shortcut -1 + #define QT_FEATURE_signaling_nan -1 + #define QT_FEATURE_slog2 -1 +-#ifdef __GLIBC_PREREQ +-# define QT_FEATURE_statx (__GLIBC_PREREQ(2, 28) ? 1 : -1) +-#else +-# define QT_FEATURE_statx -1 +-#endif ++#define QT_FEATURE_statx -1 + #define QT_FEATURE_syslog -1 + #define QT_NO_SYSTEMLOCALE + #define QT_FEATURE_systemsemaphore -1 +diff --git a/qtbase/src/corelib/io/qfilesystemengine_unix.cpp b/qtbase/src/corelib/io/qfilesystemengine_unix.cpp +index 5ba9309426..c968d1c61f 100644 +--- a/qtbase/src/corelib/io/qfilesystemengine_unix.cpp ++++ b/qtbase/src/corelib/io/qfilesystemengine_unix.cpp +@@ -99,7 +99,7 @@ extern "C" NSString *NSTemporaryDirectory(); + #endif + #endif + +-#if defined(Q_OS_ANDROID) ++#if defined(Q_OS_LINUX) + // statx() is disabled on Android because quite a few systems + // come with sandboxes that kill applications that make system calls outside a + // whitelist and several Android vendors can't be bothered to update the list. +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/no-xlib.patch b/contrib/depends/patches/qt/no-xlib.patch index d6846aa..f767a4a 100644 --- a/contrib/depends/patches/qt/no-xlib.patch +++ b/contrib/depends/patches/qt/no-xlib.patch @@ -1,18 +1,17 @@ -From 9563cef873ae82e06f60708d706d054717e801ce Mon Sep 17 00:00:00 2001 -From: Carl Dong -Date: Thu, 18 Jul 2019 17:22:05 -0400 -Subject: [PATCH] Wrap xlib related code blocks in #if's +From 0171c86423f6c5aa8becf1259d42a3e67b8da59c Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sun, 30 Oct 2022 17:43:43 +0100 +Subject: [PATCH] no xlib -They are not necessary to compile QT. --- - qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp | 8 ++++++++ + src/plugins/platforms/xcb/qxcbcursor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp -index 7c62c2e2b3..c05c6c0a07 100644 +index 2cc39f1e85..90efc1f1fb 100644 --- a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp -@@ -49,7 +49,9 @@ +@@ -13,7 +13,9 @@ #include #include #include @@ -22,7 +21,7 @@ index 7c62c2e2b3..c05c6c0a07 100644 #include #include -@@ -391,6 +391,7 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *window) +@@ -357,6 +359,7 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *window) xcb_flush(xcb_connection()); } @@ -30,7 +29,7 @@ index 7c62c2e2b3..c05c6c0a07 100644 static int cursorIdForShape(int cshape) { int cursorId = 0; -@@ -444,6 +445,7 @@ static int cursorIdForShape(int cshape) +@@ -410,6 +413,7 @@ static int cursorIdForShape(int cshape) } return cursorId; } @@ -38,7 +37,7 @@ index 7c62c2e2b3..c05c6c0a07 100644 xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) { -@@ -556,7 +558,9 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) +@@ -524,7 +528,9 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) xcb_cursor_t QXcbCursor::createFontCursor(int cshape) { xcb_connection_t *conn = xcb_connection(); @@ -47,16 +46,16 @@ index 7c62c2e2b3..c05c6c0a07 100644 +#endif xcb_cursor_t cursor = XCB_NONE; - // Try Xcursor first -@@ -586,6 +590,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) + #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) +@@ -556,6 +562,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) // Non-standard X11 cursors are created from bitmaps cursor = createNonStandardCursor(cshape); +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) - // Create a glpyh cursor if everything else failed + // Create a glyph cursor if everything else failed if (!cursor && cursorId) { cursor = xcb_generate_id(conn); -@@ -593,6 +598,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) +@@ -563,6 +570,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) cursorId, cursorId + 1, 0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0); } @@ -65,5 +64,5 @@ index 7c62c2e2b3..c05c6c0a07 100644 if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) { const char *name = cursorNames[cshape].front(); -- -2.22.0 +2.38.1 diff --git a/contrib/depends/patches/qt/no_pthread_cond_clockwait.patch b/contrib/depends/patches/qt/no_pthread_cond_clockwait.patch new file mode 100644 index 0000000..336434a --- /dev/null +++ b/contrib/depends/patches/qt/no_pthread_cond_clockwait.patch @@ -0,0 +1,174 @@ +From e062494e888e4dfbb42cb0b2f2c9d41dd76b9bfb Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Mon, 31 Oct 2022 00:38:39 +0100 +Subject: [PATCH] Revert "Re-apply "QReadWriteLock: replace (QWaitCondition, + QMutex) with std::(condition_variable, mutex)"" + +This reverts commit fd8f81f3859fe92082caec925223e08cf61c69d4. +--- + src/corelib/thread/qreadwritelock.cpp | 35 ++++++++++++--------------- + src/corelib/thread/qreadwritelock_p.h | 12 ++++----- + 2 files changed, 22 insertions(+), 25 deletions(-) + +diff --git a/qtbase/src/corelib/thread/qreadwritelock.cpp b/qtbase/src/corelib/thread/qreadwritelock.cpp +index c31782d684..a46b70180c 100644 +--- a/qtbase/src/corelib/thread/qreadwritelock.cpp ++++ b/qtbase/src/corelib/thread/qreadwritelock.cpp +@@ -31,9 +31,6 @@ QT_BEGIN_NAMESPACE + */ + + namespace { +- +-using ms = std::chrono::milliseconds; +- + enum { + StateMask = 0x3, + StateLockedForRead = 0x1, +@@ -243,7 +240,7 @@ bool QReadWriteLock::tryLockForRead(int timeout) + d = d_ptr.loadAcquire(); + continue; + } +- return d->lockForRead(lock, timeout); ++ return d->lockForRead(timeout); + } + } + +@@ -347,7 +344,7 @@ bool QReadWriteLock::tryLockForWrite(int timeout) + d = d_ptr.loadAcquire(); + continue; + } +- return d->lockForWrite(lock, timeout); ++ return d->lockForWrite(timeout); + } + } + +@@ -431,9 +428,9 @@ QReadWriteLock::StateForWaitCondition QReadWriteLock::stateForWaitCondition() co + + } + +-bool QReadWriteLockPrivate::lockForRead(std::unique_lock &lock, int timeout) ++bool QReadWriteLockPrivate::lockForRead(int timeout) + { +- Q_ASSERT(!mutex.try_lock()); // mutex must be locked when entering this function ++ Q_ASSERT(!mutex.tryLock()); // mutex must be locked when entering this function + + QElapsedTimer t; + if (timeout > 0) +@@ -447,10 +444,10 @@ bool QReadWriteLockPrivate::lockForRead(std::unique_lock &lock + if (elapsed > timeout) + return false; + waitingReaders++; +- readerCond.wait_for(lock, ms{timeout - elapsed}); ++ readerCond.wait(&mutex, QDeadlineTimer(timeout - elapsed)); + } else { + waitingReaders++; +- readerCond.wait(lock); ++ readerCond.wait(&mutex); + } + waitingReaders--; + } +@@ -459,9 +456,9 @@ bool QReadWriteLockPrivate::lockForRead(std::unique_lock &lock + return true; + } + +-bool QReadWriteLockPrivate::lockForWrite(std::unique_lock &lock, int timeout) ++bool QReadWriteLockPrivate::lockForWrite(int timeout) + { +- Q_ASSERT(!mutex.try_lock()); // mutex must be locked when entering this function ++ Q_ASSERT(!mutex.tryLock()); // mutex must be locked when entering this function + + QElapsedTimer t; + if (timeout > 0) +@@ -476,15 +473,15 @@ bool QReadWriteLockPrivate::lockForWrite(std::unique_lock &loc + if (waitingReaders && !waitingWriters && !writerCount) { + // We timed out and now there is no more writers or waiting writers, but some + // readers were queued (probably because of us). Wake the waiting readers. +- readerCond.notify_all(); ++ readerCond.wakeAll(); + } + return false; + } + waitingWriters++; +- writerCond.wait_for(lock, ms{timeout - elapsed}); ++ writerCond.wait(&mutex, QDeadlineTimer(timeout - elapsed)); + } else { + waitingWriters++; +- writerCond.wait(lock); ++ writerCond.wait(&mutex); + } + waitingWriters--; + } +@@ -497,11 +494,11 @@ bool QReadWriteLockPrivate::lockForWrite(std::unique_lock &loc + + void QReadWriteLockPrivate::unlock() + { +- Q_ASSERT(!mutex.try_lock()); // mutex must be locked when entering this function ++ Q_ASSERT(!mutex.tryLock()); // mutex must be locked when entering this function + if (waitingWriters) +- writerCond.notify_one(); ++ writerCond.wakeOne(); + else if (waitingReaders) +- readerCond.notify_all(); ++ readerCond.wakeAll(); + } + + static auto handleEquals(Qt::HANDLE handle) +@@ -523,7 +520,7 @@ bool QReadWriteLockPrivate::recursiveLockForRead(int timeout) + return true; + } + +- if (!lockForRead(lock, timeout)) ++ if (!lockForRead(timeout)) + return false; + + Reader r = {self, 1}; +@@ -542,7 +539,7 @@ bool QReadWriteLockPrivate::recursiveLockForWrite(int timeout) + return true; + } + +- if (!lockForWrite(lock, timeout)) ++ if (!lockForWrite(timeout)) + return false; + + currentWriter = self; +diff --git a/qtbase/src/corelib/thread/qreadwritelock_p.h b/qtbase/src/corelib/thread/qreadwritelock_p.h +index e1d42fbbf3..c88eb15e1b 100644 +--- a/qtbase/src/corelib/thread/qreadwritelock_p.h ++++ b/qtbase/src/corelib/thread/qreadwritelock_p.h +@@ -17,8 +17,8 @@ + // + + #include +-#include + #include ++#include + + QT_REQUIRE_CONFIG(thread); + +@@ -30,9 +30,9 @@ public: + explicit QReadWriteLockPrivate(bool isRecursive = false) + : recursive(isRecursive) {} + +- QtPrivate::mutex mutex; +- QtPrivate::condition_variable writerCond; +- QtPrivate::condition_variable readerCond; ++ QMutex mutex; ++ QWaitCondition writerCond; ++ QWaitCondition readerCond; + int readerCount = 0; + int writerCount = 0; + int waitingReaders = 0; +@@ -40,8 +40,8 @@ public: + const bool recursive; + + //Called with the mutex locked +- bool lockForWrite(std::unique_lock &lock, int timeout); +- bool lockForRead(std::unique_lock &lock, int timeout); ++ bool lockForWrite(int timeout); ++ bool lockForRead(int timeout); + void unlock(); + + //memory management +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/no_wraprt_on_apple.patch b/contrib/depends/patches/qt/no_wraprt_on_apple.patch new file mode 100644 index 0000000..bde4b1f --- /dev/null +++ b/contrib/depends/patches/qt/no_wraprt_on_apple.patch @@ -0,0 +1,27 @@ +From da01a1fcdfffeef62024546abf03a28fc1673c9e Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Sat, 26 Nov 2022 14:07:42 +0100 +Subject: [PATCH] No WrapRT on APPLE + +--- + src/corelib/CMakeLists.txt | 2 +- + src/corelib/meta_types/qt6core_release_metatypes.json | 0 + 2 files changed, 1 insertion(+), 1 deletion(-) + create mode 100644 src/corelib/meta_types/qt6core_release_metatypes.json + +diff --git a/qtbase/src/corelib/CMakeLists.txt b/qtbase/src/corelib/CMakeLists.txt +index c683bb46dd..c018b81cf2 100644 +--- a/qtbase/src/corelib/CMakeLists.txt ++++ b/qtbase/src/corelib/CMakeLists.txt +@@ -1071,7 +1071,7 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_glib AND UNIX + GLIB2::GLIB2 + ) + +-qt_internal_extend_target(Core CONDITION QT_FEATURE_clock_gettime AND UNIX ++qt_internal_extend_target(Core CONDITION QT_FEATURE_clock_gettime AND UNIX AND NOT APPLE + LIBRARIES + WrapRt::WrapRt + ) +-- +2.38.1 + diff --git a/contrib/depends/patches/qt/qt.pro b/contrib/depends/patches/qt/qt.pro deleted file mode 100644 index 0ed241a..0000000 --- a/contrib/depends/patches/qt/qt.pro +++ /dev/null @@ -1,18 +0,0 @@ -# Create the super cache so modules will add themselves to it. -cache(, super) - -!QTDIR_build: cache(CONFIG, add, $$list(QTDIR_build)) - -#prl = no_install_prl -#CONFIG += $$prl -cache(CONFIG, add stash, prl) - -TEMPLATE = subdirs -SUBDIRS = qtbase qttools qttranslations qtsvg qtwebsockets - -qtwebsockets.depends = qtbase -qtsvg.depends = qtbase -qttools.depends = qtbase -qttranslations.depends = qttools - -load(qt_configure) diff --git a/contrib/depends/patches/qt/qtbase-moc-ignore-gcc-macro.patch b/contrib/depends/patches/qt/qtbase-moc-ignore-gcc-macro.patch index f0c14a9..9b848cc 100644 --- a/contrib/depends/patches/qt/qtbase-moc-ignore-gcc-macro.patch +++ b/contrib/depends/patches/qt/qtbase-moc-ignore-gcc-macro.patch @@ -7,7 +7,7 @@ Upstream report: https://bugreports.qt.io/browse/QTBUG-83160 diff --git a/qtbase/src/tools/moc/main.cpp b/qtbase/src/tools/moc/main.cpp --- a/qtbase/src/tools/moc/main.cpp +++ b/qtbase/src/tools/moc/main.cpp -@@ -238,6 +238,7 @@ int runMoc(int argc, char **argv) +@@ -197,6 +197,7 @@ int runMoc(int argc, char **argv) dummyVariadicFunctionMacro.arguments += Symbol(0, PP_IDENTIFIER, "__VA_ARGS__"); pp.macros["__attribute__"] = dummyVariadicFunctionMacro; pp.macros["__declspec"] = dummyVariadicFunctionMacro; diff --git a/contrib/depends/patches/qt/qttools_src.pro b/contrib/depends/patches/qt/qttools_src.pro deleted file mode 100644 index 6ef71a0..0000000 --- a/contrib/depends/patches/qt/qttools_src.pro +++ /dev/null @@ -1,6 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = linguist - -fb = force_bootstrap -CONFIG += $$fb -cache(CONFIG, add, fb) diff --git a/contrib/depends/patches/qt/rcc_hardcode_timestamp.patch b/contrib/depends/patches/qt/rcc_hardcode_timestamp.patch index 03f3897..6379112 100644 --- a/contrib/depends/patches/qt/rcc_hardcode_timestamp.patch +++ b/contrib/depends/patches/qt/rcc_hardcode_timestamp.patch @@ -6,7 +6,7 @@ the SOURCE_DATE_EPOCH variable set, e.g., for Guix builds. --- old/qtbase/src/tools/rcc/rcc.cpp +++ new/qtbase/src/tools/rcc/rcc.cpp -@@ -227,14 +227,7 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib) +@@ -229,14 +229,7 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib) if (lib.formatVersion() >= 2) { // last modified time stamp diff --git a/contrib/depends/patches/qt/root_CMakeLists.txt b/contrib/depends/patches/qt/root_CMakeLists.txt new file mode 100644 index 0000000..41247a6 --- /dev/null +++ b/contrib/depends/patches/qt/root_CMakeLists.txt @@ -0,0 +1,51 @@ +# The real minimum version will be checked by the qtbase project. +# 3.16 is the absolute minimum though. +cmake_minimum_required(VERSION 3.16...3.20) + +# Include qtbase's .cmake.conf for access to QT_REPO_MODULE_VERSION +set(__qt6_qtbase_src_path "${CMAKE_CURRENT_SOURCE_DIR}/qtbase") +include("${__qt6_qtbase_src_path}/.cmake.conf") + +# Run platform auto-detection /before/ the first project() call and thus +# before the toolchain file is loaded. +include("${__qt6_qtbase_src_path}/cmake/QtAutoDetect.cmake") + +project(Qt + VERSION "${QT_REPO_MODULE_VERSION}" + DESCRIPTION "Qt Libraries" + HOMEPAGE_URL "https://qt.io/" + LANGUAGES CXX C ASM +) + +# Required so we can call ctest from the root build directory +enable_testing() + +set(qt_module_prop_prefix "__qt_prop_") + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +list(APPEND CMAKE_MODULE_PATH "${__qt6_qtbase_src_path}/cmake") +list(APPEND CMAKE_MODULE_PATH + "${__qt6_qtbase_src_path}/cmake/3rdparty/extra-cmake-modules/find-modules") +list(APPEND CMAKE_MODULE_PATH "${__qt6_qtbase_src_path}/cmake/3rdparty/kwin") + +# Also make sure the CMake config files do not recreate the already-existing targets +set(QT_NO_CREATE_TARGETS TRUE) +set(QT_SUPERBUILD TRUE) + +set(QT_BUILD_SUBMODULES "qtbase;qttranslations;qtsvg;qtwebsockets;qtshadertools;qtmultimedia" CACHE STRING "Submodules to build") + +foreach(module IN LISTS QT_BUILD_SUBMODULES) + message(NOTICE "Configuring '${module}'") + add_subdirectory("${module}") + + if(module STREQUAL "qtbase") + list(APPEND CMAKE_PREFIX_PATH "${QtBase_BINARY_DIR}/lib/cmake") + list(APPEND CMAKE_FIND_ROOT_PATH "${QtBase_BINARY_DIR}") + endif() +endforeach() + +# Display a summary of everything +include(QtBuildInformation) +include(QtPlatformSupport) +qt_print_feature_summary() +qt_print_build_instructions() diff --git a/contrib/depends/patches/qt/use_android_ndk23.patch b/contrib/depends/patches/qt/use_android_ndk23.patch deleted file mode 100644 index f22367d..0000000 --- a/contrib/depends/patches/qt/use_android_ndk23.patch +++ /dev/null @@ -1,13 +0,0 @@ -Use Android NDK r23 LTS - ---- old/qtbase/mkspecs/features/android/default_pre.prf -+++ new/qtbase/mkspecs/features/android/default_pre.prf -@@ -76,7 +76,7 @@ else: equals(QT_ARCH, x86_64): CROSS_COMPILE = $$NDK_LLVM_PATH/bin/x86_64-linux- - else: equals(QT_ARCH, arm64-v8a): CROSS_COMPILE = $$NDK_LLVM_PATH/bin/aarch64-linux-android- - else: CROSS_COMPILE = $$NDK_LLVM_PATH/bin/arm-linux-androideabi- - --QMAKE_RANLIB = $${CROSS_COMPILE}ranlib -+QMAKE_RANLIB = $$NDK_LLVM_PATH/bin/llvm-ranlib - QMAKE_LINK_SHLIB = $$QMAKE_LINK - QMAKE_LFLAGS = - diff --git a/contrib/depends/patches/qt/windows_func_fix.patch b/contrib/depends/patches/qt/windows_func_fix.patch new file mode 100644 index 0000000..1ea952a --- /dev/null +++ b/contrib/depends/patches/qt/windows_func_fix.patch @@ -0,0 +1,48 @@ +From aaae4d700b339491d9c90d12f38ac26186980305 Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Tue, 15 Nov 2022 15:48:09 +0100 +Subject: [PATCH] Windows: don't use GetFileVersionInfoSize, + GetFileVersionInfo, VerQueryValue + +--- + src/corelib/kernel/qcoreapplication_win.cpp | 24 --------------------- + 1 file changed, 24 deletions(-) + +diff --git a/qtbase/src/corelib/kernel/qcoreapplication_win.cpp b/qtbase/src/corelib/kernel/qcoreapplication_win.cpp +index 0fe14af798..e46384a6a5 100644 +--- a/qtbase/src/corelib/kernel/qcoreapplication_win.cpp ++++ b/qtbase/src/corelib/kernel/qcoreapplication_win.cpp +@@ -60,30 +60,6 @@ QString QCoreApplicationPrivate::appName() const + QString QCoreApplicationPrivate::appVersion() const + { + QString applicationVersion; +-#ifndef QT_BOOTSTRAPPED +- const QString appFileName = qAppFileName(); +- QVarLengthArray buffer(appFileName.size() + 1); +- buffer[appFileName.toWCharArray(buffer.data())] = 0; +- +- DWORD versionInfoSize = GetFileVersionInfoSize(buffer.data(), nullptr); +- if (versionInfoSize) { +- QVarLengthArray info(static_cast(versionInfoSize)); +- if (GetFileVersionInfo(buffer.data(), 0, versionInfoSize, info.data())) { +- UINT size; +- DWORD *fi; +- +- if (VerQueryValue(info.data(), __TEXT("\\"), +- reinterpret_cast(&fi), &size) && size) { +- const VS_FIXEDFILEINFO *verInfo = reinterpret_cast(fi); +- applicationVersion = QStringLiteral("%1.%2.%3.%4") +- .arg(HIWORD(verInfo->dwProductVersionMS)) +- .arg(LOWORD(verInfo->dwProductVersionMS)) +- .arg(HIWORD(verInfo->dwProductVersionLS)) +- .arg(LOWORD(verInfo->dwProductVersionLS)); +- } +- } +- } +-#endif + return applicationVersion; + } + +-- +2.38.1 + diff --git a/contrib/depends/patches/sodium/ac.patch b/contrib/depends/patches/sodium/ac.patch new file mode 100644 index 0000000..8b48151 --- /dev/null +++ b/contrib/depends/patches/sodium/ac.patch @@ -0,0 +1,110 @@ +diff --git a/configure.ac b/configure.ac +index 9e2de27c..6b17c020 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -44,6 +44,10 @@ AS_IF([pwd | fgrep ' ' > /dev/null 2>&1], + [AC_MSG_ERROR([The build directory contains whitespaces - This can cause tests/installation to fail due to limitations of some libtool versions])] + ) + ++AC_PROG_CC_C99 ++AM_PROG_AS ++AC_USE_SYSTEM_EXTENSIONS ++ + dnl Switches + + AC_ARG_ENABLE(ssp, +@@ -210,17 +214,11 @@ AX_VALGRIND_CHECK + + dnl Checks + +-AC_PROG_CC_C99 +-AM_PROG_AS +-AC_USE_SYSTEM_EXTENSIONS + AC_C_VARARRAYS + + AC_CHECK_DEFINE([__wasi__], [WASI="yes"], []) + +-AC_CHECK_DEFINE([_FORTIFY_SOURCE], [], [ +- AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2], +- [CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"]) +-]) ++AS_CASE([$host_os], [linux-gnu], [AX_ADD_FORTIFY_SOURCE], [ ]) + + AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], + [CFLAGS="$CFLAGS -fvisibility=hidden"]) +@@ -343,9 +341,11 @@ AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wswitch-enum], [CWFLAGS="$CWFLAGS -Wswitch-enum + AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wvariable-decl], [CWFLAGS="$CWFLAGS -Wvariable-decl"]) + AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wwrite-strings], [CWFLAGS="$CWFLAGS -Wwrite-strings"]) + +-AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS="$LDFLAGS -Wl,-z,relro"]) +-AX_CHECK_LINK_FLAG([-Wl,-z,now], [LDFLAGS="$LDFLAGS -Wl,-z,now"]) +-AX_CHECK_LINK_FLAG([-Wl,-z,noexecstack], [LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"]) ++AS_IF([test "x$EMSCRIPTEN" = "x"], [ ++ AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS="$LDFLAGS -Wl,-z,relro"]) ++ AX_CHECK_LINK_FLAG([-Wl,-z,now], [LDFLAGS="$LDFLAGS -Wl,-z,now"]) ++ AX_CHECK_LINK_FLAG([-Wl,-z,noexecstack], [LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"]) ++]) + + AX_CHECK_CATCHABLE_SEGV + AX_CHECK_CATCHABLE_ABRT +@@ -362,10 +362,51 @@ AC_SUBST(LIBTOOL_DEPS) + AC_ARG_VAR([AR], [path to the ar utility]) + AC_CHECK_TOOL([AR], [ar], [ar]) + +-dnl Checks for headers ++dnl Checks for headers and codegen feature flags ++ ++target_cpu_aarch64=no ++AC_MSG_CHECKING(for ARM64 target) ++AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM([ ++#ifndef __aarch64__ ++#error Not aarch64 ++#endif ++#include ++ ], [(void) 0])], ++ [AC_MSG_RESULT(yes) ++ target_cpu_aarch64=yes], ++ [AC_MSG_RESULT(no) ++ target_cpu_aarch64=no]) + + AS_IF([test "x$EMSCRIPTEN" = "x"], [ + ++ AS_IF([test "x$target_cpu_aarch64" = "xyes"], [ ++ have_armcrypto=no ++ AC_MSG_CHECKING(for ARM crypto instructions set) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ vaeseq_u8(vmovq_n_u8(0), vmovq_n_u8(__ARM_FEATURE_CRYPTO)) ]])], ++ [ ++ AC_MSG_RESULT(yes) ++ have_armcrypto=yes ++ ], ++ [ ++ AC_MSG_RESULT(no) ++ oldcflags="$CFLAGS" ++ AX_CHECK_COMPILE_FLAG([-march=armv8-a+crypto], [ ++ CFLAGS="$CFLAGS -march=armv8-a+crypto" ++ AC_MSG_CHECKING(for ARM crypto instructions set with -march=armv8-a+crypto) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ vaeseq_u8(vmovq_n_u8(0), vmovq_n_u8(__ARM_FEATURE_CRYPTO)) ]])], ++ [ ++ AC_MSG_RESULT(yes) ++ have_armcrypto=yes ++ CFLAGS_ARMCRYPTO="-march=armv8-a+crypto" ++ ], ++ [AC_MSG_RESULT(no)]) ++ CFLAGS="$oldcflags" ++ ]) ++ ]) ++ AS_IF([test "$have_armcrypto" = "yes"],[AC_DEFINE([HAVE_ARMCRYPTO], [1], [ARM crypto extensions are available])]) ++ ]) ++ + oldcflags="$CFLAGS" + AX_CHECK_COMPILE_FLAG([-mmmx], [CFLAGS="$CFLAGS -mmmx"]) + AC_MSG_CHECKING(for MMX instructions set) +@@ -542,6 +583,7 @@ __m512i y = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7), + + ]) + ++AC_SUBST(CFLAGS_ARMCRYPTO) + AC_SUBST(CFLAGS_MMX) + AC_SUBST(CFLAGS_SSE2) + AC_SUBST(CFLAGS_SSE3) diff --git a/contrib/depends/patches/sodium/fix-arm64.patch b/contrib/depends/patches/sodium/fix-arm64.patch new file mode 100644 index 0000000..a5d739c --- /dev/null +++ b/contrib/depends/patches/sodium/fix-arm64.patch @@ -0,0 +1,25 @@ +From 13214d18c6ea1671dcff3dd62ccf88007b41f112 Mon Sep 17 00:00:00 2001 +From: Frank Denis +Date: Wed, 1 Jul 2020 15:33:52 +0200 +Subject: [PATCH] Recognize the arm + apple combo as aarch64 + +--- + configure.ac | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 05a51fa5..3993dbc1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -214,6 +214,8 @@ AX_VALGRIND_CHECK + + dnl Checks + ++AS_IF([test "$host_cpu" = "arm" && test "$host_vendor" = "apple"], [host_cpu=aarch64]) ++ + AC_C_VARARRAYS + + AC_CHECK_DEFINE([__wasi__], [WASI="yes"], []) +-- +2.38.1 + diff --git a/contrib/depends/patches/zeromq/06aba27b04c5822cb88a69677382a0f053367143.patch b/contrib/depends/patches/zeromq/06aba27b04c5822cb88a69677382a0f053367143.patch deleted file mode 100644 index 53e18a4..0000000 --- a/contrib/depends/patches/zeromq/06aba27b04c5822cb88a69677382a0f053367143.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 06aba27b04c5822cb88a69677382a0f053367143 Mon Sep 17 00:00:00 2001 -From: sabotagebeats <27985126+sabotagebeats@users.noreply.github.com> -Date: Thu, 22 Jul 2021 21:53:19 -0700 -Subject: [PATCH] fix: building libzmq fails with error src/clock.cpp:131:16: - error: unused variable 'nsecs_per_usec' - ---- - src/clock.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/clock.cpp b/src/clock.cpp -index 93da90a8e..63c0100a5 100644 ---- a/src/clock.cpp -+++ b/src/clock.cpp -@@ -195,6 +195,7 @@ uint64_t zmq::clock_t::now_us () - - #else - -+ LIBZMQ_UNUSED (nsecs_per_usec); - // Use POSIX gettimeofday function to get precise time. - struct timeval tv; - int rc = gettimeofday (&tv, NULL); diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index 1bab5cd..7c5eaff 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -19,9 +19,9 @@ SET(CMAKE_FIND_ROOT_PATH @prefix@ /usr /gnu/store /feather/contrib/depends/SDKs/ SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig) -# TODO: This is hacky, find a way to obtain to obtain the version from the depends package -SET(TOR_DIR @prefix@/Tor) -SET(TOR_VERSION 0.4.7.7) +# use CACHE here because we need to be able to override these later +SET(TOR_DIR @prefix@/Tor CACHE STRING "Tor dir") +SET(TOR_VERSION @tor_version@ CACHE STRING "Tor version") SET(Readline_ROOT_DIR @prefix@) SET(Readline_INCLUDE_DIR @prefix@/include) @@ -94,8 +94,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") SET(CMAKE_CXX_COMPILER @CXX@ -stdlib=libc++ ) SET(CMAKE_CXX_COMPILER_TARGET ${CLANG_TARGET}) SET(CMAKE_CXX_FLAGS_INIT -B${_CMAKE_TOOLCHAIN_PREFIX}) - SET(CMAKE_ASM_COMPILER /home/user/.guix-profile/bin/clang) - SET(CMAKE_ASM-ATT_COMPILER /home/user/.guix-profile/bin/as) + SET(CMAKE_ASM_COMPILER clang) + SET(CMAKE_ASM-ATT_COMPILER as) SET(CMAKE_ASM_COMPILER_TARGET ${CLANG_TARGET}) SET(CMAKE_ASM-ATT_COMPILER_TARGET ${CLANG_TARGET}) SET(APPLE True) @@ -180,3 +180,16 @@ endif() #Create a new global cmake flag that indicates building with depends set (DEPENDS true) + +set(CMAKE_EXE_LINKER_FLAGS_INIT "@guix_ldflags@") + +if(DEFINED ENV{PYTHONPATH}) + set(PYTHONPATH "@prefix@/native/lib/python3/dist-packages:$ENV{PYTHONPATH}") +else() + set(PYTHONPATH "@prefix@/native/lib/python3/dist-packages") +endif() + +set(CMAKE_INSTALL_NAME_TOOL "@CMAKE_INSTALL_NAME_TOOL@" CACHE FILEPATH "") +set(CMAKE_INSTALL_NAME_TOOL "@CMAKE_INSTALL_NAME_TOOL@") + +set(OTOOL "@OTOOL@") \ No newline at end of file diff --git a/contrib/guix/README.md b/contrib/guix/README.md index 2e30650..b0babbe 100644 --- a/contrib/guix/README.md +++ b/contrib/guix/README.md @@ -1,8 +1,5 @@ # Bootstrappable Feather Wallet Builds -Significant portions of the code in this folder were copied from -[Bitcoin Core](https://github.com/bitcoin/bitcoin/tree/master/contrib/guix). - This directory contains the files necessary to perform bootstrappable Feather Wallet builds. @@ -313,12 +310,6 @@ Where `` is likely: - `/usr/local` if you installed Guix from source and didn't supply any prefix-modifying flags to Guix's `./configure` -For dongcarl's substitute server at https://guix.carldong.io, run as root: - -```sh -wget -qO- 'https://guix.carldong.io/signing-key.pub' | guix archive --authorize -``` - #### Removing authorized keys To remove previously authorized keys, simply edit `/etc/guix/acl` and remove the @@ -329,30 +320,7 @@ To remove previously authorized keys, simply edit `/etc/guix/acl` and remove the Once its key is authorized, the official Guix build farm at https://ci.guix.gnu.org is automatically used unless the `--no-substitutes` flag is supplied. This default list of substitute servers is overridable both on a -`guix-daemon` level and when you invoke `guix` commands. See examples below for -the various ways of adding dongcarl's substitute server after having [authorized -his signing key](#authorize-the-signing-keys). - -Change the **default list** of substitute servers by starting `guix-daemon` with -the `--substitute-urls` option (you will likely need to edit your init script): - -```sh -guix-daemon --substitute-urls='https://guix.carldong.io https://ci.guix.gnu.org' -``` - -Override the default list of substitute servers by passing the -`--substitute-urls` option for invocations of `guix` commands: - -```sh -guix --substitute-urls='https://guix.carldong.io https://ci.guix.gnu.org' -``` - -For scripts under `./contrib/guix`, set the `SUBSTITUTE_URLS` environment -variable: - -```sh -export SUBSTITUTE_URLS='https://guix.carldong.io https://ci.guix.gnu.org' -``` +`guix-daemon` level and when you invoke `guix` commands. ## Option 2: Disabling substitutes on an ad-hoc basis diff --git a/contrib/guix/guix-build b/contrib/guix/guix-build index e87914d..ebd380f 100755 --- a/contrib/guix/guix-build +++ b/contrib/guix/guix-build @@ -10,10 +10,6 @@ set -e -o pipefail source "$(dirname "${BASH_SOURCE[0]}")/libexec/prelude.bash" -################### -## SANITY CHECKS ## -################### - ################ # Required non-builtin commands should be invocable ################ @@ -74,7 +70,7 @@ mkdir -p "$VERSION_BASE" ################ # Default to building for all supported HOSTs (overridable by environment) -export HOSTS="${HOSTS:-x86_64-linux-gnu x86_64-w64-mingw32 x86_64-apple-darwin}" +export HOSTS="${HOSTS:-x86_64-linux-gnu x86_64-linux-gnu.tails x86_64-w64-mingw32 x86_64-w64-mingw32.installer x86_64-apple-darwin}" # Usage: distsrc_for_host HOST # @@ -293,7 +289,8 @@ mkdir -p "$OUTDIR_BASE" # Download the depends sources now as we won't have internet access in the build # container for host in $HOSTS; do - make -C "${PWD}/contrib/depends" -j"$JOBS" download-"$(host_to_commonname "$host")" ${V:+V=1} ${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"} + host_split=(${host//./ }) + make -C "${PWD}/contrib/depends" -j"$JOBS" download-"$(host_to_commonname "${host_split[0]}")" ${V:+V=1} ${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"} done # Usage: outdir_for_host HOST SUFFIX @@ -343,9 +340,11 @@ for host in $HOSTS; do trap 'int_trap ${host}' INT ( + host_split=(${host//./ }) + # Required for 'contrib/guix/manifest.scm' to output the right manifest # for the particular $HOST we're building for - export HOST="$host" + export HOST="${host_split[0]}" # shellcheck disable=SC2030 cat << EOF @@ -444,7 +443,7 @@ EOF --root="$(profiledir_for_host "${HOST}")" \ ${SUBSTITUTE_URLS:+--substitute-urls="$SUBSTITUTE_URLS"} \ ${ADDITIONAL_GUIX_COMMON_FLAGS} ${ADDITIONAL_GUIX_ENVIRONMENT_FLAGS} \ - -- env HOST="$host" \ + -- env HOST="$HOST" \ DISTNAME="$DISTNAME" \ JOBS="$JOBS" \ SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:?unable to determine value}" \ @@ -452,9 +451,10 @@ EOF ${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"} \ ${BASE_CACHE:+BASE_CACHE="$BASE_CACHE"} \ ${SDK_PATH:+SDK_PATH="$SDK_PATH"} \ - DISTSRC="$(DISTSRC_BASE=/distsrc-base && distsrc_for_host "$HOST")" \ - OUTDIR="$(OUTDIR_BASE=/outdir-base && outdir_for_host "$HOST")" \ + DISTSRC="$(DISTSRC_BASE=/distsrc-base && distsrc_for_host "$host")" \ + OUTDIR="$(OUTDIR_BASE=/outdir-base && outdir_for_host "$host")" \ DIST_ARCHIVE_BASE=/outdir-base/dist-archive \ + OPTIONS="${host_split[1]}" \ bash -c "cd /feather && bash contrib/guix/libexec/build.sh" ) diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index b37076c..d41dec7 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -35,6 +35,7 @@ Required environment variables as seen inside the container: JOBS: ${JOBS:?not set} DISTSRC: ${DISTSRC:?not set} OUTDIR: ${OUTDIR:?not set} + OPTIONS: ${OPTIONS} EOF ACTUAL_OUTDIR="${OUTDIR}" @@ -185,6 +186,19 @@ esac # Depends Building # #################### +# LDFLAGS +case "$HOST" in + *linux*) HOST_LDFLAGS="-Wl,--as-needed -Wl,--dynamic-linker=$glibc_dynamic_linker -static-libstdc++ -Wl,-O2" ;; + *mingw*) HOST_LDFLAGS="-Wl,--no-insert-timestamp" ;; +esac + +# Using --no-tls-get-addr-optimize retains compatibility with glibc 2.18, by +# avoiding a PowerPC64 optimisation available in glibc 2.22 and later. +# https://sourceware.org/binutils/docs-2.35/ld/PowerPC64-ELF64.html +case "$HOST" in + *powerpc64*) HOST_LDFLAGS="${HOST_LDFLAGS} -Wl,--no-tls-get-addr-optimize" ;; +esac + # Build the depends tree, overriding variables that assume multilib gcc make -C contrib/depends --jobs="$JOBS" HOST="$HOST" \ ${V:+V=1} \ @@ -197,8 +211,9 @@ make -C contrib/depends --jobs="$JOBS" HOST="$HOST" \ x86_64_linux_RANLIB=x86_64-linux-gnu-ranlib \ x86_64_linux_NM=x86_64-linux-gnu-nm \ x86_64_linux_STRIP=x86_64-linux-gnu-strip \ + FORCE_USE_SYSTEM_CLANG=1 \ qt_config_opts_x86_64_linux='-platform linux-g++ -xplatform bitcoin-linux-g++' \ - FORCE_USE_SYSTEM_CLANG=1 + guix_ldflags="$HOST_LDFLAGS" ########################### @@ -219,11 +234,9 @@ mkdir -p "$OUTDIR" # Binary Tarball Building # ########################### -# CONFIGFLAGS -CONFIGFLAGS="--enable-reduce-exports --disable-bench --disable-gui-tests --disable-fuzz-binary" - # CFLAGS HOST_CFLAGS="-O2 -g" +HOST_CFLAGS+=$(find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;) case "$HOST" in *linux*) HOST_CFLAGS+=" -ffile-prefix-map=${PWD}=." ;; *mingw*) HOST_CFLAGS+=" -fno-ident" ;; @@ -237,25 +250,8 @@ case "$HOST" in arm-linux-gnueabihf) HOST_CXXFLAGS="${HOST_CXXFLAGS} -Wno-psabi" ;; esac -# LDFLAGS -case "$HOST" in - *linux*) HOST_LDFLAGS="-Wl,--as-needed -Wl,--dynamic-linker=$glibc_dynamic_linker -static-libstdc++ -Wl,-O2" ;; - *mingw*) HOST_LDFLAGS="-Wl,--no-insert-timestamp" ;; -esac - -# Using --no-tls-get-addr-optimize retains compatibility with glibc 2.18, by -# avoiding a PowerPC64 optimisation available in glibc 2.22 and later. -# https://sourceware.org/binutils/docs-2.35/ld/PowerPC64-ELF64.html -case "$HOST" in - *powerpc64*) HOST_LDFLAGS="${HOST_LDFLAGS} -Wl,--no-tls-get-addr-optimize" ;; -esac - -case "$HOST" in - powerpc64-linux-*|riscv64-linux-*) HOST_LDFLAGS="${HOST_LDFLAGS} -Wl,-z,noexecstack" ;; -esac - # Make $HOST-specific native binaries from depends available in $PATH -export PATH="${BASEPREFIX}/${HOST}/native/bin:/gnu/store:${PATH}" +export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}" mkdir -p "$DISTSRC" ( cd "$DISTSRC" @@ -263,33 +259,144 @@ mkdir -p "$DISTSRC" # Extract the source tarball tar --strip-components=1 -xf "${GIT_ARCHIVE}" - # Build Feather Wallet - make --jobs="$JOBS" guix target=$HOST + # Setup the directory where our Bitcoin Core build for HOST will be + # installed. This directory will also later serve as the input for our + # binary tarballs. + INSTALLPATH="${DISTSRC}/installed" + mkdir -p "${INSTALLPATH}" + + + # Set appropriate CMake options for build type + CMAKEVARS="-DWITH_SCANNER=On" + case "$HOST" in + *mingw32) + case "$OPTIONS" in + installer) + CMAKEVARS+=" -DPLATFORM_INSTALLER=On -DTOR_DIR=Off -DTOR_VERSION=Off" + ;; + esac + ;; + *linux*) + case "$OPTIONS" in + tails) + CMAKEVARS+=" -DTOR_DIR=Off -DTOR_VERSION=Off" + ;; + esac + ;; + esac + + # Configure this DISTSRC for $HOST + # shellcheck disable=SC2086 + env CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" \ + cmake --toolchain "${BASEPREFIX}/${HOST}/share/toolchain.cmake" -S . -B build \ + -DCMAKE_INSTALL_PREFIX="${INSTALLPATH}" \ + -DCCACHE=OFF \ + ${CONFIGFLAGS} \ + -DCMAKE_EXE_LINKER_FLAGS="${HOST_LDFLAGS}" \ + -DCMAKE_SHARED_LINKER_FLAGS="${HOST_LDFLAGS}" \ + ${CMAKEVARS} + + make -C build --jobs="$JOBS" + + case "$HOST" in + *linux*) + bash contrib/AppImage/build-appimage.sh + mv feather.AppImage ${DISTNAME}.AppImage + cp ${DISTNAME}.AppImage "${INSTALLPATH}/" + cp ${DISTNAME}.AppImage "${OUTDIR}/" + ;; + esac mkdir -p "$OUTDIR" - # Setup the directory where our Feather Wallet build for HOST will be - # installed. This directory will also later serve as the input for our - # binary tarballs. - INSTALLPATH="${PWD}/installed/${DISTNAME}" - mkdir -p "${INSTALLPATH}" - # Install built Feather Wallet to $INSTALLPATH + # Make the os-specific installers + case "$HOST" in + *mingw*) + case "$OPTIONS" in + installer) + makensis -DCUR_PATH=$PWD -V2 contrib/installers/windows/setup.nsi + cp contrib/installers/windows/FeatherWalletSetup-*.exe "${INSTALLPATH}/" + mv contrib/installers/windows/FeatherWalletSetup-*.exe "${OUTDIR}/" + ;; + esac + ;; + esac + # Install built Feather to $INSTALLPATH + case "$HOST" in + *darwin*) + make -C build install/strip ${V:+V=1} + ;; + *) + make -C build install ${V:+V=1} + ;; + esac - cp -a build/ "$ACTUAL_OUTDIR" + # Make macOS DMG + case "$HOST" in + *darwin*) + make -C build deploy ${V:+V=1} + mv build/feather.dmg "${OUTDIR}/${DISTNAME}.dmg" + ;; + esac + + ( + cd installed + + # Finally, deterministically produce {non-,}debug binary tarballs ready + # for release + case "$HOST" in + *mingw*) + case "$OPTIONS" in + installer) + find . -print0 \ + | xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}" + find . \ + | sort \ + | zip -X@ "${OUTDIR}/${DISTNAME}-win-installer.zip" \ + || ( rm -f "${OUTDIR}/${DISTNAME}-win-installer.zip" && exit 1 ) + ;; + "") + mv feather.exe ${DISTNAME}.exe && \ + find . -print0 \ + | xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}" + find . \ + | sort \ + | zip -X@ "${OUTDIR}/${DISTNAME}-win.zip" \ + || ( rm -f "${OUTDIR}/${DISTNAME}-win.zip" && exit 1 ) + ;; + esac + ;; + *linux*) + find . -not -name "*.AppImage" -print0 \ + | xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}" + find . -not -name "*.AppImage" \ + | sort \ + | zip -X@ "${OUTDIR}/${DISTNAME}-linux.zip" \ + || ( rm -f "${OUTDIR}/${DISTNAME}-linux.zip" && exit 1 ) + find . -name "*.AppImage" -print0 \ + | xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}" + find . -name "*.AppImage" \ + | sort \ + | zip -X@ "${OUTDIR}/${DISTNAME}-linux-appimage.zip" \ + || ( rm -f "${OUTDIR}/${DISTNAME}-linux-appimage.zip" && exit 1 ) + ;; + esac + + ) ) # $DISTSRC -#rm -rf "$ACTUAL_OUTDIR" -#mv --no-target-directory "$OUTDIR" "$ACTUAL_OUTDIR" \ -# || ( rm -rf "$ACTUAL_OUTDIR" && exit 1 ) -# -#( -# cd /outdir-base -# { -# echo "$GIT_ARCHIVE" -# find "$ACTUAL_OUTDIR" -type f -# } | xargs realpath --relative-base="$PWD" \ -# | xargs sha256sum \ -# | sort -k2 \ -# | sponge "$ACTUAL_OUTDIR"/SHA256SUMS.part -#) +rm -rf "$ACTUAL_OUTDIR" +mv --no-target-directory "$OUTDIR" "$ACTUAL_OUTDIR" \ + || ( rm -rf "$ACTUAL_OUTDIR" && exit 1 ) + +( + cd /outdir-base + { + echo "$GIT_ARCHIVE" + find "$ACTUAL_OUTDIR" -type f + } | xargs realpath --relative-base="$PWD" \ + | xargs sha256sum \ + | sort -k2 \ + | sponge "$ACTUAL_OUTDIR"/SHA256SUMS.part +) diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash index 10662ca..07b2bc7 100644 --- a/contrib/guix/libexec/prelude.bash +++ b/contrib/guix/libexec/prelude.bash @@ -68,7 +68,8 @@ time-machine() { VERSION="${FORCE_VERSION:-$(git_head_version)}" DISTNAME="${DISTNAME:-feather-${VERSION}}" -version_base_prefix="${PWD}/guix-build-" +VERSION_BASE_DIR="${VERSION_BASE_DIR:-${PWD}}" +version_base_prefix="${VERSION_BASE_DIR}/guix-build-" VERSION_BASE="${version_base_prefix}${VERSION}" # TOP DISTSRC_BASE="${DISTSRC_BASE:-${VERSION_BASE}}" diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 9ef1ba9..e1e61f9 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -1,6 +1,7 @@ (use-modules (gnu) (gnu packages) (gnu packages autotools) + (gnu packages assembly) (gnu packages base) (gnu packages bash) (gnu packages bison) @@ -12,6 +13,7 @@ (gnu packages compression) (gnu packages cross-base) (gnu packages curl) + (gnu packages elf) (gnu packages file) (gnu packages gawk) (gnu packages gcc) @@ -31,6 +33,7 @@ (gnu packages shells) (gnu packages tls) (gnu packages version-control) + (gnu packages qt) (guix build-system gnu) (guix build-system python) (guix build-system trivial) @@ -63,6 +66,26 @@ FILE-NAME found in ./patches relative to the current file." ; ((#:make-flags flags) ; `(cons "gcc_cv_libc_provides_ssp=yes" ,flags)))))) +(define-public mingw-w64-x86_64-winpthreads-10.0.0 + (package (inherit mingw-w64-x86_64-winpthreads) + (name "mingw-w64-x86_64-winpthreads-10.0.0") + (version "10.0.0") + (source + (origin + (method url-fetch) + (uri (string-append + "mirror://sourceforge/mingw-w64/mingw-w64/" + "mingw-w64-release/mingw-w64-v" version ".tar.bz2")) + (sha256 + (base32 "15089y4rlj6g1m2m3cm3awndw3rbzhznl7skd0vkmikjxl546sxs")) + (patches + (search-patches "mingw-w64-6.0.0-gcc.patch" + "mingw-w64-dlltool-temp-prefix.patch" + "mingw-w64-reproducible-gendef.patch")))) + (arguments + (substitute-keyword-arguments (package-arguments mingw-w64-x86_64-winpthreads) + ((#:parallel-build? _ #f) #f))))) + (define (make-gcc-rpath-link xgcc) "Given a XGCC package, return a modified package that replace each instance of -rpath in the default system spec that's inserted by Guix with -rpath-link" @@ -156,7 +179,10 @@ desirable for building Feather Wallet release binaries." base-gcc)) (define (make-gcc-with-pthreads gcc) - (package-with-extra-configure-variable gcc "--enable-threads" "posix")) + (package-with-extra-configure-variable + (package-with-extra-patches gcc + (search-our-patches "gcc-10-remap-guix-store.patch")) + "--enable-threads" "posix")) (define (make-mingw-w64-cross-gcc cross-gcc) (package-with-extra-patches cross-gcc @@ -166,7 +192,7 @@ desirable for building Feather Wallet release binaries." (define (make-mingw-pthreads-cross-toolchain target) "Create a cross-compilation toolchain package for TARGET" (let* ((xbinutils (cross-binutils target)) - (pthreads-xlibc mingw-w64-x86_64-winpthreads) + (pthreads-xlibc mingw-w64-x86_64-winpthreads-10.0.0) (pthreads-xgcc (make-gcc-with-pthreads (cross-gcc target #:xgcc (make-mingw-w64-cross-gcc base-gcc) @@ -193,12 +219,17 @@ chain for " target " development.")) (define (make-nsis-for-gcc-10 base-nsis) (package-with-extra-patches base-nsis - (search-our-patches "nsis-gcc-10-memmove.patch"))) + (search-our-patches "nsis-gcc-10-memmove.patch" + "nsis-disable-installer-reloc.patch"))) + +(define (fix-ppc64-nx-default lief) + (package-with-extra-patches lief + (search-our-patches "lief-fix-ppc64-nx-default.patch"))) (define-public lief (package (name "python-lief") - (version "0.12.0") + (version "0.12.1") (source (origin (method git-fetch) @@ -208,8 +239,15 @@ chain for " target " development.")) (file-name (git-file-name name version)) (sha256 (base32 - "026jchj56q25v6gc0754dj9cj5hz5zaza8ij93y5ga94w20kzm9q")))) + "1xzbh3bxy4rw1yamnx68da1v5s56ay4g081cyamv67256g0qy2i1")))) (build-system python-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'parallel-jobs + ;; build with multiple cores + (lambda _ + (substitute* "setup.py" (("self.parallel if self.parallel else 1") (number->string (parallel-job-count))))))))) (native-inputs `(("cmake" ,cmake))) (home-page "https://github.com/lief-project/LIEF") @@ -251,7 +289,7 @@ thus should be able to compile on most platforms where these exist.") (license license:gpl3+))) ; license is with openssl exception (define-public python-elfesteem - (let ((commit "87bbd79ab7e361004c98cc8601d4e5f029fd8bd5")) + (let ((commit "2eb1e5384ff7a220fd1afacd4a0170acff54fe56")) (package (name "python-elfesteem") (version (git-version "0.1" "1" commit)) @@ -264,8 +302,7 @@ thus should be able to compile on most platforms where these exist.") (file-name (git-file-name name commit)) (sha256 (base32 - "1nyvjisvyxyxnd0023xjf5846xd03lwawp5pfzr8vrky7wwm5maz")) - (patches (search-our-patches "elfsteem-value-error-python-39.patch")))) + "07x6p8clh11z8s1n2kdxrqwqm2almgc5qpkcr9ckb6y5ivjdr5r6")))) (build-system python-build-system) ;; There are no tests, but attempting to run python setup.py test leads to ;; PYTHONPATH problems, just disable the test @@ -400,9 +437,9 @@ thus should be able to compile on most platforms where these exist.") line))) (substitute* "tests/test_validate.py" (("^(.*)def test_revocation_mode_soft" line indent) - (string-append indent - "@unittest.skip(\"Disabled by Guix\")\n" - line))) + (string-append indent + "@unittest.skip(\"Disabled by Guix\")\n" + line))) #t)) (replace 'check (lambda _ @@ -564,7 +601,8 @@ inspecting signatures in Mach-O binaries.") "glibc-versioned-locpath.patch" "glibc-2.24-elfm-loadaddr-dynamic-rewrite.patch" "glibc-2.24-no-build-time-cxx-header-run.patch" - "glibc-2.24-fcommon.patch")))))) + "glibc-2.24-fcommon.patch" + "glibc-2.24-guix-prefix.patch")))))) (define-public glibc-2.27/bitcoin-patched (package @@ -581,7 +619,47 @@ inspecting signatures in Mach-O binaries.") "1b2n1gxv9f4fd5yy68qjbnarhf8mf4vmlxk10i3328c1w5pmp0ca")) (patches (search-our-patches "glibc-ldd-x86_64.patch" "glibc-2.27-riscv64-Use-__has_include-to-include-asm-syscalls.h.patch" - "glibc-2.27-dont-redefine-nss-database.patch")))))) + "glibc-2.27-dont-redefine-nss-database.patch" + "glibc-2.27-guix-prefix.patch")))))) + +(define-public linuxdeployqt + (package + (name "linuxdeployqt") + (version "b4697483c98120007019c3456914cfd1dba58384") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/probonopd/linuxdeployqt") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0zp1c5pya39g5nwkly1ix58svj08lfsfmv530jyf2ya7m4vvkhfs")))) + (build-system gnu-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (replace 'configure + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (invoke "qmake" + (string-append "PREFIX=" out) + "linuxdeployqt.pro")))) + (replace 'install + ;; Messes up for some reason. + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (install-file "bin/linuxdeployqt" bin) + #t)))))) + (native-inputs (list qtbase-5)) + (home-page "https://github.com/probonopd/linuxdeployqt") + (synopsis "Linux deploy tool") + (description "Makes Linux applications self-contained by copying in the libraries + and plugins that the application uses, and optionally generates an AppImage. + Can be used for Qt and other applications ") + (license license:gpl3+))) (packages->manifest (append @@ -600,12 +678,15 @@ inspecting signatures in Mach-O binaries.") gawk sed moreutils + patchelf ;; Compression and archiving tar bzip2 gzip xz p7zip + zip + unzip ;; Build tools gnu-make libtool @@ -615,6 +696,8 @@ inspecting signatures in Mach-O binaries.") bison gperf gettext-minimal + squashfs-tools + linuxdeployqt ;; Native GCC 10 toolchain gcc-toolchain-10 (list gcc-toolchain-10 "static") @@ -625,13 +708,12 @@ inspecting signatures in Mach-O binaries.") git python-git-archive-all ;; Tests - lief) + lief + ) (let ((target (getenv "HOST"))) (cond ((string-suffix? "-mingw32" target) ;; Windows - (list zip - unzip - (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32") + (list (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32") (make-nsis-for-gcc-10 nsis-x86_64) osslsigncode)) ((string-contains target "-linux-") diff --git a/contrib/guix/patches/elfsteem-value-error-python-39.patch b/contrib/guix/patches/elfsteem-value-error-python-39.patch deleted file mode 100644 index 21e1228..0000000 --- a/contrib/guix/patches/elfsteem-value-error-python-39.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/examples/otool.py b/examples/otool.py -index 2b8efc0..d797b2e 100755 ---- a/examples/otool.py -+++ b/examples/otool.py -@@ -342,7 +342,7 @@ if __name__ == '__main__': - try: - e = macho_init.MACHO(raw, - parseSymbols = False) -- except ValueError, err: -+ except ValueError as err: - print("%s:" %file) - print(" %s" % err) - continue diff --git a/contrib/guix/patches/gcc-10-remap-guix-store.patch b/contrib/guix/patches/gcc-10-remap-guix-store.patch new file mode 100644 index 0000000..a47ef7a --- /dev/null +++ b/contrib/guix/patches/gcc-10-remap-guix-store.patch @@ -0,0 +1,25 @@ +From aad25427e74f387412e8bc9a9d7bbc6c496c792f Mon Sep 17 00:00:00 2001 +From: Andrew Chow +Date: Wed, 6 Jul 2022 16:49:41 -0400 +Subject: [PATCH] guix: remap guix store paths to /usr + +--- + libgcc/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in +index 851e7657d07..476c2becd1c 100644 +--- a/libgcc/Makefile.in ++++ b/libgcc/Makefile.in +@@ -854,7 +854,7 @@ endif + # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and + # LIB2ADDEHSHARED matter. (Usually all three are identical.) + +-c_flags := -fexceptions ++c_flags := -fexceptions $(shell find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;) + + ifeq ($(enable_shared),yes) + +-- +2.37.0 + diff --git a/contrib/guix/patches/glibc-2.24-guix-prefix.patch b/contrib/guix/patches/glibc-2.24-guix-prefix.patch new file mode 100644 index 0000000..875e8cd --- /dev/null +++ b/contrib/guix/patches/glibc-2.24-guix-prefix.patch @@ -0,0 +1,25 @@ +Without ffile-prefix-map, the debug symbols will contain paths for the +guix store which will include the hashes of each package. However, the +hash for the same package will differ when on different architectures. +In order to be reproducible regardless of the architecture used to build +the package, map all guix store prefixes to something fixed, e.g. /usr. + +We might be able to drop this in favour of using --with-nonshared-cflags +when we being using newer versions of glibc. + +--- a/Makeconfig ++++ b/Makeconfig +@@ -950,6 +950,10 @@ object-suffixes-for-libc += .oS + # shared objects. We don't want to use CFLAGS-os because users may, for + # example, make that processor-specific. + CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) ++ ++# Map Guix store paths to /usr ++CFLAGS-.oS += `find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;` ++ + CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 + libtype.oS = lib%_nonshared.a + endif +-- +2.35.1 + diff --git a/contrib/guix/patches/glibc-2.27-guix-prefix.patch b/contrib/guix/patches/glibc-2.27-guix-prefix.patch new file mode 100644 index 0000000..d777af7 --- /dev/null +++ b/contrib/guix/patches/glibc-2.27-guix-prefix.patch @@ -0,0 +1,25 @@ +Without ffile-prefix-map, the debug symbols will contain paths for the +guix store which will include the hashes of each package. However, the +hash for the same package will differ when on different architectures. +In order to be reproducible regardless of the architecture used to build +the package, map all guix store prefixes to something fixed, e.g. /usr. + +We might be able to drop this in favour of using --with-nonshared-cflags +when we being using newer versions of glibc. + +--- a/Makeconfig ++++ b/Makeconfig +@@ -992,6 +992,10 @@ object-suffixes := + CPPFLAGS-.o = $(pic-default) + # libc.a must be compiled with -fPIE/-fpie for static PIE. + CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) $(pie-default) ++ ++# Map Guix store paths to /usr ++CFLAGS-.o += `find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;` ++ + libtype.o := lib%.a + object-suffixes += .o + ifeq (yes,$(build-shared)) +-- +2.35.1 + diff --git a/contrib/guix/patches/lief-fix-ppc64-nx-default.patch b/contrib/guix/patches/lief-fix-ppc64-nx-default.patch new file mode 100644 index 0000000..101bc1d --- /dev/null +++ b/contrib/guix/patches/lief-fix-ppc64-nx-default.patch @@ -0,0 +1,29 @@ +Correct default for Binary::has_nx on ppc64 + +From the Linux kernel source: + + * This is the default if a program doesn't have a PT_GNU_STACK + * program header entry. The PPC64 ELF ABI has a non executable stack + * stack by default, so in the absence of a PT_GNU_STACK program header + * we turn execute permission off. + +This patch can be dropped the next time we update LIEF. + +diff --git a/src/ELF/Binary.cpp b/src/ELF/Binary.cpp +index a90be1ab..fd2d9764 100644 +--- a/src/ELF/Binary.cpp ++++ b/src/ELF/Binary.cpp +@@ -1084,7 +1084,12 @@ bool Binary::has_nx() const { + return segment->type() == SEGMENT_TYPES::PT_GNU_STACK; + }); + if (it_stack == std::end(segments_)) { +- return false; ++ if (header().machine_type() == ARCH::EM_PPC64) { ++ // The PPC64 ELF ABI has a non-executable stack by default. ++ return true; ++ } else { ++ return false; ++ } + } + + return !(*it_stack)->has(ELF_SEGMENT_FLAGS::PF_X); diff --git a/contrib/guix/patches/nsis-disable-installer-reloc.patch b/contrib/guix/patches/nsis-disable-installer-reloc.patch new file mode 100644 index 0000000..4914527 --- /dev/null +++ b/contrib/guix/patches/nsis-disable-installer-reloc.patch @@ -0,0 +1,30 @@ +Patch NSIS so that it's installer stubs, produced at NSIS build time, +do not contain .reloc sections, which will exist by default when using +binutils/ld 2.36+. + +This ultimately fixes an issue when running the installer with the +"Force randomization for images (Mandatory ASLR)" setting active. + +This patch has not yet been sent upstream, because it's not clear if this +is the best fix, for the underlying issue, which seems to be that makensis +doesn't account for .reloc sections when it builds installers. + +The existence of a reloc section shouldn't be a problem, and, if anything, +is actually a requirement for working ASLR. All other Windows binaries we +produce contain them, and function correctly when under the same +"Force randomization for images (Mandatory ASLR)" setting. + +See: +https://github.com/bitcoin/bitcoin/issues/25726 +https://sourceforge.net/p/nsis/bugs/1131/ + +--- a/SCons/Config/gnu ++++ b/SCons/Config/gnu +@@ -102,6 +102,7 @@ stub_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables + stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries + stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align + stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file ++stub_env.Append(LINKFLAGS = ['-Wl,--disable-reloc-section']) + + conf = FlagsConfigure(stub_env) + conf.CheckCompileFlag('-fno-tree-loop-distribute-patterns') # GCC 10: Don't generate msvcrt!memmove calls (bug #1248) diff --git a/contrib/installers/windows/setup.nsi.in b/contrib/installers/windows/setup.nsi.in new file mode 100644 index 0000000..15f7a21 --- /dev/null +++ b/contrib/installers/windows/setup.nsi.in @@ -0,0 +1,121 @@ +Name "Feather Wallet" + +OutFile "${CUR_PATH}\contrib\installers\windows\FeatherWalletSetup-@PROJECT_VERSION@.exe" +RequestExecutionLevel highest +SetCompressor /SOLID lzma +SetDateSave off +Unicode true + +# Uncomment these lines when investigating reproducibility errors +#SetCompress off +#SetDatablockOptimize off + +# MUI Symbol Definitions +!define MUI_ICON "${CUR_PATH}\contrib\installers\windows\appicon.ico" +!define MUI_FINISHPAGE_NOAUTOCLOSE +!define MUI_STARTMENUPAGE_DEFAULTFOLDER "$(^Name)" +!define MUI_FINISHPAGE_RUN "$WINDIR\explorer.exe" +!define MUI_FINISHPAGE_RUN_PARAMETERS $INSTDIR\feather.exe +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" +!define MUI_UNFINISHPAGE_NOAUTOCLOSE + +# Included files +!include Sections.nsh +!include MUI2.nsh +!include x64.nsh + +# Variables +Var StartMenuGroup + +# Installer pages +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +# Installer languages +!insertmacro MUI_LANGUAGE English + +# Installer attributes +InstallDir "$PROGRAMFILES64\Feather Wallet" +CRCCheck force +XPStyle on +BrandingText " " +ShowInstDetails show +VIProductVersion @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.0 +VIAddVersionKey ProductName "$(^Name)" +VIAddVersionKey ProductVersion "@PROJECT_VERSION@" +VIAddVersionKey CompanyName "Feather Wallet" +VIAddVersionKey CompanyWebsite "https://featherwallet.org" +VIAddVersionKey FileVersion "@PROJECT_VERSION@" +VIAddVersionKey FileDescription "Installer for $(^Name)" +VIAddVersionKey LegalCopyright "Copyright (C) 2020-@COPYRIGHT_YEAR@ @COPYRIGHT_HOLDERS@" +ShowUninstDetails show + +# Installer sections +Section -Main SEC0000 + SetOutPath $INSTDIR + SetOverwrite on + File "${CUR_PATH}\build\bin\feather.exe" + File /oname=LICENSE.txt "${CUR_PATH}\LICENSE" + SetOutPath $INSTDIR\tor + File /r "${CUR_PATH}\src\assets\tor\*.*" + SetOutPath $INSTDIR +SectionEnd + +Section -post SEC0001 + SetOutPath $INSTDIR + Delete /REBOOTOK "$INSTDIR\unins000.exe" + Delete /REBOOTOK "$INSTDIR\unins000.dat" + WriteUninstaller "$INSTDIR\uninstall.exe" + SetShellVarContext all + Delete /REBOOTOK "$SMPROGRAMS\Feather Wallet.lnk" + SetShellVarContext current + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + CreateDirectory $SMPROGRAMS\$StartMenuGroup + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" $INSTDIR\feather.exe + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe + CreateShortcut "$Desktop\$(^Name).lnk" "$InstDir\feather.exe" + !insertmacro MUI_STARTMENU_WRITE_END +SectionEnd + +# Uninstaller sections +Section /o -un.Main UNSEC0000 + Delete /REBOOTOK $INSTDIR\feather.exe + Delete /REBOOTOK $INSTDIR\LICENSE.txt + RMDir /r /REBOOTOK $INSTDIR\tor +SectionEnd + +Section -un.post UNSEC0001 + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" + Delete /REBOOTOK "$Desktop\$(^Name).lnk" + Delete /REBOOTOK $INSTDIR\uninstall.exe + RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup + RmDir /REBOOTOK $INSTDIR + Push $R0 + StrCpy $R0 $StartMenuGroup 1 + StrCmp $R0 ">" no_smgroup +no_smgroup: + Pop $R0 +SectionEnd + +# Installer functions +Function .onInit + InitPluginsDir + ${If} ${RunningX64} + ; disable registry redirection (enable access to 64-bit portion of registry) + SetRegView 64 + ${Else} + MessageBox MB_OK|MB_ICONSTOP "Cannot install 64-bit version on a 32-bit system." + Abort + ${EndIf} +FunctionEnd + +# Uninstaller functions +Function un.onInit + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup + !insertmacro SelectSection ${UNSEC0000} +FunctionEnd \ No newline at end of file diff --git a/utils/Info.plist b/contrib/macdeploy/Info.plist.in similarity index 69% rename from utils/Info.plist rename to contrib/macdeploy/Info.plist.in index 4517bdc..c3e4f24 100644 --- a/utils/Info.plist +++ b/contrib/macdeploy/Info.plist.in @@ -1,12 +1,14 @@ - - + + LSMinimumSystemVersion - 10.10.0 + 10.15.0 - NSPrincipalClass - NSApplication + LSArchitecturePriority + + x86_64 + CFBundleIconFile appicon.icns @@ -14,6 +16,20 @@ CFBundlePackageType APPL + CFBundleSupportedPlatforms + + MacOSX + + + NSHumanReadableCopyright + Copyright © 2014-@COPYRIGHT_YEAR@ @COPYRIGHT_HOLDERS@ + + CFBundleShortVersionString + @VERSION@ + + CFBundleVersion + @VERSION@ + CFBundleSignature ???? @@ -23,20 +39,11 @@ CFBundleName Feather - NSHumanReadableCopyright - Copyright © 2014-2021 The Monero Project - - NSCameraUsageDescription - Camera is used to scan QR codes on demand. - CFBundleIdentifier org.monero-project.feather - CFBundleVersion - @VERSION_LONG@ - - CFBundleShortVersionString - @VERSION@ + NSCameraUsageDescription + Camera is used to scan QR codes on demand. NSSupportsAutomaticGraphicsSwitching @@ -60,5 +67,14 @@ + + NSPrincipalClass + NSApplication + + NSHighResolutionCapable + True + + LSApplicationCategoryType + public.app-category.finance diff --git a/contrib/macdeploy/README.md b/contrib/macdeploy/README.md new file mode 100644 index 0000000..599a0bf --- /dev/null +++ b/contrib/macdeploy/README.md @@ -0,0 +1,112 @@ +# MacOS Deployment + +The `macdeployqtplus` script should not be run manually. Instead, after building as usual: + +```bash +make deploy +``` + +When complete, it will have produced `Bitcoin-Core.dmg`. + +## SDK Extraction + +### Step 1: Obtaining `Xcode.app` + +A free Apple Developer Account is required to proceed. + +Our current macOS SDK +(`Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz`) +can be extracted from +[Xcode_12.2.xip](https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip). + +Alternatively, after logging in to your account go to 'Downloads', then 'More' +and search for [`Xcode 12.2`](https://developer.apple.com/download/all/?q=Xcode%2012.2). + +An Apple ID and cookies enabled for the hostname are needed to download this. + +The `sha256sum` of the downloaded XIP archive should be `28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0`. + +After Xcode version 7.x, Apple started shipping the `Xcode.app` in a `.xip` +archive. This makes the SDK less-trivial to extract on non-macOS machines. One +approach (tested on Debian Buster) is outlined below: + +```bash +# Install/clone tools needed for extracting Xcode.app +apt install cpio +git clone https://github.com/bitcoin-core/apple-sdk-tools.git + +# Unpack Xcode_12.2.xip and place the resulting Xcode.app in your current +# working directory +python3 apple-sdk-tools/extract_xcode.py -f Xcode_12.2.xip | cpio -d -i +``` + +On macOS the process is more straightforward: + +```bash +xip -x Xcode_12.2.xip +``` + +### Step 2: Generating `Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz` from `Xcode.app` + +To generate `Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz`, run +the script [`gen-sdk`](./gen-sdk) with the path to `Xcode.app` (extracted in the +previous stage) as the first argument. + +```bash +# Generate a Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz from +# the supplied Xcode.app +./contrib/macdeploy/gen-sdk '/path/to/Xcode.app' +``` + +The `sha256sum` of the generated TAR.GZ archive should be `df75d30ecafc429e905134333aeae56ac65fac67cb4182622398fd717df77619`. + +## Deterministic macOS DMG Notes + +Working macOS DMGs are created in Linux by combining a recent `clang`, the Apple +`binutils` (`ld`, `ar`, etc) and DMG authoring tools. + +Apple uses `clang` extensively for development and has upstreamed the necessary +functionality so that a vanilla clang can take advantage. It supports the use of `-F`, +`-target`, `-mmacosx-version-min`, and `-isysroot`, which are all necessary when +building for macOS. + +Apple's version of `binutils` (called `cctools`) contains lots of functionality missing in the +FSF's `binutils`. In addition to extra linker options for frameworks and sysroots, several +other tools are needed as well such as `install_name_tool`, `lipo`, and `nmedit`. These +do not build under Linux, so they have been patched to do so. The work here was used as +a starting point: [mingwandroid/toolchain4](https://github.com/mingwandroid/toolchain4). + +In order to build a working toolchain, the following source packages are needed from +Apple: `cctools`, `dyld`, and `ld64`. + +These tools inject timestamps by default, which produce non-deterministic binaries. The +`ZERO_AR_DATE` environment variable is used to disable that. + +This version of `cctools` has been patched to use the current version of `clang`'s headers +and its `libLTO.so` rather than those from `llvmgcc`, as it was originally done in `toolchain4`. + +To complicate things further, all builds must target an Apple SDK. These SDKs are free to +download, but not redistributable. See the SDK Extraction notes above for how to obtain it. + +The Guix process builds 2 sets of files: Linux tools, then Apple binaries which are +created using these tools. The build process has been designed to avoid including the +SDK's files in Guix's outputs. All interim tarballs are fully deterministic and may be freely +redistributed. + +[`xorrisofs`](https://www.gnu.org/software/xorriso/) is used to create the DMG. + +A background image is added to DMG files by inserting a `.DS_Store` during creation. + +As of OS X 10.9 Mavericks, using an Apple-blessed key to sign binaries is a requirement in +order to satisfy the new Gatekeeper requirements. Because this private key cannot be +shared, we'll have to be a bit creative in order for the build process to remain somewhat +deterministic. Here's how it works: + +- Builders use Guix to create an unsigned release. This outputs an unsigned DMG which + users may choose to bless and run. It also outputs an unsigned app structure in the form + of a tarball, which also contains all of the tools that have been previously (deterministically) + built in order to create a final DMG. +- The Apple keyholder uses this unsigned app to create a detached signature, using the + script that is also included there. Detached signatures are available from this [repository](https://github.com/bitcoin-core/bitcoin-detached-sigs). +- Builders feed the unsigned app + detached signature back into Guix. It uses the + pre-built tools to recombine the pieces into a deterministic DMG. diff --git a/contrib/macdeploy/background.tiff b/contrib/macdeploy/background.tiff new file mode 100644 index 0000000000000000000000000000000000000000..1fb088c8374ac3acd5c4f4eb6ea6b5869723fd2f GIT binary patch literal 18464 zcmeHtc|4Tg`}d3)OV&_Cwvs)vWEs22l08M1LQG8d8Pv#9DJ_a*9mW!(5=xdVQA#p2 zM1@G}%v82AA^UUgTYW!$zMt>&{Fdk6c#Zoy*SXI7dSA;qbJy!wSt%mcaUu{$UybK> zC#LTed;CW2fvl}M=Nkasjk(NKXM?5+jZUu0F8O3r#LZt=@%D&HseG>t8+Uipo& zN}Uz}FMAN4(iuFL&_T1q%f^#a$;NUI-@HDY%Uvs>qaN|`WWYmJ;w!1SCYQh%l#{4z zru#BjDKYmq15ePl70p`Qsh#C)%n*F-Vz{1&@yqS!>NPNB@1mp$=H!~NB?TU6+DQ$g zw{ur6w^Tr0FFBk1LiMPx!Y1}&V?ae#RxR$4D^EYES4@h%IMt3V{Gu)HGnnkOW4mN) zckr2X`^yM>T(AxGm1SM(yEiu3dA++eF;cnV>c<0p1gz1RvMbFg7!6E-^i{irH?g>Y zUDiV%kK5FxB7GB6_wAPT(|oR0b?PjtDi3gxBUkq|vD+UJ*#BduKO)C`op9F9#3t`^ zvB&1ZGYlF+F22nOS(DwwE20v-JeR+6aUyo_B*N>qRETTgWSxpWF?jOYD^lw^TSKGy z_cdkq{dxP8A}`;mKHD$*?3+Qqd7VV`j?pcCDbgXk3QZ*!XHTbyhiu)g+u>RTdb6Xe z`D=iCNeDj}dpvPZ^`Cz@oY~)<6vijfFPk4HHjv+PV<=gFE8+4TyObk-Sxf9u6#?I# zYo(`>WxS{6Wxn|2VTVeD0>~e?hNWia79S^S5q;|)Sy2yeCvpjh%X{U$j+;VGJos?^ zbVo8L$*)d)uTF<6`bpzHp0=(#ZO0CLi@SX1l+A%sGgOw};Ecj-E*YaaN7H8PIxt$2 zoGFu9{b8x8UuDZHO_zDRcGv4RgQEh0-gfs6ygTU<*ZerbTIMvW^qiqnC~>J^?N{{2%z=tmuT`}by$=kIZgzW} zd89i%nt$89@uhyxazg46>1W@=za`$qF?i1?+c@RgxC!uhHGhA5s1#X#B04YItgXu> zR((RV;00CR;2bBZGJij9Jl$qHaNGG-yMyD+V zrufZ{kUOHuHtXqD*6Y+gKaKbrZs-9mxT5ooT2rdTYs-nQ7R@SEd6ubHX*d)bZnLRi z@1*bL%ui>8h4S=QCIo8ir|X1lB~s-x^BSh=sn&0z9Jdtg9rN|D{Jt>L=c+ZgeE305 zL{?!(<>Ku7BP|zPX$PFqnRPwqzbk+PbE94FsyDv=h1axHd;A((+<3Ow3+b%h zU7IWzX{FWXwn<;q>~L8g!J7MWW!vMeY;e>37Sm=W)tpbBVV){nJT9vZEzdlR-hNx* zjJn0BCRaP@VP zxs~{PPPXS;7W4P8saixJQyHY9JB;JbkHlWYuvfFt$sft=)rRy9k7JBSy_3G|kX^~d zEZo^)%tb0{FgNCsU^u>Ri*?Sx=<4zMpYC#e9m1t?93zK$gDlU-+&ISPAJgS%@M7ua zRzkQChd+^iZKC<~XK!i?$sb+)HjMX$Cd(@X{hEr`lo%mAQoQGUR#C$Tp^{4gVG>!M ziIMm&*%JkHmpUp{{o*n>{5KKy^n=#_z_-W#kWs*K%qM;J>Ky>J?zF-osuh)JJnEP9 zWd!B6jj$&<$|&F@<`bI5EeUgDA;dc>>kjEK#hwS}+(x=RVbeWUx2gEugeblV%I=iEl!}9QLm-!AXeZE6T?LWx)9=33I8H zwS2o=d@pOcI(x75$1+U#7uFyj-r^ajta8jHHdf`FRFg9&g`S@H&PmMS%Xb^w-xJw& zt|rt(>FJ4T4&wGRc8vu=Pfw)9aypTi(}~e0qhQv=#F}pGc6u?8H`l_1i-71YDj3gV zQXffu>>%&67Orj;dlDxwB{%#T0p>@ao_M~^KNoXJV&%0n;b4$sPa)>gflVPymA#1y z{(RY}&ugcAd5d>GiN}P$XAKJAEpETvoDF=%nsm}1y;ArnOpq$yF+%6jt-Lf#Hx@lB zM;IZ=3s+Of`;MK`&qCn@raS?x;8YIg(maR2FoS}_@fN#HT=%)UNwE(D6JZ1&LIuI+?L!DPad5DKtb;>>vC#AHKQk|3 zCx|{}2Jzy@RSI3Fnsyf;zG!aFF)TS{F;UCIF;atIgrA6P?+{(pXg0wW;a z(2peea1#QYtie+S@IU42Z3fA@K(6xf-suEn9UzZI;+*Y(Yz(?7a)rQ*(M;w8d|#<$cKUt+Svmc_(Gla zA(*-WSsuu({#YxhW?O*#1s}2-vQb1J(7e7_vzI4z36=oI3&w05;r@Fp zfnFWRd&2R1ptXPxTf!lnxfPJjfqcUsZwcu^ylh`X1K~acIbm1v#_zNMdXN+Lqxgv3 zP#!>x?8VsNy-+?ukFbv*oRQuLEFuJP5d8H)1S8%dq!0uI4iO1Ueh6T0N(lHsBMA8u zjO_E%qYCh7DsdGN0p|S?V_@DNNVbT#u;wUW7zDIesz?J5Uo z9`f?}r@Pj~Xy_UNV!2&tDB?sp)hZmz9=0>=YoM(PFnu16ntd-VUK zs()4U7q`Dx)&BRsfji0fAAJLSvG%g|u#T`kM@WI^N7fgtpMW&PIt+dX|HbF88bCdT z1NzmTSnW0+a7h2+U;;7|2+szAY(SO5!gaC$>%2jJ2_SnBpzoksD}xUBy%vA(5U8hr zpNBeP)w>_ST^;?^@jkEy>JZ33)Ghza&;MkH{I)+11z!>k4Lwj2y?_l}tshi7>>0Zm zJH*MYs<%|fREt$_sxnna;4HxPQ|(tBSAC&+16oc1Hyr-0onh`;o+Y<`}baj zGX8rHLAm_zG5S5%e?LK1s}Ju|UTI!6UUptZUQJ#TUL@}(@T<;i3?ymZ&Ac|e!eG{t zSB}?=cjLeE@vCBiKm&CU)OmmP;_A8Q3RwQ?G$=lQP<=dn%6b2c_upfb`dgIH35ffB zpCNg`PG0r2dWQV+`75t*h5vSf?ggH3h$Dap9^@4|9fHBxBlR~M=j*?O%2ksZDZR7WDI15mO!hat-z^gkB~x}pf%CP zKV|47)Ca%NIk=i5Wwa5PHAI`Cb)Yly_h`x_lz=k*hj1^k7ABf_JcW z2oZz?LK=LlD+8|D2tDvUyA!-O*dz8JToDHVJAY71JjiV{;shcAk%+j2NJnHN@)5;| z>xc?O6`~H&gm{2>jOax4AYLGbz&8*LF^c$#m_aNckw|tV4^j{*f|NwcAeE5nNFAgh zawpOTxf|(<^g{X}gOL%)XkW0SoX8{v4pWiv7BN_V##7DWVy*w%kqGwljQ}=Tb5ClX%qs* zg%Uz-LMfwkP^Kt*lpE?03Xh6KokwM$3Q-l{6lh2Fq28j#P;+QDv>;jvtqf{oiQbF$ zL5HDZ(HGF!=xgX&^dod1`W^Z!dYP4nRg6`MRhQL@bswuA>k-xj)(qAX)*99}aB9<7 zXV}=-gg{?tgMM*kJIr>B?E+gaTP53lwr6Y~*rwUp*+tlu*bUh2*}d7r*%R1F>^Iq4 z*n8P&>_0fTI3zjLIm|iSID$D&a%6Da;ArOP(am{fH za4T|~a(i$`a3^t>a^L43jl1|$t|{9 zqPLW7c_p((Mn}e9CR3(eW>!{C)MdG@<#Gu@`dux71$JX z6ao}-6?zm|6g3t76>}83l~|OtlyFM9O3${kZpCa3-deb|UzuCkL^)EqO!=LPkcy4U zNtHU4iEUf9xou0?*1m07RZ}$(e7_B;38?K-JE_*7Hl?np?xUWg{#=7c!(1ay1yeQ>sIMb>M835=-tr!q%WtB)i2inV6fT1+u(}9TSF;BFT(=Ew?>NYX^iQ8GnAQy*?BYSPJx|!cV_P#G2d+NXI^Ih z)k4$an8kfdR!eKk6w7`qaVsCI>sDWPY43{J^~jpr+Q~ZG`n`>!4c?}~mc@3LZL00C zos3(Jyxq5LU(CKvS5a4->s>c?H)ppJw`upC?&?8vDki;>TfXLEgXd-II*D)Pni z6Z7W_a0LTbEUwfR$`)o6u@yxY(Tkmn+pp?ey&tDg+b^rEt6J~q+^MLRsV3J5)|{_J z))H&K*7?`Hz3Y1SS^cj1)&{+Xnnsnz(xy#KIrrAzOK#?DKGnR^64f$&KlJ|C1HT6! zT0L8b9`1Yi{E_1$YMXW2lgH+dAGVvcw>&X;($t~bQBTpK)OBig)^=%j)jZXFT0_;M z)^=-m-|fNlG(6LP*4%5<`=HOP@9}f1=bbO?UOaob_vJvpNB`Ra-+@nqfrH;(MZQ`X zIu2g!&%a*#I%7m^r0|Wxo65IZZ|}V`d)M{e>HW|LpAVxS2_F|}r|3NN42C4*`X}{I zO`pv__k3~xLK_VoT^LIk=N~6e$WK&H8c%k8-S?ID4gYOr>H<@QS^9nZ_tt5L>5-YB znT6T&KSX|9o70(VpLdyOEF4*6U(8xkSZY|dULIZvT3G@Ab2#j1H>$dBrz72HkQW)7 zvbKZ=H#*ixolGy=5~b9x)7uzxb}YNwv}mfTsO2a#*{Y&cjK-cBrb5v-A!6Qpq!CX} z;UCw_Gto5KS%M>dNt%UmyS#9Lppb^4jPf(oBRdU0^@%ffk5nyi zc7ru*SJ$kebc!$vy9CoRrKvkfa`M~!$cgHclZraR*b$@6Z#~S@=X&}KsaKup&8;h9 zVJgB~32Bnx=~O$GYVjhH`$huAK}xrC}XQKF}a zMhpQ(LjFXoNSI2$A|WmLf==c*MU2)LmqNe=4#qUNU)0I$3>t%C<0WBo-KRihc= zG-d_}wJEOZKFH*92Mfe0ho6d#BH0gI2vtE*q8B%9V)V)bz%qUYo}_Lu_w_7c@OqbH zEOi@RWt$2i?akLja_9QmG5M7cfY|{suh80t5>EP~B-G7pgS zwtVyuz$Q(ZN>j1@0I|vQqsPcTx_rwgz>blDq3C&VFsj}Gq*Tx&lY>=7ixezWO;00; zU)|GsZWX3lh${8!e!88IPNo^DXpwQ2FlUTuIrGlLVPeu-M>uWa*aj*qZCN6L;9Ui& zv&L4{{oVBi!!1G3To6G;einF;pPf}Db5WLrB^f92D{bw-AnqHa_KYTTrT$dUV*qB| zQw$ASl7yiw4bjQ?w1rNcb}`y=Vlsi^IMMRs-v;Ckc!o3vWuP;~j(kQ`{C zkup`yqJE_sHtKsXMo3$*Py9KNj!9iAZNtzqra>m%BRl6o`05t*Ef)ybB>YM(#$^=+ z8sNezx?r$$K(Dk7G6R?{beoxcAqHrszs|bZJ0Ng|2Er3=E_~*aKuGK=Jmf@5EIi zzz+xq45+>T<(qiO|$-%UfXiF03#mc zDEZ=3;%G;3N!v2+9F&0nOOS9}_Fw~+lJl8I0gx8soVtbUSWAY^8*nBGEmUm7kHk~~ z2gGyC^8B$wZewM&aEJV!{kT}TqC@YYf*2Vw;z2%d-^PT1G9O&2el!<}O{yALIq*KZ z4Z?1ZO<{JWzP3qR8WmvZ84NzH9;gfY@Q+$9!u?U#HrJzWLEIBaZG=D=GSoW2wypW_ zIp&K_G3@QhmCXz;aHt=YT--@L5>u6fyIuL_@m#BYq=xcL{O?o&ub*YE_Y|6EFrv*# zMf!SL3~(H|j(KM4yaDHt&_b;YRT%VTo8j9;vQZ198T9-ZohsKz5?V+KB3CkfwfhcA z)?EA#Iqg;=v~2B4d`hf>mURj+8o?=a(6i;yTq{JKZ+r51BVYjKg!rK!lg+G-tz2LI0?rfuPnZq?Xvyc zMYLa@jcM_tl1%-~*VLKT#hXTPh}0JCYmpL5yB!p}6iT)68EOvF@hiC<0=}P^V7CXe_fgfy-ntKFFlL^4(&6O!vDMA<2oY$E#w7SO}gEiI3hbz8PwojwlEm zsVx}p4~@KcNw98EUgH4YeiHE)EH0Eo6Ttdd_}(QYe>L5a=c= zKdaf7x!ltqKb~X9itSWCQC~?i^mEDQ%YUhXO5*{{n-4WicQ@C`8^*HZ25Xd6XEn*n zanp6rT1(FtV_(1?wI(NyG|ni?rDiz7lrTj5759u?*gLjk}X^lCb&&8jPpuc2u(2`3H z=~^;CaZ`x9-w@Q~-BUX>XcBz(@r1k!(eus@TC%A=UHc{SWHSU`wHl7}vryFd&JFLL z`2KZ|5ToO!t=y#ynW3rk_5JSx<+s(Bj4KyopVUV0o;ae@`B5Je#*`_>w%2+boH(k} zNz+%T@UU?^6xg|mR&nOel|_z84>gvwi#I)&Rc8&z>qGOpVu)MihxWA;3}@aHpr+Oa zEe4T!NYRc|4db0;xoLy(fn29WwHoacRY;PUBb9WBMwUBGJ#*L?6Gd9| zqLSziI`)@G^CVG}+kEGm9D>LcS=DriRLA7C1~)`@TbJbB?b>n^Y6r<<=g$-g%q@pkrl>y@)z#$ z9mhv=rI>V$OZbV-p5|-*VZ|kHQ5Or&;i<4gy~|?0aSN#hV!1XiRkdTtIGwEcukMB@ z+9zMUX+5i}icbDl8F>r2R2jyqsBcLeO|q*LbEoEt)b3+%KXRBzvSyj*`=33{cm|6GVxm}+uQt&P_N zZNB??&!i8I=p!cI?(fbfKTBBhi+VeI)o#dD}2bll#e2Qc$HEhR%YX@pslblb0ajw*R|m$g7S>A zPL0Of$rEY3t)f{ZO*%v2K$k(rv9HTV;-5P#^m;fX&54=c2E9Dr-F(cDx98!H@t^{+ zY0QPqZNuZ!`AgPDT}@|d$3K{0CI}mLTGcZ~jRxZl1DwR!nNNb0%)9EBHNste+IDV@ zF65xx9&(OOi=PVhO~)I)KOs{fwlcq7oL->6)%7&FKe&k{jpwFkiX$)OVcOou#1Bf~ z^e`#8tIAG$M^Svgcv4v|zG@BWfj?e=*=QM;30FKw*_k z3;n@@8&4?orkS}ilfkY_@&Xi-`dw9cjAZ{YE%_l4fwmJEc^7MESw>$SnT3*&V5a84 zOL>u+PEquEko~L}+flpuJ~`utywVxw4i}db)i#696AGnQZ%`<2n`##nd(~@WY2pO8 z8x?_}RO@@?#n`8{Q??l8z3y7_4B?;(b}T`iCJN@G+)~-+4%3qM?sTY?b0VinZ~P*W z!@l@v;QdrvL7-#F@NPTn>tkUQW6vwGy`35+gC8%+S7!C?)~)KB{oaCgpWNb5i`hbv zqgAJ6+^kutbZCk85trX6E^jI z$RMRSfR$avJThI6!!bpQu}7CE8v$0uSk>f0!;y&uLCemnAR0Hoa;<$^hV;yiud*fK zcVd*Us<<~Xvl_p=+>fF>#!>|7)oHPAvn_Go4T2109BNgZ)}=|8y^`?UPyBvv@rznP zV60`DFa@WOb9yndgFjB*Df&CFL!{~!${MgTeXORPuh9=bTVF8dZJEXe>`Vs}N0*1L z^?V!H;1H>{g@OWR*T=Suw2?GriBS*K*s?dq@`QY; z43GxL9lce7B;6UhiPHq5?447sp00qPSDy;%r8t*#DU{0ewnn~G$6j0o%~Wuw;LcUw z5;rcfQG@3=Nb1Gp3`?#dZ(j;8;k~SKAp0(BOo5n4t;pr@*=vETevq@*Y+yfJ^=q-l zu%A{+nj!3mbF0&DG7`f?ni?c16V z@ILV}VE2&mIy3LdxKb<2eJnpth`Wle`S5^l*I(MA;HX=-P`uPI8a2|qkl)1SZq+=y zO(L(K;Xa``uxqNiWnjEM&Ff)BYYpzvVEZF+KY#$(s5{Q+reE&T+A z&)dhs9xvK;UoGyt#V*Qh)X%(Z_fX<+*W@>kUAjESZmO*`Fn0Ii28u4uWg0+pDiC6> zd#Sf@i*p@g_eq|{`I-iUOo2c};gw5}uc3e!EiI6*$a3%YMe|i;3Fgo$GO;UU6?sgp zlkhf<$bLJRM;093-LyPqm+^1-Tlp z;gpL#nMGBmlCu;deq0q#2=_{*|h%@gnsO5dP zlsraLVB(zpQP%*jE$waoSUaOK&FfhC{WFVckSjNSpJp2D;c-^wYKqk9WqHvieEFms>w#W6Tp6IuCiYV0JKMX;l1KFx6lib0FrX^-xMGm=0Xh0yvp$5w?9 zRb&P#($(n!Fg^`t2Lb@>zC)d=bog)VK*v_Ad9G$go2~(SM!`9IkRXnsgI)sdekH?G zAM|7;cG(w7A|Rv>X@0Vkf;hWNQW77Z+E&=sdwqV zW;!O_`yp>{(|CQTw-e^cR0%_uXDGliqfWmc2T)7qS_!!c<8HW&ZLlJ}bgl-ns9{lV zneiy~ZgeiD3wB4im3sTR8GiG?M2JS-p!>n#?QYBOAaJ{vpv55Y!Kru{d@y6u00K|1 zn474xdl*?B+Nr(jZL%I3hIdDZ)&{g4tLOt%UlVB0aRZ<8oJ6$7ZZU%10i=Z$Lpvr3 zh9YKkuhO~(Y6kI4$*_m9*WZ|HgB907qF`rbAT5x^gN%Hj09{u;Hv(e=I*~2cxHm@L zrMc&gZV&X4D4d%RuYL5S6FQ>YgTWDncASXIp*%dWQ@}N8%Wm?V6vz3#*-zRVjz>7A z&oG|Y`P4KO!_)Y^W=h?2bX9e0 zDt%S8StIWAs_M=Zmhthskuh%Ud6!?VwMZmxY=GjIOAw9xyfR5piu(f0E)oyZXTidu ztWxLY76Lf0V#>dFg+NBMfHs%q7noA-%x32kT`Lh(+(3He-YZkM`M2B0DE&85h@}L4 zYf_7I3S|hgH;g28xkG|}WG-bR5Ng%6mnV_ogE8s=4*UMpiD?tT%EFGkP~vllu1W)0m#{a>rH(ajJKbM zHGQ1g@!9q9Y#C61p7ZK#dJUc%nbj0eU}$JBl8lRxLUR3j;3d@TQZ!t8J+&i zbF~2M7&+j2v=4A+K&|m@E(h6`V7Mv1d5OUoZ2Yu>; zF<!90s8E?^Z%&)&IRu0uQEur{A)#JtevZ0M8`wIYM&~@K$C&wL<~x zBjG$}4Krn`d#-k3ENpnV#itAPpi zohIMnYs~2C?p=kH0E)c1R09Jhk?}FDN-f#9;S$7L;>)%dMw&9e-K_nD0(T#O-cmiz z0`4{bl%Wf#|J|FltiU!@>%YEP8xQQDo3)U=2eAKjv(^U4zi!s<0rLO$X6-4k7W#p% zH6nj|)`1w`f{z0Tst8=(&;*|fF$4lDg+T1wf@y8@J$I" + echo "example: $0 " + exit 1 +fi + +rm -rf ${TEMPDIR} +mkdir -p ${TEMPDIR} + +${SIGNAPPLE} sign -f --detach "${TEMPDIR}/${OUTROOT}" "$@" "${BUNDLE}" + +tar -C "${TEMPDIR}" -czf "${OUT}" . +rm -rf "${TEMPDIR}" +echo "Created ${OUT}" diff --git a/contrib/macdeploy/gen-sdk b/contrib/macdeploy/gen-sdk new file mode 100755 index 0000000..6efaacc --- /dev/null +++ b/contrib/macdeploy/gen-sdk @@ -0,0 +1,116 @@ +#!/usr/bin/env python3 +import argparse +import plistlib +import pathlib +import sys +import tarfile +import gzip +import os +import contextlib + +# monkey-patch Python 3.8 and older to fix wrong TAR header handling +# see https://github.com/bitcoin/bitcoin/pull/24534 +# and https://github.com/python/cpython/pull/18080 for more info +if sys.version_info < (3, 9): + _old_create_header = tarfile.TarInfo._create_header + def _create_header(info, format, encoding, errors): + buf = _old_create_header(info, format, encoding, errors) + # replace devmajor/devminor with binary zeroes + buf = buf[:329] + bytes(16) + buf[345:] + # recompute checksum + chksum = tarfile.calc_chksums(buf)[0] + buf = buf[:-364] + bytes("%06o\0" % chksum, "ascii") + buf[-357:] + return buf + tarfile.TarInfo._create_header = staticmethod(_create_header) + +@contextlib.contextmanager +def cd(path): + """Context manager that restores PWD even if an exception was raised.""" + old_pwd = os.getcwd() + os.chdir(str(path)) + try: + yield + finally: + os.chdir(old_pwd) + +def run(): + parser = argparse.ArgumentParser( + description=__doc__, formatter_class=argparse.RawTextHelpFormatter) + + parser.add_argument('xcode_app', metavar='XCODEAPP', nargs=1) + parser.add_argument("-o", metavar='OUTSDKTGZ', nargs=1, dest='out_sdktgz', required=False) + + args = parser.parse_args() + + xcode_app = pathlib.Path(args.xcode_app[0]).resolve() + assert xcode_app.is_dir(), "The supplied Xcode.app path '{}' either does not exist or is not a directory".format(xcode_app) + + xcode_app_plist = xcode_app.joinpath("Contents/version.plist") + with xcode_app_plist.open('rb') as fp: + pl = plistlib.load(fp) + xcode_version = pl['CFBundleShortVersionString'] + xcode_build_id = pl['ProductBuildVersion'] + print("Found Xcode (version: {xcode_version}, build id: {xcode_build_id})".format(xcode_version=xcode_version, xcode_build_id=xcode_build_id)) + + sdk_dir = xcode_app.joinpath("Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk") + sdk_plist = sdk_dir.joinpath("System/Library/CoreServices/SystemVersion.plist") + with sdk_plist.open('rb') as fp: + pl = plistlib.load(fp) + sdk_version = pl['ProductVersion'] + sdk_build_id = pl['ProductBuildVersion'] + print("Found MacOSX SDK (version: {sdk_version}, build id: {sdk_build_id})".format(sdk_version=sdk_version, sdk_build_id=sdk_build_id)) + + out_name = "Xcode-{xcode_version}-{xcode_build_id}-extracted-SDK-with-libcxx-headers".format(xcode_version=xcode_version, xcode_build_id=xcode_build_id) + + xcode_libcxx_dir = xcode_app.joinpath("Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1") + assert xcode_libcxx_dir.is_dir() + + if args.out_sdktgz: + out_sdktgz_path = pathlib.Path(args.out_sdktgz_path) + else: + # Construct our own out_sdktgz if not specified on the command line + out_sdktgz_path = pathlib.Path("./{}.tar.gz".format(out_name)) + + def tarfp_add_with_base_change(tarfp, dir_to_add, alt_base_dir): + """Add all files in dir_to_add to tarfp, but prepent MEMBERPREFIX to the files' + names + + e.g. if the only file under /root/bazdir is /root/bazdir/qux, invoking: + + tarfp_add_with_base_change(tarfp, "foo/bar", "/root/bazdir") + + would result in the following members being added to tarfp: + + foo/bar/ -> corresponding to /root/bazdir + foo/bar/qux -> corresponding to /root/bazdir/qux + + """ + def change_tarinfo_base(tarinfo): + if tarinfo.name and tarinfo.name.startswith("./"): + tarinfo.name = str(pathlib.Path(alt_base_dir, tarinfo.name)) + if tarinfo.linkname and tarinfo.linkname.startswith("./"): + tarinfo.linkname = str(pathlib.Path(alt_base_dir, tarinfo.linkname)) + # make metadata deterministic + tarinfo.mtime = 0 + tarinfo.uid, tarinfo.uname = 0, '' + tarinfo.gid, tarinfo.gname = 0, '' + # don't use isdir() as there are also executable files present + tarinfo.mode = 0o0755 if tarinfo.mode & 0o0100 else 0o0644 + return tarinfo + with cd(dir_to_add): + # recursion already adds entries in sorted order + tarfp.add(".", recursive=True, filter=change_tarinfo_base) + + print("Creating output .tar.gz file...") + with out_sdktgz_path.open("wb") as fp: + with gzip.GzipFile(fileobj=fp, mode='wb', compresslevel=9, mtime=0) as gzf: + with tarfile.open(mode="w", fileobj=gzf, format=tarfile.GNU_FORMAT) as tarfp: + print("Adding MacOSX SDK {} files...".format(sdk_version)) + tarfp_add_with_base_change(tarfp, sdk_dir, out_name) + print("Adding libc++ headers...") + tarfp_add_with_base_change(tarfp, xcode_libcxx_dir, "{}/usr/include/c++/v1".format(out_name)) + print("Done! Find the resulting gzipped tarball at:") + print(out_sdktgz_path.resolve()) + +if __name__ == '__main__': + run() diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus new file mode 100755 index 0000000..62ece56 --- /dev/null +++ b/contrib/macdeploy/macdeployqtplus @@ -0,0 +1,597 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2011 Patrick "p2k" Schneider +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import sys, re, os, platform, shutil, stat, subprocess, os.path +from argparse import ArgumentParser +from ds_store import DSStore +from mac_alias import Alias +from pathlib import Path +from subprocess import PIPE, run +from typing import List, Optional + +# This is ported from the original macdeployqt with modifications + +class FrameworkInfo(object): + def __init__(self): + self.frameworkDirectory = "" + self.frameworkName = "" + self.frameworkPath = "" + self.binaryDirectory = "" + self.binaryName = "" + self.binaryPath = "" + self.version = "" + self.installName = "" + self.deployedInstallName = "" + self.sourceFilePath = "" + self.destinationDirectory = "" + self.sourceResourcesDirectory = "" + self.sourceVersionContentsDirectory = "" + self.sourceContentsDirectory = "" + self.destinationResourcesDirectory = "" + self.destinationVersionContentsDirectory = "" + + def __eq__(self, other): + if self.__class__ == other.__class__: + return self.__dict__ == other.__dict__ + else: + return False + + def __str__(self): + return f""" Framework name: {self.frameworkName} + Framework directory: {self.frameworkDirectory} + Framework path: {self.frameworkPath} + Binary name: {self.binaryName} + Binary directory: {self.binaryDirectory} + Binary path: {self.binaryPath} + Version: {self.version} + Install name: {self.installName} + Deployed install name: {self.deployedInstallName} + Source file Path: {self.sourceFilePath} + Deployed Directory (relative to bundle): {self.destinationDirectory} +""" + + def isDylib(self): + return self.frameworkName.endswith(".dylib") + + def isQtFramework(self): + if self.isDylib(): + return self.frameworkName.startswith("libQt") + else: + return self.frameworkName.startswith("Qt") + + reOLine = re.compile(r'^(.+) \(compatibility version [0-9.]+, current version [0-9.]+\)$') + bundleFrameworkDirectory = "Contents/Frameworks" + bundleBinaryDirectory = "Contents/MacOS" + + @classmethod + def fromOtoolLibraryLine(cls, line: str) -> Optional['FrameworkInfo']: + # Note: line must be trimmed + if line == "": + return None + + # Don't deploy system libraries + if line.startswith("/System/Library/") or line.startswith("@executable_path") or line.startswith("/usr/lib/"): + return None + + m = cls.reOLine.match(line) + if m is None: + raise RuntimeError(f"otool line could not be parsed: {line}") + + path = m.group(1) + + info = cls() + info.sourceFilePath = path + info.installName = path + + if path.endswith(".dylib"): + dirname, filename = os.path.split(path) + info.frameworkName = filename + info.frameworkDirectory = dirname + info.frameworkPath = path + + info.binaryDirectory = dirname + info.binaryName = filename + info.binaryPath = path + info.version = "-" + + info.installName = path + info.deployedInstallName = f"@executable_path/../Frameworks/{info.binaryName}" + info.sourceFilePath = path + info.destinationDirectory = cls.bundleFrameworkDirectory + else: + parts = path.split("/") + i = 0 + # Search for the .framework directory + for part in parts: + if part.endswith(".framework"): + break + i += 1 + if i == len(parts): + raise RuntimeError(f"Could not find .framework or .dylib in otool line: {line}") + + info.frameworkName = parts[i] + info.frameworkDirectory = "/".join(parts[:i]) + info.frameworkPath = os.path.join(info.frameworkDirectory, info.frameworkName) + + info.binaryName = parts[i+3] + info.binaryDirectory = "/".join(parts[i+1:i+3]) + info.binaryPath = os.path.join(info.binaryDirectory, info.binaryName) + info.version = parts[i+2] + + info.deployedInstallName = f"@executable_path/../Frameworks/{os.path.join(info.frameworkName, info.binaryPath)}" + info.destinationDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, info.binaryDirectory) + + info.sourceResourcesDirectory = os.path.join(info.frameworkPath, "Resources") + info.sourceContentsDirectory = os.path.join(info.frameworkPath, "Contents") + info.sourceVersionContentsDirectory = os.path.join(info.frameworkPath, "Versions", info.version, "Contents") + info.destinationResourcesDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Resources") + info.destinationVersionContentsDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Versions", info.version, "Contents") + + return info + +class ApplicationBundleInfo(object): + def __init__(self, path: str): + self.path = path + self.binaryPath = os.path.join(path, "Contents", "MacOS", "feather") + if not os.path.exists(self.binaryPath): + raise RuntimeError(f"Could not find bundle binary for {path}") + self.resourcesPath = os.path.join(path, "Contents", "Resources") + self.pluginPath = os.path.join(path, "Contents", "PlugIns") + +class DeploymentInfo(object): + def __init__(self): + self.qtPath = None + self.pluginPath = None + self.deployedFrameworks = [] + + def detectQtPath(self, frameworkDirectory: str): + parentDir = os.path.dirname(frameworkDirectory) + if os.path.exists(os.path.join(parentDir, "translations")): + # Classic layout, e.g. "/usr/local/Trolltech/Qt-4.x.x" + self.qtPath = parentDir + else: + self.qtPath = os.getenv("QTDIR", None) + + if self.qtPath is not None: + pluginPath = os.path.join(self.qtPath, "plugins") + if os.path.exists(pluginPath): + self.pluginPath = pluginPath + + def usesFramework(self, name: str) -> bool: + for framework in self.deployedFrameworks: + if framework.endswith(".framework"): + if framework.startswith(f"{name}."): + return True + elif framework.endswith(".dylib"): + if framework.startswith(f"lib{name}."): + return True + return False + +def getFrameworks(binaryPath: str, verbose: int) -> List[FrameworkInfo]: + if verbose: + print(f"Inspecting with otool: {binaryPath}") + otoolbin=os.getenv("OTOOL", "otool") + otool = run([otoolbin, "-L", binaryPath], stdout=PIPE, stderr=PIPE, universal_newlines=True) + if otool.returncode != 0: + sys.stderr.write(otool.stderr) + sys.stderr.flush() + raise RuntimeError(f"otool failed with return code {otool.returncode}") + + otoolLines = otool.stdout.split("\n") + otoolLines.pop(0) # First line is the inspected binary + if ".framework" in binaryPath or binaryPath.endswith(".dylib"): + otoolLines.pop(0) # Frameworks and dylibs list themselves as a dependency. + + libraries = [] + for line in otoolLines: + line = line.replace("@loader_path", os.path.dirname(binaryPath)) + info = FrameworkInfo.fromOtoolLibraryLine(line.strip()) + if info is not None: + if verbose: + print("Found framework:") + print(info) + libraries.append(info) + + return libraries + +def runInstallNameTool(action: str, *args): + installnametoolbin=os.getenv("INSTALL_NAME_TOOL", "install_name_tool") + run([installnametoolbin, "-"+action] + list(args), check=True) + +def changeInstallName(oldName: str, newName: str, binaryPath: str, verbose: int): + if verbose: + print("Using install_name_tool:") + print(" in", binaryPath) + print(" change reference", oldName) + print(" to", newName) + runInstallNameTool("change", oldName, newName, binaryPath) + +def changeIdentification(id: str, binaryPath: str, verbose: int): + if verbose: + print("Using install_name_tool:") + print(" change identification in", binaryPath) + print(" to", id) + runInstallNameTool("id", id, binaryPath) + +def runStrip(binaryPath: str, verbose: int): + stripbin=os.getenv("STRIP", "strip") + if verbose: + print("Using strip:") + print(" stripped", binaryPath) + run([stripbin, "-x", binaryPath], check=True) + +def copyFramework(framework: FrameworkInfo, path: str, verbose: int) -> Optional[str]: + if framework.sourceFilePath.startswith("Qt"): + #standard place for Nokia Qt installer's frameworks + fromPath = f"/Library/Frameworks/{framework.sourceFilePath}" + else: + fromPath = framework.sourceFilePath + toDir = os.path.join(path, framework.destinationDirectory) + toPath = os.path.join(toDir, framework.binaryName) + + if framework.isDylib(): + if not os.path.exists(fromPath): + raise RuntimeError(f"No file at {fromPath}") + + if os.path.exists(toPath): + return None # Already there + + if not os.path.exists(toDir): + os.makedirs(toDir) + + shutil.copy2(fromPath, toPath) + if verbose: + print("Copied:", fromPath) + print(" to:", toPath) + else: + to_dir = os.path.join(path, "Contents", "Frameworks", framework.frameworkName) + if os.path.exists(to_dir): + return None # Already there + + from_dir = framework.frameworkPath + if not os.path.exists(from_dir): + raise RuntimeError(f"No directory at {from_dir}") + + shutil.copytree(from_dir, to_dir, symlinks=True) + if verbose: + print("Copied:", from_dir) + print(" to:", to_dir) + + headers_link = os.path.join(to_dir, "Headers") + if os.path.exists(headers_link): + os.unlink(headers_link) + + headers_dir = os.path.join(to_dir, framework.binaryDirectory, "Headers") + if os.path.exists(headers_dir): + shutil.rmtree(headers_dir) + + permissions = os.stat(toPath) + if not permissions.st_mode & stat.S_IWRITE: + os.chmod(toPath, permissions.st_mode | stat.S_IWRITE) + + return toPath + +def deployFrameworks(frameworks: List[FrameworkInfo], bundlePath: str, binaryPath: str, strip: bool, verbose: int, deploymentInfo: Optional[DeploymentInfo] = None) -> DeploymentInfo: + if deploymentInfo is None: + deploymentInfo = DeploymentInfo() + + while len(frameworks) > 0: + framework = frameworks.pop(0) + deploymentInfo.deployedFrameworks.append(framework.frameworkName) + + print("Processing", framework.frameworkName, "...") + + # Get the Qt path from one of the Qt frameworks + if deploymentInfo.qtPath is None and framework.isQtFramework(): + deploymentInfo.detectQtPath(framework.frameworkDirectory) + + if framework.installName.startswith("@executable_path") or framework.installName.startswith(bundlePath): + print(framework.frameworkName, "already deployed, skipping.") + continue + + # install_name_tool the new id into the binary + changeInstallName(framework.installName, framework.deployedInstallName, binaryPath, verbose) + + # Copy framework to app bundle. + deployedBinaryPath = copyFramework(framework, bundlePath, verbose) + # Skip the rest if already was deployed. + if deployedBinaryPath is None: + continue + + if strip: + runStrip(deployedBinaryPath, verbose) + + # install_name_tool it a new id. + changeIdentification(framework.deployedInstallName, deployedBinaryPath, verbose) + # Check for framework dependencies + dependencies = getFrameworks(deployedBinaryPath, verbose) + + for dependency in dependencies: + changeInstallName(dependency.installName, dependency.deployedInstallName, deployedBinaryPath, verbose) + + # Deploy framework if necessary. + if dependency.frameworkName not in deploymentInfo.deployedFrameworks and dependency not in frameworks: + frameworks.append(dependency) + + return deploymentInfo + +def deployFrameworksForAppBundle(applicationBundle: ApplicationBundleInfo, strip: bool, verbose: int) -> DeploymentInfo: + frameworks = getFrameworks(applicationBundle.binaryPath, verbose) + if len(frameworks) == 0: + print(f"Warning: Could not find any external frameworks to deploy in {applicationBundle.path}.") + return DeploymentInfo() + else: + return deployFrameworks(frameworks, applicationBundle.path, applicationBundle.binaryPath, strip, verbose) + +def deployPlugins(appBundleInfo: ApplicationBundleInfo, deploymentInfo: DeploymentInfo, strip: bool, verbose: int): + plugins = [] + if deploymentInfo.pluginPath is None: + return + for dirpath, dirnames, filenames in os.walk(deploymentInfo.pluginPath): + pluginDirectory = os.path.relpath(dirpath, deploymentInfo.pluginPath) + + if pluginDirectory not in ['styles', 'platforms']: + continue + + for pluginName in filenames: + pluginPath = os.path.join(pluginDirectory, pluginName) + + if pluginName.split('.')[0] not in ['libqminimal', 'libqcocoa', 'libqmacstyle']: + continue + + plugins.append((pluginDirectory, pluginName)) + + for pluginDirectory, pluginName in plugins: + print("Processing plugin", os.path.join(pluginDirectory, pluginName), "...") + + sourcePath = os.path.join(deploymentInfo.pluginPath, pluginDirectory, pluginName) + destinationDirectory = os.path.join(appBundleInfo.pluginPath, pluginDirectory) + if not os.path.exists(destinationDirectory): + os.makedirs(destinationDirectory) + + destinationPath = os.path.join(destinationDirectory, pluginName) + shutil.copy2(sourcePath, destinationPath) + if verbose: + print("Copied:", sourcePath) + print(" to:", destinationPath) + + if strip: + runStrip(destinationPath, verbose) + + dependencies = getFrameworks(destinationPath, verbose) + + for dependency in dependencies: + changeInstallName(dependency.installName, dependency.deployedInstallName, destinationPath, verbose) + + # Deploy framework if necessary. + if dependency.frameworkName not in deploymentInfo.deployedFrameworks: + deployFrameworks([dependency], appBundleInfo.path, destinationPath, strip, verbose, deploymentInfo) + +ap = ArgumentParser(description="""Improved version of macdeployqt. + +Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .dmg file. +Note, that the "dist" folder will be deleted before deploying on each run. + +Optionally, Qt translation files (.qm) can be added to the bundle.""") + +ap.add_argument("app_bundle", nargs=1, metavar="app-bundle", help="application bundle to be deployed") +ap.add_argument("appname", nargs=1, metavar="appname", help="name of the app being deployed") +ap.add_argument("-verbose", nargs="?", const=True, help="Output additional debugging information") +ap.add_argument("-no-plugins", dest="plugins", action="store_false", default=True, help="skip plugin deployment") +ap.add_argument("-no-strip", dest="strip", action="store_false", default=True, help="don't run 'strip' on the binaries") +ap.add_argument("-dmg", nargs="?", const="", metavar="basename", help="create a .dmg disk image") +ap.add_argument("-translations-dir", nargs=1, metavar="path", default=None, help="Path to Qt's translations. Base translations will automatically be added to the bundle's resources.") + +config = ap.parse_args() + +verbose = config.verbose + +# ------------------------------------------------ + +app_bundle = config.app_bundle[0] +appname = config.appname[0] + +if not os.path.exists(app_bundle): + sys.stderr.write(f"Error: Could not find app bundle \"{app_bundle}\"\n") + sys.exit(1) + +# ------------------------------------------------ + +if os.path.exists("dist"): + print("+ Removing existing dist folder +") + shutil.rmtree("dist") + +if os.path.exists(appname + ".dmg"): + print("+ Removing existing DMG +") + os.unlink(appname + ".dmg") + +if os.path.exists(appname + ".temp.dmg"): + os.unlink(appname + ".temp.dmg") + +# ------------------------------------------------ + +target = os.path.join("dist", "feather.app") + +print("+ Copying source bundle +") +if verbose: + print(app_bundle, "->", target) + +os.mkdir("dist") +shutil.copytree(app_bundle, target, symlinks=True) + +applicationBundle = ApplicationBundleInfo(target) + +# ------------------------------------------------ + +print("+ Deploying frameworks +") + +try: + deploymentInfo = deployFrameworksForAppBundle(applicationBundle, config.strip, verbose) + if deploymentInfo.qtPath is None: + deploymentInfo.qtPath = os.getenv("QTDIR", None) + if deploymentInfo.qtPath is None: + sys.stderr.write("Warning: Could not detect Qt's path, skipping plugin deployment!\n") + config.plugins = False +except RuntimeError as e: + sys.stderr.write(f"Error: {str(e)}\n") + sys.exit(1) + +# ------------------------------------------------ + +if config.plugins: + print("+ Deploying plugins +") + + try: + deployPlugins(applicationBundle, deploymentInfo, config.strip, verbose) + except RuntimeError as e: + sys.stderr.write(f"Error: {str(e)}\n") + sys.exit(1) + +# ------------------------------------------------ + +if config.translations_dir: + if not Path(config.translations_dir[0]).exists(): + sys.stderr.write(f"Error: Could not find translation dir \"{config.translations_dir[0]}\"\n") + sys.exit(1) + + print("+ Adding Qt translations +") + + translations = Path(config.translations_dir[0]) + + regex = re.compile('qt_[a-z]*(.qm|_[A-Z]*.qm)') + + lang_files = [x for x in translations.iterdir() if regex.match(x.name)] + + for file in lang_files: + if verbose: + print(file.as_posix(), "->", os.path.join(applicationBundle.resourcesPath, file.name)) + shutil.copy2(file.as_posix(), os.path.join(applicationBundle.resourcesPath, file.name)) + +# ------------------------------------------------ + +print("+ Installing qt.conf +") + +qt_conf="""[Paths] +Translations=Resources +Plugins=PlugIns +""" + +with open(os.path.join(applicationBundle.resourcesPath, "qt.conf"), "wb") as f: + f.write(qt_conf.encode()) + +# ------------------------------------------------ + +print("+ Generating .DS_Store +") + +output_file = os.path.join("dist", ".DS_Store") + +ds = DSStore.open(output_file, 'w+') + +ds['.']['bwsp'] = { + 'WindowBounds': '{{300, 280}, {500, 343}}', + 'PreviewPaneVisibility': False, +} + +icvp = { + 'gridOffsetX': 0.0, + 'textSize': 12.0, + 'viewOptionsVersion': 1, + 'backgroundImageAlias': b'\x00\x00\x00\x00\x02\x1e\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd1\x94\\\xb0H+\x00\x05\x00\x00\x00\x98\x0fbackground.tiff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x99\xd19\xb0\xf8\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\r\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b.background\x00\x00\x10\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x11\x00\x08\x00\x00\xd19\xb0\xf8\x00\x00\x00\x01\x00\x04\x00\x00\x00\x98\x00\x0e\x00 \x00\x0f\x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00.\x00t\x00i\x00f\x00f\x00\x0f\x00\x02\x00\x00\x00\x12\x00\x1c/.background/background.tiff\x00\x14\x01\x06\x00\x00\x00\x00\x01\x06\x00\x02\x00\x00\x0cMacintosh HD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\x97\xab\xc3H+\x00\x00\x01\x88[\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02u\xab\x8d\xd1\x94\\\xb0devrddsk\xff\xff\xff\xff\x00\x00\t \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07bitcoin\x00\x00\x10\x00\x08\x00\x00\xce\x97\xab\xc3\x00\x00\x00\x11\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x01\x00\x14\x01\x88[\x88\x00\x16\xa9\t\x00\x08\xfaR\x00\x08\xfaQ\x00\x02d\x8e\x00\x0e\x00\x02\x00\x00\x00\x0f\x00\x1a\x00\x0c\x00M\x00a\x00c\x00i\x00n\x00t\x00o\x00s\x00h\x00 \x00H\x00D\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\x14\xff\xff\x00\x00\xff\xff\x00\x00', + 'backgroundColorBlue': 1.0, + 'iconSize': 96.0, + 'backgroundColorGreen': 1.0, + 'arrangeBy': 'none', + 'showIconPreview': True, + 'gridSpacing': 100.0, + 'gridOffsetY': 0.0, + 'showItemInfo': False, + 'labelOnBottom': True, + 'backgroundType': 2, + 'backgroundColorRed': 1.0 +} +alias = Alias().from_bytes(icvp['backgroundImageAlias']) +alias.volume.name = appname +alias.volume.posix_path = '/Volumes/' + appname +icvp['backgroundImageAlias'] = alias.to_bytes() +ds['.']['icvp'] = icvp + +ds['.']['vSrn'] = ('long', 1) + +ds['Applications']['Iloc'] = (370, 156) +ds['feather.app']['Iloc'] = (128, 156) + +ds.flush() +ds.close() + +# ------------------------------------------------ + +if platform.system() == "Darwin": + subprocess.check_call(f"codesign --deep --force --sign - {target}", shell=True) + +print("+ Installing background.tiff +") + +bg_path = os.path.join('dist', '.background', 'background.tiff') +os.mkdir(os.path.dirname(bg_path)) + +tiff_path = os.path.join('contrib', 'macdeploy', 'background.tiff') +shutil.copy2(tiff_path, bg_path) + +# ------------------------------------------------ + +print("+ Generating symlink for /Applications +") + +os.symlink("/Applications", os.path.join('dist', "Applications")) + +# ------------------------------------------------ + +if config.dmg is not None: + + print("+ Preparing .dmg disk image +") + + if verbose: + print("Determining size of \"dist\"...") + size = 0 + for path, dirs, files in os.walk("dist"): + for file in files: + size += os.path.getsize(os.path.join(path, file)) + size += int(size * 0.15) + + if verbose: + print("Creating temp image for modification...") + + tempname: str = appname + ".temp.dmg" + + run(["hdiutil", "create", tempname, "-srcfolder", "dist", "-format", "UDRW", "-size", str(size), "-volname", appname], check=True, universal_newlines=True) + + if verbose: + print("Attaching temp image...") + output = run(["hdiutil", "attach", tempname, "-readwrite"], check=True, universal_newlines=True, stdout=PIPE).stdout + + print("+ Finalizing .dmg disk image +") + + run(["hdiutil", "detach", f"/Volumes/{appname}"], universal_newlines=True) + + run(["hdiutil", "convert", tempname, "-format", "UDZO", "-o", appname, "-imagekey", "zlib-level=9"], check=True, universal_newlines=True) + + os.unlink(tempname) + +# ------------------------------------------------ + +print("+ Done +") + +sys.exit(0) diff --git a/contrib/monero-seed/CMakeLists.txt b/contrib/monero-seed/CMakeLists.txt deleted file mode 100644 index 2028ceb..0000000 --- a/contrib/monero-seed/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (c) 2020, tevador - -cmake_minimum_required(VERSION 3.13) - -option(MONERO_SEED_DEMO "Build a demo executable for monero-seed") - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) - message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}") -endif() - -project(monero-seed) - -include(GNUInstallDirs) - -add_library(${PROJECT_NAME} -src/argon2/blake2/blake2b.c -src/argon2/argon2.c -src/argon2/core.c -src/argon2/ref.c -src/galois_field.cpp -src/gf_elem.cpp -src/gf_poly.cpp -src/monero_seed.cpp -src/pbkdf2.c -src/reed_solomon_code.cpp -src/secure_random.cpp -src/wordlist.cpp) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_include_directories(${PROJECT_NAME} PUBLIC - $ - $) - -if(MONERO_SEED_DEMO) - add_executable(demo src/main.cpp) - set_property(TARGET demo PROPERTY CXX_STANDARD 11) - target_link_libraries(demo -Wl,--whole-archive ${PROJECT_NAME} -Wl,--no-whole-archive) -endif() - -install(TARGETS ${PROJECT_NAME} - EXPORT ${PROJECT_NAME} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install(DIRECTORY include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -install(EXPORT ${PROJECT_NAME} - FILE ${PROJECT_NAME}Config.cmake - NAMESPACE ${PROJECT_NAME}:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) diff --git a/contrib/monero-seed/src/main.cpp b/contrib/monero-seed/src/main.cpp deleted file mode 100644 index 577b40c..0000000 --- a/contrib/monero-seed/src/main.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (c) 2020 tevador - All rights reserved. -*/ - -#include -#include -#include -#include -#include -#include - -static inline void read_string_option(const char* option, int argc, - const char** argv, const char** out, const char* def_val = nullptr) { - for (int i = 0; i < argc - 1; ++i) { - if (strcmp(argv[i], option) == 0) { - *out = argv[i + 1]; - return; - } - } - *out = def_val; -} - -static inline void read_option(const char* option, int argc, const char** argv, - bool& out) { - for (int i = 0; i < argc; ++i) { - if (strcmp(argv[i], option) == 0) { - out = true; - return; - } - } - out = false; -} - -static time_t parse_date(const char* s) { - std::istringstream iss(s); - char delimiter; - int day, month, year; - if (iss >> year >> delimiter >> month >> delimiter >> day) { - struct tm t = { 0 }; - t.tm_mday = day; - t.tm_mon = month - 1; - t.tm_year = year - 1900; - t.tm_isdst = -1; - - time_t dt = mktime(&t); - if (dt != -1) { - return dt; - } - } - throw std::runtime_error("invalid date"); -} - -void print_seed(const monero_seed& seed, const char* coin, bool phrase) { - if (!seed.correction().empty()) { - std::cout << "Warning: corrected erasure: " << monero_seed::erasure << " -> " << seed.correction() << std::endl; - } - if (phrase) { - std::cout << "Mnemonic phrase: " << seed << std::endl; - } - std::cout << "- coin: " << coin << std::endl; - std::cout << "- private key: " << seed.key() << std::endl; - auto created_on = seed.date(); - std::tm tm = *std::localtime(&created_on); - std::cout << "- created on or after: " << std::put_time(&tm, "%d/%b/%Y") << std::endl; -} - -int main(int argc, const char* argv[]) { - bool create; - const char* create_date; - const char* coin; - const char* restore; - read_option("--create", argc, argv, create); - read_string_option("--date", argc, argv, &create_date); - read_string_option("--coin", argc, argv, &coin, "monero"); - read_string_option("--restore", argc, argv, &restore); - - try { - if (create) { - time_t time; - if (create_date != nullptr) { - time = parse_date(create_date); - } - else { - time = std::time(nullptr); - } - monero_seed seed(time, coin); - print_seed(seed, coin, true); - } - else if (restore != nullptr) { - monero_seed seed(restore, coin); - print_seed(seed, coin, false); - } - else { - std::cout << "Monero 14-word mnemonic seed proof of concept" << std::endl; - std::cout << "Usage: " << std::endl; - std::cout << argv[0] << " --create [--date ] [--coin ]" << std::endl; - std::cout << argv[0] << " --restore \"<14-word seed>\" [--coin ]" << std::endl; - } - } - catch (const std::exception & ex) { - std::cout << "ERROR: " << ex.what() << std::endl; - return 1; - } - return 0; -} diff --git a/contrib/patches/polyseed/force-static-mingw.patch b/contrib/patches/polyseed/force-static-mingw.patch deleted file mode 100644 index f05cb2b..0000000 --- a/contrib/patches/polyseed/force-static-mingw.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/include/polyseed.h -+++ b/include/polyseed.h -@@ -93,13 +93,13 @@ Shared/static library definitions - - define POLYSEED_STATIC when linking to the static library - */ - #if defined(_WIN32) || defined(__CYGWIN__) -- #ifdef POLYSEED_SHARED -- #define POLYSEED_API __declspec(dllexport) -- #elif !defined(POLYSEED_STATIC) -- #define POLYSEED_API __declspec(dllimport) -- #else -- #define POLYSEED_API -- #endif -+// #ifdef POLYSEED_SHARED -+// #define POLYSEED_API __declspec(dllexport) -+// #elif !defined(POLYSEED_STATIC) -+// #define POLYSEED_API __declspec(dllimport) -+// #else -+ #define POLYSEED_API -+// #endif - #define POLYSEED_PRIVATE - #else - #ifdef POLYSEED_SHARED diff --git a/contrib/patches/polyseed/no_shared.patch b/contrib/patches/polyseed/no_shared.patch deleted file mode 100644 index 8a5f73b..0000000 --- a/contrib/patches/polyseed/no_shared.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -28,19 +28,20 @@ if(NOT CMAKE_BUILD_TYPE) - message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}") - endif() - --add_library(polyseed SHARED ${polyseed_sources}) --set_property(TARGET polyseed PROPERTY POSITION_INDEPENDENT_CODE ON) --set_property(TARGET polyseed PROPERTY PUBLIC_HEADER include/polyseed.h) --include_directories(polyseed -- include/) --target_compile_definitions(polyseed PRIVATE POLYSEED_SHARED) --set_target_properties(polyseed PROPERTIES VERSION 1.0.0 -- SOVERSION 1 -- C_STANDARD 11 -- C_STANDARD_REQUIRED ON) -+#add_library(polyseed SHARED ${polyseed_sources}) -+#set_property(TARGET polyseed PROPERTY POSITION_INDEPENDENT_CODE ON) -+#set_property(TARGET polyseed PROPERTY PUBLIC_HEADER include/polyseed.h) -+#include_directories(polyseed -+# include/) -+#target_compile_definitions(polyseed PRIVATE POLYSEED_SHARED) -+#set_target_properties(polyseed PROPERTIES VERSION 1.0.0 -+# SOVERSION 1 -+# C_STANDARD 11 -+# C_STANDARD_REQUIRED ON) - - add_library(polyseed_static STATIC ${polyseed_sources}) - set_property(TARGET polyseed_static PROPERTY POSITION_INDEPENDENT_CODE ON) -+set_property(TARGET polyseed_static PROPERTY PUBLIC_HEADER include/polyseed.h) - include_directories(polyseed_static - include/) - target_compile_definitions(polyseed_static PRIVATE POLYSEED_STATIC) -@@ -57,7 +58,7 @@ target_link_libraries(polyseed-tests - PRIVATE polyseed_static) - - include(GNUInstallDirs) --install(TARGETS polyseed polyseed_static -+install(TARGETS polyseed_static - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 81fb8a2..fb21e40 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,21 +1,6 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) - -if(NOT DEPENDS) - set(CMAKE_AUTORCC ON) -else() - add_executable(Qt5::moc IMPORTED) - set_target_properties(Qt5::moc PROPERTIES - IMPORTED_LOCATION "${NATIVE_BIN_PATH}/moc") - - add_executable(Qt5::rcc IMPORTED) - set_target_properties(Qt5::rcc PROPERTIES - IMPORTED_LOCATION "${NATIVE_BIN_PATH}/rcc") - - add_executable(Qt5::uic IMPORTED) - set_target_properties(Qt5::uic PROPERTIES - IMPORTED_LOCATION "${NATIVE_BIN_PATH}/uic") -endif() +set(CMAKE_AUTORCC ON) # pthread find_package(Threads REQUIRED) @@ -45,17 +30,11 @@ add_subdirectory(third-party/singleapplication) add_subdirectory(openpgp) -IF(DEPENDS) - # AutoRCC is broken in depends builds. - # RCC path in Options is an apparent Qt bug. It appears to ignore IMPORTED_LOCATION set earlier. - qt_add_resources(RESOURCES - assets.qrc assets_tor.qrc ui/qdarkstyle/style.qrc ui/BreezeStyleSheets/breeze.qrc - OPTIONS "${NATIVE_BIN_PATH}/rcc") -else() - qt_add_resources(RESOURCES assets.qrc assets_tor.qrc) -endif() +qt_add_resources(RESOURCES assets.qrc assets_tor.qrc) -find_library(ICONV_LIBRARIES iconv) +if (DEPENDS) + find_library(ICONV_LIBRARIES iconv) +endif() # Compile source files (.h/.cpp) file(GLOB SOURCE_FILES @@ -92,17 +71,28 @@ file(GLOB SOURCE_FILES "polyseed/*.c" "qrcode_scanner/QrCodeUtils.cpp" "qrcode_scanner/QrCodeUtils.h" + "monero_seed/argon2/blake2/*.c" + "monero_seed/argon2/*.c" + "monero_seed/*.cpp" + "monero_seed/*.c" + "monero_seed/*.hpp" ) if (WITH_SCANNER AND NOT Qt6_FOUND) file(GLOB SCANNER_FILES "qrcode_scanner/*.h" "qrcode_scanner/*.cpp") - - list(APPEND SOURCE_FILES - ${SCANNER_FILES}) endif() +if (WITH_SCANNER AND Qt6_FOUND) + file(GLOB SCANNER_FILES + "qrcode_scanner_qt6/*.h" + "qrcode_scanner_qt6/*.cpp") +endif() + +list(APPEND SOURCE_FILES + ${SCANNER_FILES}) + set(EXECUTABLE_FLAG) if(MINGW) set(EXECUTABLE_FLAG WIN32) @@ -116,46 +106,29 @@ if(MINGW) list(APPEND RESOURCES ${ICON_RES}) endif() -# mac os bundle -if(APPLE) - set(ICON ${PROJECT_SOURCE_DIR}/src/assets/images/appicons/appicon.icns) - set_source_files_properties(${ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") - list(APPEND RESOURCES ${ICON}) -endif() - add_executable(feather ${EXECUTABLE_FLAG} main.cpp ${SOURCE_FILES} ${RESOURCES} ${ASSETS_TOR} ) -# mac os bundle set_target_properties(feather PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" - MACOSX_BUNDLE TRUE - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/utils/Info.plist" LINK_FLAGS_RELEASE -s ) -set_property(TARGET feather PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -target_include_directories(feather PUBLIC ${QtGui_PRIVATE_INCLUDE_DIRS}) - target_include_directories(feather PUBLIC ${CMAKE_BINARY_DIR}/src/feather_autogen/include - ${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/monero/include ${CMAKE_SOURCE_DIR}/monero/src ${CMAKE_SOURCE_DIR}/monero/external/easylogging++ ${CMAKE_SOURCE_DIR}/monero/contrib/epee/include ${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/daemon ${CMAKE_CURRENT_SOURCE_DIR}/libwalletqt ${CMAKE_CURRENT_SOURCE_DIR}/model ${CMAKE_CURRENT_SOURCE_DIR}/utils ${CMAKE_CURRENT_SOURCE_DIR}/qrcode -# ${X11_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${QtCore_INCLUDE_DIRS} ${QtWidgets_INCLUDE_DIRS} @@ -169,8 +142,7 @@ target_include_directories(feather PUBLIC ${ZLIB_INCLUDE_DIRS} ${ZBAR_INCLUDE_DIR} ${POLYSEED_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIR} - ) +) if(WITH_SCANNER) target_include_directories(feather PUBLIC @@ -245,18 +217,6 @@ if (WITH_SCANNER) ) endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QtWidgets_EXECUTABLE_COMPILE_FLAGS}") - -if(UNIX AND NOT APPLE) - # https://stackoverflow.com/questions/57766620/cmake-add-library-doesnt-initialize-static-global-variable - # so that contrib/monero-seed/src/gf_elem.cpp properly initializes. A better solution is welcome. - target_link_libraries(feather -Wl,--whole-archive monero-seed -Wl,--no-whole-archive) -else() - target_link_libraries(feather monero-seed) -endif() - -MESSAGE(INFO "ZLIBBB ${ZLIB_LIBRARIES}") - target_link_libraries(feather wallet_merged ${LMDB_LIBRARY} @@ -278,21 +238,18 @@ target_link_libraries(feather openpgp Threads::Threads ${QRENCODE_LIBRARY} - ${ZLIB_LIBRARIES} ${ZBAR_LIBRARIES} ${POLYSEED_LIBRARY} SingleApplication::SingleApplication ${ICU_LIBRARIES} - ${ICONV_LIBRARIES} + ${LIBZIP_LIBRARIES} ${ZLIB_LIBRARIES} - ) +) -if(APPLE) +if(DEPENDS) target_link_libraries(feather ${ICONV_LIBRARIES}) endif() -target_link_libraries(feather ${LIBZIP_LIBRARIES} ${ZLIB_LIBRARIES}) - if(Qt6_FOUND) target_link_libraries(feather Qt::SvgWidgets) endif() @@ -327,16 +284,6 @@ if(STATIC AND NOT Qt6_FOUND) endif() endif() -#if(X11_FOUND) -# target_link_libraries(feather ${X11_LIBRARIES}) -#endif() - -#if(APPLE) -# include(Deploy) -#endif() - -target_link_libraries(feather ${ZLIB_LIBRARIES}) - install(TARGETS feather DESTINATION ${CMAKE_INSTALL_PREFIX} ) diff --git a/src/SendWidget.cpp b/src/SendWidget.cpp index a48c5d7..a8d1082 100644 --- a/src/SendWidget.cpp +++ b/src/SendWidget.cpp @@ -11,7 +11,7 @@ #include "utils/AppData.h" #include "Icons.h" -#ifdef WITH_SCANNER +#if defined(WITH_SCANNER) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include "qrcode_scanner/QrCodeScanDialog.h" #include #endif @@ -112,7 +112,7 @@ void SendWidget::fillAddress(const QString &address) { } void SendWidget::scanClicked() { -#ifdef WITH_SCANNER +#if defined(WITH_SCANNER) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) auto cameras = QCameraInfo::availableCameras(); if (cameras.count() < 1) { QMessageBox::warning(this, "QR code scanner", "No available cameras found."); diff --git a/src/cli.cpp b/src/cli.cpp deleted file mode 100644 index 0ca825c..0000000 --- a/src/cli.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// SPDX-FileCopyrightText: 2020-2022 The Monero Project - -#include "cli.h" - -// libwalletqt -#include "libwalletqt/TransactionHistory.h" -#include "libwalletqt/WalletManager.h" -#include "model/AddressBookModel.h" -#include "model/TransactionHistoryModel.h" -#include "utils/brute.h" -#include "utils/Utils.h" -#include "constants.h" - -CLI::CLI(Mode mode, QCommandLineParser *cmdargs, QObject *parent) - : QObject(parent) - , m_mode(mode) - , m_cmdargs(cmdargs) -{ - m_walletManager = WalletManager::instance(); - connect(m_walletManager, &WalletManager::walletOpened, this, &CLI::onWalletOpened); - - if (m_mode == Mode::ExportContacts || m_mode == Mode::ExportTxHistory) - { - if (!cmdargs->isSet("wallet-file")) { - this->finished("--wallet-file argument missing"); - return; - } - if (!cmdargs->isSet("password")) { - this->finished("--password argument missing"); - return; - } - - QString walletFile = cmdargs->value("wallet-file"); - QString password = cmdargs->value("password"); - - - m_walletManager->openWalletAsync(walletFile, password, constants::networkType, constants::kdfRounds, Utils::ringDatabasePath()); - } - else if (mode == Mode::BruteforcePassword) - { - QString keys_file = m_cmdargs->value("bruteforce-password"); - if (!keys_file.endsWith(".keys")) { - this->finished("Wallet file does not end with .keys"); - return; - } - - QStringList words; - if (m_cmdargs->isSet("bruteforce-dict")) { - QString data = Utils::barrayToString(Utils::fileOpen(m_cmdargs->value("bruteforce-dict"))); - words = data.split("\n"); - } - - if (!m_cmdargs->isSet("bruteforce-chars")) { - this->finished("--bruteforce-chars argument missing"); - return; - } - QString chars = m_cmdargs->value("bruteforce-chars"); - - brute b(chars.toStdString()); - if (words.isEmpty()) { - qDebug() << "No dictionairy specified, bruteforcing all chars"; - while (true) { - QString pass = QString::fromStdString(b.next()); - if (m_walletManager->verifyWalletPassword(keys_file, pass, false)) { - this->finished(QString("Found password: %1").arg(pass)); - break; - } - qDebug() << pass; - } - } - else { - bruteword bb(chars.toStdString()); - bool foundPass = false; - for (const auto& word: words) { - if (word.isEmpty()) { - continue; - } - bb.setWord(word.toStdString()); - - while (true) { - QString pass = QString::fromStdString(bb.next()); - if (pass == "") { - break; - } - if (m_walletManager->verifyWalletPassword(keys_file, pass, false)) { - this->finished(QString("Found password: %1").arg(pass)); - foundPass = true; - break; - } - qDebug() << pass; - } - if (foundPass) { - break; - } - } - - if (!foundPass) { - this->finished("Search space exhausted"); - } - } - } - else { - this->finished("Invalid mode"); - } -} - -void CLI::onWalletOpened(Wallet *w) { - QScopedPointer wallet{w}; - - if (wallet->status() != Wallet::Status_Ok) { - this->finished(wallet->errorString()); - return; - } - - if (m_mode == Mode::ExportContacts) { - auto *model = wallet->addressBookModel(); - QString fileName = m_cmdargs->value("export-contacts"); - if (model->writeCSV(fileName)) - this->finished(QString("Contacts exported to %1").arg(fileName)); - else - this->finished("Failed to export contacts"); - } - else if (m_mode == Mode::ExportTxHistory) { - wallet->history()->refresh(wallet->currentSubaddressAccount()); - auto *model = wallet->history(); - QString fileName = m_cmdargs->value("export-txhistory"); - if (model->writeCSV(fileName)) - this->finished(QString("Transaction history exported to %1").arg(fileName)); - else - this->finished("Failed to export transaction history"); - } -} - -void CLI::finished(const QString &message) { - qInfo() << message; - QApplication::quit(); -} diff --git a/src/cli.h b/src/cli.h deleted file mode 100644 index 4b4c957..0000000 --- a/src/cli.h +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// SPDX-FileCopyrightText: 2020-2022 The Monero Project - -#ifndef FEATHER_CLI_H -#define FEATHER_CLI_H - -#include -#include "appcontext.h" - -class CLI : public QObject -{ - Q_OBJECT - -public: - enum Mode { - Invalid, - ExportContacts, - ExportTxHistory, - BruteforcePassword - }; - - explicit CLI(Mode mode, QCommandLineParser *cmdargs, QObject *parent = nullptr); - -private slots: - void onWalletOpened(Wallet *wallet); - -private: - void finished(const QString &message); - - Mode m_mode; - QCommandLineParser *m_cmdargs; - WalletManager *m_walletManager; -}; - -#endif //FEATHER_CLI_H diff --git a/src/main.cpp b/src/main.cpp index 477df63..66e78aa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,7 +7,6 @@ #include #include -#include "cli.h" #include "config-feather.h" #include "constants.h" #include "MainWindow.h" @@ -66,44 +65,15 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { QCommandLineOption testnetOption(QStringList() << "testnet", "Testnet is for development purposes only."); parser.addOption(testnetOption); - QCommandLineOption walletPathOption(QStringList() << "wallet-file", "Path to wallet keys file.", "file"); - parser.addOption(walletPathOption); - - QCommandLineOption walletPasswordOption(QStringList() << "password", "Wallet password (escape/quote as needed)", "password"); - parser.addOption(walletPasswordOption); - - QCommandLineOption daemonAddressOption(QStringList() << "daemon-address", "Daemon address (IPv4:port)", "daemonAddress"); - parser.addOption(daemonAddressOption); - - QCommandLineOption exportContactsOption(QStringList() << "export-contacts", "Output wallet contacts as CSV to specified path.", "file"); - parser.addOption(exportContactsOption); - - QCommandLineOption exportTxHistoryOption(QStringList() << "export-txhistory", "Output wallet transaction history as CSV to specified path.", "file"); - parser.addOption(exportTxHistoryOption); - - QCommandLineOption bruteforcePasswordOption(QStringList() << "bruteforce-password", "Bruteforce wallet password", "file"); - parser.addOption(bruteforcePasswordOption); - - QCommandLineOption bruteforceCharsOption(QStringList() << "bruteforce-chars", "Chars used to bruteforce password", "string"); - parser.addOption(bruteforceCharsOption); - - QCommandLineOption bruteforceDictionairy(QStringList() << "bruteforce-dict", "Bruteforce dictionairy", "file"); - parser.addOption(bruteforceDictionairy); - bool parsed = parser.parse(argv_); if (!parsed) { qCritical() << parser.errorText(); exit(1); } - const QStringList args = parser.positionalArguments(); bool stagenet = parser.isSet(stagenetOption); bool testnet = parser.isSet(testnetOption); bool quiet = parser.isSet(quietModeOption); - bool exportContacts = parser.isSet(exportContactsOption); - bool exportTxHistory = parser.isSet(exportTxHistoryOption); - bool bruteforcePassword = parser.isSet(bruteforcePasswordOption); - bool cliMode = exportContacts || exportTxHistory || bruteforcePassword; // Setup networkType if (stagenet) @@ -177,21 +147,6 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { if (parser.isSet("use-local-tor")) config()->set(Config::useLocalTor, true); - if (cliMode) { - CLI::Mode mode = [&]{ - if (exportContacts) - return CLI::Mode::ExportContacts; - if (exportTxHistory) - return CLI::Mode::ExportTxHistory; - if (bruteforcePassword) - return CLI::Mode::BruteforcePassword; - return CLI::Mode::Invalid; - }(); - - CLI cli{mode, &parser, &app}; - return QCoreApplication::exec(); - } - parser.process(app); // Parse again for --help and --version if (!quiet) { @@ -235,7 +190,5 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { windowManager.raise(); }); - - return QApplication::exec(); } diff --git a/contrib/monero-seed/LICENSE.txt b/src/monero_seed/LICENSE.txt similarity index 100% rename from contrib/monero-seed/LICENSE.txt rename to src/monero_seed/LICENSE.txt diff --git a/contrib/monero-seed/README.md b/src/monero_seed/README.md similarity index 63% rename from contrib/monero-seed/README.md rename to src/monero_seed/README.md index d44196e..e40d1ec 100644 --- a/contrib/monero-seed/README.md +++ b/src/monero_seed/README.md @@ -1,11 +1,10 @@ -## Build -``` -git clone https://github.com/tevador/monero-seed.git -cd monero-seed -mkdir build && cd build -cmake .. -make -``` +## Note to package maintainers: + +This library was vendored because it is **deprecated** and **unmaintained**, it is kept for legacy reasons only. +Feather is the only project that will ever use this code, thus it is considered part of Feather source. +Do NOT unvendor this code. + +--- ## Features @@ -14,54 +13,6 @@ make * advanced checksum based on Reed-Solomon linear code, which allows certain types of errors to be detected without false positives and provides limited error correction capability * built-in way to make seeds incompatible between different coins, e.g. a seed for Aeon cannot be accidentally used to restore a Monero wallet -## Usage - -### Create a new seed - -``` -> ./monero-seed --create [--date ] [--coin ] -``` - -Example: -``` -> ./monero-seed --create --date 2100/03/14 --coin monero -Mnemonic phrase: test park taste security oxygen decorate essence ridge ship fish vehicle dream fluid pattern -- coin: monero -- private key: 7b816d8134e29393b0333eed4b6ed6edf97c156ad139055a706a6fb9599dcf8c -- created on or after: 02/Mar/2100 -``` - -### Restore seed -``` -./monero-seed --restore "<14-word seed>" [--coin ] -``` - -Example: - -``` -> ./monero-seed --restore "test park taste security oxygen decorate essence ridge ship fish vehicle dream fluid pattern" --coin monero -- coin: monero -- private key: 7b816d8134e29393b0333eed4b6ed6edf97c156ad139055a706a6fb9599dcf8c -- created on or after: 02/Mar/2100 -``` - -Attempting to restore the same seed under a different coin will fail: -``` -> ./monero-seed --restore "test park taste security oxygen decorate essence ridge ship fish vehicle dream fluid pattern" --coin aeon -ERROR: phrase is invalid (checksum mismatch) -``` - -Restore has limited error correction capability, namely it can correct a single erasure (illegible word with a known location). -This can be tested by replacing a word with `xxxx`: - -``` -> ./monero-seed --restore "test park xxxx security oxygen decorate essence ridge ship fish vehicle dream fluid pattern" --coin monero -Warning: corrected erasure: xxxx -> taste -- coin: monero -- private key: 7b816d8134e29393b0333eed4b6ed6edf97c156ad139055a706a6fb9599dcf8c -- created on or after: 02/Mar/2100 -``` - ## Implementation details The mnemonic phrase contains 154 bits of data, which are used as follows: diff --git a/contrib/monero-seed/src/argon2/argon2.c b/src/monero_seed/argon2/argon2.c similarity index 100% rename from contrib/monero-seed/src/argon2/argon2.c rename to src/monero_seed/argon2/argon2.c diff --git a/contrib/monero-seed/src/argon2/argon2.h b/src/monero_seed/argon2/argon2.h similarity index 100% rename from contrib/monero-seed/src/argon2/argon2.h rename to src/monero_seed/argon2/argon2.h diff --git a/contrib/monero-seed/src/argon2/blake2/blake2-impl.h b/src/monero_seed/argon2/blake2/blake2-impl.h similarity index 100% rename from contrib/monero-seed/src/argon2/blake2/blake2-impl.h rename to src/monero_seed/argon2/blake2/blake2-impl.h diff --git a/contrib/monero-seed/src/argon2/blake2/blake2.h b/src/monero_seed/argon2/blake2/blake2.h similarity index 100% rename from contrib/monero-seed/src/argon2/blake2/blake2.h rename to src/monero_seed/argon2/blake2/blake2.h diff --git a/contrib/monero-seed/src/argon2/blake2/blake2b.c b/src/monero_seed/argon2/blake2/blake2b.c similarity index 100% rename from contrib/monero-seed/src/argon2/blake2/blake2b.c rename to src/monero_seed/argon2/blake2/blake2b.c diff --git a/contrib/monero-seed/src/argon2/blake2/blamka-round-ref.h b/src/monero_seed/argon2/blake2/blamka-round-ref.h similarity index 100% rename from contrib/monero-seed/src/argon2/blake2/blamka-round-ref.h rename to src/monero_seed/argon2/blake2/blamka-round-ref.h diff --git a/contrib/monero-seed/src/argon2/core.c b/src/monero_seed/argon2/core.c similarity index 100% rename from contrib/monero-seed/src/argon2/core.c rename to src/monero_seed/argon2/core.c diff --git a/contrib/monero-seed/src/argon2/core.h b/src/monero_seed/argon2/core.h similarity index 100% rename from contrib/monero-seed/src/argon2/core.h rename to src/monero_seed/argon2/core.h diff --git a/contrib/monero-seed/src/argon2/ref.c b/src/monero_seed/argon2/ref.c similarity index 100% rename from contrib/monero-seed/src/argon2/ref.c rename to src/monero_seed/argon2/ref.c diff --git a/contrib/monero-seed/src/galois_field.cpp b/src/monero_seed/galois_field.cpp similarity index 100% rename from contrib/monero-seed/src/galois_field.cpp rename to src/monero_seed/galois_field.cpp diff --git a/contrib/monero-seed/include/monero_seed/galois_field.hpp b/src/monero_seed/galois_field.hpp similarity index 100% rename from contrib/monero-seed/include/monero_seed/galois_field.hpp rename to src/monero_seed/galois_field.hpp diff --git a/contrib/monero-seed/src/gf_elem.cpp b/src/monero_seed/gf_elem.cpp similarity index 100% rename from contrib/monero-seed/src/gf_elem.cpp rename to src/monero_seed/gf_elem.cpp diff --git a/contrib/monero-seed/include/monero_seed/gf_elem.hpp b/src/monero_seed/gf_elem.hpp similarity index 100% rename from contrib/monero-seed/include/monero_seed/gf_elem.hpp rename to src/monero_seed/gf_elem.hpp diff --git a/contrib/monero-seed/src/gf_poly.cpp b/src/monero_seed/gf_poly.cpp similarity index 100% rename from contrib/monero-seed/src/gf_poly.cpp rename to src/monero_seed/gf_poly.cpp diff --git a/contrib/monero-seed/include/monero_seed/gf_poly.hpp b/src/monero_seed/gf_poly.hpp similarity index 100% rename from contrib/monero-seed/include/monero_seed/gf_poly.hpp rename to src/monero_seed/gf_poly.hpp diff --git a/contrib/monero-seed/src/monero_seed.cpp b/src/monero_seed/monero_seed.cpp similarity index 100% rename from contrib/monero-seed/src/monero_seed.cpp rename to src/monero_seed/monero_seed.cpp diff --git a/contrib/monero-seed/include/monero_seed/monero_seed.hpp b/src/monero_seed/monero_seed.hpp similarity index 100% rename from contrib/monero-seed/include/monero_seed/monero_seed.hpp rename to src/monero_seed/monero_seed.hpp diff --git a/contrib/monero-seed/src/pbkdf2.c b/src/monero_seed/pbkdf2.c similarity index 100% rename from contrib/monero-seed/src/pbkdf2.c rename to src/monero_seed/pbkdf2.c diff --git a/contrib/monero-seed/src/pbkdf2.h b/src/monero_seed/pbkdf2.h similarity index 100% rename from contrib/monero-seed/src/pbkdf2.h rename to src/monero_seed/pbkdf2.h diff --git a/contrib/monero-seed/src/reed_solomon_code.cpp b/src/monero_seed/reed_solomon_code.cpp similarity index 100% rename from contrib/monero-seed/src/reed_solomon_code.cpp rename to src/monero_seed/reed_solomon_code.cpp diff --git a/contrib/monero-seed/include/monero_seed/reed_solomon_code.hpp b/src/monero_seed/reed_solomon_code.hpp similarity index 100% rename from contrib/monero-seed/include/monero_seed/reed_solomon_code.hpp rename to src/monero_seed/reed_solomon_code.hpp diff --git a/contrib/monero-seed/src/secure_random.cpp b/src/monero_seed/secure_random.cpp similarity index 100% rename from contrib/monero-seed/src/secure_random.cpp rename to src/monero_seed/secure_random.cpp diff --git a/contrib/monero-seed/include/monero_seed/secure_random.hpp b/src/monero_seed/secure_random.hpp similarity index 100% rename from contrib/monero-seed/include/monero_seed/secure_random.hpp rename to src/monero_seed/secure_random.hpp diff --git a/contrib/monero-seed/src/sha256/hash_impl.h b/src/monero_seed/sha256/hash_impl.h similarity index 100% rename from contrib/monero-seed/src/sha256/hash_impl.h rename to src/monero_seed/sha256/hash_impl.h diff --git a/contrib/monero-seed/src/wordlist.cpp b/src/monero_seed/wordlist.cpp similarity index 100% rename from contrib/monero-seed/src/wordlist.cpp rename to src/monero_seed/wordlist.cpp diff --git a/contrib/monero-seed/include/monero_seed/wordlist.hpp b/src/monero_seed/wordlist.hpp similarity index 100% rename from contrib/monero-seed/include/monero_seed/wordlist.hpp rename to src/monero_seed/wordlist.hpp diff --git a/src/qrcode_scanner_qt6/CMakeLists.txt b/src/qrcode_scanner_qt6/CMakeLists.txt new file mode 100644 index 0000000..e927cef --- /dev/null +++ b/src/qrcode_scanner_qt6/CMakeLists.txt @@ -0,0 +1,3 @@ +file(GLOB_RECURSE SRC_SOURCES *.cpp) +file(GLOB_RECURSE SRC_HEADERS *.h) + diff --git a/src/qrcode_scanner_qt6/QrCodeScanDialog.cpp b/src/qrcode_scanner_qt6/QrCodeScanDialog.cpp new file mode 100644 index 0000000..989c9fc --- /dev/null +++ b/src/qrcode_scanner_qt6/QrCodeScanDialog.cpp @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: BSD-3-Clause +// SPDX-FileCopyrightText: 2020-2022 The Monero Project + +#include "QrCodeScanDialog.h" +#include "ui_QrCodeScanDialog.h" + +#include +#include +#include + +QrCodeScanDialog::QrCodeScanDialog(QWidget *parent) + : QDialog(parent) + , ui(new Ui::QrCodeScanDialog) +{ + ui->setupUi(this); + + m_camera.reset(new QCamera(QMediaDevices::defaultVideoInput())); + m_captureSession.setCamera(m_camera.data()); + + m_captureSession.setVideoOutput(ui->viewfinder); + + m_camera->start(); + + const QList availableCameras = QMediaDevices::videoInputs(); +} + +QrCodeScanDialog::~QrCodeScanDialog() +{ +} \ No newline at end of file diff --git a/src/qrcode_scanner_qt6/QrCodeScanDialog.h b/src/qrcode_scanner_qt6/QrCodeScanDialog.h new file mode 100644 index 0000000..8ea94ff --- /dev/null +++ b/src/qrcode_scanner_qt6/QrCodeScanDialog.h @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: BSD-3-Clause +// SPDX-FileCopyrightText: 2020-2022 The Monero Project + +#ifndef FEATHER_QRCODESCANDIALOG_H +#define FEATHER_QRCODESCANDIALOG_H + +#include +#include +#include +#include + +namespace Ui { + class QrCodeScanDialog; +} + +class QrCodeScanDialog : public QDialog +{ + Q_OBJECT + +public: + explicit QrCodeScanDialog(QWidget *parent); + ~QrCodeScanDialog() override; + +private: + QScopedPointer ui; + + QScopedPointer m_camera; + QMediaCaptureSession m_captureSession; +}; + + +#endif //FEATHER_QRCODESCANDIALOG_H diff --git a/src/qrcode_scanner_qt6/QrCodeScanDialog.ui b/src/qrcode_scanner_qt6/QrCodeScanDialog.ui new file mode 100644 index 0000000..0f371e4 --- /dev/null +++ b/src/qrcode_scanner_qt6/QrCodeScanDialog.ui @@ -0,0 +1,75 @@ + + + QrCodeScanDialog + + + + 0 + 0 + 816 + 688 + + + + Dialog + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + QVideoWidget + QWidget +
qvideowidget.h
+ 1 +
+
+ + + + buttonBox + accepted() + QrCodeScanDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + QrCodeScanDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +
diff --git a/src/utils/RestoreHeightLookup.h b/src/utils/RestoreHeightLookup.h index 48f448b..b32e5a5 100644 --- a/src/utils/RestoreHeightLookup.h +++ b/src/utils/RestoreHeightLookup.h @@ -7,7 +7,7 @@ #include #include -#include +#include "monero_seed/monero_seed.hpp" #include "networktype.h" #include "utils/Utils.h" diff --git a/src/utils/brute.cpp b/src/utils/brute.cpp deleted file mode 100644 index d884c19..0000000 --- a/src/utils/brute.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// SPDX-FileCopyrightText: 2020-2022 The Monero Project - -#include "brute.h" - -brute::brute(const std::string &chars) { - this->chars = chars; - this->len = chars.length(); -} - -std::string brute::next() { - std::string out; - int c = count; - int i; - while (c >= 0){ - i = (c % len); - out = chars[i] + out; - c = (c / len) - 1; - } - count += 1; - return out; -} - -bruteword::bruteword(const std::string &chars) { - this->m_chars = chars; - this->m_currentStrategy = strategy::ReplaceSingle; -} - -void bruteword::setWord(const std::string &word) { - this->m_currentStrategy = strategy::ReplaceSingle; - m_word = word; - resetIndex(); -} - -void bruteword::nextStrategy() { - m_currentStrategy = static_cast(static_cast(m_currentStrategy) + 1); - resetIndex(); -} - -void bruteword::resetIndex() { - iword = 0; - ichar = 0; -} - -std::string bruteword::next() { - std::string out = m_word; - - switch(m_currentStrategy) { - case strategy::ReplaceSingle: { - if (iword >= m_word.length()) { - this->nextStrategy(); - return next(); - } - out[iword] = m_chars[ichar]; - ichar++; - if (ichar == m_chars.length()){ - ichar = 0; - iword++; - } - return out; - } - - case strategy::AppendSingle: { - if (ichar >= m_chars.length()) { - this->nextStrategy(); - return next(); - } - out += m_chars[ichar]; - ichar++; - return out; - } - - case strategy::PrependSingle: { - if (ichar >= m_chars.length()) { - this->nextStrategy(); - return next(); - } - out = m_chars[ichar] + out; - ichar++; - return out; - } - - case strategy::SwitchLetters: { - if (iword+1 >= out.length()) { - this->nextStrategy(); - return next(); - } - char l = out[iword]; - out[iword] = out[iword+1]; - out[iword+1] = l; - iword++; - return out; - } - - case strategy::DeleteSingle: { - if (iword >= out.length()) { - this->nextStrategy(); - return next(); - } - out = out.substr(0, iword) + out.substr(iword+1); - iword++; - return out; - } - - case strategy::AddSingle: { - if (iword+1 >= out.length()) { - this->nextStrategy(); - return next(); - } - out = out.substr(0, iword+1) + m_chars[ichar] + out.substr(iword+1); - ichar++; - if (ichar == m_chars.length()) { - ichar = 0; - iword++; - } - return out; - } - - case strategy::END: { - return ""; - } - } - - return ""; -} \ No newline at end of file diff --git a/src/utils/brute.h b/src/utils/brute.h deleted file mode 100644 index 223c966..0000000 --- a/src/utils/brute.h +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// SPDX-FileCopyrightText: 2020-2022 The Monero Project - -#ifndef FEATHER_BRUTE_H -#define FEATHER_BRUTE_H - -#include - -class brute { -public: - explicit brute(const std::string &chars); - - std::string next(); - - std::string chars; - std::string current; - int len; - int count = 0; -}; - -class bruteword { -public: - enum strategy { - ReplaceSingle = 0, - AppendSingle, - PrependSingle, - SwitchLetters, - DeleteSingle, - AddSingle, - END - }; - - explicit bruteword(const std::string &chars); - void nextStrategy(); - void setWord(const std::string &word); - - std::string next(); - -private: - void resetIndex(); - - std::string m_chars; - std::string m_word; - strategy m_currentStrategy; - - size_t iword = 0; - size_t ichar = 0; -}; - -#endif //FEATHER_BRUTE_H diff --git a/utils/build_macos.sh b/utils/build_macos.sh deleted file mode 100644 index 41399c3..0000000 --- a/utils/build_macos.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -# Used for macos buildbot -HASH="$1" -echo "[+] hash: $HASH" - -echo "[+] Building" - -rm ~/feather.zip 2>&1 >/dev/null -cd ~/feather -git fetch --all -git reset --hard "$HASH" -git submodule update --init --depth 120 monero -git submodule update --init --depth 120 --recursive monero - -cp "/Users/administrator/tor/libevent-2.1.7.dylib" "/Users/administrator/feather/src/assets/exec/libevent-2.1.7.dylib" -CMAKE_PREFIX_PATH="~/Qt/5.15.1/clang_64" TOR_BIN="/Users/administrator/tor/tor" make -j3 mac-release - -if [[ $? -eq 0 ]]; then - echo "[+] Feather built OK" - cd ~/feather/build/bin - zip -qr ~/feather.zip feather.app -else - echo "[+] Error!" - exit 1; -fi