Skip to content

Commit

Permalink
Move installers and launchers into modules/installer andn rewrite bui…
Browse files Browse the repository at this point in the history
…ld scripts.

More work on building debs.
 - Use CDBS now which allows us to choose what ant targets to use

This can now build nice jars, debs, dmgs, and exes - and passable rpm and slackware-style tgzs

The .run files no longer exist, we should probably come up with an alternative for non-debian, non-redhat, non-slackware unixes (gentoo, BSD, Solaris etc...)

Change-Id: I2d518110abbf37196d11c8110c54ad20f34a115e
Depends-On: I31ac07ade010d2bff38aefeac71a03e946069627
Reviewed-on: http://gerrit.dmdirc.com/1738
Automatic-Compile: DMDirc Local Commits <[email protected]>
Reviewed-by: Chris Smith <[email protected]>
  • Loading branch information
ShaneMcC authored and csmith committed Jan 26, 2011
1 parent b6c1b74 commit e87bde3
Show file tree
Hide file tree
Showing 35 changed files with 1,998 additions and 45 deletions.
113 changes: 113 additions & 0 deletions deb/DMDirc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/bin/sh
#
# This script launches dmdirc and attempts to update the jar file if needed.
#
# DMDirc - Open Source IRC Client
# Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

LAUNCHERVERSION="1"
LAUNCHERINFO="deb-${LAUNCHERVERSION}"

echo "---------------------"
echo "DMDirc - Open Source IRC Client"
echo "Launcher Version: ${LAUNCHERVERSION}"
echo "Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes"
echo "---------------------"
echo "Running on Linux."
echo -n "Looking for java - ";

JAVA=`which java`

if [ "" != "${JAVA}" ]; then
echo "Success! (${JAVA})"
else
echo "Failed!"

PIDOF=`which pidof`
if [ "${PIDOF}" = "" ]; then
# For some reason some distros hide pidof...
if [ -e /sbin/pidof ]; then
PIDOF=/sbin/pidof
elif [ -e /usr/sbin/pidof ]; then
PIDOF=/usr/sbin/pidof
fi;
fi;

PGREP=`which pgrep`
if [ "${PIDOF}" != "" ]; then
ISKDE=`${PIDOF} -x -s kdeinit kdeinit4`
ISGNOME=`${PIDOF} -x -s gnome-panel`
elif [ "${PGREP}" != "" ]; then
ISKDE=`pgrep kdeinit`
ISGNOME=`pgrep gnome-panel`
else
ISKDE=`ps -Af | grep kdeinit | grep -v grep`
ISGNOME=`ps -Af | grep gnome-panel | grep -v grep`
fi;
KDIALOG=`which kdialog`
ZENITY=`which zenity`
DIALOG=`which dialog`

if [ "${ISKDE}" != "" -o "${ZENITY}" = "" ]; then
USEKDIALOG="1";
else
USEKDIALOG="0";
fi;

