1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge pull request #249 from dubslow/master

Fancier packaging script
This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-09-01 21:24:08 +02:00
commit 4e6f0c1e7e
2 changed files with 91 additions and 8 deletions

View File

@ -1,3 +1,19 @@
/*
Copyright (C) 2013 by Maxim Biro <nurupo.contributions@gmail.com>
This file is part of Tox Qt GUI.
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, either version 3 of the License, or
(at your option) any later version.
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 COPYING file for more details.
*/
#include "core.h"
#include "widget/widget.h"

83
tools/buildPackages.sh Normal file → Executable file
View File

@ -4,28 +4,95 @@
VERSION_UPSTREAM="1.0"
VERSION_PACKAGE="1"
PACKAGENAME="qtox"
UPSTREAM_GIT_URL="https://github.com/tux3/qtox.git"
UPSTREAM_URL="https://github.com/tux3/qTox/archive/master.tar.gz"
# Make some vars for convenience
VERNAME=$PACKAGENAME"_"$VERSION_UPSTREAM
FULLVERNAME=$VERNAME"-"$VERSION_PACKAGE
ARCHIVENAME=$VERNAME".orig.tar.gz"
# ARCHIVENAME > FULLVERNAME > VERNAME = PACKAGENAME+UPVER
# Get some args
OPT_SUDO=true
OPT_APT=true
OPT_KEEP=false
while [ $# -ge 1 ] ; do
if [ ${1} = "-s" -o ${1} = "--no-sudo" ] ; then
OPT_SUDO=false
shift
elif [ ${1} = "-a" -o ${1} = "--no-apt" ] ; then
OPT_APT=false
shift
elif [ ${1} = "-k" -o ${1} = "--keep" ]; then
OPT_KEEP=true
shift
else
if [ ${1} != "-h" -a ${1} != "--help" ] ; then
echo "[ERROR] Unknown parameter \"${1}\""
echo ""
fi
# print help
echo "Use this script to build qTox packages for Debian and Red Hat families"
echo ""
echo "usage:"
echo " ${0} [-h|--help|-k|--keep|-s|--no-sudo|-a|--no-apt]"
echo ""
echo "parameters:"
echo " -h|--help : displays this help"
echo " -s|--no-sudo: disables using sudo for apt and alien"
echo " -a|--no-apt : disables apt-get (used for build deps) entirely"
echo " -k|--keep : does not delete the build files afterwards"
echo ""
echo "example usages:"
echo " ${0} -- build packages, cleaning up trash and running sudo alien and apt-get"
echo " ${0} -s -k -- build packages, keeping build files and non-sudo alien and apt-get"
exit 1
fi
done
# Get the requried tools if needed
echo "Installing missing tools (if any)..."
apt-get install git debhelper cdbs devscripts alien tar gzip build-essential
if [[ $OPT_APT = "true" ]]; then
echo "Installing missing tools (if any)..."
if [[ $EUID -ne 0 && $OPT_SUDO = "true" ]]; then
sudo apt-get install wget debhelper cdbs devscripts alien tar gzip build-essential
else
apt-get install wget debhelper cdbs devscripts alien tar gzip build-essential
fi
fi
mkdir -p .packages
cd .packages
# Cleanup
rm -r $VERNAME 2> /dev/null
rm $ARCHIVENAME 2> /dev/null
# Fectche sources and layour directories
git clone --depth 1 $UPSTREAM_GIT_URL
mv $PACKAGENAME $VERNAME
tar cz $VERNAME > $ARCHIVENAME
# Fectch sources and layout directories
wget -O $ARCHIVENAME $UPSTREAM_URL
tar xvf $ARCHIVENAME 2> /dev/null # Extracts to qTox-master
mv qTox-master $VERNAME
#tar cz $VERNAME > $ARCHIVENAME
# Build packages
cd $VERNAME
debuild -us -uc
cd ..
alien ./$FULLVERNAME*.deb -r
# alien warns that it should probably be run as root...
if [[ $EUID -ne 0 && $OPT_SUDO = "true" ]]; then
sudo alien ./$FULLVERNAME*.deb -r
else
alien ./$FULLVERNAME*.deb -r
fi
mv *.deb ..
mv -f *.rpm ..
if [[ $OPT_KEEP = "false" ]]; then
rm -r *
fi
cd ..
rmdir .packages 2> /dev/null # fails if non empty