From 135b3437f9dce12a73b1a76940d809f8bf0671e8 Mon Sep 17 00:00:00 2001 From: Evgeny Ermakov Date: Mon, 19 Oct 2020 16:58:11 +1100 Subject: [PATCH] vdrift: remove unused dependency; minor fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Danh] Port build system to Python 3. Co-Authored-by: Đoàn Trần Công Danh Close: #25727 --- ...de-build-date-with-SOURCE_DATE_EPOCH.patch | 38 +++++++++++ .../patches/0002-Scons-python-3-fixes.patch | 65 +++++++++++++++++++ .../0003-SConstruct-Python-3-fix.patch | 32 +++++++++ srcpkgs/vdrift/template | 7 +- 4 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/vdrift/patches/0001-Allow-to-override-build-date-with-SOURCE_DATE_EPOCH.patch create mode 100644 srcpkgs/vdrift/patches/0002-Scons-python-3-fixes.patch create mode 100644 srcpkgs/vdrift/patches/0003-SConstruct-Python-3-fix.patch diff --git a/srcpkgs/vdrift/patches/0001-Allow-to-override-build-date-with-SOURCE_DATE_EPOCH.patch b/srcpkgs/vdrift/patches/0001-Allow-to-override-build-date-with-SOURCE_DATE_EPOCH.patch new file mode 100644 index 00000000000..c3ec422a02f --- /dev/null +++ b/srcpkgs/vdrift/patches/0001-Allow-to-override-build-date-with-SOURCE_DATE_EPOCH.patch @@ -0,0 +1,38 @@ +From 5345e8b57d300b14c36b8519e18f67096e4b8d78 Mon Sep 17 00:00:00 2001 +From: "Bernhard M. Wiedemann" +Date: Thu, 11 Jul 2019 10:33:52 +0200 +Subject: [PATCH 1/3] Allow to override build date with SOURCE_DATE_EPOCH + +in order to make builds reproducible. +See https://reproducible-builds.org/ for why this is good +and https://reproducible-builds.org/specs/source-date-epoch/ +for the definition of this variable. + +Also use UTC/gmtime to be independent of timezone. +--- + SConstruct | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git SConstruct SConstruct +index 950a5289..763f2e36 100644 +--- SConstruct ++++ SConstruct +@@ -1,5 +1,4 @@ +-import os, sys, errno, SCons +-from time import gmtime, strftime ++import os, sys, time, errno, SCons + + #---------------# + # Build Options # +@@ -395,7 +394,7 @@ else: + #------------------------# + # Version, debug/release # + #------------------------# +-version = strftime("%Y-%m-%d") ++version = time.strftime("%Y-%m-%d", time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))) + build_dir = 'build' + if env['release']: + # release build, debugging off, optimizations on +-- +2.29.0.rc1 + diff --git a/srcpkgs/vdrift/patches/0002-Scons-python-3-fixes.patch b/srcpkgs/vdrift/patches/0002-Scons-python-3-fixes.patch new file mode 100644 index 00000000000..bd32399836e --- /dev/null +++ b/srcpkgs/vdrift/patches/0002-Scons-python-3-fixes.patch @@ -0,0 +1,65 @@ +From b5af38086bcb972f6f454f65281121cca9d0ed93 Mon Sep 17 00:00:00 2001 +From: logzero +Date: Thu, 30 Jul 2020 19:01:13 +0200 +Subject: [PATCH 2/3] Scons python 3 fixes. + +--- + SConstruct | 10 +++++----- + src/SConscript | 2 +- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git SConstruct SConstruct +index 763f2e36..f20e1745 100644 +--- SConstruct ++++ SConstruct +@@ -91,9 +91,9 @@ elif sys.platform == 'darwin': + + for a in env['universal']: + if not sdk_path: +- print 'Building a universal binary require access to an ' + \ ++ print('Building a universal binary require access to an ' + \ + 'SDK that has universal \nbinary support.If you know ' + \ +- 'the location of such an SDK, specify it using the \n"SDK" option' ++ 'the location of such an SDK, specify it using the \n"SDK" option') + Exit(1) + env.Append( CCFLAGS = ['-arch', a], LINKFLAGS = ['-arch', a] ) + +@@ -231,7 +231,7 @@ def distcopy (target, source, env): + def tarballer (target, source, env): + cmd = 'tar -jcf "%s" -C "%s" .' % ( str(target[0]), str(source[0]) ) + #cmd = 'tar -jcf ' + str (target[0]) + ' ' + str(source[0]) + " --exclude '*~' " +- print 'running ', cmd, ' ... ' ++ print('running ', cmd, ' ... ') + p = os.popen (cmd) + return p.close () + +@@ -361,11 +361,11 @@ env.ParseConfig('pkg-config bullet --libs --cflags') + conf = Configure(env) + for header in check_headers: + if not conf.CheckCXXHeader(header): +- print 'You do not have the %s headers installed. Exiting.' % header ++ print('You do not have the %s headers installed. Exiting.' % header) + Exit(1) + for lib in check_libs: + if not conf.CheckLibWithHeader(lib[0], lib[1], 'C', lib[2]): +- print lib[3] ++ print(lib[3]) + Exit(1) + + env = conf.Finish() +diff --git src/SConscript src/SConscript +index c980a2e6..67cecebd 100644 +--- src/SConscript ++++ src/SConscript +@@ -151,7 +151,7 @@ src = Split(""" + utils.cpp + window.cpp""") + +-src.sort(lambda x, y: cmp(x.lower(),y.lower())) ++src.sort(key = str.lower) + + #------------------------# + # Copy Build Environment # +-- +2.29.0.rc1 + diff --git a/srcpkgs/vdrift/patches/0003-SConstruct-Python-3-fix.patch b/srcpkgs/vdrift/patches/0003-SConstruct-Python-3-fix.patch new file mode 100644 index 00000000000..2e1ea37856c --- /dev/null +++ b/srcpkgs/vdrift/patches/0003-SConstruct-Python-3-fix.patch @@ -0,0 +1,32 @@ +From d0529275cf70aa60b7942f0306217913df6bf53e Mon Sep 17 00:00:00 2001 +From: Matthias Coppens +Date: Wed, 26 Aug 2020 14:24:36 +0200 +Subject: [PATCH 3/3] SConstruct Python 3 fix + +`dict.has_key` is removed in Python 3.X, use `in` instead. +--- + SConstruct | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git SConstruct SConstruct +index f20e1745..0e7f02e9 100644 +--- SConstruct ++++ SConstruct +@@ -140,11 +140,11 @@ else: + CC = 'gcc', CXX = 'g++', + options = opts) + # Take environment variables into account +- if os.environ.has_key('CXX'): ++ if 'CXX' in os.environ: + env['CXX'] = os.environ['CXX'] +- if os.environ.has_key('CXXFLAGS'): ++ if 'CXXFLAGS' in os.environ: + env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS']) +- if os.environ.has_key('LDFLAGS'): ++ if 'LDFLAGS' in os.environ: + env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS']) + check_headers = ['GL/gl.h', 'SDL2/SDL.h', 'SDL2/SDL_image.h', 'vorbis/vorbisfile.h', 'curl/curl.h', 'bullet/btBulletCollisionCommon.h', 'bullet/btBulletDynamicsCommon.h'] + check_libs = [] +-- +2.29.0.rc1 + diff --git a/srcpkgs/vdrift/template b/srcpkgs/vdrift/template index 290288696f6..5674f951a88 100644 --- a/srcpkgs/vdrift/template +++ b/srcpkgs/vdrift/template @@ -1,15 +1,15 @@ # Template file for 'vdrift' pkgname=vdrift version=2014.10.20 -revision=9 +revision=10 wrksrc="$pkgname" build_style=scons make_build_args="release=1 force_feedback=1 extbullet=1 datadir=share/${pkgname}" make_install_args="$make_build_args" hostmakedepends="gettext pkg-config" -makedepends="asio libcurl-devel bullet-devel SDL2_image-devel glew-devel +makedepends="libcurl-devel bullet-devel SDL2_image-devel glew-devel libvorbis-devel libarchive-devel MesaLib-devel" -depends="vdrift-data-${version}_${revision}" +depends="desktop-file-utils vdrift-data-${version}_${revision}" short_desc="Open source driving simulation made with drift racing in mind" maintainer="Orphaned " license="GPL-3.0-or-later" @@ -35,7 +35,6 @@ post_install() { vdrift-data_package() { short_desc+=" - data files" - archs=noarch pkg_install() { vmove usr/share/vdrift }