Merge branch 'insp3' into master.

This commit is contained in:
Sadie Powell 2021-06-09 09:19:41 +01:00
commit 55cc3a36bd
4 changed files with 80 additions and 43 deletions

1
.gitignore vendored
View File

@ -7,7 +7,6 @@
!.travis !.travis
/.configure /.configure
/Makefile
/GNUmakefile /GNUmakefile
/build /build
/core /core

18
configure vendored
View File

@ -52,6 +52,7 @@ my ($opt_binary_dir,
$opt_development, $opt_development,
$opt_disable_auto_extras, $opt_disable_auto_extras,
$opt_disable_interactive, $opt_disable_interactive,
$opt_disable_ownership,
$opt_distribution_label, $opt_distribution_label,
$opt_example_dir, $opt_example_dir,
$opt_gid, $opt_gid,
@ -86,6 +87,7 @@ exit 1 unless GetOptions(
'development' => \$opt_development, 'development' => \$opt_development,
'disable-auto-extras' => \$opt_disable_auto_extras, 'disable-auto-extras' => \$opt_disable_auto_extras,
'disable-interactive' => \$opt_disable_interactive, 'disable-interactive' => \$opt_disable_interactive,
'disable-ownership' => \$opt_disable_ownership,
'distribution-label=s' => \$opt_distribution_label, 'distribution-label=s' => \$opt_distribution_label,
'example-dir=s' => \$opt_example_dir, 'example-dir=s' => \$opt_example_dir,
'gid=s' => \$opt_gid, 'gid=s' => \$opt_gid,
@ -124,6 +126,7 @@ our $interactive = !(
defined $opt_development || defined $opt_development ||
defined $opt_disable_auto_extras || defined $opt_disable_auto_extras ||
defined $opt_disable_interactive || defined $opt_disable_interactive ||
defined $opt_disable_ownership ||
defined $opt_distribution_label || defined $opt_distribution_label ||
defined $opt_example_dir || defined $opt_example_dir ||
defined $opt_gid || defined $opt_gid ||
@ -226,7 +229,10 @@ if (defined $opt_portable) {
# Parse --gid=123 or --gid=foo and extract the group id. # Parse --gid=123 or --gid=foo and extract the group id.
my @group; my @group;
if (defined $opt_gid) { if (defined $opt_disable_ownership) {
@group = qw(insert-group-here . -1);
print_error 'you can not use --disable-ownership and --gid at the same time!' if defined $opt_gid;
} elsif (defined $opt_gid) {
@group = $opt_gid =~ /^\d+$/ ? getgrgid($opt_gid) : getgrnam($opt_gid); @group = $opt_gid =~ /^\d+$/ ? getgrgid($opt_gid) : getgrnam($opt_gid);
print_error "there is no '$opt_gid' group on this system!" unless @group; print_error "there is no '$opt_gid' group on this system!" unless @group;
} else { } else {
@ -242,7 +248,7 @@ unprivileged user/group to build and run as or pass the '--gid [id|name]' flag
to specify an unprivileged group to run as. to specify an unprivileged group to run as.
EOW EOW
if (!prompt_bool $interactive, "Are you sure you want to build as the $group[0] group?", 0) { if (!prompt_bool $interactive, "Are you sure you want to build as the $group[0] group?", 0) {
# PACKAGERS: You do not need to delete this check. Use `--gid $(id -g)` or `--gid 0` instead. # PACKAGERS: You do not need to delete this check. Use `--disable-ownership` instead.
say STDERR "If you are sure you want to build as the $group[0] group pass the --gid $group[2] flag." unless $interactive; say STDERR "If you are sure you want to build as the $group[0] group pass the --gid $group[2] flag." unless $interactive;
exit 1; exit 1;
} }
@ -253,7 +259,10 @@ $config{GID} = $group[2];
# Parse --uid=123 or --uid=foo and extract the user id. # Parse --uid=123 or --uid=foo and extract the user id.
my @user; my @user;
if (defined $opt_uid) { if (defined $opt_disable_ownership) {
@user = qw(insert-user-here . -1);
print_error 'you can not use --disable-ownership and --uid at the same time!' if defined $opt_uid;
} elsif (defined $opt_uid) {
@user = $opt_uid =~ /^\d+$/ ? getpwuid($opt_uid) : getpwnam($opt_uid); @user = $opt_uid =~ /^\d+$/ ? getpwuid($opt_uid) : getpwnam($opt_uid);
print_error "there is no '$opt_uid' user on this system!" unless @user; print_error "there is no '$opt_uid' user on this system!" unless @user;
} else { } else {
@ -269,7 +278,7 @@ unprivileged user/group to build and run as or pass the '--uid [id|name]' flag
to specify an unprivileged user to run as. to specify an unprivileged user to run as.
EOW EOW
if (!prompt_bool $interactive, "Are you sure you want to build as the $user[0] user?", 0) { if (!prompt_bool $interactive, "Are you sure you want to build as the $user[0] user?", 0) {
# PACKAGERS: You do not need to delete this check. Use `--uid $(id -u)` or `--uid 0` instead. # PACKAGERS: You do not need to delete this check. Use `--disable-ownership` instead.
say STDERR "If you are sure you want to build as the $user[0] user pass the --uid $user[2] flag." unless $interactive; say STDERR "If you are sure you want to build as the $user[0] user pass the --uid $user[2] flag." unless $interactive;
exit 1; exit 1;
} }
@ -396,6 +405,7 @@ EOM
# Cache the distribution label so that its not lost when --update is run. # Cache the distribution label so that its not lost when --update is run.
$config{DISTRIBUTION} = $opt_distribution_label if $opt_distribution_label; $config{DISTRIBUTION} = $opt_distribution_label if $opt_distribution_label;
$config{DISABLE_OWNERSHIP} = $opt_disable_ownership // 0;
write_configure_cache %config; write_configure_cache %config;
parse_templates \%config, \%compiler, \%version; parse_templates \%config, \%compiler, \%version;

View File

@ -86,6 +86,7 @@ sub __get_template_settings($$$) {
# Miscellaneous information # Miscellaneous information
$settings{CONFIGURE_DIRECTORY} = CONFIGURE_DIRECTORY; $settings{CONFIGURE_DIRECTORY} = CONFIGURE_DIRECTORY;
$settings{CONFIGURE_CACHE_FILE} = CONFIGURE_CACHE_FILE; $settings{CONFIGURE_CACHE_FILE} = CONFIGURE_CACHE_FILE;
$settings{SOURCE_DIR} = CONFIGURE_ROOT;
$settings{SYSTEM_NAME} = lc $^O; $settings{SYSTEM_NAME} = lc $^O;
return %settings; return %settings;
@ -160,6 +161,7 @@ non-interactive configuration is started and any omitted values are defaulted.
<|BOLD --disable-auto-extras|> Disables automatically enabling extra modules <|BOLD --disable-auto-extras|> Disables automatically enabling extra modules
for which the dependencies are available. for which the dependencies are available.
<|BOLD --disable-interactive|> Disables the interactive configuration wizard. <|BOLD --disable-interactive|> Disables the interactive configuration wizard.
<|BOLD --disable-ownership|> Disables setting file ownership on install.
<|BOLD --distribution-label <TEXT>|> Sets a distribution specific version label in <|BOLD --distribution-label <TEXT>|> Sets a distribution specific version label in
the build configuration. the build configuration.
<|BOLD --gid <ID|NAME>|> Sets the group to run InspIRCd as. <|BOLD --gid <ID|NAME>|> Sets the group to run InspIRCd as.

View File

@ -43,7 +43,8 @@
CXX = @CXX@ -std=c++17 CXX = @CXX@ -std=c++17
COMPILER = @COMPILER_NAME@ COMPILER = @COMPILER_NAME@
SYSTEM = @SYSTEM_NAME@ SYSTEM = @SYSTEM_NAME@
BUILDPATH ?= $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/build/@COMPILER_NAME@-@COMPILER_VERSION@ SOURCEPATH = @SOURCE_DIR@
BUILDPATH ?= $(SOURCEPATH)/build/@COMPILER_NAME@-@COMPILER_VERSION@
SOCKETENGINE = @SOCKETENGINE@ SOCKETENGINE = @SOCKETENGINE@
CORECXXFLAGS = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pipe -Iinclude -Ivendor -Wall -Wextra -Wfatal-errors -Wformat=2 -Wmissing-format-attribute -Woverloaded-virtual -Wpedantic -Wno-format-nonliteral -Wno-unused-parameter CORECXXFLAGS = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pipe -Iinclude -Ivendor -Wall -Wextra -Wfatal-errors -Wformat=2 -Wmissing-format-attribute -Woverloaded-virtual -Wpedantic -Wno-format-nonliteral -Wno-unused-parameter
LDLIBS = @COMPILER_EXTRA_LDLIBS@ LDLIBS = @COMPILER_EXTRA_LDLIBS@
@ -74,6 +75,15 @@ else
DLLEXT = "so" DLLEXT = "so"
endif endif
# Only set the ownership of installed files when --disable-ownership
# was not passed to configure.
DISABLE_OWNERSHIP=@DISABLE_OWNERSHIP@
ifeq ($(DISABLE_OWNERSHIP), 1)
INSTFLAGS =
else
INSTFLAGS = -g @GID@ -o @UID@
endif
# Force the use of libc++ on macOS as on some systems it is not the # Force the use of libc++ on macOS as on some systems it is not the
# default and this breaks modern C++ support. # default and this breaks modern C++ support.
ifeq ($(COMPILER), AppleClang) ifeq ($(COMPILER), AppleClang)
@ -162,8 +172,6 @@ endif
MAKEFLAGS += --no-print-directory MAKEFLAGS += --no-print-directory
SOURCEPATH = $(shell pwd)
ifndef INSPIRCD_VERBOSE ifndef INSPIRCD_VERBOSE
MAKEFLAGS += --silent MAKEFLAGS += --silent
endif endif
@ -242,38 +250,38 @@ finishmessage: target
@echo "*************************************" @echo "*************************************"
install: target install: target
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(BINPATH) @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(BINPATH)
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(CONPATH) @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(CONPATH)
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(DATPATH) @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(DATPATH)
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/codepages @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(EXAPATH)/codepages
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/providers @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(EXAPATH)/providers
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/services @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(EXAPATH)/services
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/sql @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(EXAPATH)/sql
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(LOGPATH) @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(LOGPATH)
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(MANPATH) @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(MANPATH)
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(MODPATH) @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(MODPATH)
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(RUNPATH) @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(RUNPATH)
@-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(SCRPATH) @-$(INSTALL) -d $(INSTFLAGS) -m $(INSTMODE_DIR) $(SCRPATH)
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" $(BINPATH) -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" $(BINPATH)
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) "$(BUILDPATH)/modules/"*.$(DLLEXT) $(MODPATH) -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_BIN) "$(BUILDPATH)/modules/"*.$(DLLEXT) $(MODPATH)
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd $(SCRPATH) 2>/dev/null -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd $(SCRPATH) 2>/dev/null
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/apparmor $(SCRPATH) 2>/dev/null -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/apparmor $(SCRPATH) 2>/dev/null
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/logrotate $(SCRPATH) 2>/dev/null -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/logrotate $(SCRPATH) 2>/dev/null
ifeq ($(SYSTEM), darwin) ifeq ($(SYSTEM), darwin)
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(SCRPATH) 2>/dev/null -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(SCRPATH) 2>/dev/null
endif endif
ifeq ($(SYSTEM), linux) ifeq ($(SYSTEM), linux)
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd.service $(SCRPATH) 2>/dev/null -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd.service $(SCRPATH) 2>/dev/null
endif endif
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd.1 $(MANPATH) 2>/dev/null -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd.1 $(MANPATH) 2>/dev/null
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd-testssl.1 $(MANPATH) 2>/dev/null -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd-testssl.1 $(MANPATH) 2>/dev/null
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) tools/testssl $(BINPATH)/inspircd-testssl 2>/dev/null -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_BIN) tools/testssl $(BINPATH)/inspircd-testssl 2>/dev/null
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/*.example $(EXAPATH) -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) docs/conf/*.example $(EXAPATH)
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/codepages/*.example $(EXAPATH)/codepages -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) docs/conf/codepages/*.example $(EXAPATH)/codepages
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/providers/*.example $(EXAPATH)/providers -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) docs/conf/providers/*.example $(EXAPATH)/providers
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/services/*.example $(EXAPATH)/services -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) docs/conf/services/*.example $(EXAPATH)/services
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/sql/*.sql $(EXAPATH)/sql -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) docs/sql/*.sql $(EXAPATH)/sql
-$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/help.txt $(CONPATH) -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/help.txt $(CONPATH)
@echo "" @echo ""
@echo "*************************************" @echo "*************************************"
@echo "* INSTALL COMPLETE! *" @echo "* INSTALL COMPLETE! *"
@ -300,22 +308,40 @@ clean:
deinstall: deinstall:
-rm -f $(BINPATH)/inspircd -rm -f $(BINPATH)/inspircd
-rm -rf $(EXAPATH) -rm -f $(BINPATH)/inspircd-testssl
-rm -f $(CONPATH)/help.txt
-rm -f $(EXAPATH)/*.example
-rm -f $(EXAPATH)/codepages/*.example
-rm -f $(EXAPATH)/providers/*.example
-rm -f $(EXAPATH)/services/*.example
-rm -f $(EXAPATH)/sql/*.sql
-rm -f $(MANPATH)/inspircd-testssl.1
-rm -f $(MANPATH)/inspircd.1 -rm -f $(MANPATH)/inspircd.1
-rm -f $(MODPATH)/m_*.$(DLLEXT)
-rm -f $(MODPATH)/core_*.$(DLLEXT) -rm -f $(MODPATH)/core_*.$(DLLEXT)
-rm -f $(MODPATH)/m_*.$(DLLEXT)
-rm -f $(SCRPATH)/apparmor
-rm -f $(SCRPATH)/inspircd
-rm -f $(SCRPATH)/inspircd.service -rm -f $(SCRPATH)/inspircd.service
-rm -f $(SCRPATH)/logrotate
-rm -f $(SCRPATH)/org.inspircd.plist -rm -f $(SCRPATH)/org.inspircd.plist
-[ -d $(BINPATH) ] && find $(BINPATH) -type d -empty -delete
-[ -d $(CONPATH) ] && find $(CONPATH) -type d -empty -delete
-[ -d $(DATPATH) ] && find $(DATPATH) -type d -empty -delete
-[ -d $(EXAPATH) ] && find $(EXAPATH) -type d -empty -delete
-[ -d $(LOGPATH) ] && find $(LOGPATH) -type d -empty -delete
-[ -d $(MANPATH) ] && find $(MANPATH) -type d -empty -delete
-[ -d $(MODPATH) ] && find $(MODPATH) -type d -empty -delete
-[ -d $(RUNPATH) ] && find $(RUNPATH) -type d -empty -delete
-[ -d $(SCRPATH) ] && find $(SCRPATH) -type d -empty -delete
configureclean: configureclean:
-rm -f Makefile -rm -f GNUmakefile
rm -f GNUmakefile -rm -f include/config.h
rm -f include/config.h -rm -rf @CONFIGURE_DIRECTORY@
rm -rf @CONFIGURE_DIRECTORY@
distclean: clean configureclean distclean: clean configureclean
-rm -rf "$(SOURCEPATH)/run" -rm -rf "$(SOURCEPATH)/run"
find "$(SOURCEPATH)/src/modules" -type l | xargs rm -f -find "$(SOURCEPATH)/src/modules" -type l -delete
help: help:
@echo 'InspIRCd Makefile' @echo 'InspIRCd Makefile'