|
| 1 | +# SPDX-FileCopyrightText: Copyright © 2026, Jared Cook |
| 2 | +# SPDX-License-Identifier: AGPL-3.0-or-later |
| 3 | + |
| 4 | +# This is a subroutine of pkg-source-build-routine |
| 5 | +--- |
| 6 | +- name: Collect running user facts |
| 7 | + ansible.builtin.include_tasks: utilities/sudo_user_facts.yml |
| 8 | + when: sudo_user is not defined |
| 9 | + |
| 10 | +- name: Build {{ autobuild.git_repo.name }} from source using Make |
| 11 | + become: true |
| 12 | + become_user: "{{ sudo_user }}" |
| 13 | + when: autobuild.git_repo is defined and autobuild.git_repo.directory is defined |
| 14 | + block: |
| 15 | + - name: Clean {{ autobuild.git_repo.name }} with Make to ensure clean build |
| 16 | + ansible.builtin.command: make clean |
| 17 | + args: |
| 18 | + chdir: "{{ autobuild.git_repo.directory }}" |
| 19 | + become: true |
| 20 | + become_user: root |
| 21 | + |
| 22 | + - name: Check if Autogen configure script exists |
| 23 | + ansible.builtin.stat: |
| 24 | + path: "{{ autobuild.git_repo.directory }}/configure" |
| 25 | + register: configure_check |
| 26 | + |
| 27 | + - name: Make Configuration if using autogen |
| 28 | + when: configure_check.stat.exists |
| 29 | + block: |
| 30 | + # TODO: This same step will need to be added to cmake |
| 31 | + # NOTE: Assumed that this path is /opt/** |
| 32 | + - name: Ensure Installation Path exists |
| 33 | + ansible.builtin.file: |
| 34 | + path: "{{ autobuild.build.full_install_path }}" |
| 35 | + state: directory |
| 36 | + owner: root |
| 37 | + group: root |
| 38 | + mode: "0755" |
| 39 | + become: true |
| 40 | + become_user: root |
| 41 | + when: autobuild.build.full_install_path is defined |
| 42 | + |
| 43 | + - name: Build Prefix Settings Generation |
| 44 | + ansible.builtin.set_fact: |
| 45 | + autobuild: >- |
| 46 | + {{ autobuild |
| 47 | + | combine({'build': autobuild.build |
| 48 | + | combine({'prefix': ('--prefix=', autobuild.build.full_install_path) | join('')}) |
| 49 | + }) |
| 50 | + }} |
| 51 | +
|
| 52 | + - name: View Build Variables |
| 53 | + ansible.builtin.debug: |
| 54 | + msg: "{{ autobuild.build }}" |
| 55 | + |
| 56 | + - name: build configure |
| 57 | + ansible.builtin.set_fact: |
| 58 | + configure: >- |
| 59 | + {{ ['./configure', autobuild.build.prefix, autobuild.build.flags] | select('defined') | join(' ') }} |
| 60 | +
|
| 61 | + - name: View Build Variables |
| 62 | + ansible.builtin.debug: |
| 63 | + msg: "{{ configure }}" |
| 64 | + |
| 65 | + - name: Run ./autogen.sh for autogen project {{ autobuild.git_repo.name }} |
| 66 | + ansible.builtin.shell: autogen.sh > ansible-autogen.log |
| 67 | + args: |
| 68 | + executable: /bin/bash |
| 69 | + chdir: "{{ autobuild.git_repo.directory }}" |
| 70 | + |
| 71 | + - name: Run ./configure for autogen project {{ autobuild.git_repo.name }} |
| 72 | + ansible.builtin.shell: "{{ configure }} > ansible-configure.log" |
| 73 | + args: |
| 74 | + executable: /bin/bash |
| 75 | + chdir: "{{ autobuild.git_repo.directory }}" |
| 76 | + |
| 77 | + - name: Build {{ autobuild.git_repo.name }} with Make |
| 78 | + ansible.builtin.shell: make > ansible-make.log |
| 79 | + args: |
| 80 | + executable: /bin/bash |
| 81 | + chdir: "{{ autobuild.git_repo.directory }}" |
0 commit comments