From 8814ff5bc7e0ba07d2122e922fbf8a0df5dc25bf Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 1 Apr 2025 03:53:23 -0600 Subject: [PATCH] port hyprgraphics to using helpers --- tasks/config/hyprgraphics.yml | 2 +- tasks/src/hyprgraphics.yml | 74 +++++++++++------------------------ vars/src/hyrpgraphics.yml | 26 ++++++++++++ 3 files changed, 49 insertions(+), 53 deletions(-) diff --git a/tasks/config/hyprgraphics.yml b/tasks/config/hyprgraphics.yml index bedf3b9..5dcd41f 100644 --- a/tasks/config/hyprgraphics.yml +++ b/tasks/config/hyprgraphics.yml @@ -5,7 +5,7 @@ hyprgraphics: vers: "{{ pkgconfig.hyprgraphics.version }}" repo: "{{ pkgconfig.hyprgraphics.repo }}" - build_deps: "{{ pkgconfig.hyprgraphics.build_deps[ansible_os_family] }}" + build_deps: "{{ srcconfig.hyprgraphics.deps[ansible_os_family] }}" installed_files: "{{ pkgconfig.hyprgraphics.build_installed_files }}" git_path: "{{ d_tempdir.path }}/hyprgraphics" clean: "{{ pkgconfig_hyprland_clean | default(package_default_clean_src) }}" diff --git a/tasks/src/hyprgraphics.yml b/tasks/src/hyprgraphics.yml index d30be62..2fdf34c 100644 --- a/tasks/src/hyprgraphics.yml +++ b/tasks/src/hyprgraphics.yml @@ -3,13 +3,10 @@ - name: Remove existing install of {{ pkg }} when: - hyprgraphics.clean - become: true - loop: "{{ hyprgraphics.installed_files }}" - loop_control: - loop_var: file - ansible.builtin.file: - state: absent - path: "{{ hyprland.prefix }}/{{ file }}" + vars: + file_list: "{{ srcconfig.hyprcursor.build_installed_files }}" + ansible.builtin.include_tasks: + file: helpers/clean_install.yml - name: Check for existing install {{ pkg }} register: stat_hyprgraphics_inst @@ -20,49 +17,22 @@ when: - not stat_hyprgraphics_inst.stat.exists block: - - name: Clone git repository {{ pkg }} - ansible.builtin.git: - force: true - depth: 1 - dest: "{{ hyprgraphics.git_path }}" - repo: "{{ hyprgraphics.repo }}" - version: "{{ hyprgraphics.vers }}" + - name: Do repo clone {{ pkg }} + vars: + src_pkg: hyprgraphics + src_path: "{{ srcconfig.hyprgraphics.src_path }}" + src_gitrepo: "{{ srconfig.hyprgraphics.gitrepo }}" + src_version: "{{ hyprgraphics.vers }}" + ansible.builtin.include_tasks: + file: helpers/git.yml - - name: Configure {{ pkg }} - ansible.builtin.command: - creates: "{{ hyprgraphics.git_path }}/build" - chdir: "{{ hyprgraphics.git_path }}" - argv: - - cmake - - --no-warn-unused-cli - - DCMAKE_BUILD_TYPE=Release - - -DCMAKE_INSTALL_PREFIX={{ hyprland.prefix }} - - -S - - . - - -B - - ./build - - - name: Build {{ pkg }} - ansible.builtin.command: - creates: "{{ hyprgraphics.git_path }}/build/libhyprgraphics.so" - chdir: "{{ hyprgraphics.git_path }}" - argv: - - cmake - - --build - - ./build - - --config - - Release - - --target - - all - - -j - - "{{ ansible_processor_nproc | int }}" - - - name: Install {{ pkg }} - become: true - ansible.builtin.command: - creates: "{{ path.bin }}/hyprgraphics" - chdir: "{{ hyprgraphics.git_path }}" - argv: - - cmake - - --install - - ./build + - name: CMake build and install {{ pkg }} + vars: + src_path: "{{ srcconfig.hyprgraphics.src_path }}" + configure: "{{ srcconfig.hyprgraphics.configure }}" + build_creates: "{{ srcconfig.hyprgraphics.build_creates }}" + build: "{{ srcconfig.hyprgraphics.build }}" + install_creates: "{{ srcconfig.hyprgraphics.install_creates }}" + install: "{{ srcconfig.hyprcursor.install }}" + ansible.builtin.include_tasks: + files: helpers/cmake_build.yml diff --git a/vars/src/hyrpgraphics.yml b/vars/src/hyrpgraphics.yml index 1770e6e..3ef09a0 100644 --- a/vars/src/hyrpgraphics.yml +++ b/vars/src/hyrpgraphics.yml @@ -1,6 +1,32 @@ # vim: set filetype=yaml.ansible : --- hyprgraphics: + src_path: "{{ d_tempdir.path }}/hyprgraphics" + configure: + - cmake + - --no-warn-unused-cli + - DCMAKE_BUILD_TYPE=Release + - -DCMAKE_INSTALL_PREFIX={{ hyprland.prefix }} + - -S + - . + - -B + - ./build + build_creates: "{{ d_tempdir.path }}/hyprgraphics/build/libhyprgraphics.so" + build: + - cmake + - --build + - ./build + - --config + - Release + - --target + - all + - -j + - "{{ ansible_processor_nproc | int }}" + install_creates: "{{ root_prefix }}/{{ lib_path }}/libhyprgraphics.so.0.1.2" + install: + - cmake + - --install + - ./build deps: RedHat: - pixman-devel