1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Merge pull request #1557 from mzmiric5/libs-versioning

Libs versioning
This commit is contained in:
Ted John
2015-07-05 23:00:30 +01:00
3 changed files with 66 additions and 2 deletions

1
.gitignore vendored
View File

@@ -13,6 +13,7 @@ distribution/windows/*.exe
#lib
lib
libversion
#################
## Eclipse

View File

@@ -2,10 +2,51 @@
set -e
cachedir=.cache
mkdir -p $cachedir
if [[ ! -d build ]]; then
mkdir -p build
fi
libversion=1
libVFile="./libversion"
libdir="./lib"
currentversion=0
needsdownload="true"
if [ -f $libVFile ]; then
while read line; do
currentversion=$line
continue
done < $libVFile
fi
if [ $currentversion -ge $libversion ]; then
needsdownload="false"
fi
if [ ! -d $libdir ]; then
needsdownload="true"
fi
if [[ "$needsdownload" = "true" ]]; then
echo "New libraries need to be downloaded, the script might ask you for sudo access password"
rm -rf ./lib
if [[ -f $cachedir/orctlibs.zip ]]; then
rm -rf $cachedir/orctlibs.zip
fi
if [[ -d /usr/local/cross-tools/orctlibs ]]; then
sudo rm -rf /usr/local/cross-tools/orctlibs
fi
curl https://download.openrct2.website/dev/lib/mingw -o $cachedir/orctlibs.zip;
sudo mkdir -p /usr/local/cross-tools/orctlibs
mkdir -p lib
sudo cp -rf $cachedir/orctlibs/glob/* /usr/local/cross-tools/orctlibs/.
cp -rf $cachedir/orctlibs/local/* ./lib/.
echo $libversion > $libVFile
fi
pushd build
cmake -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt -DCMAKE_BUILD_TYPE=Debug ..
make

View File

@@ -1,11 +1,33 @@
#init
$libversion = 1
$path = Split-Path $Script:MyInvocation.MyCommand.Path
$zip = $path+'\orctlibs.zip'
$libs = $path+'\lib'
$libsVFile = $path+'\libversion'
$libsTest = Test-Path $libs
if (!$libsTest) {
mkdir $libs
#libs version test
$libsVersionTest = Test-Path $libsVFile
$currentVersion = 0
$needsdownload = $true
if ($libsVersionTest) {
$currentVersion = [IO.File]::ReadAllText($libsVFile)
}
if ($currentVersion -ge $libversion) {
$needsdownload = $false
}
#download
if (!$libsTest -or $needsdownload) {
if ($libsTest) {
rm $libs -Recurse -Force
}
mkdir $libs
Invoke-WebRequest https://download.openrct2.website/dev/lib/vs -OutFile $path\orctlibs.zip
[System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $libs)
rm $path\orctlibs.zip -Force -ErrorAction SilentlyContinue
$libversion | Set-Content $libsVFile
} else {
echo 'All libs up to date'
}