mirror of
https://github.com/znc/znc.git
synced 2026-07-01 07:21:44 +02:00
a44e6eaada
Old modperl had several flaws and was very outdated. New modperl makes the whole ZNC API accessible from inside perl. Modperl API was changed, so old perl modules are not supported, but they weren't used much anyway. Modperl needs --enable-perl option to ./configure. This introduces new dependence on SWIG, which is needed only while compiling ZNC. So to use modperl, you need to install SWIG or to download several files and use --disable-swig option of configure. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2120 726aef4b-f618-498e-8847-2d620e286838
174 lines
4.9 KiB
Makefile
174 lines
4.9 KiB
Makefile
SHELL := @SHELL@
|
|
|
|
# Support out-of-tree builds
|
|
srcdir := @srcdir@
|
|
VPATH := @srcdir@
|
|
|
|
prefix := @prefix@
|
|
exec_prefix := @exec_prefix@
|
|
datarootdir := @datarootdir@
|
|
bindir := @bindir@
|
|
datadir := @datadir@
|
|
sysconfdir := @sysconfdir@
|
|
libdir := @libdir@
|
|
sbindir := @sbindir@
|
|
localstatedir := @localstatedir@
|
|
CXX := @CXX@
|
|
# CXXFLAGS are for the main binary, so don't use them here, use MODFLAGS instead
|
|
MODFLAGS := @CPPFLAGS@ @MODFLAGS@ -I$(srcdir)/..
|
|
MODLINK := @MODLINK@
|
|
LDFLAGS := @LDFLAGS@
|
|
# LIBS are not and should not be used in here.
|
|
# The znc binary links already against those.
|
|
# LIBS := @LIBS@
|
|
PERL := @PERL_BINARY@
|
|
SWIG := @SWIG_BINARY@
|
|
MODDIR := @MODDIR@
|
|
DATADIR := @DATADIR@
|
|
LIBZNC := @LIBZNC@
|
|
LIBZNCDIR:= @LIBZNCDIR@
|
|
INSTALL := @INSTALL@
|
|
INSTALL_PROGRAM := @INSTALL_PROGRAM@
|
|
INSTALL_SCRIPT := @INSTALL_SCRIPT@
|
|
INSTALL_DATA := @INSTALL_DATA@
|
|
|
|
TCL_FLAGS:= @TCL_FLAGS@
|
|
|
|
ifneq "$(V)" ""
|
|
VERBOSE=1
|
|
endif
|
|
ifeq "$(VERBOSE)" ""
|
|
Q=@
|
|
E=@echo
|
|
else
|
|
Q=
|
|
E=@\#
|
|
endif
|
|
|
|
ifneq "$(LIBZNC)" ""
|
|
LDFLAGS += -L.. -lznc -Wl,-rpath,$(LIBZNCDIR)
|
|
endif
|
|
|
|
FILES := $(notdir $(wildcard $(srcdir)/*.cpp))
|
|
# If extra is enabled
|
|
ifeq "@EXTRA@" "yes"
|
|
FILES += $(addprefix extra/, $(notdir $(wildcard $(srcdir)/extra/*.cpp)))
|
|
endif
|
|
|
|
FILES := $(basename $(FILES))
|
|
|
|
ifeq "@NOSSL@" "1"
|
|
FILES := $(foreach file, $(FILES), \
|
|
$(if $(shell grep REQUIRESSL $(srcdir)/$(file).cpp), \
|
|
, \
|
|
$(basename $(file)) \
|
|
))
|
|
endif
|
|
|
|
ifneq "$(PERL)" ""
|
|
# We execute this now so that we see the 'beauty' of these flags in make's output
|
|
modperlFLAGS := $(shell $(PERL) -MExtUtils::Embed -e perl_inc -e ldopts)
|
|
# Perl API is ugly, casting string literals to char* and redeclaring functions :(
|
|
modperlFLAGS += -Wno-write-strings -Wno-redundant-decls -Wno-missing-declarations
|
|
# This is for SWIG
|
|
modperlFLAGS += -DSWIG_TYPE_TABLE=znc
|
|
# Find additional headers for out-of-tree build
|
|
modperlFLAGS += -I.
|
|
PERLHOOK := modperl_install
|
|
else
|
|
FILES := $(shell echo $(FILES) | sed -e "s/modperl//")
|
|
endif
|
|
|
|
ifeq "@SASL@" ""
|
|
FILES := $(shell echo $(FILES) | sed -e "s:extra/saslauth::")
|
|
endif
|
|
saslauthFLAGS := -lsasl2
|
|
|
|
ifeq "@CHARSET@" ""
|
|
FILES := $(shell echo $(FILES) | sed -e "s:extra/charset::")
|
|
endif
|
|
charsetFLAGS := @LIBICONV@
|
|
|
|
ifeq "$(TCL_FLAGS)" ""
|
|
FILES := $(shell echo $(FILES) | sed -e "s:extra/modtcl::")
|
|
else
|
|
TCLHOOK := modtcl_install
|
|
endif
|
|
modtclFLAGS := $(TCL_FLAGS)
|
|
|
|
|
|
TARGETS := $(addsuffix .so, $(FILES))
|
|
|
|
CLEAN := *.so extra/*.so modperl/ZNC.so modperl/modperl_wrap.cxx modperl/ZNC.pm
|
|
|
|
.PHONY: all clean install modperl_install
|
|
|
|
all: $(TARGETS)
|
|
|
|
install: all create_install_dir install_metadirs $(PERLHOOK) $(TCLHOOK)
|
|
$(INSTALL_PROGRAM) $(TARGETS) $(DESTDIR)$(MODDIR)
|
|
|
|
create_install_dir:
|
|
mkdir -p $(DESTDIR)$(MODDIR)
|
|
mkdir -p $(DESTDIR)$(DATADIR)
|
|
rm -rf $(DESTDIR)$(MODDIR)/*.so
|
|
|
|
install_metadirs: create_install_dir
|
|
for a in $(srcdir)/*; do \
|
|
d=$$(echo $$a | sed -e "s:$(srcdir)/::g"); \
|
|
if [ -d $$a ] && [ -f $${d}.so ]; then \
|
|
cp -Rp $$a $(DESTDIR)$(DATADIR); \
|
|
fi \
|
|
done
|
|
|
|
clean:
|
|
rm -rf $(CLEAN)
|
|
|
|
%.so: %.cpp Makefile
|
|
@mkdir -p .depend
|
|
@mkdir -p extra
|
|
$(E) Building $(if $(filter %extra/,$(dir $<)),extra )module $(notdir $(basename $@))...
|
|
$(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $($(notdir $(basename $@))FLAGS) -MMD -MF .depend/$(notdir $@).dep
|
|
|
|
modperl.so: modperl/ZNC.so
|
|
modperl/ZNC.so: modperl/modperl_wrap.cxx Makefile
|
|
$(E) Building ZNC perl bindings library...
|
|
$(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -I$(srcdir) -DSWIG_TYPE_TABLE=znc $(shell $(PERL) -MExtUtils::Embed -e perl_inc -e ldopts) -o $@ $<
|
|
ifneq "$(SWIG)" ""
|
|
modperl/modperl_wrap.cxx: modperl/modperl.i Makefile modperl/module.h modperl/CString.i
|
|
$(E) Generating ZNC API for perl...
|
|
@mkdir -p modperl
|
|
$(Q)$(SWIG) -perl5 -c++ -shadow -outdir modperl -I$(srcdir) -w362,315,401,402 -o $@.warn $<
|
|
$(Q)$(PERL) -pe '$$x==2 and print "items+=0;" and $$x=3;/^XS\(SWIG_init\)/ and $$x=1;$$x==1 and /dXSARGS/ and $$x=2' $@.warn > $@
|
|
$(Q)rm -rf $@.warn
|
|
$(Q)$(SWIG) -perl5 -c++ -shadow -external-runtime modperl/swigperlrun.h
|
|
endif
|
|
|
|
modperl_install: create_install_dir install_metadirs
|
|
for i in $(srcdir)/*.pm; do \
|
|
$(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \
|
|
done
|
|
for a in $(srcdir)/*; do \
|
|
if [ -d $$a ] && [ -f $${a}.pm ]; then \
|
|
cp -Rp $$a $(DESTDIR)$(DATADIR); \
|
|
fi \
|
|
done
|
|
rm -rf $(DESTDIR)$(DATADIR)/modperl
|
|
mkdir -p $(DESTDIR)$(MODDIR)/modperl
|
|
$(INSTALL_PROGRAM) $(srcdir)/modperl/ZNC.so $(DESTDIR)$(MODDIR)/modperl
|
|
$(INSTALL_DATA) $(srcdir)/modperl/ZNC.pm $(DESTDIR)$(MODDIR)/modperl
|
|
$(INSTALL_DATA) $(srcdir)/modperl/startup.pl $(DESTDIR)$(MODDIR)/modperl
|
|
|
|
modtcl_install:
|
|
mkdir -p $(DESTDIR)$(DATADIR)/modtcl/
|
|
$(INSTALL_DATA) $(srcdir)/extra/modtcl.tcl $(srcdir)/extra/binds.tcl $(DESTDIR)$(DATADIR)/modtcl/
|
|
|
|
uninstall:
|
|
# Yes, we are lazy, just remove everything in there
|
|
rm -rf $(DESTDIR)$(MODDIR)/*
|
|
rm -rf $(DESTDIR)$(DATADIR)/*
|
|
rmdir $(DESTDIR)$(MODDIR)
|
|
rmdir $(DESTDIR)$(DATADIR)
|
|
|
|
-include $(wildcard .depend/*.dep)
|