Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow GNU conventions for installation #453

Merged
merged 2 commits into from
Apr 12, 2019
Merged

Follow GNU conventions for installation #453

merged 2 commits into from
Apr 12, 2019

Conversation

ilammy
Copy link
Collaborator

@ilammy ilammy commented Apr 9, 2019

First of all, move Soter and Themis installation rules out from Makefile to their individual makefiles. This makes them a bit easier to maintain.

After that, reduce installation targets to just install, install_themis and install_soter (plus uninstall counterparts). No one should really be using individual targets to install only some parts of the library. These targets are not really documented, and are not standard.

  • Follow GNU conventions for installation: Soter, Themis

Adhere to GNU Makefile conventions when installing files. This encompasses multiple aspects:

  • INSTALL, INSTALL_DATA, INSTALL_PROGRAM variables

    It's not strictly necessary, but nice to have. This allows to override the tool for installing files, and makes sure that data files are not marked executable.

  • DESTDIR prefix

    This is an important variable for packaging as it allows staged installation. It gets prefixed to each installation destination so that it could be made into a temporary directory which will get packaged later.

    Note that this variable is never set explicitly in the Makefile and is empty by default. It's also used only during installation, the library is built as if it's going to be installed to the usual location with DESTDIR preprended to it.

  • prefix, includedir, libdir, etc. variables

    These variables allow fine tuning of installation paths when packaging for distributions that have varying conventions. Most prominently, they affect the destination for libraries which may be /lib, /usr/lib, /usr/lib64, /usr/lib/x86_64-linux-gnu, or something else.

    Note that it's lowercase prefix, not uppercase PREFIX. That's how it should be by the book, but all our documentation uses the capitalized version, so we keep it for compatibility.

This teaches our Makefile to play nicely with other tools that expect GNU conventions to hold. Primarily, these are various package-building tools that rely on the variables to interpose their helper tools and override installation paths to distribution-specific places.

(We could have gotten all of that automatically by using Autotools, but no one really knows Autotools nowadays. Even these GNU conventions are arcane knowledge in the days of "curl | sudo sh" and every language having their own package manager.)

  • Follow GNU conventions for installation: ThemisPP

Now, there are quite a few ThemisPP-specific rules in the main Makefile. Move them all into a separate one, just for ThemisPP.

After that, update ThemisPP installation targets to follow the same conventions as for Soter and Themis.

First of all, move Soter and Themis installation rules out from Makefile
to their individual makefiles. This makes them a bit easier to maintain.

After that, reduce installation targets to just "install",
"install_themis" and "install_soter" (plus "uninstall" counterparts).
No one should really be using individual targets to instally only some
parts of the library. And these targets are not really documented, and
are not standard.

Finally, adhere to GNU Makefile conventions [1] when installing files.
This encompasses multiple aspects:

  - $(INSTALL), $(INSTALL_DATA), $(INSTALL_PROGRAM) variables

    It's not strictly necessary, but nice to have. This allows
    to override the tool for installing files, and makes sure that
    data files are not marked executable.

  - $(DESTDIR) prefix

    This is an important variable for packaging as it allows staged
    installation. It gets prefixed to each installation destination
    so that it could be made into a temporary directory which will
    get packaged later.

    Note that this variable is never set explicitly in the Makefile
    and is empty by default. It's also used only during installation,
    the library is built as if it's going to be installed to the usual
    location with DESTDIR preprended to it.

  - $(prefix), $(includedir), $(libdir), etc. variables

    These variables allow fine tuning of installation paths when
    packaging for distributions that have varying conventions.
    Most prominently, they affect the destination for libraries which
    may be /lib, /usr/lib, /usr/lib64, /usr/lib/x86_64-linux-gnu, or
    something else.

    Note that it's lowercase "prefix", not uppercase "PREFIX". That's
    how it should be by the book, but all our documentation uses the
    capitalized version, so we keep it for compatibility.

This teaches our Makefile to play nicely with other tools that expect
GNU conventions to hold. Primarily, these are various package-building
tools that rely on the variables to interpose their helper tools and
override installation paths to distribution-specific places.

(We could have gotten all of that automatically by using Autotools, but
no one really knows Autotools nowadays. Even these GNU conventions are
arcane knowledge in the days of "curl | sudo sh" and every language
having their own package manager.)

[1]: https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
First of all, there are quite a few ThemisPP-specific rules in the main
Makefile. Move them all into a separate one, just for ThemisPP.

After that, update ThemisPP installation targets to follow the same
conventions as for Soter and Themis.
@ilammy ilammy added infrastructure Automated building and packaging installation Installation of Themis core and wrapper packages labels Apr 10, 2019
@ilammy ilammy marked this pull request as ready for review April 10, 2019 09:12
@ilammy ilammy requested a review from ignatk April 10, 2019 09:13
@ilammy
Copy link
Collaborator Author

ilammy commented Apr 10, 2019

Ready for review now.

Copy link
Collaborator

@Lagovas Lagovas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ilammy ilammy merged commit b4384c3 into master Apr 12, 2019
@ilammy ilammy deleted the ilammy/gnu-install branch April 12, 2019 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Automated building and packaging installation Installation of Themis core and wrapper packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants