SpectrumIM / spectrum2

Spectrum 2 IM transports
https://spectrum.im
408 stars 91 forks source link

Use GNUInstallDirs to setup installation target directories. #456

Closed coldtobi closed 1 year ago

coldtobi commented 1 year ago

The installation target directories might be different on different distributions. For example, Debian using multiarch tuples paths for the libraries.

CMake provided a facility to set up certain variables to that the files will get installed into the correct directories. More details: https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html

vitalyster commented 1 year ago

Will make DESTDIR=/different_root_dir work with these changes?

coldtobi commented 1 year ago

Will make DESTDIR=/different_root_dir work with these changes?

It should (as this is the way Debian packages are built), but I'll try that and report here.

coldtobi commented 1 year ago

Can confirm that make && make install DESTDIR=/tmp/something works.

tree /tmp/something after make install

/tmp/something/
├── etc
│   └── spectrum2
│       ├── backend-logging.cfg
│       ├── logging.cfg
│       ├── manager-logging.cfg
│       ├── spectrum_manager.cfg
│       └── transports
│           ├── spectrum.cfg.example
│           └── spectrum_server_mode.cfg.example
├── usr
│   ├── bin
│   │   ├── spectrum2
│   │   └── spectrum2_manager
│   ├── include
│   │   └── transport
│   │       ├── AdminInterfaceCommand.h
│   │       ├── AdminInterface.h
│   │       ├── Buddy.h
│   │       ├── Config.h
│   │       ├── Conversation.h
│   │       ├── ConversationManager.h
│   │       ├── Factory.h
│   │       ├── Frontend.h
│   │       ├── HTTPRequest.h
│   │       ├── HTTPRequestQueue.h
│   │       ├── LocalBuddy.h
│   │       ├── Logging.h
│   │       ├── MemoryUsage.h
│   │       ├── MySQLBackend.h
│   │       ├── NetworkPlugin.h
│   │       ├── NetworkPluginServer.h
│   │       ├── OAuth2.h
│   │       ├── PQXXBackend.h
│   │       ├── PresenceOracle.h
│   │       ├── RosterManager.h
│   │       ├── RosterStorage.h
│   │       ├── SQLite3Backend.h
│   │       ├── StorageBackend.h
│   │       ├── ThreadPool.h
│   │       ├── Transport.h
│   │       ├── User.h
│   │       ├── UserManager.h
│   │       ├── UserRegistration.h
│   │       ├── UserRegistry.h
│   │       ├── UsersReconnecter.h
│   │       ├── utf8.h
│   │       ├── Util.h
│   │       └── WebSocketClient.h
│   ├── lib
│   │   └── x86_64-linux-gnu
│   │       ├── libtransport-plugin.so -> libtransport-plugin.so.2.0
│   │       ├── libtransport-plugin.so.2.0
│   │       ├── libtransport.so -> libtransport.so.2.0
│   │       └── libtransport.so.2.0
│   └── libexec
│       ├── spectrum2_libcommuni_backend
│       ├── spectrum2_libpurple_backend
│       ├── spectrum2_smstools3_backend
│       ├── spectrum2_swiften_backend
│       └── spectrum2_twitter_backend
└── var
    └── lib
        └── spectrum2_manager
            └── html
                ├── footer.shtml
                ├── form.css
                ├── header.shtml
                ├── instances
                │   ├── index.shtml
                │   └── instance.shtml
                ├── js
                │   ├── app.js
                │   └── config.js
                ├── login
                │   └── index.shtml
                ├── logo.png
                ├── style.css
                └── users
                    ├── list.shtml
                    └── register.shtml

18 directories, 62 files

(The above tree output already includes #457, of course)

vitalyster commented 1 year ago

Now our packaging scripts are broken:

dh_install: warning: Cannot find (any matches for) "/usr/lib/libtransport.so.2.0" (tried in ., debian/tmp)

because libraries are in /usr/lib/x86_64-linux-gnu directory. How to update *.install files to specify library directory in platform-independent way?

coldtobi commented 1 year ago

Now our packaging scripts are broken:

dh_install: warning: Cannot find (any matches for) "/usr/lib/libtransport.so.2.0" (tried in ., debian/tmp)

because libraries are in /usr/lib/x86_64-linux-gnu directory. How to update *.install files to specify library directory in platform-independent way?

Two possiblities:

  1. With debhelper compat level 13, use substitutions. The Debian package is using this approach: https://salsa.debian.org/xmpp-team/spectrum2/-/blob/master/debian/libtransport2.0.install
  2. use '//' e.g. `/usr/lib//libtransport.so.2.0`

If you have the possibility to use compat level 13 -- this is the recommended way.

vitalyster commented 1 year ago

OK fixed