tukaani-project / xz

XZ Utils
https://tukaani.org/xz/
Other
559 stars 104 forks source link

Uninstallation | Support by script or documented in the `INSTALL.generic` file #72

Closed Ricky-Tigg closed 10 months ago

Ricky-Tigg commented 10 months ago

Describe the Feature

Hello. The program acquired from this repository and installed works as intended. Nonetheless I'd rather keep the benefit of having a release installed as packaged by the Linux distribution I am using in order to obtain its automatic updates. However, the uninstallation is uncovered in theINSTALL.generic file. This could be rectified by an addition either of a methodology into this file or script dedicated for that purpose.

Expected Complications

No response

Will I try to implement this new feature?

Yes

JiaT75 commented 10 months ago

Hello!

the installation is uncovered in theINSTALL.generic file. This could be rectified by an addition either of a methodology into this file or script dedicated for that purpose.

There is a section in INSTALL.generic "Installation Names". This describes when using the Autotools build system where the installation files go (defaults to /usr/local/). Your Linux distribution should install/update your packages in a different directory so these should not conflict.

You may already know this, but typically to build and install a package with Autotools the steps are (and should be covered in INSTALL.generic already):

  1. ./configure [options]. The options can enable/disable features, dependencies, set installation locations, etc.
  2. make. This will compile the project.
  3. make check. This will compile and run the test framework to be sure the binaries work as expected.
  4. make install. This will install the binaries and documentation (unless disabled).
  5. make uninstall. This will remove the installed artifacts.

You can set a different installation location when running configure by passing --prefix=[path to install directory] or during installation make install DESTDIR=[path to install directory].

I hope this explanation was clear. Let me know if you have more questions.

Ricky-Tigg commented 10 months ago

Thanks to your quote, I could notice in it installation while I had in mind uninstallation while reporting. Rectified in report.

Larhzu commented 10 months ago

INSTALL.generic does mention make uninstall. Note that for it to work you practically need to keep the matching build tree around. Builds made with different options or builds of different package versions can install and thus uninstall a different set of files.

--prefix sets the location where the files are expected to be when the programs or libraries are used. This matters because some paths may get hardcoded (like translations or library search path (rpath)).

DESTDIR allows doing a kind of fake install to a temporary directory from which a distro-specific package (.deb, .rpm, .txz etc.) can be created. In general one cannot run the program in the DESTDIR directory.

One option is to use

./configure --prefix=/home/foo/local-xz
make install

and then put /home/foo/local-xz/bin to PATH. This way uninstallation is simple: just rm -r /home/foo/local-xz.

In case of XZ Utils, if you only want the latest xz command line tool, build it against static liblzma without translation support. In case of xz there will then be no dependencies that rely on --prefix. With many other packages it's not so; this tip is specific to XZ Utils. You can also use the -j option with make to use multiple processor cores for a shorter build time.

./configure --disable-shared --disable-nls
make -j4
cp src/xz/xz /home/foo/bin/

The /home/foo/bin/ is a directory of your choosing. That is, no need to use make install if you only need xz.

Ricky-Tigg commented 10 months ago

I just took care to enter "unin" in the web browser's search field and indeed it revealed that some targets exist. My bad, I had had to enter in it an irrelevant term at the time I reported. That's no excuse. This also means I wasted the time of the participants in this discussion. Not proud of myself. I am sorry.

JiaT75 commented 10 months ago

There is no shame in asking question. I'm glad we were able to help :)