From 1158b206bc2d5ea6db2db749c4b46991426a697b Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Thu, 25 Nov 2004 19:27:09 +0000
Subject: [PATCH] we can now install Gajim with 'make install' Gajim is
 launched throught a bash script that check if we are not root

---
 Makefile      | 29 +++++++++++++++++++++++++++--
 scripts/gajim | 25 +++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 scripts/gajim

diff --git a/Makefile b/Makefile
index d1bbe307b8..1002774232 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,38 @@
 MODULES = common plugins/gtkgui
+PREFIX = /usr
+
+FIND= find -regex '.*\.\(\(glade\)\|\(py\)\|\(xpm\)\)'
+FILES=`$(FIND)`
+DIRS= `$(FIND) -exec dirname {} \; | sort -u`
+
+SCRIPTS = \
+	scripts/gajim
 
 all:
 	msgfmt Messages/fr/LC_MESSAGES/gajim.po -o Messages/fr/LC_MESSAGES/gajim.mo
-	for dir in ${MODULES}; do \
+	for dir in $(MODULES); do \
 	  (cd $$dir; make all); \
 	done
 
 clean:
 	find -name *.pyc -exec rm {} \;
-	for dir in ${MODULES}; do \
+	for dir in $(MODULES) ; do \
 	  (cd $$dir; make clean); \
 	done
+
+install:
+	for d in $(DIRS) ; do \
+		if [ ! -d $(PREFIX)/share/gajim/$$d ] ; then \
+			mkdir -p "$(PREFIX)/share/gajim/$$d"; \
+		fi; \
+	done
+	for f in $(FILES) ; do \
+		DST=`dirname "$$f"`; \
+		cp "$$f" "$(PREFIX)/share/gajim/$$DST/"; \
+	done
+	for s in $(SCRIPTS) ; do \
+		BASE=`basename "$$s"`; \
+		F=`cat "$$s" | sed -e 's!PREFIX!$(PREFIX)!g'`; \
+		echo "$$F" > "$(PREFIX)/bin/$$BASE"; \
+		chmod +x "$(PREFIX)/bin/$$BASE"; \
+	done
diff --git a/scripts/gajim b/scripts/gajim
new file mode 100644
index 0000000000..17cc1d3125
--- /dev/null
+++ b/scripts/gajim
@@ -0,0 +1,25 @@
+#!/bin/sh
+##      gajim
+##
+## Gajim Team:
+##      - Yann Le Boulanger <asterix@crans.org>
+##      - Vincent Hanquez <tab@snarc.org>
+##
+##      Copyright (C) 2003 Gajim Team
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published
+## by the Free Software Foundation; version 2 only.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+if [ `id -u` -eq 0 ]; then
+	echo "You must not launch Gajim as root, it is DANGEROUS"
+	exit 0
+fi
+
+cd PREFIX/share/gajim
+./runCore.py
-- 
GitLab