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

MAINT/BUILD: Clean up scripts directory #5838

Merged
merged 48 commits into from
Sep 10, 2022

Conversation

Krzmbrzl
Copy link
Member

Inside scripts there were several entries that appear to have no use anymore or scripts that have been written in Pearl, which is not really usable in a cross-platform environment.

This PR attempts to radically clean up the mess inside the scripts directory by deleting unneeded entries and by rewriting several scripts in Python.

Furthermore, all scripts that are used to generate source files are now directly embedded into the build process in order to generate the source files on-the-fly instead of generating them once and then keeping them as part of the source tree.

Finally, non-script entries where moved to a new auxiliary_files directory. These files mostly got converted to make use of cmake's configure_file mechanism to replace certain things (as e.g. a binary's name) with the appropriate value. This has to be seen as a first step of resolving #5436.

Checks

@Krzmbrzl Krzmbrzl added the build Everything related to compiling/building the code label Aug 29, 2022
@Krzmbrzl
Copy link
Member Author

@davidebeatrici could you please check that the files that I deleted are indeed not needed anymore? I probably did not think of all use-cases 👀

@Krzmbrzl Krzmbrzl force-pushed the maint-fix-run-scripts branch from 63550b2 to f29ca8d Compare August 29, 2022 16:43
@Krzmbrzl Krzmbrzl force-pushed the maint-fix-run-scripts branch from f29ca8d to 663d73c Compare August 29, 2022 17:05
@Krzmbrzl Krzmbrzl force-pushed the maint-fix-run-scripts branch 4 times, most recently from 025574d to d9890d3 Compare August 31, 2022 10:58
@Krzmbrzl Krzmbrzl force-pushed the maint-fix-run-scripts branch from 594f9e9 to 04eb867 Compare September 7, 2022 18:11
@Krzmbrzl
Copy link
Member Author

Krzmbrzl commented Sep 7, 2022

@dvzrv I think I have addressed all of your concerns now. Mind having another look at this PR to check whether I missed anything?

@Krzmbrzl Krzmbrzl force-pushed the maint-fix-run-scripts branch 3 times, most recently from 9009420 to bd971ae Compare September 8, 2022 09:07
@dvzrv
Copy link
Contributor

dvzrv commented Sep 8, 2022

Okay, here are the results of building the client:

cmake -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE=None -D warnings-as-errors=OFF -D bundled-opus=OFF -D bundled-speex=OFF -D update=OFF -D server=OFF -D translations=OFF  -W no-dev -S mumble -B build-client
cmake --build build-client
DESTDIR=install_mumble-client cmake --install build-client

I noticed a bunch of files that are not part of mumble and should not be installed (MS GSL? Tracy?). Not sure if that's due to this PR though:

$ tree -n install_mumble-client