errordialog() {
# Send error to console.
echo ""
echo "-----------------------------------------------------------------------"
echo "[Error] DMDirc: ${1}"
echo "-----------------------------------------------------------------------"
echo "${2}"
echo "-----------------------------------------------------------------------"

# if kdialog exists, and we have a display, and we are not running gnome,
# and either we are running kde or zenity doesn't exist..
if [ "" != "${KDIALOG}" -a "" != "${DISPLAY}" -a "" = "${ISGNOME}" -a "${USEKDIALOG}" = "1" ]; then
echo "Dialog on Display: ${DISPLAY}"
${KDIALOG} --title "DMDirc: ${1}" --error "${2}"
elif [ "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
# Else, if zenity exists and we have a display
echo "Dialog on Display: ${DISPLAY}"
${ZENITY} --error --title "DMDirc: ${1}" --text "${2}"
elif [ "" != "${DIALOG}" ]; then
# Else, if dialog exists and we have a display
${DIALOG} --title "[Error] DMDirc: ${1}" --msgbox "${2}" 8 40
fi
}

errordialog "Unable to launch DMDirc" "DMDirc was unable to locate java, please make sure there is a java binary in your PATH."

exit 1;
fi

echo "Running DMDirc - "

${JAVA} -ea -jar ${jar} -l ${LAUNCHERINFO} ${@}
EXITCODE=${?}
if [ ${EXITCODE} -eq 42 ]; then
# The client says we need to update, rerun ourself before exiting.
${0} ${@}
fi;

exit ${EXITCODE};
4 changes: 2 additions & 2 deletions deb/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Source: dmdirc
Priority: extra
Maintainer: Shane Mc Cormack <[email protected]>
Uploaders: Chris Smith <[email protected]>, Greg Holmes <[email protected]>, Simon Mott <[email protected]>
Build-Depends: debhelper (>= 7.0.50~), javahelper (>=0.25)
Build-Depends-Indep: default-jdk, ant, git-core
Build-Depends: cdbs (>= 0.4.36), debhelper (>= 7.0.50~), javahelper (>=0.25)
Build-Depends-Indep: default-jdk, ant-optional, git-core
Standards-Version: 3.9.0
Vcs-Git: git://dmdirc.com/client
Vcs-browser: http://git.dmdirc.com/client/
Expand Down
4 changes: 4 additions & 0 deletions deb/debian/dmdirc.install
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
dist/DMDirc.jar opt/dmdirc
DMDirc.sh opt/dmdirc
icon.svg opt/dmdirc
irc.protocol opt/dmdirc
dmdirc.desktop usr/share/applications/
1 change: 1 addition & 0 deletions deb/debian/dmdirc.links
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/bin/dmdirc opt/dmdirc/DMDirc.sh
11 changes: 11 additions & 0 deletions deb/debian/dmdirc.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

if [ "configure" = "${1}" ]; then
update-alternatives --quiet --install /usr/share/services/irc.protocol irc.protocol /opt/dmdirc/irc.protocol 50

# TODO: Also add to gnome
fi;

#DEBHELPER#

exit 0;
11 changes: 11 additions & 0 deletions deb/debian/dmdirc.prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

if [ "remove" = "${1}" -o "upgrade" = "${1}" -o "deconfigure" = "${1}" ]; then
update-alternatives --quiet --remove irc.protocol /opt/dmdirc/irc.protocol

# TODO: Also remove from gnome
fi;

#DEBHELPER#

exit 0;
20 changes: 11 additions & 9 deletions deb/debian/rules
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#!/usr/bin/make -f

JAVA_HOME=/usr/lib/jvm/default-java
VERSION=$(shell cat dmdirc-version)

%:
dh $@ --with javahelper

override_dh_link:
include /usr/share/cdbs/1/class/ant.mk
include /usr/share/cdbs/1/rules/debhelper.mk

JAVA_HOME=/usr/lib/jvm/default-java
DEB_ANT_COMPILER=ant
DEB_ANT_BUILD_TARGET=with.disabled.updater jar

# dh_link opt/dmdirc/dmdirc.sh usr/bin/dmdirc
# Without this, cdbs seems to try something strange which makes it unabel to
# find some of the ant tasks.
# So lets just do it normally.
DEB_ANT_INVOKE= cd $(DEB_BUILDDIR) && ant

override_dh_auto_test:
# Used by get-source and get-orig-souce
PACKAGE_VERSION := $(shell cat dmdirc-version)

# Get the source and the version
get-source:
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions deb/dmdirc.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Desktop Entry]
Categories=Network;IRCClient;
Comment=DMDirc IRC Client
Encoding=UTF-8
Exec=/usr/bin/DMDirc
GenericName=IRC Client
Icon=/opt/dmdirc/icon.svg
Name=DMDirc
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
11 changes: 11 additions & 0 deletions deb/irc.protocol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Protocol]
exec="/usr/bin/DMDirc" -e -c %u
protocol=irc
input=none
output=none
helper=true
listing=false
reading=false
writing=false
makedir=false
deleting=false
File renamed without changes.
Loading

0 comments on commit e87bde3

Please sign in to comment.