standarizing cmake builds

This commit is contained in:
Matthew Stobbs
2025-03-31 21:17:22 -06:00
parent 4da72c2539
commit 40adb16987
18 changed files with 242 additions and 216 deletions

View File

@@ -11,7 +11,7 @@
ansible.builtin.set_fact:
alacritty:
method: "{{ alacritty.method }}"
build_deps: "{{ pkgconfig.alacritty.build_deps[ansible_os_family] }}"
build_deps: "{{ srcconfig.alacritty.deps[ansible_os_family] }}"
cargo:
vers: "{{ pkgconfig.alacritty.version }}"
locked: true

View File

@@ -4,11 +4,7 @@
ansible.builtin.set_fact:
aquamarine:
bin: aquamarine
build: "{{ pkgconfig.aquamarine.build }}"
build_deps: "{{ pkgconfig.aquamarine.build_deps[ansible_os_family] }}"
build_deps: "{{ srcconfig.aquamarine.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

@@ -6,7 +6,5 @@
vers: "{{ pkgconfig.hyprcursor.version }}"
repo: "{{ pkgconfig.hyprcursor.repo }}"
pkg_deps: "{{ pkgconfig.hyprcursor.pkg_deps }}"
build_deps: "{{ pkgconfig.hyprcursor.build_deps[ansible_os_family] }}"
installed_files: "{{ pkgconfig.hyprcursor.build_installed_files }}"
git_path: "{{ d_tempdir.path }}/hyprcursor"
build_deps: "{{ srcconfig.hyprcursor.deps[ansible_os_family] }}"
clean: "{{ pkgconfig_hyprland_clean | default(package_default_clean_src) }}"

View File

@@ -40,6 +40,7 @@
pipx_exec: "/usr/bin/pipx"
sys_pkg_become: true # Linux package managers require sudo access
lib_path: lib64
root_prefix: /usr/local
- name: Set alpine linux specific facts
when:

View File

@@ -0,0 +1,10 @@
# vim: set filetype=yaml.ansible :
---
- name: Remove file list
become: true
loop: "{{ file_list }}"
loop_control:
loop_var: file
ansible.builtin.file:
state: absent
path: "{{ file }}"

View File

@@ -2,18 +2,18 @@
---
- name: Configure {{ repo.git_path }}
ansible.builtin.command:
creates: "{{ repo.git_path }}/build"
chdir: "{{ repo.git_path }}"
argv: "{{ repo.build.configure }}"
creates: "{{ src_path }}/build"
chdir: "{{ src_path }}"
argv: "{{ configure }}"
- name: Build {{ repo.git_path }}
ansible.builtin.command:
creates: "{{ repo.git_path }}/{{ repo.build.creates }}"
chdir: "{{ repo.git_path }}"
argv: "{{ repo.build.build }}"
creates: "{{ build_creates }}"
chdir: "{{ src_path }}"
argv: "{{ build }}"
- name: Install {{ repo.git_push }}
ansible.buitlin.command:
creates: "{{ repo.prefix }}/{{ repo.build.installs }}"
chdir: "{{ repo.git_path }}"
argv: "{{ repo.build.install }}"
ansible.builtin.command:
creates: "{{ install_creates }}"
chdir: "{{ src_path }}"
argv: "{{ install }}"

View File

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

View File

@@ -62,8 +62,16 @@
ansible.builtin.debug:
var: pkgconfig
- name: End playbook
ansible.builtin.meta: end_play
- name: Read default package configuration
ansible.builtin.include_vars:
dir: src
extensions:
- yml
name: srcconfig
- name: Dump srcconfig
ansible.builtin.debug:
var: srcconfig
- name: Generate package installation lists
loop: "{{ packages | unique }}"

View File

@@ -3,13 +3,10 @@
- name: Remove existing install {{ pkg }}
when:
- aquamarine.clean
become: true
loop: "{{ aquamarine.installed_files }}"
loop_control:
loop_var: file
ansible.builtin.file:
state: absent
path: "{{ hyprland.prefix }}/{{ file }}"
vars:
file_list: "{{ srcconfig.aquamarine.build_installed_files }}"
ansible.builtin.include_tasks:
files: helpers/clean_install.yml
- name: Check for installed {{ pkg }}
register: stat_aquamarine_inst
@@ -22,7 +19,10 @@
block:
- name: Do repo clone {{ pkg }}
vars:
repo: "{{ aquamarine }}"
src_pkg: aquamarine
src_path: "{{ srcconfig.aquamarine.src_path }}"
src_gitrepo: "{{ srcconfig.aquamarine.gitrepo }}"
src_version: "{{ aquamarine.vers }}"
ansible.builtin.include_tasks:
file: helpers/git.yml
@@ -37,6 +37,11 @@
- name: Do build and install {{ pkg }}
vars:
repo: "{{ aquamarine }}"
src_path: "{{ srcconfig.aquamarine.src_path }}"
configure: "{{ srcconfig.aquamarine.configure }}"
build_creates: "{{ srcconfig.aquamarine.build_creates }}"
build: "{{ srcconfig.aquamarine.build }}"
install_creates: "{{ srcconfig.aquamarine.install_creates }}"
install: "{{ srcconfig.aquamarine.install }}"
ansible.builtin.include_tasks:
file: helpers/cmake_build.yml

View File

@@ -3,13 +3,10 @@
- name: Remove existing install of {{ pkg }}
when:
- hyprcursor.clean
become: true
loop: "{{ hyprcursor.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 installed {{ pkg }}
register: stat_hyprcursor_inst
@@ -20,49 +17,22 @@
when:
- not stat_hyprcursor_inst.stat.exists
block:
- name: Clone git repository {{ pkg }}
ansible.builtin.git:
depth: 1
force: true
dest: "{{ hyprcursor.git_path }}"
repo: "{{ hyprcursor.repo }}"
version: "{{ hyprcursor.vers }}"
- name: Do repo clone {{ pkg }}
vars:
src_pkg: hyprcursor
src_path: "{{ srcconfig.hyprcursor.src_path }}"
src_gitrepo: "{{ srcconfig.hyprcursor.gitrepo }}"
src_version: "{{ hyprcursor.vers }}"
ansible.builtin.include_tasks:
file: helpers/git.yml
- name: Configure {{ pkg }}
ansible.builtin.command:
creates: "{{ hyprcursor.git_path }}/build"
chdir: "{{ hyprcursor.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: "{{ hyprcursor.git_path }}/build/hyprcursor.so"
chdir: "{{ hyprcursor.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 }}/hyprcursor"
chdir: "{{ hyprcursor.git_path }}"
argv:
- cmake
- --install
- ./build
- name: CMake build and install {{ pkg }}
vars:
src_path: "{{ srcconfig.hyprcursor.src_path }}"
configure: "{{ srcconfig.hyprcursor.configure }}"
build_creates: "{{ srcconfig.hyprcursor.build_creates }}"
build: "{{ srcconfig.hyprcursor.build }}"
install_creates: "{{ srcconfig.hyprcursor.install_creates }}"
install: "{{ srcconfig.hyprcursor.install }}"
ansible.builtin.include_tasks:
file: helpers/cmake_build.yml