Unverified Commit c8a020b7 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

sqlitebrowser: add .app bundle for darwin (#495064)

parents 26d646d1 d76b8cbd
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
diff -ru source/CMakeLists.txt source-patched/CMakeLists.txt
--- source/CMakeLists.txt	1970-01-01 01:00:01.000000000 +0100
+++ source-patched/CMakeLists.txt	2024-09-03 11:09:48.289053141 +0200
@@ -39,9 +39,7 @@
 set(CMAKE_AUTOMOC ON)
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 
-if(APPLE)
-    add_executable(${PROJECT_NAME} MACOSX_BUNDLE)
-elseif(WIN32)
+if(WIN32)
     add_executable(${PROJECT_NAME} WIN32)
 else()
     add_executable(${PROJECT_NAME})
@@ -106,33 +104,6 @@
     list(PREPEND CMAKE_PREFIX_PATH ${QT5_PATH} ${SQLITE3_PATH})
 endif()
@@ -60,27 +49,3 @@ diff -ru source/CMakeLists.txt source-patched/CMakeLists.txt
 find_package(${LIBSQLITE_NAME})
 if (sqlcipher)
     target_link_libraries(${PROJECT_NAME} SQLCipher::SQLCipher)
@@ -510,7 +474,7 @@
     endif()
 endif()
 
-if((NOT WIN32 AND NOT APPLE) OR MINGW)
+if(NOT WIN32 OR MINGW)
     install(TARGETS ${PROJECT_NAME}
         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -630,14 +594,6 @@
     )
 endif()
 
-if(APPLE)
-    set_target_properties(${PROJECT_NAME} PROPERTIES
-        BUNDLE True
-        OUTPUT_NAME "DB Browser for SQLite"
-        MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/src/app.plist
-    )
-endif()
-
 # CPack configuration
 set(CPACK_STRIP_FILES ON)
 set(CPACK_DEBIAN_PACKAGE_PRIORITY optional)
+16 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
  pkg-config,
  libsForQt5,
  sqlcipher,
  nix-update-script,
}:

let
@@ -28,6 +29,9 @@ stdenv.mkDerivation (finalAttrs: {
  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail '"Unknown"' '"${finalAttrs.src.rev}"'

    substituteInPlace src/app.plist \
      --replace-fail '@ICON@' 'icon.icns'
  ''
  # Fix build with CMake 4
  # Will be part of the Qt6 port
@@ -62,10 +66,22 @@ stdenv.mkDerivation (finalAttrs: {
    (lib.cmakeFeature "QSCINTILLA_INCLUDE_DIR" "${lib.getDev qt'.qscintilla}/include")
  ];

  postInstall = lib.optional stdenv.hostPlatform.isDarwin ''
    # Copy the icon file to the app bundle
    target="$(find . -name "*.app")"
    mkdir -p "$target/Contents/Resources/"
    cp $src/installer/macos/macapp.icns "$target/Contents/Resources/icon.icns"

    mkdir -p $out/Applications
    cp -r *.app $out/Applications
  '';

  env.LANG = "C.UTF-8";

  doCheck = true;

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "DB Browser for SQLite";
    mainProgram = "sqlitebrowser";