Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: znc/znc
base: d9459e153768
...
head fork: znc/znc
compare: f80ae4aad63b
  • 2 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
11 configure.ac
View
@@ -153,10 +153,13 @@ AC_ARG_ENABLE([add-networks],
if test "$DEBUG" != "no"; then
appendCXX -ggdb3
AC_DEFINE([_DEBUG], [1], [Define for debugging])
- # These enable some debug options in g++'s STL, e.g. invalid use of iterators
- AC_DEFINE([_GLIBCXX_DEBUG], [1], [Enable extra debugging checks in libstdc++])
- AC_DEFINE([_GLIBCXX_DEBUG_PEDANTIC], [1], [Enable extra debugging checks in libstdc++])
- AC_DEFINE([_GLIBCXX_CONCEPT_CHECKS], [1], [Enable extra debugging checks in libstdc++])
+ if test "x$ISCYGWIN" != x1; then
+ # These enable some debug options in g++'s STL, e.g. invalid use of iterators
+ # But they cause crashes on cygwin while loading modules
+ AC_DEFINE([_GLIBCXX_DEBUG], [1], [Enable extra debugging checks in libstdc++])
+ AC_DEFINE([_GLIBCXX_DEBUG_PEDANTIC], [1], [Enable extra debugging checks in libstdc++])
+ AC_DEFINE([_GLIBCXX_CONCEPT_CHECKS], [1], [Enable extra debugging checks in libstdc++])
+ fi
else
if test "x$OPTIMIZE" = "xyes"; then
appendCXX -O2
4 modules/Makefile.in
View
@@ -20,14 +20,14 @@ CXX := @CXX@
MODFLAGS := -I$(srcdir)/../include -I../include @CPPFLAGS@ @MODFLAGS@
MODLINK := @MODLINK@
LDFLAGS := @LDFLAGS@
+ISCYGWIN := @ISCYGWIN@
# LIBS are not and should not be used in here.
# The znc binary links already against those.
# ...but not on cygwin!
LIBS :=
-ifeq "@ISCYGWIN@" "1"
+ifeq "$(ISCYGWIN)" "1"
LIBS += @LIBS@
-LDFLAGS += ${LIBS}
endif
PERL_ON := @PERL@
5 modules/modperl.cpp
View
@@ -63,10 +63,13 @@ class CModPerl: public CModule {
m_pPerl = perl_alloc();
perl_construct(m_pPerl);
if (perl_parse(m_pPerl, xs_init, argc, argv, environ)) {
+ sMessage = "Can't initialize perl. ";
+ if (SvTRUE(ERRSV)) {
+ sMessage += PString(ERRSV);
+ }
perl_free(m_pPerl);
PERL_SYS_TERM();
m_pPerl = NULL;
- sMessage = "Can't initialize perl.";
DEBUG(__PRETTY_FUNCTION__ << " can't init perl");
return false;
}
18 modules/modperl/Makefile.inc
View
@@ -14,8 +14,16 @@ modperlLDFLAGS := $(PERL_LD)
# Find additional headers for out-of-tree build
modperlCXXFLAGS += -I.
+ifeq "$(ISCYGWIN)" "1"
+PERLCEXT_EXT := "dll"
+PERLDEPONMOD := "modperl.so"
+else
+PERLCEXT_EXT := "so"
+PERLDEPONMOD :=
+endif
+
PERLHOOK := modperl_install
-CLEAN += modperl/ZNC.so modperl/ZNC.pm modperl/ZNC.o
+CLEAN += modperl/ZNC.$(PERLCEXT_EXT) modperl/ZNC.pm modperl/ZNC.o
CLEAN += modperl/swigperlrun.h modperl/ZNC.cpp modperl/functions.cpp
CLEAN += modperl/gen
all: modperl_all
@@ -28,11 +36,11 @@ endif
install: $(PERLHOOK)
-modperl_all: modperl/ZNC.so modperl/swigperlrun.h modperl/functions.cpp
+modperl_all: modperl/ZNC.$(PERLCEXT_EXT) modperl/swigperlrun.h modperl/functions.cpp
-modperl/ZNC.so: modperl/ZNC.o Makefile
+modperl/ZNC.$(PERLCEXT_EXT): modperl/ZNC.o Makefile modperl.so
$(E) Linking ZNC Perl bindings library...
- $(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $(PERL_LD)
+ $(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $(PERL_LD) $(PERLDEPONMOD)
modperl/ZNC.o: modperl/ZNC.cpp Makefile
@mkdir -p modperl
@@ -51,6 +59,6 @@ modperl_install: install_datadir modperl_all
$(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \
done
mkdir -p $(DESTDIR)$(MODDIR)/modperl
- $(INSTALL_PROGRAM) modperl/ZNC.so $(DESTDIR)$(MODDIR)/modperl
+ $(INSTALL_PROGRAM) modperl/ZNC.$(PERLCEXT_EXT) $(DESTDIR)$(MODDIR)/modperl
$(INSTALL_DATA) modperl/ZNC.pm $(DESTDIR)$(MODDIR)/modperl
$(INSTALL_DATA) $(srcdir)/modperl/startup.pl $(DESTDIR)$(MODDIR)/modperl
32 modules/modpython.cpp
View
@@ -81,8 +81,13 @@ class CModPython: public CModule {
bool OnLoad(const CString& sArgsi, CString& sMessage) {
CString sModPath, sTmp;
- if (!CModules::FindModPath("modpython/_znc_core.so", sModPath, sTmp)) {
- sMessage = "modpython/_znc_core.so not found.";
+#ifdef __CYGWIN__
+ CString sDllPath = "modpython/_znc_core.dll";
+#else
+ CString sDllPath = "modpython/_znc_core.so";
+#endif
+ if (!CModules::FindModPath(sDllPath, sModPath, sTmp)) {
+ sMessage = sDllPath + " not found.";
return false;
}
sTmp = CDir::ChangeDir(sModPath, "..");
@@ -328,14 +333,23 @@ class CModPython: public CModule {
}
virtual ~CModPython() {
+ if (!m_PyZNCModule) {
+ DEBUG("~CModPython(): seems like CModPython::OnLoad() didn't initialize python");
+ return;
+ }
PyObject* pyFunc = PyObject_GetAttrString(m_PyZNCModule, "unload_all");
- PyObject* pyRes = PyObject_CallFunctionObjArgs(pyFunc, NULL);
- if (!pyRes) {
- CString sRetMsg = GetPyExceptionStr();
- DEBUG("modpython tried to unload all modules in its destructor, but: " << sRetMsg);
- }
- Py_CLEAR(pyRes);
- Py_CLEAR(pyFunc);
+ if (!pyFunc) {
+ CString sRetMsg = GetPyExceptionStr();
+ DEBUG("~CModPython(): couldn't find unload_all: " << sRetMsg);
+ return;
+ }
+ PyObject* pyRes = PyObject_CallFunctionObjArgs(pyFunc, NULL);
+ if (!pyRes) {
+ CString sRetMsg = GetPyExceptionStr();
+ DEBUG("modpython tried to unload all modules in its destructor, but: " << sRetMsg);
+ }
+ Py_CLEAR(pyRes);
+ Py_CLEAR(pyFunc);
Py_CLEAR(m_PyFormatException);
Py_CLEAR(m_PyZNCModule);
18 modules/modpython/Makefile.inc
View
@@ -10,8 +10,16 @@ PYTHONCOMMON += -Wno-redundant-decls
modpythonCXXFLAGS := $(PYTHONCOMMON) -I.
modpythonLDFLAGS := $(PY_LDFLAGS)
+ifeq "${ISCYGWIN}" "1"
+PYCEXT_EXT := dll
+PYDEPONMOD := ./modpython.so
+else
+PYCEXT_EXT := so
+PYDEPONMOD :=
+endif
+
PYTHONHOOK := modpython_install
-CLEAN += modpython/_znc_core.so modpython/_znc_core.cpp modpython/znc_core.py modpython/znc_core.pyc
+CLEAN += modpython/_znc_core.$(PYCEXT_EXT) modpython/_znc_core.cpp modpython/znc_core.py modpython/znc_core.pyc
CLEAN += modpython/swigpyrun.h modpython/znc.pyc modpython/functions.cpp modpython/compiler *.pyc
CLEAN += modpython/_znc_core.o modpython/compiler.o
ifneq "$(srcdir)" "."
@@ -35,7 +43,7 @@ install: $(PYTHONHOOK)
ifeq "$(PYTHON_ON)" "yes"
all: modpython_all
endif
-modpython_all: modpython/_znc_core.so modpython/znc.pyc modpython/znc_core.pyc
+modpython_all: modpython/_znc_core.$(PYCEXT_EXT) modpython/znc.pyc modpython/znc_core.pyc
modpython_all: $(addsuffix c, $(notdir $(wildcard $(srcdir)/*.py)))
modpython/_znc_core.o: modpython/_znc_core.cpp Makefile
@@ -44,9 +52,9 @@ modpython/_znc_core.o: modpython/_znc_core.cpp Makefile
$(E) Building ZNC python bindings library...
$(Q)$(CXX) $(MODFLAGS) -I$(srcdir) -MD -MF .depend/modpython.library.dep $(PYTHONCOMMON) -o $@ $< -c
-modpython/_znc_core.so: modpython/_znc_core.o Makefile
+modpython/_znc_core.$(PYCEXT_EXT): modpython/_znc_core.o Makefile modpython.so
$(E) Linking ZNC python bindings library...
- $(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $(PY_LDFLAGS)
+ $(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $(PY_LDFLAGS) $(PYDEPONMOD)
ifneq "$(SWIG)" ""
modpython/znc_core.py modpython/_znc_core.cpp modpython/functions.cpp modpython/swigpyrun.h: modpython/codegen.pl modpython/functions.in Makefile
@@ -70,7 +78,7 @@ modpython_install: install_datadir modpython_all
$(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \
done
mkdir -p $(DESTDIR)$(MODDIR)/modpython
- $(INSTALL_PROGRAM) modpython/_znc_core.so $(DESTDIR)$(MODDIR)/modpython
+ $(INSTALL_PROGRAM) modpython/_znc_core.$(PYCEXT_EXT) $(DESTDIR)$(MODDIR)/modpython
$(INSTALL_DATA) modpython/znc_core.pyc $(DESTDIR)$(MODDIR)/modpython
if test -r modpython/znc_core.py;\
then $(INSTALL_DATA) modpython/znc_core.py $(DESTDIR)$(MODDIR)/modpython;\
2  modules/modpython/znc.py
View
@@ -575,6 +575,8 @@ def unload_module(module):
def unload_all():
while len(_py_modules) > 0:
mod = _py_modules.pop()
+ # add it back to set, otherwise unload_module will be sad
+ _py_modules.add(mod)
unload_module(mod)

No commit comments for this range

Something went wrong with that request. Please try again.