Skip to content

Commit a55a0c9

Browse files
Seeker04Seeker04
authored andcommitted
Build, installation and release creation overhaul (#105)
- Binaries and object files are now generated to bin/ - Added tools/ with install.sh, uninstall.sh, generate_release.sh - Extended check_all.sh (e.g. release generation checks) - README.md and CHANGELOG.md moved to docs/ - Updated documentation, e.g. #installation links to the Releases now
1 parent 17b4953 commit a55a0c9

File tree

10 files changed

+264
-69
lines changed

10 files changed

+264
-69
lines changed

Makefile

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,34 @@ OFLAGS = -O2
1111
CFLAGS = -std=$(CSTD) $(IFLAGS) $(WFLAGS) $(OFLAGS) -fpic
1212
LDFLAGS = -shared -lX11 -lXft -lXrandr
1313

14-
SWIFLAGS = -p foreign=$(INSTALLDIR_LIB) \
15-
--goal=main --toplevel=halt --stand_alone=true -O -o plwm -c src/plwm.pl
14+
LIB_PATH = /usr/local/lib
1615

17-
INSTALLDIR_BIN = /usr/local/bin
18-
INSTALLDIR_LIB = /usr/local/lib
19-
INSTALLDIR_CNF = /etc/plwm
20-
INSTALLDIR_MAN = /usr/local/share/man/man1
16+
BIN_DIR = bin
17+
PLWM = $(BIN_DIR)/plwm
18+
PLX_O = $(BIN_DIR)/plx.o
19+
PLX_SO = $(BIN_DIR)/plx.so
20+
21+
SWIFLAGS = -p foreign=$(LIB_PATH) \
22+
--goal=main --toplevel=halt --stand_alone=true -O -o $(PLWM) -c src/plwm.pl
2123

2224
#================================== Build =====================================
2325

24-
plwm: plx.so src/*.pl
26+
$(PLWM): src/*.pl $(PLX_SO)
2527
swipl $(SWIFLAGS)
2628

27-
plx.o: src/plx.c
29+
$(PLX_SO): $(PLX_O)
30+
$(CC) $< $(LDFLAGS) -o $@
31+
32+
$(PLX_O): src/plx.c $(BIN_DIR)
2833
$(CC) -c $(CFLAGS) $< -o $@
2934

30-
plx.so: src/plx.o
31-
$(CC) $< $(LDFLAGS) -o $@
35+
$(BIN_DIR):
36+
mkdir $(BIN_DIR)
3237

3338
clean:
34-
rm -f src/plx.o plx.so plwm
39+
rm -f $(BIN_DIR)/*
3540

36-
rebuild: clean plwm
41+
rebuild: clean $(PLWM)
3742

3843
#============================== Static checks =================================
3944

@@ -59,19 +64,9 @@ test:
5964

6065
#============================ Install/uninstall ===============================
6166

62-
VERSION = ${shell sed -n 's/^version(\([0-9.]\+\))\.$$/\1/p' src/plwm.pl}
63-
64-
install: plwm
65-
install -D --mode=755 plwm $(INSTALLDIR_BIN)/plwm
66-
install -D --mode=755 plx.so $(INSTALLDIR_LIB)/plx.so
67-
install -D --mode=644 -C --backup=numbered config/config.pl $(INSTALLDIR_CNF)/config.pl
68-
mkdir -p $(INSTALLDIR_MAN)
69-
sed 's/VERSION/$(VERSION)/' < docs/plwm.1 > $(INSTALLDIR_MAN)/plwm.1
70-
chmod 644 $(INSTALLDIR_MAN)/plwm.1
67+
install:
68+
tools/install.sh
7169

7270
uninstall:
73-
rm -f $(INSTALLDIR_BIN)/plwm \
74-
$(INSTALLDIR_LIB)/plx.so \
75-
$(INSTALLDIR_MAN)/plwm.1
76-
[ -d $(INSTALLDIR_CNF) ] && echo "Note: $(INSTALLDIR_CNF) is kept" || true
71+
tools/uninstall.sh
7772

File renamed without changes.

README.md renamed to docs/README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- MIT License, Copyright (c) 2023-2025 Barnabás Zahorán, see LICENSE -->
22

33
<p align="center">
4-
<img alt="plwm logo" src="img/logo.png">
4+
<img alt="plwm logo" src="../img/logo.png">
55
</p>
66

77
# plwm - An X11 window manager written in Prolog
@@ -52,20 +52,23 @@ Powered by [SWI-Prolog](https://www.swi-prolog.org/)
5252

5353
# Installation
5454

55-
**Dependencies:**
55+
**From release**
56+
57+
Download the latest version from the [releases](https://github.com/Seeker04/plwm/releases), extract and run `./install.sh`.
5658

57-
* `xorg` with `libx11-dev`, `libxft-dev`, `libxrandr-dev` (exact package names may vary)
58-
* [SWI-Prolog](https://www.swi-prolog.org/Download.html) (downloadable from most distros' package repos)
59+
**From source**
5960

60-
On Ubuntu 22.04, easiest way to install them is:
61+
Run `make && sudo make install`
6162

62-
`$ sudo apt install xorg-dev swi-prolog`
63+
**Dependencies:**
6364

64-
Run:
65+
* `xorg` with `libx11-dev`, `libxft-dev`, `libxrandr-dev`<br>
66+
(exact package names may vary, `dev` versions are only needed when building from source)
67+
* [SWI-Prolog](https://www.swi-prolog.org/Download.html) (most likely also packaged by your distro)
6568

66-
`$ make && sudo make install`
69+
E.g. on Ubuntu 22.04, easiest way to install them is:
6770

68-
By default, this will install plwm to `/usr/local/bin/`. The location can be adjusted in the [Makefile](Makefile).
71+
`sudo apt install xorg-dev swi-prolog`
6972

7073
## Minimal environment
7174

@@ -181,7 +184,7 @@ then you'll have a triple stack layout where your windows will be evenly spread
181184

182185
## Configuration
183186

184-
`sudo make install` installs the [default configuration](config/config.pl) to `/etc/plwm/config.pl`. This file can be copied to user config directories.
187+
`sudo make install` installs the [default configuration](../config/config.pl) to `/etc/plwm/config.pl`. This file can be copied to user config directories.
185188

186189
plwm attempts reading configuration when it starts from the first file among
187190
- `$XDG_CONFIG_HOME/plwm/config.pl`
@@ -226,14 +229,14 @@ While cooking your config, you can use the `-C` flag to quickly and easily check
226229
| `modkey` | shift, lock, ctrl, alt, mod2, mod3, super, mod5<br>**Default:** super | Key you must hold for mouse operations |
227230
| `scroll_up_action` | callable term or 'none'<br>**Default:** switch_workspace(next) | Action to perform on modkey + scroll up |
228231
| `scroll_down_action` | callable term or 'none'<br>**Default:** switch_workspace(prev) | Action to perform on modkey + scroll down |
229-
| `keymaps` | list of (Modifiers + Key -> Action)<br>**Default:** [see here](#default-keybindings) | Modifiers: see values at `modkey`<br/>Key: keycode, [usual X11 names](http://xahlee.info/linux/linux_show_keycode_keysym.html), or [special key](src/xf86names.pl)<br/>Action: callable term |
232+
| `keymaps` | list of (Modifiers + Key -> Action)<br>**Default:** [see here](#default-keybindings) | Modifiers: see values at `modkey`<br/>Key: keycode, [usual X11 names](http://xahlee.info/linux/linux_show_keycode_keysym.html), or [special key](../src/xf86names.pl)<br/>Action: callable term |
230233
| `rules` | list of (Name, Class, Title -> Monitor, Workspace, Mode)<br>**Default:** [] | Auto place and configure matching windows (explained [here](#rules)) |
231234
| `hooks` | list of (Event -> Action)<br>**Default:** `[start -> writeln("plwm starting"), quit -> writeln("plwm quitting")]` | Run custom logic on certain events (explained [here](#hooks)) |
232235

233236
**Tips**
234237

235238
* You can safely remove any setting from your config file, plwm will use the default value for those.
236-
* In `keymaps/1`, the callback predicates can be arbitrary shell commands using `shellcmd/1`, even whole commandlines (some examples are included in the [default config](config/config.pl)).
239+
* In `keymaps/1`, the callback predicates can be arbitrary shell commands using `shellcmd/1`, even whole commandlines (some examples are included in the [default config](../config/config.pl)).
237240
* If you wish to stick to default keymaps mostly, with only a few changes and feel redundant to list the whole table in your config, you can simply omit the `keymaps/1` setting and add your changes as a `start` hook like this:
238241

239242
```Prolog
@@ -520,15 +523,15 @@ done > /tmp/plwm_fifo
520523

521524
# Screenshots
522525

523-
| ![Screenshot 1](img/screenshot1.png) |
526+
| ![Screenshot 1](../img/screenshot1.png) |
524527
|:--:|
525528
| *default appearance* |
526529

527-
| ![Screenshot 2](img/screenshot2.png) |
530+
| ![Screenshot 2](../img/screenshot2.png) |
528531
|:--:|
529532
| *lmaster / nmaster=1 / mfact=2/3 / 1px borders / 18px inner & outer gaps / goto window menu / polybar / picom / gruvbox colors* |
530533

531-
| ![Screenshot 3](img/screenshot3.png) |
534+
| ![Screenshot 3](../img/screenshot3.png) |
532535
|:--:|
533536
| *bmaster / nmaster=1 / mfact=2/3 / 3px focused border / 26px inner & outer gaps / polybar / picom /w rounded corners & shadows* |
534537

@@ -552,7 +555,7 @@ If you have a feature request or questions, feel free to [open discussions](http
552555

553556
Any code contribution is also welcome. Especially if it solves some known issue. For brand new ideas, I recommend creating a discussion first.
554557

555-
Please read the [Development Guide](docs/development_guide.md).
558+
Please read the [Development Guide](development_guide.md).
556559

557560
# FAQ
558561

@@ -566,7 +569,7 @@ Compared to what? C? Yes. Does it matter? No. I've been using dwm for 6 years, s
566569

567570
**Isn't SWI-Prolog non-ISO compliant?**
568571

569-
Interoperability between different Prolog implementations was never really on the table. Their C FFIs are also different, so [plx.c](plx.c) would also need to be rewritten for each kind of Prolog. SWI-Prolog is arguably one of the most popular free and community-driven Prolog implementations, is easily accessible, has good documentation, some LSP support and a lot of libraries. Though, to be honest, plwm's code mostly sticks to fundamentals, so if someone really wanted to, it shouldn't be too hard to port this to another Prolog system...
572+
Interoperability between different Prolog implementations was never really on the table. Their C FFIs are also different, so [plx.c](../src/plx.c) would also need to be rewritten for each kind of Prolog. SWI-Prolog is arguably one of the most popular free and community-driven Prolog implementations, is easily accessible, has good documentation, some LSP support and a lot of libraries. Though, to be honest, plwm's code mostly sticks to fundamentals, so if someone really wanted to, it shouldn't be too hard to port this to another Prolog system...
570573

571574
**Why not Wayland?**
572575

docs/development_guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,19 @@ plwm is currently in a pre-release stage.
178178
Now we simply increment a `0.x` version every 4-6 months.
179179

180180
Current process:
181-
* Increment `version/1` in [plwm.pl](../src/plwm.pl).
182-
* Update [CHANGELOG.md](../CHANGELOG.md) with changes since the latest version based on commit history.
181+
* Increment `version/1` in [plwm.pl](../src/plwm.pl) and in [plwm.1](plwm.1).
182+
* Update [CHANGELOG.md](../docs/CHANGELOG.md) with changes since the latest version based on commit history.
183183
* Create "Version bump to 0.x" commit.
184184
* Create `v0.x` git tag.
185185
* Push commit and tag.
186186
* Create a [new release](https://github.com/Seeker04/plwm/releases/new) from the tag.
187187
* Name: "plwm v0.x"
188-
* Assets: `plwm-v0.x-linux-x86_64.tar.gz` with `bin/plwm` and `lib/plx.so` extracted from a Docker build
188+
* Assets: archive created with [generate_release.sh](../tools/generate_release.sh) from the Docker build
189189
* Description:
190190
```
191191
Version 0.x
192192
193-
See [CHANGELOG.md](CHANGELOG.md)
193+
See [CHANGELOG.md](link to the new section in docs/CHANGELOG.md)
194194
195195
Note: Experimental release (first stable version will be 1.0.0)
196196
```

docs/plwm.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH PLWM 1 plwm\-VERSION
1+
.TH PLWM 1 plwm\-0.4
22
.SH NAME
33
plwm \- An X11 window manager written in Prolog
44
.SH SYNOPSIS

src/plwm.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%
33
% plwm - an X11 window manager written in Prolog
44
%
5-
% See README.md for getting started
5+
% See docs/README.md to get started
66

77
version(0.4).
88

0 commit comments

Comments
 (0)