Mercurial > pidgin.yaz
changeset 6816:5aeba37b303c
[gaim-migrate @ 7356]
Perl plugins for Win Gaim.
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Fri, 12 Sep 2003 19:04:52 +0000 |
parents | 1c6a4cba84f3 |
children | 8af705eb064e |
files | Makefile.mingw gaim-installer.nsi plugins/perl/.cvsignore plugins/perl/Makefile.mingw plugins/perl/common/.cvsignore plugins/perl/common/Makefile.mingw plugins/perl/common/module.h plugins/perl/perl-common.h src/main.c src/win32/win32dep.c src/win32/win32dep.h src/win_gaim.c |
diffstat | 12 files changed, 146 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.mingw Fri Sep 12 05:36:50 2003 +0000 +++ b/Makefile.mingw Fri Sep 12 19:04:52 2003 +0000 @@ -11,7 +11,6 @@ GAIM_PIXMAPS = ./pixmaps GAIM_SOUNDS = ./sounds GAIM_INSTALL_DIR = ./win32-install-dir -PERL_TOP = ../win32-dev/perl56 GTKSPELL_TOP = ../win32-dev/gtkspell-2.0.4/gtkspell NSS_TOP = ../win32-dev/nss-3.8 NSPR_TOP = ../win32-dev/nspr-4.3 @@ -30,8 +29,7 @@ VERSION := $(shell cat ./VERSION) -NEEDED_DLLS = $(PERL_TOP)/perl56.dll \ - $(GTKSPELL_TOP)/libgtkspell.dll \ +NEEDED_DLLS = $(GTKSPELL_TOP)/libgtkspell.dll \ $(IDLETRACK_TOP)/idletrack.dll \ $(NSS_TOP)/lib/nss3.dll \ $(NSS_TOP)/lib/nssckbi.dll \
--- a/gaim-installer.nsi Fri Sep 12 05:36:50 2003 +0000 +++ b/gaim-installer.nsi Fri Sep 12 19:04:52 2003 +0000 @@ -49,6 +49,8 @@ !define GTK_VERSION "2.2.2" !define GTK_REG_KEY "SOFTWARE\GTK\2.0" +!define PERL_REG_KEY "SOFTWARE\Perl" +!define PERL_DLL "perl58.dll" !define GTK_DEFAULT_INSTALL_PATH "$PROGRAMFILES\Common Files\GTK\2.0" !define GTK_RUNTIME_INSTALLER "..\gtk_installer\gtk-runtime*.exe" !define GTK_THEME_DIR "..\gtk_installer\gtk_themes" @@ -313,6 +315,7 @@ gaim_hklm: ReadRegStr $R1 HKLM ${GTK_REG_KEY} "Path" + WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "" "$INSTDIR\gaim.exe" WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$R1\bin" WriteRegStr HKLM ${GAIM_REG_KEY} "" "$INSTDIR" WriteRegStr HKLM ${GAIM_REG_KEY} "Version" "${GAIM_VERSION}" @@ -345,6 +348,25 @@ File ..\win32-dev\drmingw\exchndl.dll !endif + ; Check if Perl is installed, If not remove perl plugin + ReadRegStr $R2 HKLM ${PERL_REG_KEY} "" + StrCmp $R2 "" 0 perl_exists + ReadRegStr $R2 HKCU ${PERL_REG_KEY} "" + StrCmp $R2 "" perl_remove perl_exists + + perl_remove: + Delete "$INSTDIR\plugins\perl.dll" + RMDir /r "$INSTDIR\perlmod" + Goto perl_done + + perl_exists: + IfFileExists "$R2\bin\${PERL_DLL}" 0 perl_remove + StrCmp $R0 "HKLM" 0 perl_done + ReadRegStr $R3 HKLM "${HKLM_APP_PATHS_KEY}" "Path" + WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$R3;$R2\bin" + + perl_done: + ; If we don't have install rights and no hklm GTK install.. then Start in lnk property should ; remain gaim dir.. otherwise it should be set to the GTK bin dir. (to avoid dll hell) StrCmp $R0 "NONE" 0 startin_gtk
--- a/plugins/perl/.cvsignore Fri Sep 12 05:36:50 2003 +0000 +++ b/plugins/perl/.cvsignore Fri Sep 12 19:04:52 2003 +0000 @@ -3,6 +3,7 @@ .deps .libs *.dll +*.lib *.la *.lo *.a
--- a/plugins/perl/Makefile.mingw Fri Sep 12 05:36:50 2003 +0000 +++ b/plugins/perl/Makefile.mingw Fri Sep 12 19:04:52 2003 +0000 @@ -10,7 +10,7 @@ GTK_TOP := ../../../win32-dev/gtk_2_0 GAIM_TOP := ../.. -PERL_LIB_DIR := ../../../win32-dev/perl56 +PERL_LIB_DIR := ../../../win32-dev/perl58 PERL_INCLUDE := $(PERL_LIB_DIR)/CORE GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir DLL_INSTALL_DIR := $(GAIM_INSTALL_DIR)/plugins @@ -84,7 +84,7 @@ -lws2_32 \ -lintl \ -lgaim \ - -lperl56 + -lperl58 ## @@ -103,10 +103,11 @@ .PHONY: all clean all: $(TARGET).dll + $(MAKE) -C ./common -f Makefile.mingw install: cp $(TARGET).dll $(DLL_INSTALL_DIR) - + $(MAKE) -C ./common -f Makefile.mingw install ## ## BUILD Dependencies @@ -120,7 +121,7 @@ ## $(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--export-all-symbols -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll ## @@ -129,4 +130,5 @@ clean: rm -rf *.o - rm -rf $(TARGET).dll + rm -rf $(TARGET).dll $(TARGET).lib + $(MAKE) -C ./common -f Makefile.mingw clean
--- a/plugins/perl/common/.cvsignore Fri Sep 12 05:36:50 2003 +0000 +++ b/plugins/perl/common/.cvsignore Fri Sep 12 19:04:52 2003 +0000 @@ -7,3 +7,4 @@ const-xs.inc pm_to_blib *.c +*.dll
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/perl/common/Makefile.mingw Fri Sep 12 19:04:52 2003 +0000 @@ -0,0 +1,77 @@ +# +# Makefile.mingw +# +# Description: Makefile for Gaim perl module. +# + +TARGET = Gaim + +CC := gcc +PERL := /cygdrive/c/perl/bin/perl + +EXTUTILS := C:/perl/lib/ExtUtils +GAIM_TOP := ../../.. +GTK_TOP := ../../../../win32-dev/gtk_2_0 +PERL_TOP := ../../../../win32-dev/perl58 +PERL_PLUGIN_TOP := .. +GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir +PERLMOD_INSTALL_DIR := $(GAIM_INSTALL_DIR)/perlmod + +INCLUDE_PATHS = -I. \ + -I$(GAIM_TOP) \ + -I$(GAIM_TOP)/src \ + -I$(GTK_TOP)/include/glib-2.0 \ + -I$(GTK_TOP)/lib/glib-2.0/include \ + -I$(PERL_TOP)/CORE + +LIB_PATHS = -L$(PERL_TOP) \ + -L$(PERL_PLUGIN_TOP) \ + -L$(GAIM_TOP)/src \ + -L$(GTK_TOP)/lib + + +XS_FILES = Account.xs \ + BuddyList.xs \ + BuddyList_Buddy.xs \ + BuddyList_Chat.xs \ + BuddyList_Group.xs \ + Connection.xs \ + ConvWindow.xs \ + Conversation.xs \ + Conversation_Chat.xs \ + Conversation_IM.xs \ + Gaim.xs + +FALLBACKS = const-c.inc const-xs.inc + +C_FILES = $(XS_FILES:%.xs=%.c) + +OBJECTS = $(C_FILES:%.c=%.o) + +LIBS = -lperl58 \ + -lperl \ + -lgaim \ + -lglib-2.0 + +# How to make a C file +%.o: %.c + $(CC) $(CFLAGS) $(INCLUDE_PATHS) $(DEFINES) -c $< -o $@ + +# How to make a XS file +%.c: %.xs + $(PERL) $(EXTUTILS)/xsubpp -typemap $(EXTUTILS)/typemap -typemap typemap $< > $@ + +%.inc: + cp fallback/$@ ./ + +all: $(TARGET).dll + +install: + mkdir -p $(PERLMOD_INSTALL_DIR) + cp $(TARGET).dll Gaim.pm $(PERLMOD_INSTALL_DIR) + +$(TARGET).dll: $(FALLBACKS) $(OBJECTS) + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) -o $(TARGET).dll + +clean: + rm -rf *.o $(TARGET).dll $(FALLBACKS)
--- a/plugins/perl/common/module.h Fri Sep 12 05:36:50 2003 +0000 +++ b/plugins/perl/common/module.h Fri Sep 12 19:04:52 2003 +0000 @@ -2,10 +2,13 @@ #define group perl_group +#include <glib.h> +#ifdef _WIN32 +#undef pipe +#endif #include <EXTERN.h> #include <perl.h> #include <XSUB.h> -#include <glib.h> #undef group
--- a/plugins/perl/perl-common.h Fri Sep 12 05:36:50 2003 +0000 +++ b/plugins/perl/perl-common.h Fri Sep 12 19:04:52 2003 +0000 @@ -1,10 +1,13 @@ #ifndef _GAIM_PERL_COMMON_H_ #define _GAIM_PERL_COMMON_H_ +#include <glib.h> +#ifdef _WIN32 +#undef pipe +#endif #include <XSUB.h> #include <EXTERN.h> #include <perl.h> -#include <glib.h> #include "value.h"
--- a/src/main.c Fri Sep 12 05:36:50 2003 +0000 +++ b/src/main.c Fri Sep 12 19:04:52 2003 +0000 @@ -805,6 +805,10 @@ abort(); } +#ifdef _WIN32 + wgaim_pre_plugin_init(); +#endif + plugin_search_paths[0] = LIBDIR; plugin_search_paths[1] = gaim_user_dir(); plugin_search_paths[2] = g_strdup_printf("%s/plugins", gaim_user_dir());
--- a/src/win32/win32dep.c Fri Sep 12 05:36:50 2003 +0000 +++ b/src/win32/win32dep.c Fri Sep 12 19:04:52 2003 +0000 @@ -412,19 +412,28 @@ /* Windows Initializations */ +void wgaim_pre_plugin_init(void) { + char *perlenv, *newenv; + + /* Tell perl where to find Gaim's perl modules */ + perlenv = (char*)g_getenv("PERL5LIB"); + newenv = g_strdup_printf("PERL5LIB=%s%s%s%s", + perlenv ? perlenv : "", + perlenv ? ";" : "", + wgaim_install_dir(), + "\\perlmod;"); + if(putenv(newenv)<0) + gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "putenv failed\n"); + g_free(newenv); +} + void wgaim_init(void) { WORD wVersionRequested; WSADATA wsaData; char newenv[128]; - char* drmingw; gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_init\n"); - /* Load exception handler if we have it */ - drmingw = g_build_filename(wgaim_install_dir(), "exchndl.dll", NULL); - LoadLibrary(drmingw); - g_free(drmingw); - load_winver_specific_procs(); /*
--- a/src/win32/win32dep.h Fri Sep 12 05:36:50 2003 +0000 +++ b/src/win32/win32dep.h Fri Sep 12 19:04:52 2003 +0000 @@ -56,6 +56,7 @@ extern void wgaim_systray_minimize( GtkWidget* ); extern void wgaim_systray_maximize( GtkWidget* ); /* init / cleanup */ +extern void wgaim_pre_plugin_init(void); extern void wgaim_init(void); extern void wgaim_cleanup(void);
--- a/src/win_gaim.c Fri Sep 12 05:36:50 2003 +0000 +++ b/src/win_gaim.c Fri Sep 12 19:04:52 2003 +0000 @@ -8,6 +8,7 @@ */ #include <windows.h> #include <stdlib.h> +#include <glib.h> /* * GLOBALS @@ -22,7 +23,7 @@ * PROTOTYPES */ extern int gaim_main( int, char** ); - +extern char* wgaim_install_dir(); #ifdef __GNUC__ # ifndef _stdcall @@ -36,7 +37,14 @@ char *lpszCmdLine, int nCmdShow) { + char* drmingw; gaimexe_hInstance = hInstance; + + /* Load exception handler if we have it */ + drmingw = g_build_filename(wgaim_install_dir(), "exchndl.dll", NULL); + LoadLibrary(drmingw); + g_free(drmingw); + return gaim_main (__argc, __argv); }