install_mumble-client
└── usr
    ├── bin
    │   ├── mumble
    │   └── mumble-overlay
    ├── include
    │   ├── Tracy.hpp
    │   ├── TracyC.h
    │   ├── TracyD3D11.hpp
    │   ├── TracyD3D12.hpp
    │   ├── TracyLua.hpp
    │   ├── TracyOpenCL.hpp
    │   ├── TracyOpenGL.hpp
    │   ├── TracyVulkan.hpp
    │   ├── client
    │   │   ├── TracyArmCpuTable.hpp
    │   │   ├── TracyCallstack.h
    │   │   ├── TracyCallstack.hpp
    │   │   ├── TracyDebug.hpp
    │   │   ├── TracyDxt1.hpp
    │   │   ├── TracyFastVector.hpp
    │   │   ├── TracyLock.hpp
    │   │   ├── TracyProfiler.hpp
    │   │   ├── TracyRingBuffer.hpp
    │   │   ├── TracyScoped.hpp
    │   │   ├── TracyStringHelpers.hpp
    │   │   ├── TracySysTime.hpp
    │   │   ├── TracySysTrace.hpp
    │   │   ├── TracyThread.hpp
    │   │   ├── tracy_SPSCQueue.h
    │   │   ├── tracy_concurrentqueue.h
    │   │   └── tracy_rpmalloc.hpp
    │   ├── common
    │   │   ├── TracyAlign.hpp
    │   │   ├── TracyAlloc.hpp
    │   │   ├── TracyApi.h
    │   │   ├── TracyColor.hpp
    │   │   ├── TracyForceInline.hpp
    │   │   ├── TracyMutex.hpp
    │   │   ├── TracyProtocol.hpp
    │   │   ├── TracyQueue.hpp
    │   │   ├── TracySocket.hpp
    │   │   ├── TracyStackFrames.hpp
    │   │   ├── TracySystem.hpp
    │   │   ├── TracyYield.hpp
    │   │   ├── tracy_lz4.hpp
    │   │   └── tracy_lz4hc.hpp
    │   └── gsl
    │       ├── gsl
    │       ├── gsl_algorithm
    │       ├── gsl_assert
    │       ├── gsl_byte
    │       ├── gsl_util
    │       ├── multi_span
    │       ├── pointers
    │       ├── span
    │       ├── span_ext
    │       └── string_span
    ├── lib
    │   ├── libTracyClient.a
    │   └── mumble
    │       ├── libcelt0.so -> libcelt0.so.0.7.0
    │       ├── libcelt0.so.0.7.0
    │       ├── libmumbleoverlay.x86.so -> libmumbleoverlay.x86.so.1.5.0
    │       ├── libmumbleoverlay.x86.so.1.5.0
    │       ├── libmumbleoverlay.x86_64.so -> libmumbleoverlay.x86_64.so.1.5.0
    │       ├── libmumbleoverlay.x86_64.so.1.5.0
    │       └── plugins
    │           ├── libamongus.so
    │           ├── libaoc.so
    │           ├── libarma2.so
    │           ├── libbf1.so
    │           ├── libbf1942.so
    │           ├── libbf2.so
    │           ├── libbf2142.so
    │           ├── libbf3.so
    │           ├── libbf4.so
    │           ├── libbf4_x86.so
    │           ├── libbfbc2.so
    │           ├── libbfheroes.so
    │           ├── libblacklight.so
    │           ├── libborderlands.so
    │           ├── libborderlands2.so
    │           ├── libbreach.so
    │           ├── libcod2.so
    │           ├── libcod4.so
    │           ├── libcod5.so
    │           ├── libcodmw2.so
    │           ├── libcodmw2so.so
    │           ├── libcs.so
    │           ├── libdys.so
    │           ├── libetqw.so
    │           ├── libffxiv.so
    │           ├── libffxiv_x64.so
    │           ├── libgmod.so
    │           ├── libgtaiv.so
    │           ├── libgtasa.so
    │           ├── libgtav.so
    │           ├── libgw.so
    │           ├── libinsurgency.so
    │           ├── libjc2.so
    │           ├── liblink.so
    │           ├── liblol.so
    │           ├── liblotro.so
    │           ├── libql.so
    │           ├── librl.so
    │           ├── libse.so
    │           ├── libsr.so
    │           ├── libut2004.so
    │           ├── libut3.so
    │           ├── libut99.so
    │           ├── libwolfet.so
    │           ├── libwow.so
    │           └── libwow_x64.so
    └── share
        ├── Tracy
        │   ├── TracyConfig-none.cmake
        │   └── TracyConfig.cmake
        ├── applications
        │   └── info.mumble.Mumble.desktop
        ├── cmake
        │   └── Microsoft.GSL
        │       ├── Microsoft.GSLConfig.cmake
        │       └── Microsoft.GSLConfigVersion.cmake
        ├── icons
        │   └── hicolor
        │       ├── 256x256
        │       │   └── apps
        │       │       └── mumble.png
        │       └── scalable
        │           └── apps
        │               └── mumble.svg
        ├── man
        │   └── man1
        │       ├── mumble-overlay.1
        │       └── mumble.1
        └── metainfo
            └── info.mumble.Mumble.appdata.xml

23 directories, 114 files

Apart from the unrelated files this seems alright. Will have a look at the server next

@Krzmbrzl
Copy link
Member Author

Krzmbrzl commented Sep 8, 2022

I noticed a bunch of files that are not part of mumble and should not be installed (MS GSL? Tracy?).

Yeah, that's unrelated from this PR. I noticed these issues in #5006 as well. Probably cmake automatically includes the install targets of linked-against targets as well 🤔

@dvzrv
Copy link
Contributor

dvzrv commented Sep 8, 2022

Hm, with the server I'm running into some issues:

