From 937d76934d267e306117b914df89e5f425ef4d74 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sun, 21 Apr 2024 19:56:46 +0300 Subject: [PATCH 1/3] CMake: install files (instead of Makefile) --- CMakeLists.txt | 71 +++++++++++++++++++++++++++++++++++++++--- Makefile | 63 ++++++------------------------------- hyprctl/CMakeLists.txt | 15 ++++++++- hyprland.pc.in | 6 ++-- hyprpm/CMakeLists.txt | 13 ++++++++ 5 files changed, 105 insertions(+), 63 deletions(-) mode change 100755 => 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index cdf72fe0757..72dae45706f --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.27) + include(CheckIncludeFile) +include(ExternalProject) +include(GNUInstallDirs) # Get version file(READ ${CMAKE_CURRENT_SOURCE_DIR}/props.json PROPS) @@ -12,6 +15,7 @@ project(Hyprland set(HYPRLAND_VERSION ${VER}) set(PREFIX ${CMAKE_INSTALL_PREFIX}) +set(INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}) configure_file(hyprland.pc.in hyprland.pc @ONLY) set(CMAKE_MESSAGE_LOG_LEVEL "STATUS") @@ -23,8 +27,6 @@ message(STATUS "Gathering git info") execute_process( COMMAND ./scripts/generateVersion.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -# -# # udis add_subdirectory("subprojects/udis86") @@ -32,8 +34,6 @@ add_subdirectory("subprojects/udis86") # wlroots message(STATUS "Setting up wlroots") -include(ExternalProject) - if(CMAKE_BUILD_TYPE) string(TOLOWER ${CMAKE_BUILD_TYPE} BUILDTYPE_LOWER) if(BUILDTYPE_LOWER STREQUAL "release") @@ -112,7 +112,7 @@ pkg_check_modules(deps REQUIRED IMPORTED_TARGET hyprwayland-scanner>=0.3.4 hyprlang>=0.3.2 hyprcursor>=0.1.7 ) -file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp") +file(GLOB_RECURSE SRCFILES "src/*.cpp") set(TRACY_CPP_FILES "") if(USE_TRACY) @@ -287,3 +287,64 @@ protocolNew("staging/ext-session-lock/ext-session-lock-v1.xml" "ext-session-lock # tools add_subdirectory(hyprctl) add_subdirectory(hyprpm) + +# binary and symlink +install(TARGETS Hyprland) + +install(CODE "execute_process( \ + COMMAND ${CMAKE_COMMAND} -E create_symlink \ + ${CMAKE_INSTALL_BINDIR}/Hyprland \ + ${CMAKE_INSTALL_BINDIR}/hyprland + )" +) + +# session file +install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.desktop + DESTINATION ${CMAKE_INSTALL_DATADIR}/wayland-sessions) + +# wallpapers +file(GLOB_RECURSE WALLPAPERS "assets/wall*") +install(FILES ${WALLPAPERS} + DESTINATION ${CMAKE_INSTALL_DATADIR}/hyprland) + +# default config +install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.conf + DESTINATION ${CMAKE_INSTALL_DATADIR}/hyprland) + +# portal config +install(FILES ${CMAKE_SOURCE_DIR}/assets/hyprland-portals.conf + DESTINATION ${CMAKE_INSTALL_DATADIR}/xdg-desktop-portal) + +# man pages +file(GLOB_RECURSE MANPAGES "docs/*.1") +install(FILES ${MANPAGES} + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) + + +# pkgconfig entry +install(FILES ${CMAKE_BINARY_DIR}/hyprland.pc + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) + +# wlroots headers +set(HEADERS_WLR "${CMAKE_CURRENT_SOURCE_DIR}/subprojects/wlroots-hyprland/include/wlr") +install(DIRECTORY ${HEADERS_WLR} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland + FILES_MATCHING PATTERN "*.h") + +# config.h and version.h +set(HEADERS_WLR_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/subprojects/wlroots-hyprland/build/include/wlr") +install(DIRECTORY ${HEADERS_WLR_ROOT}/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland/wlr + FILES_MATCHING PATTERN "*.h") + +# protocol headers +set(HEADERS_PROTO "${CMAKE_CURRENT_SOURCE_DIR}/protocols") +install(DIRECTORY ${HEADERS_PROTO} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland + FILES_MATCHING PATTERN "*.h*") + +# hyprland headers +set(HEADERS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src") +install(DIRECTORY ${HEADERS_SRC} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland + FILES_MATCHING PATTERN "*.h*") diff --git a/Makefile b/Makefile index 077319939f2..53ac0fdf72d 100644 --- a/Makefile +++ b/Makefile @@ -2,27 +2,27 @@ PREFIX = /usr/local legacyrenderer: cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja - cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` + cmake --build ./build --config Release --target all chmod -R 777 ./build legacyrendererdebug: cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja - cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` + cmake --build ./build --config Release --target all chmod -R 777 ./build release: cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build -G Ninja - cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` + cmake --build ./build --config Release --target all chmod -R 777 ./build debug: cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build -G Ninja - cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` + cmake --build ./build --config Debug --target all chmod -R 777 ./build nopch: cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -S . -B ./build -G Ninja - cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` + cmake --build ./build --config Release --target all clear: rm -rf build @@ -30,58 +30,14 @@ clear: rm -rf ./subprojects/wlroots-hyprland/build all: - @if [[ "$EUID" = 0 ]]; then echo -en "Avoid running $(MAKE) all as sudo.\n"; fi $(MAKE) clear $(MAKE) release install: - @if [ ! -f ./build/Hyprland ]; then echo -en "You need to run $(MAKE) all first.\n" && exit 1; fi - @echo -en "!NOTE: Please note make install does not compile Hyprland and only installs the already built files." - - mkdir -p ${PREFIX}/share/wayland-sessions - mkdir -p ${PREFIX}/bin - mkdir -p ${PREFIX}/share/hyprland - mkdir -p ${PREFIX}/share/bash-completion/completions - mkdir -p ${PREFIX}/share/fish/vendor_completions.d - mkdir -p ${PREFIX}/share/zsh/site-functions - cp -f ./build/Hyprland ${PREFIX}/bin - cp -f ./build/hyprctl/hyprctl ${PREFIX}/bin - cp -f ./build/hyprpm/hyprpm ${PREFIX}/bin - cp -f ./hyprctl/hyprctl.bash ${PREFIX}/share/bash-completion/completions/hyprctl - cp -f ./hyprctl/hyprctl.fish ${PREFIX}/share/fish/vendor_completions.d/hyprctl.fish - cp -f ./hyprctl/hyprctl.zsh ${PREFIX}/share/zsh/site-functions/_hyprctl - cp -f ./hyprpm/hyprpm.bash ${PREFIX}/share/bash-completion/completions/hyprpm - cp -f ./hyprpm/hyprpm.fish ${PREFIX}/share/fish/vendor_completions.d/hyprpm.fish - cp -f ./hyprpm/hyprpm.zsh ${PREFIX}/share/zsh/site-functions/_hyprpm - chmod 755 ${PREFIX}/bin/Hyprland - chmod 755 ${PREFIX}/bin/hyprctl - chmod 755 ${PREFIX}/bin/hyprpm - cd ${PREFIX}/bin && ln -sf Hyprland hyprland - if [ ! -f ${PREFIX}/share/wayland-sessions/hyprland.desktop ]; then cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions; fi - cp ./assets/wall* ${PREFIX}/share/hyprland - mkdir -p ${PREFIX}/share/xdg-desktop-portal - cp ./assets/hyprland-portals.conf ${PREFIX}/share/xdg-desktop-portal - - mkdir -p ${PREFIX}/share/man/man1 - install -m644 ./docs/*.1 ${PREFIX}/share/man/man1 - - $(MAKE) installheaders + cmake --install ./build uninstall: - rm -f ${PREFIX}/share/wayland-sessions/hyprland.desktop - rm -f ${PREFIX}/bin/Hyprland - rm -f ${PREFIX}/bin/hyprland - rm -f ${PREFIX}/bin/hyprctl - rm -f ${PREFIX}/bin/hyprpm - rm -rf ${PREFIX}/share/hyprland - rm -f ${PREFIX}/share/man/man1/Hyprland.1 - rm -f ${PREFIX}/share/man/man1/hyprctl.1 - rm -f ${PREFIX}/share/bash-completion/completions/hyprctl - rm -f ${PREFIX}/share/fish/vendor_completions.d/hyprctl.fish - rm -f ${PREFIX}/share/zsh/site-functions/_hyprctl - rm -f ${PREFIX}/share/bash-completion/completions/hyprpm - rm -f ${PREFIX}/share/fish/vendor_completions.d/hyprpm.fish - rm -f ${PREFIX}/share/zsh/site-functions/_hyprpm + xargs rm < ./build/install_manifest.txt pluginenv: @echo -en "$(MAKE) pluginenv has been deprecated.\nPlease run $(MAKE) all && sudo $(MAKE) installheaders\n" @@ -95,7 +51,7 @@ installheaders: mkdir -p ${PREFIX}/include/hyprland/protocols mkdir -p ${PREFIX}/include/hyprland/wlroots-hyprland mkdir -p ${PREFIX}/share/pkgconfig - + find src -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland cd subprojects/wlroots-hyprland/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots-hyprland && cd ../../.. cd subprojects/wlroots-hyprland/build/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots-hyprland && cd ../../../.. @@ -143,8 +99,7 @@ asan: patch -p1 < ./scripts/hyprlandStaticAsan.diff cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DWITH_ASAN:STRING=True -DUSE_TRACY:STRING=False -DUSE_TRACY_GPU:STRING=False -S . -B ./build -G Ninja - cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` + cmake --build ./build --config Debug --target all @echo "Hyprland done" ASAN_OPTIONS="detect_odr_violation=0,log_path=asan.log" HYPRLAND_NO_CRASHREPORTER=1 ./build/Hyprland -c ~/.config/hypr/hyprland.conf - diff --git a/hyprctl/CMakeLists.txt b/hyprctl/CMakeLists.txt index 99964b50aa3..6f70ace8fb6 100644 --- a/hyprctl/CMakeLists.txt +++ b/hyprctl/CMakeLists.txt @@ -5,4 +5,17 @@ project( DESCRIPTION "Control utility for Hyprland" ) -add_executable(hyprctl "main.cpp") \ No newline at end of file +add_executable(hyprctl "main.cpp") + +# binary +install(TARGETS hyprctl) + +# shell completions +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprctl.bash + DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions + RENAME hyprctl) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprctl.fish + DESTINATION ${CMAKE_INSTALL_DATADIR}/fish/vendor_completions.d) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprctl.zsh + DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions + RENAME _hyprctl) diff --git a/hyprland.pc.in b/hyprland.pc.in index c93e8f42795..45e9c6040a4 100644 --- a/hyprland.pc.in +++ b/hyprland.pc.in @@ -1,8 +1,8 @@ -prefix="@PREFIX@" -includedir="${prefix}/include" +prefix=@PREFIX@ +includedir=@INCLUDEDIR@ Name: Hyprland URL: https://github.com/hyprwm/Hyprland Description: Hyprland header files Version: @HYPRLAND_VERSION@ -Cflags: -I"${includedir}/hyprland/protocols" -I"${includedir}/hyprland/wlroots-hyprland" -I"${includedir}" +Cflags: -I${includedir} -I${includedir}/hyprland/protocols -I${includedir}/hyprland diff --git a/hyprpm/CMakeLists.txt b/hyprpm/CMakeLists.txt index a6bd1eca8ee..8b6a8320737 100644 --- a/hyprpm/CMakeLists.txt +++ b/hyprpm/CMakeLists.txt @@ -14,3 +14,16 @@ pkg_check_modules(tomlplusplus REQUIRED IMPORTED_TARGET tomlplusplus) add_executable(hyprpm ${SRCFILES}) target_link_libraries(hyprpm PUBLIC PkgConfig::tomlplusplus) + +# binary +install(TARGETS hyprpm) + +# shell completions +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprpm.bash + DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions + RENAME hyprpm) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprpm.fish + DESTINATION ${CMAKE_INSTALL_DATADIR}/fish/vendor_completions.d) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprpm.zsh + DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions + RENAME _hyprpm) From 96e5be2449689f4262bf79496ccb33e6b3bcf2bb Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sun, 21 Apr 2024 19:58:54 +0300 Subject: [PATCH 2/3] Nix: use CMake for builds instead of Meson Build using submodules instead of patching the build process and using Nix derivations of the subprojects. From this commit on, you'll have to change the Hyprland flake url to `git+https://github.com/hyprwm/Hyprland?submodules=1` --- flake.lock | 25 ++------------ flake.nix | 25 ++------------ nix/default.nix | 62 +++++++++++++++++------------------ nix/overlays.nix | 30 ++++++++--------- nix/patches/meson-build.patch | 61 ---------------------------------- nix/udis86.nix | 32 ------------------ nix/wlroots.nix | 16 --------- 7 files changed, 49 insertions(+), 202 deletions(-) delete mode 100644 nix/patches/meson-build.patch delete mode 100644 nix/udis86.nix delete mode 100644 nix/wlroots.nix diff --git a/flake.lock b/flake.lock index 4dc48dc9dc7..976553d3a4e 100644 --- a/flake.lock +++ b/flake.lock @@ -29,9 +29,11 @@ "hyprland-protocols": { "inputs": { "nixpkgs": [ + "xdph", "nixpkgs" ], "systems": [ + "xdph", "systems" ] }, @@ -114,12 +116,10 @@ "root": { "inputs": { "hyprcursor": "hyprcursor", - "hyprland-protocols": "hyprland-protocols", "hyprlang": "hyprlang", "hyprwayland-scanner": "hyprwayland-scanner", "nixpkgs": "nixpkgs", "systems": "systems", - "wlroots": "wlroots", "xdph": "xdph" } }, @@ -138,28 +138,9 @@ "type": "github" } }, - "wlroots": { - "flake": false, - "locked": { - "lastModified": 1713731601, - "narHash": "sha256-bdcKdtLkusvv85DNuJsajZLFeq7bXp+x5AGP1Sd4wD8=", - "owner": "hyprwm", - "repo": "wlroots-hyprland", - "rev": "5c1d51c5a2793480f5b6c4341ad0797052aec2ea", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "wlroots-hyprland", - "rev": "5c1d51c5a2793480f5b6c4341ad0797052aec2ea", - "type": "github" - } - }, "xdph": { "inputs": { - "hyprland-protocols": [ - "hyprland-protocols" - ], + "hyprland-protocols": "hyprland-protocols", "hyprlang": [ "hyprlang" ], diff --git a/flake.nix b/flake.nix index 69d1dfedcab..eff2b3cd37c 100644 --- a/flake.nix +++ b/flake.nix @@ -7,14 +7,6 @@ # systems.url = "github:nix-systems/default-linux"; - wlroots = { - type = "github"; - owner = "hyprwm"; - repo = "wlroots-hyprland"; - rev = "5c1d51c5a2793480f5b6c4341ad0797052aec2ea"; - flake = false; - }; - hyprcursor = { url = "github:hyprwm/hyprcursor"; inputs.nixpkgs.follows = "nixpkgs"; @@ -22,12 +14,6 @@ inputs.hyprlang.follows = "hyprlang"; }; - hyprland-protocols = { - url = "github:hyprwm/hyprland-protocols"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.systems.follows = "systems"; - }; - hyprlang = { url = "github:hyprwm/hyprlang"; inputs.nixpkgs.follows = "nixpkgs"; @@ -44,7 +30,6 @@ url = "github:hyprwm/xdg-desktop-portal-hyprland"; inputs.nixpkgs.follows = "nixpkgs"; inputs.systems.follows = "systems"; - inputs.hyprland-protocols.follows = "hyprland-protocols"; inputs.hyprlang.follows = "hyprlang"; }; }; @@ -92,8 +77,6 @@ # dependencies hyprland-protocols - wlroots-hyprland - udis86 ; }); @@ -103,13 +86,9 @@ stdenv = pkgsFor.${system}.gcc13Stdenv; } { name = "hyprland-shell"; - nativeBuildInputs = with pkgsFor.${system}; [cmake python3 expat libxml2]; - buildInputs = [self.packages.${system}.wlroots-hyprland]; + nativeBuildInputs = with pkgsFor.${system}; [expat libxml2]; hardeningDisable = ["fortify"]; - inputsFrom = [ - self.packages.${system}.wlroots-hyprland - self.packages.${system}.hyprland - ]; + inputsFrom = [pkgsFor.${system}.hyprland]; }; }); diff --git a/nix/default.nix b/nix/default.nix index 216e69a50ad..e9d81fd7270 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -4,10 +4,12 @@ pkg-config, pkgconf, makeWrapper, + cmake, meson, ninja, binutils, cairo, + expat, git, hyprcursor, hyprland-protocols, @@ -19,19 +21,19 @@ libexecinfo, libinput, libuuid, - libxcb, libxkbcommon, mesa, pango, pciutils, + python3, systemd, tomlplusplus, udis86, wayland, wayland-protocols, wayland-scanner, - wlroots-hyprland, - xcbutilwm, + wlroots, + xorg, xwayland, debug ? false, enableXWayland ? true, @@ -48,9 +50,7 @@ }: assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed."; assert lib.assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed."; -assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland"; let - wlr = wlroots-hyprland.override {inherit enableXWayland;}; -in +assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland"; stdenv.mkDerivation { pname = "hyprland${lib.optionalString debug "-debug"}"; inherit version; @@ -63,11 +63,6 @@ in src = lib.cleanSource ../.; }; - patches = [ - # make meson use the provided wlroots instead of the git submodule - ./patches/meson-build.patch - ]; - postPatch = '' # Fix hardcoded paths to /usr installation sed -i "s#/usr#$out#" src/render/OpenGL.cpp @@ -91,9 +86,11 @@ in hyprwayland-scanner jq makeWrapper + cmake meson ninja pkg-config + python3 wayland-scanner ]; @@ -103,10 +100,12 @@ in "dev" ]; - buildInputs = - wlr.buildInputs - ++ [ + buildInputs = lib.concatLists [ + wlroots.buildInputs + udis86.buildInputs + [ cairo + expat git hyprcursor.dev hyprland-protocols @@ -120,31 +119,32 @@ in pango pciutils tomlplusplus - udis86 wayland wayland-protocols - wlr ] - ++ lib.optionals stdenv.hostPlatform.isMusl [libexecinfo] - ++ lib.optionals enableXWayland [libxcb xcbutilwm xwayland] - ++ lib.optionals withSystemd [systemd]; + (lib.optionals stdenv.hostPlatform.isMusl [libexecinfo]) + (lib.optionals enableXWayland [ + xorg.libxcb + xorg.libXdmcp + xorg.xcbutil + xorg.xcbutilwm + xwayland + ]) + (lib.optionals withSystemd [systemd]) + ]; - mesonBuildType = + cmakeBuildType = if debug - then "debug" - else "release"; + then "Debug" + else "RelWithDebInfo"; - mesonAutoFeatures = "disabled"; - - mesonFlags = [ - (lib.mesonEnable "xwayland" enableXWayland) - (lib.mesonEnable "legacy_renderer" legacyRenderer) - (lib.mesonEnable "systemd" withSystemd) + cmakeFlags = [ + (lib.cmakeBool "NO_XWAYLAND" (!enableXWayland)) + (lib.cmakeBool "LEGACY_RENDERER" legacyRenderer) + (lib.cmakeBool "NO_SYSTEMD" (!withSystemd)) ]; postInstall = '' - ln -s ${wlr}/include/wlr $dev/include/hyprland/wlroots - ${lib.optionalString wrapRuntimeDeps '' wrapProgram $out/bin/Hyprland \ --suffix PATH : ${lib.makeBinPath [ @@ -161,7 +161,7 @@ in homepage = "https://github.com/hyprwm/Hyprland"; description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks"; license = licenses.bsd3; - platforms = wlr.meta.platforms; + platforms = wlroots.meta.platforms; mainProgram = "Hyprland"; }; } diff --git a/nix/overlays.nix b/nix/overlays.nix index 3a7dca52734..50d9f9d92bb 100644 --- a/nix/overlays.nix +++ b/nix/overlays.nix @@ -22,12 +22,11 @@ in { hyprland-packages = lib.composeManyExtensions [ # Dependencies inputs.hyprcursor.overlays.default - inputs.hyprland-protocols.overlays.default inputs.hyprlang.overlays.default inputs.hyprwayland-scanner.overlays.default - self.overlays.wlroots-hyprland - self.overlays.udis86 self.overlays.wayland-protocols + self.overlays.xwayland + # Hyprland packages themselves (final: prev: let date = mkDate (self.lastModifiedDate or "19700101"); @@ -36,19 +35,20 @@ in { stdenv = final.gcc13Stdenv; version = "${props.version}+date=${date}_${self.shortRev or "dirty"}"; commit = self.rev or ""; - udis86 = final.udis86-hyprland; # explicit override until decided on breaking change of the name - inherit (final) wlroots-hyprland; # explicit override until decided on breaking change of the name inherit date; }; hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;}; hyprland-debug = final.hyprland.override {debug = true;}; hyprland-legacy-renderer = final.hyprland.override {legacyRenderer = true;}; + + # deprecated packages hyprland-nvidia = builtins.trace '' hyprland-nvidia was removed. Please use the hyprland package. Nvidia patches are no longer needed. '' final.hyprland; + hyprland-hidpi = builtins.trace '' hyprland-hidpi was removed. Please use the hyprland package. @@ -64,18 +64,14 @@ in { inputs.xdph.overlays.xdg-desktop-portal-hyprland ]; - udis86 = final: prev: { - udis86-hyprland = final.callPackage ./udis86.nix {}; - }; - - # Patched version of wlroots for Hyprland. - # It is under a new package name so as to not conflict with - # the standard version in nixpkgs. - wlroots-hyprland = final: prev: { - wlroots-hyprland = final.callPackage ./wlroots.nix { - version = "${mkDate (inputs.wlroots.lastModifiedDate or "19700101")}_${inputs.wlroots.shortRev or "dirty"}"; - src = inputs.wlroots; - }; + # Patches XWayland's pkgconfig file to not include Cflags or includedir + # The above two variables trip up CMake and the build fails + xwayland = final: prev: { + xwayland = prev.xwayland.overrideAttrs (old: { + postInstall = '' + sed -i '/includedir/d' $out/lib/pkgconfig/xwayland.pc + ''; + }); }; wayland-protocols = final: prev: { diff --git a/nix/patches/meson-build.patch b/nix/patches/meson-build.patch deleted file mode 100644 index eb1d3f9a591..00000000000 --- a/nix/patches/meson-build.patch +++ /dev/null @@ -1,61 +0,0 @@ -diff --git a/meson.build b/meson.build -index 40883073..d8f2e536 100644 ---- a/meson.build -+++ b/meson.build -@@ -33,20 +33,7 @@ if cpp_compiler.check_header('execinfo.h') - add_project_arguments('-DHAS_EXECINFO', language: 'cpp') - endif - --wlroots = subproject('wlroots-hyprland', default_options: ['examples=false', 'renderers=gles2']) --have_xwlr = wlroots.get_variable('features').get('xwayland') --xcb_dep = dependency('xcb', required: get_option('xwayland')) -- --cmake = import('cmake') --udis = cmake.subproject('udis86') --udis86 = udis.dependency('libudis86') -- --if get_option('xwayland').enabled() and not have_xwlr -- error('Cannot enable Xwayland in Hyprland: wlroots has been built without Xwayland support') --endif --have_xwayland = xcb_dep.found() and have_xwlr -- --if not have_xwayland -+if get_option('xwayland').disabled() - add_project_arguments('-DNO_XWAYLAND', language: 'cpp') - endif - -@@ -65,8 +52,6 @@ if get_option('buildtype') == 'debug' - add_project_arguments('-DHYPRLAND_DEBUG', language: 'cpp') - endif - --version_h = run_command('sh', '-c', 'scripts/generateVersion.sh') -- - globber = run_command('find', 'src', '-name', '*.h*', check: true) - headers = globber.stdout().strip().split('\n') - foreach file : headers -diff --git a/src/meson.build b/src/meson.build -index 15c69552..327aa4fb 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -9,7 +9,7 @@ executable('Hyprland', src, - server_protos, - dependency('wayland-server'), - dependency('wayland-client'), -- wlroots.get_variable('wlroots'), -+ dependency('wlroots'), - dependency('cairo'), - dependency('hyprcursor'), - dependency('hyprlang', version: '>= 0.3.2'), -@@ -17,10 +17,10 @@ executable('Hyprland', src, - dependency('egl'), - dependency('xkbcommon'), - dependency('libinput'), -- xcb_dep, -+ dependency('xcb', required: get_option('xwayland')), - backtrace_dep, - epoll_dep, -- udis86, -+ dependency('udis86'), - - dependency('pixman-1'), - dependency('gl', 'opengl'), diff --git a/nix/udis86.nix b/nix/udis86.nix deleted file mode 100644 index d5e92afca01..00000000000 --- a/nix/udis86.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - autoreconfHook, - python3, -}: -stdenv.mkDerivation { - pname = "udis86"; - version = "unstable-2022-10-13"; - - src = fetchFromGitHub { - owner = "canihavesomecoffee"; - repo = "udis86"; - rev = "5336633af70f3917760a6d441ff02d93477b0c86"; - hash = "sha256-HifdUQPGsKQKQprByeIznvRLONdOXeolOsU5nkwIv3g="; - }; - - nativeBuildInputs = [autoreconfHook python3]; - - configureFlags = ["--enable-shared"]; - - outputs = ["bin" "out" "dev" "lib"]; - - meta = with lib; { - homepage = "https://udis86.sourceforge.net"; - license = licenses.bsd2; - mainProgram = "udcli"; - description = "Easy-to-use, minimalistic x86 disassembler library (libudis86)"; - platforms = platforms.all; - }; -} diff --git a/nix/wlroots.nix b/nix/wlroots.nix deleted file mode 100644 index b0dccb00ec3..00000000000 --- a/nix/wlroots.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - version, - src, - git, - wlroots, - enableXWayland ? true, -}: -wlroots.overrideAttrs (old: { - inherit version src enableXWayland; - - pname = "${old.pname}-hyprland"; - - patches = [ ]; # don't inherit old.patches - - nativeBuildInputs = old.nativeBuildInputs ++ [ git ]; -}) From a4c0d56c4e2efac9849e9bca708aca3df399d599 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sun, 21 Apr 2024 20:13:59 +0300 Subject: [PATCH 3/3] CI/Nix: build with submodules - Clone repo recursively - Update Nix install action - Remove wlroots update --- .github/workflows/nix-build.yml | 5 +++-- .github/workflows/nix-ci.yml | 7 +++---- .github/workflows/nix-update-inputs.yml | 11 ++++------ .github/workflows/nix-update-wlroots.yml | 26 ------------------------ 4 files changed, 10 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/nix-update-wlroots.yml diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index 45db0b5ed11..33ee5cac41a 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -18,12 +18,13 @@ jobs: uses: actions/checkout@v3 with: ref: ${{ github.ref }} + submodules: recursive - - uses: cachix/install-nix-action@v25 + - uses: cachix/install-nix-action@v26 - uses: DeterminateSystems/magic-nix-cache-action@main - uses: cachix/cachix-action@v12 with: name: hyprland authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: nix build .#${{ matrix.package }} --extra-substituters "https://hyprland.cachix.org" -L + - run: nix build '.?submodules=1#${{ matrix.package }}' -L --extra-substituters "https://hyprland.cachix.org" diff --git a/.github/workflows/nix-ci.yml b/.github/workflows/nix-ci.yml index f0de7f5c170..3b017576554 100644 --- a/.github/workflows/nix-ci.yml +++ b/.github/workflows/nix-ci.yml @@ -3,13 +3,12 @@ name: Nix on: [push, pull_request, workflow_dispatch] jobs: - wlroots: - if: github.event_name != 'pull_request' - uses: ./.github/workflows/nix-update-wlroots.yml + update-inputs: + uses: ./.github/workflows/nix-update-inputs.yml secrets: inherit build: if: always() && !cancelled() && !contains(needs.*.result, 'failure') - needs: wlroots + needs: update-inputs uses: ./.github/workflows/nix-build.yml secrets: inherit diff --git a/.github/workflows/nix-update-inputs.yml b/.github/workflows/nix-update-inputs.yml index f5df3f4fc08..000900d9632 100644 --- a/.github/workflows/nix-update-inputs.yml +++ b/.github/workflows/nix-update-inputs.yml @@ -1,8 +1,10 @@ name: Nix on: - schedule: - - cron: '0 0 * * *' # check daily + workflow_call: + secrets: + PAT: + required: true jobs: update: @@ -22,8 +24,3 @@ jobs: uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: "[gha] Nix: update inputs" - - update-build: - needs: update - uses: ./.github/workflows/nix-build.yml - secrets: inherit diff --git a/.github/workflows/nix-update-wlroots.yml b/.github/workflows/nix-update-wlroots.yml deleted file mode 100644 index a0db9ef5bb7..00000000000 --- a/.github/workflows/nix-update-wlroots.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Nix - -on: - workflow_call: - secrets: - PAT: - required: true - -jobs: - update: - name: wlroots - runs-on: ubuntu-latest - steps: - - name: Clone repository - uses: actions/checkout@v3 - with: - token: ${{ secrets.PAT }} - - - uses: DeterminateSystems/nix-installer-action@main - - name: Update lockfile - run: nix/update-wlroots.sh - - - name: Commit - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: "[gha] Nix: update wlroots"