add helpers for git cloning and building

This commit is contained in:
Matthew Stobbs
2025-03-31 19:44:02 -06:00
parent dc120c0fec
commit 6593947256
5 changed files with 68 additions and 50 deletions

View File

@@ -3,11 +3,12 @@
- name: Set aquamarine config
ansible.builtin.set_fact:
aquamarine:
vers: "{{ pkgconfig.aquamarine.version }}"
repo: "{{ pkgconfig.aquamarine.repo }}"
git_path: "{{ d_tempdir.path }}/aquamarine"
pkg_deps: "{{ pkgconfig.aquamarine.pkg_deps }}"
installed_files: "{{ pkgconfig.aquamarine.build_installed_files }}"
bin: aquamarine
build: "{{ pkgconfig.aquamarine.build }}"
build_deps: "{{ pkgconfig.aquamarine.build_deps[ansible_os_family] }}"
clean: "{{ pkgconfig_hyprland_clean | default(package_default_clean_src) }}"
git_path: "{{ d_tempdir.path }}/aquamarine"
installed_files: "{{ pkgconfig.aquamarine.build_installed_files }}"
pkg_deps: "{{ pkgconfig.aquamarine.pkg_deps }}"
repo: "{{ pkgconfig.aquamarine.repo }}"
vers: "{{ pkgconfig.aquamarine.version }}"

View File

@@ -0,0 +1,19 @@
# vim: set filetype=yaml.ansible :
---
- name: Configure {{ repo.git_path }}
ansible.builtin.command:
creates: "{{ repo.git_path }}/build"
chdir: "{{ repo.git_path }}"
argv: "{{ repo.build.configure }}"
- name: Build {{ repo.git_path }}
ansible.builtin.command:
creates: "{{ repo.git_path }}/{{ repo.build.creates }}"
chdir: "{{ repo.git_path }}"
argv: "{{ repo.build.build }}"
- name: Install {{ repo.git_push }}
ansible.buitlin.command:
creates: "{{ repo.prefix }}/{{ repo.build.installs }}"
chdir: "{{ repo.git_path }}"
argv: "{{ repo.build.install }}"

7
tasks/helpers/git.yml Normal file
View File

@@ -0,0 +1,7 @@
- name: Clone git repository {{ repo.repo }}
ansible.builtin.git:
depth: 1
force: true
dest: "{{ repo.git_path }}"
repo: "{{ repo.repo }}"
version: "{{ repo.version | default(omit) }}"

View File

@@ -20,13 +20,11 @@
when:
- not stat_aquamarine_inst.stat.exists
block:
- name: Clone git repository {{ pkg }}
ansible.builtin.git:
depth: 1
force: true
dest: "{{ aquamarine.git_path }}"
repo: "{{ aquamarine.repo }}"
version: "{{ aquamarine.vers }}"
- name: Do repo clone {{ pkg }}
vars:
repo: "{{ aquamarine }}"
ansible.builtin.include_tasks:
file: helpers/git.yml
- name: Apply patch for alpine linux {{ pkg }}
when:
@@ -37,41 +35,8 @@
state: present
strip: 1
- name: Configure {{ pkg }}
ansible.builtin.command:
creates: "{{ aquamarine.git_path }}/build"
chdir: "{{ aquamarine.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: "{{ aquamarine.git_path }}/build/libaquamarine.so"
chdir: "{{ aquamarine.git_path }}"
argv:
- cmake
- --build
- ./build
- --config
- Release
- --target
- all
- -j
- "{{ ansible_processor_nproc | int }}"
- name: Install {{ pkg }}
become: true
ansible.builtin.command:
creates: "{{ hyprland.prefix }}/{{ lib_path }}/libaquamarine.so"
chdir: "{{ aquamarine.git_path }}"
argv:
- cmake
- --install
- ./build
- name: Do build and install {{ pkg }}
vars:
repo: "{{ aquamarine }}"
ansible.builtin.include_tasks:
file: helpers/cmake_build.yml

View File

@@ -6,6 +6,32 @@ aquamarine:
pkg_deps:
- hyprwayland_scanner
- hyprutils
build:
configure:
- cmake
- --no-warn-unused-cli
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX={{ hyprland.prefix }}
- -S
- .
- -B
- ./build
creates: build/libaquamarine.so
build:
- cmake
- --build
- ./build
- --config
- Release
- --target
- all
- -j
- "{{ ansible_processor_nproc | int }}"
installs: "{{ lib_path }}/libaquamarine.so"
install:
- cmake
- --install
- ./build
build_deps:
RedHat:
- hwdata-devel