cmake -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE=None -D warnings-as-errors=OFF -D bundled-opus=OFF -D bundled-speex=OFF -D update=OFF -D grpc=ON -D client=OFF -D translations=OFF  -W no-dev -S mumble -B build-server
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python interpreter version 3.10.6
-- Performing Test COMPILER_HAS_MBIG_OBJ
-- Performing Test COMPILER_HAS_MBIG_OBJ - Failed
-- ##################################################
-- Mumble version:          1.5.0
-- Architecture:            x64
-- Build type:              None
-- Using LTO:               ON
-- ##################################################
-- Qt5 component found: Core | Version: 5.15.5
-- Qt5 component found: Network | Version: 5.15.5
-- Qt5 component found: Xml | Version: 5.15.5
-- OpenSSL component found: Crypto | Version: 1.1.1q
-- OpenSSL component found: SSL | Version: 1.1.1q
-- Found ZLIB: /usr/lib/libz.so (found version "1.2.12")
-- Protobuf found | Version: 3.21.5.0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- TRACY_ENABLE: OFF
-- TRACY_ON_DEMAND: ON
-- TRACY_CALLSTACK: OFF
-- TRACY_ONLY_LOCALHOST: OFF
-- TRACY_NO_BROADCAST: OFF
-- TRACY_NO_CODE_TRANSFER: OFF
-- TRACY_NO_CONTEXT_SWITCH: OFF
-- TRACY_NO_EXIT: OFF
-- TRACY_NO_FRAME_IMAGE: OFF
-- TRACY_NO_SAMPLING: OFF
-- TRACY_NO_VERIFY: OFF
-- TRACY_NO_VSYNC_CAPTURE: OFF
-- Disabling warnings for targets: TracyClient
-- Tracy: OFF
-- Found Git: /usr/bin/git (found version "2.37.3")
-- Qt5 component found: Sql | Version: 5.15.5
-- File: /home/dave/Downloads/build-server/src/murmur/murmur_autogen
-- Qt5 component found: DBus | Version: 5.15.5
-- Ice component found: Ice | Version: 3.7.8
-- Ice component found: IceSSL | Version: 3.7.8
-- Ice optional component found: IceDiscovery | Version: 3.7.8
-- Ice optional component found: IceLocatorDiscovery | Version: 3.7.8
CMake Error at cmake/delayed_configure_files.cmake:39 (message):
  delayed_configure_files: Provided target "overlay_gl" is not actually a
  (valid) target
Call Stack (most recent call first):
  auxiliary_files/CMakeLists.txt:91 (delayed_configure_files)


-- Configuring incomplete, errors occurred!
See also "/home/dave/Downloads/build-server/CMakeFiles/CMakeOutput.log".
See also "/home/dave/Downloads/build-server/CMakeFiles/CMakeError.log".

@Krzmbrzl
Copy link
Member Author

Krzmbrzl commented Sep 8, 2022

Ah yes, the problem seems to be that the internal overlay option is enabled, even if the client isn't built. This should be fixed with my latest commit

@Krzmbrzl
Copy link
Member Author

Krzmbrzl commented Sep 8, 2022

I now also fixed the additional, unrelated files getting installed, when installing Mumble.

@dvzrv
Copy link
Contributor

dvzrv commented Sep 8, 2022

Alright, here are the results for building the server-side:

cmake -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE=None -D warnings-as-errors=OFF -D bundled-opus=OFF -D bundled-speex=OFF -D update=OFF -D grpc=ON -D client=OFF -D translations=OFF  -W no-dev -S mumble -B build-server
cmake --build build-server
DESTDIR=install_mumble-server cmake --install build-server

Here we can also see that additional, unwanted files are being installed, but I guess that's something for another PR?

tree -n install_mumble-server

