diff --git a/tasks/helpers/make.yml b/tasks/helpers/make.yml index c971a34..8f8200a 100644 --- a/tasks/helpers/make.yml +++ b/tasks/helpers/make.yml @@ -5,21 +5,29 @@ ## Variables: ## --- -- name: Fetch source code +- name: Fetch source code git vars: path: "{{ pkg.path }}" repo: "{{ pkg.repo }}" version: "{{ pkg.version | default(omit) }}" + when: + - pkg.repo is defined ansible.builtin.include_tasks: helpers/git.yml +- name: Fetch source code archive + vars: + archive: "{{ pkg }}" + when: + - pkg.extract_to is defined + ansible.builtin.include_tasks: helpers/archive.yml + - name: Run configure target when: - pkg.target.configure is defined register: make_configure - community.general.make: + ansible.builtin.command: chdir: "{{ pkg.path }}" - target: "{{ pkg.target.configure.name }}" - params: "{{ pkg.target.configure.params | default(omit) }}" + argv: ["./configure", "{{ pkg.target.configure.options }}"] - name: Run build target when: diff --git a/tasks/pkgs/stow.yml b/tasks/pkgs/stow.yml index e69de29..1e4c349 100644 --- a/tasks/pkgs/stow.yml +++ b/tasks/pkgs/stow.yml @@ -0,0 +1,66 @@ +# vim: set filetype=yaml.ansible : +# +## Package: stow +## Description: GNU symbolic link manager +## Version: latest +## Methods: [system, source] +## Helpers: make +--- +- name: Set stow default facts # {{{ + ansible.builtin.set_fact: + stow: + methods: + - system + - source + pkgname: + RedHat: stow + Archlinux: stow + baseurl: https://ftp.gnu.org/gnu/stow + version: 2.4.1 +# }}} +- name: Configure stow + when: + - "'stow' not in __configured" + block: + - name: Set stow install method + when: + - stow_imethod is undefined + ansible.builtin.set_fact: + stow_imethod: "{{ imethod if imethod in stow.methods else stow.methods[0] }}" + + - name: Configure stow system install + when: + - stow_imethod == 'system' + block: + - name: Queue stow for system install + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + [stow.pkgname[os_family]] }}" + stow_install: "{{ stow_imethod }}={{ stow.pkgname[os_family] }}" + + - name: Configure stow source install + when: + - stow_imethod == 'source' + block: + - name: Set stow source install configuration + ansible.builtin.set_fact: + stow_src_install: + url: "{{ stow.baseurl }}/stow-{{ stow.version }}.tar.gz" + name: "stow-{{ stow.version }}.tar.gz" + extract_to: "{{ d_cache.path }}" + path: "{{ d_cache.path }}/stow-{{ stow.version }}" + target: + configure: + options: "--prefix={{ install_prefix }}" + build: + name: "" + install: + name: install + + - name: Queue stow source install + ansible.builtin.set_fact: + pkg_make: "{{ pkg_make + [stow_src_install] }}" + stow_install: "{{ stow_imethod }}={{ stow_src_install }}" + + - name: Finalise stow configuration + ansible.builtin.set_fact: + __configured: "{{ __configured | combine( { 'stow': stow_install } ) }}"