... | ... |
@@ -2,6 +2,10 @@ |
2 | 2 |
|
3 | 3 |
An [Ansible][] [role][] for cloning, building and installing [`xwinwrap`][]. |
4 | 4 |
|
5 |
+Installs build dependencies, clones <https://github.com/ujjwal96/xwinwrap> |
|
6 |
+(overridable with the variable `xwinwrap_repo`), builds it, and installs the |
|
7 |
+results into `/usr/local` (overridable with the variable `xwinwrap_prefix`). |
|
8 |
+ |
|
5 | 9 |
[`ansible-role-xwinwrap`]: https://git.rcrnstn.net/rcrnstn/ansible-role-xwinwrap |
6 | 10 |
[Ansible]: https://docs.ansible.com/ansible |
7 | 11 |
[role]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html |
0 | 5 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,22 @@ |
1 |
+#!/bin/sh |
|
2 |
+set -euC |
|
3 |
+ |
|
4 |
+prefix="${1:-"/usr/local"}" |
|
5 |
+repo="${2:-"https://github.com/ujjwal96/xwinwrap"}" |
|
6 |
+commitish="${3:-"ec32e9b72539de7e1553a4f70345166107b431f7"}" |
|
7 |
+ |
|
8 |
+sudo= |
|
9 |
+if [ "$(stat -c '%U' "$prefix")" != "$USER" ] |
|
10 |
+then |
|
11 |
+ sudo=sudo |
|
12 |
+fi |
|
13 |
+ |
|
14 |
+tmp_dir="$(mktemp -d)" |
|
15 |
+trap 'rm -rf "$tmp_dir"' EXIT INT |
|
16 |
+cd "$tmp_dir" |
|
17 |
+ |
|
18 |
+git clone --no-checkout "$repo" '.' |
|
19 |
+git checkout "$commitish" |
|
20 |
+ |
|
21 |
+"${CC:-gcc}" 'xwinwrap.c' -O3 -lX11 -lXext -lXrender -o 'xwinwrap' |
|
22 |
+$sudo install -D 'xwinwrap' "$prefix/bin/xwinwrap" |
0 | 23 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,25 @@ |
1 |
+--- |
|
2 |
+ |
|
3 |
+- name: 'Check existence' |
|
4 |
+ shell: '[ "$(command -v xwinwrap)" ] || [ -x {{ xwinwrap_prefix | quote }}/bin/xwinwrap ]' |
|
5 |
+ register: xwinwrap_exists |
|
6 |
+ changed_when: xwinwrap_exists.rc != 0 |
|
7 |
+ failed_when: false |
|
8 |
+ |
|
9 |
+- name: 'Install build dependencies' |
|
10 |
+ become: yes |
|
11 |
+ apt: |
|
12 |
+ name: |
|
13 |
+ - 'make' |
|
14 |
+ - 'gcc' |
|
15 |
+ - 'libc6-dev' |
|
16 |
+ - 'xorg-dev' |
|
17 |
+ - 'libx11-dev' |
|
18 |
+ - 'libxext-dev' |
|
19 |
+ - 'libxrender-dev' |
|
20 |
+ - 'x11proto-dev' |
|
21 |
+ when: xwinwrap_exists.rc != 0 |
|
22 |
+ |
|
23 |
+- name: 'Clone, build and install' |
|
24 |
+ script: 'install {{ xwinwrap_prefix | quote }} {{ xwinwrap_repo | quote }}' |
|
25 |
+ when: xwinwrap_exists.rc != 0 |