install_mumble-server
└── usr
    ├── bin
    │   ├── mumble-server
    │   └── mumble-server-user-wrapper
    ├── etc
    │   ├── mumble
    │   │   └── mumble-server.ini
    │   └── sysconfig.d
    │       └── mumble-server.conf
    ├── include
    │   ├── Tracy.hpp
    │   ├── TracyC.h
    │   ├── TracyD3D11.hpp
    │   ├── TracyD3D12.hpp
    │   ├── TracyLua.hpp
    │   ├── TracyOpenCL.hpp
    │   ├── TracyOpenGL.hpp
    │   ├── TracyVulkan.hpp
    │   ├── client
    │   │   ├── TracyArmCpuTable.hpp
    │   │   ├── TracyCallstack.h
    │   │   ├── TracyCallstack.hpp
    │   │   ├── TracyDebug.hpp
    │   │   ├── TracyDxt1.hpp
    │   │   ├── TracyFastVector.hpp
    │   │   ├── TracyLock.hpp
    │   │   ├── TracyProfiler.hpp
    │   │   ├── TracyRingBuffer.hpp
    │   │   ├── TracyScoped.hpp
    │   │   ├── TracyStringHelpers.hpp
    │   │   ├── TracySysTime.hpp
    │   │   ├── TracySysTrace.hpp
    │   │   ├── TracyThread.hpp
    │   │   ├── tracy_SPSCQueue.h
    │   │   ├── tracy_concurrentqueue.h
    │   │   └── tracy_rpmalloc.hpp
    │   ├── common
    │   │   ├── TracyAlign.hpp
    │   │   ├── TracyAlloc.hpp
    │   │   ├── TracyApi.h
    │   │   ├── TracyColor.hpp
    │   │   ├── TracyForceInline.hpp
    │   │   ├── TracyMutex.hpp
    │   │   ├── TracyProtocol.hpp
    │   │   ├── TracyQueue.hpp
    │   │   ├── TracySocket.hpp
    │   │   ├── TracyStackFrames.hpp
    │   │   ├── TracySystem.hpp
    │   │   ├── TracyYield.hpp
    │   │   ├── tracy_lz4.hpp
    │   │   └── tracy_lz4hc.hpp
    │   └── gsl
    │       ├── gsl
    │       ├── gsl_algorithm
    │       ├── gsl_assert
    │       ├── gsl_byte
    │       ├── gsl_util
    │       ├── multi_span
    │       ├── pointers
    │       ├── span
    │       ├── span_ext
    │       └── string_span
    ├── lib
    │   ├── libTracyClient.a
    │   └── systemd
    │       └── system
    │           └── mumble-server.service
    └── share
        ├── Tracy
        │   ├── TracyConfig-none.cmake
        │   └── TracyConfig.cmake
        ├── cmake
        │   └── Microsoft.GSL
        │       ├── Microsoft.GSLConfig.cmake
        │       └── Microsoft.GSLConfigVersion.cmake
        └── man
            └── man1
                ├── mumble-server-user-wrapper.1
                └── mumble-server.1

18 directories, 61 files

