mirror of https://github.com/PCSX2/pcsx2.git
debian: make create tarball script compatible with git
This commit is contained in:
parent
c2b78c6fdf
commit
da4a785fae
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# copyright (c) 2011 Gregory Hainaut
|
||||
# copyright (c) 2011-2014 Gregory Hainaut
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -24,140 +24,128 @@ help()
|
|||
Help:
|
||||
-rev <rev> : revision number
|
||||
-branch <name> : branch name, take trunk otherwise
|
||||
-local : download the svn repository into $HOME/.cache (not deleted by the script)
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Default value
|
||||
SVN_CO_VERSION=0;
|
||||
BRANCH="trunk"
|
||||
LOCAL=0
|
||||
GIT_SHA1=0;
|
||||
BRANCH="master"
|
||||
while [ -n "$1" ]; do
|
||||
case $1 in
|
||||
-help|-h) help;shift 1;;
|
||||
-rev|-r) SVN_CO_VERSION=$2; shift 2;;
|
||||
-branch|-b) BRANCH=$2; shift 2;;
|
||||
-local|-l) LOCAL=1;shift 1;;
|
||||
-help|-h ) help;shift 1;;
|
||||
-rev|-r ) GIT_SHA1=$2; shift 2;;
|
||||
-branch|-b ) BRANCH=$2; shift 2;;
|
||||
--) shift;break;;
|
||||
-*) echo "ERROR: $1 option does not exists. Use -h for help";exit 1;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$SVN_CO_VERSION" = "0" ] ; then
|
||||
help
|
||||
fi
|
||||
|
||||
if [ "$BRANCH" = "trunk" ] ; then
|
||||
SVN_TRUNK="http://pcsx2.googlecode.com/svn/trunk"
|
||||
else
|
||||
SVN_TRUNK="http://pcsx2.googlecode.com/svn/branches/$BRANCH"
|
||||
fi
|
||||
|
||||
# Debian name of package and tarball
|
||||
PKG_NAME="pcsx2.snapshot-${SVN_CO_VERSION}"
|
||||
TAR_NAME="pcsx2.snapshot_${SVN_CO_VERSION}.orig.tar"
|
||||
|
||||
# Directory
|
||||
TMP_DIR=/tmp
|
||||
if [ "$LOCAL" = 1 ] ; then
|
||||
ROOT_DIR=${HOME}/.cache/svn_pcsx2__${BRANCH}
|
||||
else
|
||||
ROOT_DIR=${TMP_DIR}/subversion_pcsx2_${SVN_CO_VERSION}
|
||||
fi
|
||||
NEW_DIR=${TMP_DIR}/$PKG_NAME
|
||||
TMP_DIR=/tmp/pcsx2_git
|
||||
mkdir -p $TMP_DIR
|
||||
|
||||
REMOTE_REPO="https://github.com/PCSX2/pcsx2.git"
|
||||
LOCAL_REPO="$TMP_DIR/pcsx2"
|
||||
|
||||
|
||||
######################################################################
|
||||
# Basic functions
|
||||
######################################################################
|
||||
get_svn_dir()
|
||||
date=
|
||||
version=
|
||||
release=
|
||||
get_pcsx2_version()
|
||||
{
|
||||
for directory in $* ; do
|
||||
# Print the directory without /
|
||||
echo " $directory" | sed -e 's/\//\ /g'
|
||||
if [ -e `basename ${directory}` ] ; then
|
||||
# Directory already exist so only update
|
||||
svn up --quiet `basename ${directory}` -r $SVN_CO_VERSION;
|
||||
else
|
||||
svn co --quiet ${SVN_TRUNK}/${directory} -r $SVN_CO_VERSION;
|
||||
local major=`grep -o "VersionHi.*" $LOCAL_REPO/pcsx2/SysForwardDefs.h | grep -o "[0-9]*"`
|
||||
local mid=`grep -o "VersionMid.*" $LOCAL_REPO/pcsx2/SysForwardDefs.h | grep -o "[0-9]*"`
|
||||
local minor=`grep -o "VersionLo.*" $LOCAL_REPO/pcsx2/SysForwardDefs.h | grep -o "[0-9]*"`
|
||||
release=`grep -o "isReleaseVersion.*" $LOCAL_REPO/pcsx2/SysForwardDefs.h | grep -o "[0-9]*"`
|
||||
version="$major.$mid.$minor"
|
||||
}
|
||||
|
||||
get_git_version()
|
||||
{
|
||||
date=`git -C $LOCAL_REPO show -s --format=%ci HEAD | sed -e 's/[\:\-]//g' -e 's/ /./' -e 's/ .*//'`
|
||||
}
|
||||
|
||||
download_orig()
|
||||
{
|
||||
(cd $TMP_DIR && git clone --branch $1 $REMOTE_REPO pcsx2)
|
||||
if [ "$SVN_CO_VERSION" = "1" ] ; then
|
||||
(cd $TMP_DIR/pcsx2 && git checkout $GIT_SHA1)
|
||||
fi
|
||||
}
|
||||
|
||||
remove_3rdparty()
|
||||
{
|
||||
echo "Remove 3rdparty code"
|
||||
rm -fr $LOCAL_REPO/3rdparty
|
||||
rm -fr $LOCAL_REPO/fps2bios
|
||||
rm -fr $LOCAL_REPO/tools
|
||||
}
|
||||
|
||||
remove_not_yet_free_plugin()
|
||||
{
|
||||
echo "Remove non free plugins"
|
||||
# remove also deprecated plugins
|
||||
for plugin in CDVDiso CDVDisoEFP CDVDlinuz CDVDolio CDVDpeops dev9ghzdrk PeopsSPU2 SSSPSXPAD USBqemu xpad zerogs zerospu2 zzogl-pg-cg
|
||||
do
|
||||
rm -fr $LOCAL_REPO/plugins/$plugin
|
||||
done
|
||||
}
|
||||
|
||||
get_svn_file()
|
||||
remove_remaining_non_free_file()
|
||||
{
|
||||
for file in $* ; do
|
||||
# Versioning information is not supported for a single file
|
||||
# therefore you can't use svn co
|
||||
svn export --quiet ${SVN_TRUNK}/${file} --force -r $SVN_CO_VERSION;
|
||||
done
|
||||
echo "Remove remaining non free file. TODO UPSTREAM"
|
||||
rm -fr $LOCAL_REPO/plugins/GSdx/baseclasses
|
||||
rm -f $LOCAL_REPO/plugins/zzogl-pg/opengl/Win32/aviUtil.h
|
||||
rm -f $LOCAL_REPO/plugins/spu2-x/src/Windows/Hyperlinks.h
|
||||
rm -f $LOCAL_REPO/plugins/spu2-x/src/Windows/Hyperlinks.cpp
|
||||
rm -f $LOCAL_REPO/common/src/Utilities/x86/MemcpyFast.cpp
|
||||
rm -f $LOCAL_REPO/common/include/comptr.h
|
||||
}
|
||||
remove_dot_git()
|
||||
{
|
||||
# To save 66% of the package size
|
||||
rm -fr $LOCAL_REPO/.git
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Main script
|
||||
######################################################################
|
||||
download_orig $BRANCH
|
||||
remove_3rdparty
|
||||
remove_not_yet_free_plugin
|
||||
remove_remaining_non_free_file
|
||||
|
||||
## Download the svn repository (only the useful things)
|
||||
echo "Downloading pcsx2 source revision ${SVN_CO_VERSION}"
|
||||
mkdir -p $ROOT_DIR;
|
||||
(cd $ROOT_DIR;
|
||||
get_svn_file CMakeLists.txt;
|
||||
get_svn_dir common cmake locales pcsx2;
|
||||
get_svn_dir debian-unstable-upstream linux_various;
|
||||
echo "Done")
|
||||
get_git_version
|
||||
get_pcsx2_version
|
||||
|
||||
# separate bin to avoid downloading the .mo file
|
||||
mkdir -p $ROOT_DIR/bin;
|
||||
(cd $ROOT_DIR/bin;
|
||||
get_svn_file bin/GameIndex.dbf;
|
||||
get_svn_file bin/cheats_ws.zip;
|
||||
get_svn_dir bin/cheats;
|
||||
get_svn_dir bin/docs;)
|
||||
# must be done after getting the git version
|
||||
remove_dot_git
|
||||
|
||||
echo "Downloading Linux compatible plugins for revision ${SVN_CO_VERSION}"
|
||||
# Note: Other plugins exist but they are not 100% copyright free.
|
||||
mkdir -p $ROOT_DIR/plugins
|
||||
(cd $ROOT_DIR/plugins;
|
||||
get_svn_file plugins/CMakeLists.txt;
|
||||
get_svn_dir plugins/CDVDnull;
|
||||
# Potential copyright issue. Optional anyway
|
||||
# get_svn_dir plugins/CDVDnull plugins/CDVDiso;
|
||||
get_svn_dir plugins/onepad;
|
||||
get_svn_dir plugins/spu2-x;
|
||||
get_svn_dir plugins/zzogl-pg plugins/zzogl-pg-cg plugins/GSdx;
|
||||
get_svn_dir plugins/dev9null plugins/FWnull plugins/USBnull;
|
||||
echo "Note: some plugins are more or less deprecated CDVDisoEFP, CDVDlinuz, Zerogs, Zeropad ...";
|
||||
echo "Done")
|
||||
# Debian name of package and tarball
|
||||
if [ $release -eq 1 ]
|
||||
then
|
||||
PKG_NAME="pcsx2-${version}"
|
||||
TAR_NAME="pcsx2_${version}.orig.tar"
|
||||
else
|
||||
PKG_NAME="pcsx2.snapshot-${version}~git${date}"
|
||||
TAR_NAME="pcsx2.snapshot_${version}~git${date}.orig.tar"
|
||||
fi
|
||||
|
||||
## Installation
|
||||
echo "Copy the subversion repository to a temporary directory"
|
||||
# Copy the dir
|
||||
|
||||
NEW_DIR=${TMP_DIR}/$PKG_NAME
|
||||
rm -fr $NEW_DIR
|
||||
cp -r $ROOT_DIR $NEW_DIR
|
||||
mv $LOCAL_REPO $NEW_DIR
|
||||
|
||||
echo "Remove .svn directories"
|
||||
find $NEW_DIR -name ".svn" -type d -exec rm -fr {} \; 2> /dev/null
|
||||
echo "Remove windows files (useless & potential copyright issues)"
|
||||
# => pcsx2/windows
|
||||
# Copyright header must be updated
|
||||
find $NEW_DIR -iname "windows" -type d -exec rm -fr {} \; 2> /dev/null
|
||||
# => ./plugins/zzogl-pg*/opengl/Win32 (reduced to the current linux plugins)
|
||||
find $NEW_DIR -name "Win32" -type d -exec rm -fr {} \; 2> /dev/null
|
||||
|
||||
echo "Remove useless files (copyright issues)"
|
||||
rm -fr "${NEW_DIR}/plugins/zzogl-pg/opengl/ZeroGSShaders"
|
||||
rm -fr "${NEW_DIR}/common/src/Utilities/x86/MemcpyFast.cpp"
|
||||
rm -fr "${NEW_DIR}/plugins/GSdx/baseclasses"
|
||||
|
||||
## BUILD
|
||||
echo "Build the tar.gz file"
|
||||
tar -C $TMP_DIR -czf ${TAR_NAME}.gz $PKG_NAME
|
||||
tar -C $TMP_DIR -cJf ${TAR_NAME}.xz $PKG_NAME
|
||||
|
||||
## Clean
|
||||
rm -fr $NEW_DIR
|
||||
if [ "$LOCAL" = 0 ] ; then
|
||||
rm -fr $ROOT_DIR
|
||||
fi
|
||||
rm -fr $TMP_DIR
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue