diff --git a/tasks/config/aquamarine.yml b/tasks/config/aquamarine.yml index a7323e6..9fd8f9e 100644 --- a/tasks/config/aquamarine.yml +++ b/tasks/config/aquamarine.yml @@ -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 }}" diff --git a/tasks/helpers/cmake_build.yml b/tasks/helpers/cmake_build.yml new file mode 100644 index 0000000..e3bd32c --- /dev/null +++ b/tasks/helpers/cmake_build.yml @@ -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 }}" diff --git a/tasks/helpers/git.yml b/tasks/helpers/git.yml new file mode 100644 index 0000000..31e49b9 --- /dev/null +++ b/tasks/helpers/git.yml @@ -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) }}" diff --git a/tasks/src/aquamarine.yml b/tasks/src/aquamarine.yml index 84f5d97..76bdf80 100644 --- a/tasks/src/aquamarine.yml +++ b/tasks/src/aquamarine.yml @@ -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 diff --git a/vars/pkgs/aquamarine.yml b/vars/pkgs/aquamarine.yml index 818589e..296f75c 100644 --- a/vars/pkgs/aquamarine.yml +++ b/vars/pkgs/aquamarine.yml @@ -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