All looks mainly fine so far, but the systemd service file points at a wrong location for the config and that the config is also located at the wrong location (we don't need the prefix there):

cat install_mumble-server/usr/lib/systemd/system/mumble-server.service
[Unit]
Description=Mumble server
After=network.target
Wants=network-online.target

[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
ExecStart=/usr/bin/mumble-server -ini /usr/etc/mumble/mumble-server.ini -fg
Group=_mumble-server
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
PrivateDevices=true
PrivateTmp=true
ProtectClock=yes
ProtectControlGroups=yes
ProtectHome=true
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectSystem=full
RestrictAddressFamilies=~AF_PACKET AF_NETLINK
RestrictNamespaces=yes
RestrictSUIDSGID=yes
RestrictRealtime=yes
Restart=always
SystemCallArchitectures=native
SystemCallFilter=@system-service
Type=simple
User=_mumble-server

[Install]
WantedBy=multi-user.target

The sysusers.d file is also in the wrong location below /usr/etc/sysconfig.d/. It needs to go to /usr/lib/sysconfig.d/ (on Arch).
The correct location, distribution independent, can be gotten from pkg-config --variable=sysusersdir systemd.

It seems that the dbus file is still missing (on Arch it is currently located in /usr/share/dbus-1/system.d/murmur.conf). This and also the Murmur.ice file (but renamed) should be retained, as they are (at least according to the config file) available methods for doing RPC.
Do you know if grpc is still supported? The server does not seem to link against it anymore, but there's MurmurRPC.proto.

@Krzmbrzl
Copy link
Member Author

Krzmbrzl commented Sep 8, 2022

Here we can also see that additional, unwanted files are being installed, but I guess that's something for another PR?

See my latest commit - that should have fixed it

Do you know if grpc is still supported?

No, it's not. It has been removed due to our implementation being broken and unmaintained

but the systemd service file points at a wrong location for the config and that the config is also located at the wrong location (we don't need the prefix there)

By config file, I suppose you are referring to mumble-server.ini?
The service file should point exactly to where the file is being installed to (/etc/mumble/mumble-server.ini). That seems to have worked correctly.

What is the rule as to when to use a prefix when writing files to /etc? To me it seemed to make sense to use a prefix, in case we ever wanted to install more than one file there (in which case we can use the prefix to nicely group those files together).

The sysusers.d file is also in the wrong location below /usr/etc/sysconfig.d/. It needs to go to /usr/lib/sysconfig.d/ (on Arch).
The correct location, distribution independent, can be gotten from pkg-config --variable=sysusersdir systemd.

I'll fix that.

It seems that the dbus file is still missing (on Arch it is currently located in /usr/share/dbus-1/system.d/murmur.conf). This and also the Murmur.ice file (but renamed) should be retained, as they are (at least according to the config file) available methods for doing RPC.

Ah yes indeed, I forgot about the DBus file. Is there also some pkgconf magic that can be used to fetch the correct DBus directory?
And where should the ice file be installed to? Also /etc? 🤔

The auxiliary files will now make use of configure_file in order to
ensure that e.g. the binary names used in them always match the names of
the actually built binaries.
Previously we would define our install paths as relative paths when
using the packaging option and turning them into absolute paths
otherwise.

While relative paths are required for CPack to work properly, we use
the paths e.g. for passing them in via macros and there we absolutely
require the full, absolute paths to be passed.

Thus, this commit removed the discrepancy of the results when built with
packagin=ON vs packagin=OFF and now always defines the install paths as
relative paths. However, we now keep an additional set of paths around
that are now always absolute.
The logrotate script is not intended to be used on systems with systemd
support. However, we don't want to take on the burden of having to keep
around and maintain config files for non-systemd systems.
This essentially copied the file from
https://github.com/archlinux/svntogit-community/blob/ba167269f8336659313d589dea65642b4eae4f85/trunk/murmur.service
and only adapted it in as far as that it uses the actual install paths.
This prevents adding all targets in said subdirectories to the ALL
target by default. Instead, only those targets that are explicitly
referenced (e.g. via target_link_libraries) are built.

This also has the side-effect that any install-directives in these
subdirectories are also ignored for the default install targets which
prevents these libraries of unconditionally installing themselves when
issuing a make install. Instead, we now have to make any 3rdparty
component that we do indeed want to install, do so explicitly (e.g. via
install_library()).
@Krzmbrzl Krzmbrzl force-pushed the maint-fix-run-scripts branch from 317ec1d to b81b060 Compare September 10, 2022 15:29
@Krzmbrzl
Copy link
Member Author

I'll merge this as-is now. If any of the install paths require further tuning, that can be done in a separate PR.

@Krzmbrzl Krzmbrzl merged commit 98fb1cd into mumble-voip:master Sep 10, 2022
Krzmbrzl added a commit to Krzmbrzl/mumble-docker that referenced this pull request Sep 12, 2022
With mumble-voip/mumble#5838 the file structure
of the upstream repo has changed slightly and most importantly the
location of the default server ini file has changed as well. Thus, we
now have to check multiple locations inside our Dockerfile in order to
make it work with the old and the new layout.
Krzmbrzl added a commit to mumble-voip/mumble-docker that referenced this pull request Sep 12, 2022
With mumble-voip/mumble#5838 the file structure
of the upstream repo has changed slightly and most importantly the
location of the default server ini file has changed as well. Thus, we
now have to check multiple locations inside our Dockerfile in order to
make it work with the old and the new layout.
@Krzmbrzl Krzmbrzl deleted the maint-fix-run-scripts branch November 9, 2022 18:17
Kissaki added a commit to Kissaki/mumble that referenced this pull request Apr 7, 2024
PR mumble-voip#5838 commit 81bb8f7 removed the `docker-compose.yml` file in this repository.
It points to our mumble-docker repository for docker related things.
In that repository, we do not currently have a default or example docker compose configuration file.
The README in that repository does have a description for it, so we link to that now.

Update the relative file path reference `murmur.ini` -> `mumble-server-ini`.

Update `database` path 'murmur' -> 'mumble-server'.
I did not test or verify this change. Even if it is incorrect or does not work, I assume it to be *more correct*. Even if nobody chooses to test or verify it in this doc-update-changeset, I think that's preferable.
Kissaki added a commit to Kissaki/mumble that referenced this pull request Apr 10, 2024
Docker documentation should be on our website (administrator/hoster documentation) or our [mumble-docker] repository.
This repository /docs/ should only contain developer documentation and scoped to this source/main project.

---

PR mumble-voip#5838 commit 81bb8f7 removed the docker-compose.yml file in this repository.

The `murmur.ini` reference is outdated. It was moved and renamed to `umble-server-ini`

The `database` path is outdated ('murmur' name).

---

Replaces/Closes PR mumble-voip#6387 which intended to fix the documentation.

[mumble-docker]: https://github.com/mumble-voip/mumble-docker/
mryamac pushed a commit to mryamac/mumble that referenced this pull request May 21, 2024
Docker documentation should be on our website (administrator/hoster documentation) or our [mumble-docker] repository.
This repository /docs/ should only contain developer documentation and scoped to this source/main project.

---

PR mumble-voip#5838 commit 81bb8f7 removed the docker-compose.yml file in this repository.

The `murmur.ini` reference is outdated. It was moved and renamed to `umble-server-ini`

The `database` path is outdated ('murmur' name).

---

Replaces/Closes PR mumble-voip#6387 which intended to fix the documentation.

[mumble-docker]: https://github.com/mumble-voip/mumble-docker/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Everything related to compiling/building the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants