Skip to content

Commit 5badd09

Browse files
rizsottoclaude
andcommitted
fix install script for distro packaging (fixes #685)
Simplify install.sh: remove uninstall script generation and --uninstall flag, switch shebang to /bin/sh, drop pipefail. Fix INSTALL.md packaging instructions to use DESTDIR for staging instead of baking the staging path into PREFIX. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 659c4a8 commit 5badd09

File tree

2 files changed

+117
-257
lines changed

2 files changed

+117
-257
lines changed

INSTALL.md

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,14 @@ ensure `gcc` or `clang` is installed.
8484
5. Verify the installation:
8585
```bash
8686
bear --version
87-
bear -- true # quick smoke test should produce an empty compile_commands.json
87+
bear -- true # quick smoke test - should produce an empty compile_commands.json
8888
```
8989

9090
## Uninstall
9191

92-
Once installed, the easiest way to remove all files is to run the original
93-
install script with the uninstall option:
94-
95-
```bash
96-
./scripts/install.sh --uninstall
97-
```
98-
99-
If the source tree is no longer available, run the `uninstall.sh` script:
100-
101-
```bash
102-
sh $HOME/.local/share/bear/uninstall.sh
103-
```
104-
105-
The path above assumes Bear was installed under `$HOME/.local`. Depending on
106-
customization, the uninstall script may be located elsewhere.
92+
The install script does not generate an uninstall script. To remove Bear,
93+
delete the installed files manually. The installation layout is listed at the
94+
end of this document.
10795

10896
## Custom installation
10997

@@ -131,7 +119,7 @@ install time:
131119
INTERCEPT_LIBDIR=lib64 ./scripts/install.sh
132120
```
133121

134-
On glibc-based Linux, the special value `$LIB` can be used the dynamic
122+
On glibc-based Linux, the special value `$LIB` can be used - the dynamic
135123
linker expands it at runtime (see `man ld.so`). On other platforms (macOS,
136124
musl, FreeBSD), use a concrete directory name.
137125

@@ -141,17 +129,17 @@ When Bear is installed to a system prefix like `/usr` or `/usr/local`, shells
141129
typically find completions automatically. For a user-local install
142130
(`$HOME/.local`), you need to tell your shell where to look:
143131

144-
**Bash** add to `~/.bashrc`:
132+
**Bash** - add to `~/.bashrc`:
145133
```bash
146134
source "$HOME/.local/share/bash-completion/completions/bear"
147135
```
148136

149-
**Zsh** add to `~/.zshrc` (before `compinit`):
137+
**Zsh** - add to `~/.zshrc` (before `compinit`):
150138
```zsh
151139
fpath=("$HOME/.local/share/zsh/site-functions" $fpath)
152140
```
153141

154-
**Fish** add to `~/.config/fish/config.fish`:
142+
**Fish** - add to `~/.config/fish/config.fish`:
155143
```fish
156144
set -p fish_complete_path $HOME/.local/share/fish/vendor_completions.d
157145
```
@@ -161,14 +149,19 @@ typically find completions automatically. For a user-local install
161149

162150
If you are a package maintainer for a distribution:
163151

164-
- Build, generate completions, and install with explicit values for `PREFIX`
165-
and `INTERCEPT_LIBDIR`:
152+
- Build, generate completions, and install with `DESTDIR`, `PREFIX`, and
153+
`INTERCEPT_LIBDIR`:
166154
```bash
167155
INTERCEPT_LIBDIR=lib64 cargo build --release
168156
target/release/generate-completions target/release/completions
169-
INTERCEPT_LIBDIR=lib64 PREFIX=$pkgdir/usr ./scripts/install.sh
157+
DESTDIR=$pkgdir PREFIX=/usr INTERCEPT_LIBDIR=lib64 ./scripts/install.sh
170158
```
171159

160+
`DESTDIR` is the staging root prepended to all install paths. `PREFIX` is
161+
the final on-system prefix (e.g. `/usr`). Do not combine them into
162+
`PREFIX` - the entry script embeds `PREFIX` as a literal runtime path,
163+
so it must match the installed system, not the build chroot.
164+
172165
- The preload library (`libexec.so`) is only built on Unix. Windows builds
173166
only produce `bear-driver` and `bear-wrapper`. Consult
174167
`intercept-preload/build.rs` for details.

0 commit comments

Comments
 (0)