diff --git a/gyp-0.1-gitfcd686f1.tar.xz b/gyp-0.1-gitfcd686f1.tar.xz new file mode 100644 index 0000000..f9ae44f Binary files /dev/null and b/gyp-0.1-gitfcd686f1.tar.xz differ diff --git a/gyp-fix-cmake.patch b/gyp-fix-cmake.patch new file mode 100644 index 0000000..31bd7ac --- /dev/null +++ b/gyp-fix-cmake.patch @@ -0,0 +1,33 @@ +--- a/pylib/gyp/generator/cmake.py ++++ b/pylib/gyp/generator/cmake.py +@@ -40,9 +40,9 @@ + + try: + # maketrans moved to str in python3. ++ _maketrans = str.maketrans ++except NameError: + _maketrans = string.maketrans +-except NameError: +- _maketrans = str.maketrans + + generator_default_variables = { + 'EXECUTABLE_PREFIX': '', +@@ -281,7 +281,7 @@ + dirs = set(dir for dir in (os.path.dirname(o) for o in outputs) if dir) + + if int(action.get('process_outputs_as_sources', False)): +- extra_sources.extend(zip(cmake_outputs, outputs)) ++ extra_sources.extend(list(zip(cmake_outputs, outputs))) + + # add_custom_command + output.write('add_custom_command(OUTPUT ') +@@ -987,7 +987,7 @@ + + # XCode settings + xcode_settings = config.get('xcode_settings', {}) +- for xcode_setting, xcode_value in xcode_settings.viewitems(): ++ for xcode_setting, xcode_value in xcode_settings.items(): + SetTargetProperty(output, cmake_target_name, + "XCODE_ATTRIBUTE_%s" % xcode_setting, xcode_value, + '' if isinstance(xcode_value, str) else ' ') + diff --git a/gyp-ninja-build.patch b/gyp-ninja-build.patch new file mode 100644 index 0000000..74d8522 --- /dev/null +++ b/gyp-ninja-build.patch @@ -0,0 +1,26 @@ +diff -pruN gyp-0.1-gitfcd686f1.orig/pylib/gyp/generator/ninja.py gyp-0.1-gitfcd686f1/pylib/gyp/generator/ninja.py +--- gyp-0.1-gitfcd686f1.orig/pylib/gyp/generator/ninja.py 2019-08-14 09:05:50.000000000 +0000 ++++ gyp-0.1-gitfcd686f1/pylib/gyp/generator/ninja.py 2019-08-14 09:19:26.668031638 +0000 +@@ -2073,11 +2073,11 @@ def GenerateOutputForConfig(target_list, + # .c files. This should be handled by mspdbsrv, but rarely errors out with + # c1xx : fatal error C1033: cannot open program database + # By making the rules target separate pdb files this might be avoided. +- cc_command = ('ninja -t msvc -e $arch ' + ++ cc_command = ('ninja-build -t msvc -e $arch ' + + '-- ' + '$cc /nologo /showIncludes /FC ' + '@$out.rsp /c $in /Fo$out /Fd$pdbname_c ') +- cxx_command = ('ninja -t msvc -e $arch ' + ++ cxx_command = ('ninja-build -t msvc -e $arch ' + + '-- ' + '$cxx /nologo /showIncludes /FC ' + '@$out.rsp /c $in /Fo$out /Fd$pdbname_cc ') +@@ -2453,7 +2453,7 @@ def PerformBuild(data, configurations, p + options = params['options'] + for config in configurations: + builddir = os.path.join(options.toplevel_dir, 'out', config) +- arguments = ['ninja', '-C', builddir] ++ arguments = ['ninja-build', '-C', builddir] + print('Building [%s]: %s' % (config, arguments)) + subprocess.check_call(arguments) + diff --git a/gyp-python3.patch b/gyp-python3.patch new file mode 100644 index 0000000..6235b82 --- /dev/null +++ b/gyp-python3.patch @@ -0,0 +1,36 @@ +diff -pruN gyp-0.1-gitfcd686f1.orig/gyp gyp-0.1-gitfcd686f1/gyp +--- gyp-0.1-gitfcd686f1.orig/gyp 2015-04-30 09:48:21.000000000 +0000 ++++ gyp-0.1-gitfcd686f1/gyp 2019-08-14 09:41:05.343208034 +0000 +@@ -5,4 +5,4 @@ + + set -e + base=$(dirname "$0") +-exec python "${base}/gyp_main.py" "$@" ++exec python3 "${base}/gyp_main.py" "$@" +diff -pruN gyp-0.1-gitfcd686f1.orig/gyp_main.py gyp-0.1-gitfcd686f1/gyp_main.py +--- gyp-0.1-gitfcd686f1.orig/gyp_main.py 2016-10-17 02:00:37.000000000 +0000 ++++ gyp-0.1-gitfcd686f1/gyp_main.py 2019-08-14 09:41:43.380207320 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # Copyright (c) 2009 Google Inc. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be +diff -pruN gyp-0.1-gitfcd686f1.orig/gyptest.py gyp-0.1-gitfcd686f1/gyptest.py +--- gyp-0.1-gitfcd686f1.orig/gyptest.py 2019-08-14 09:05:50.000000000 +0000 ++++ gyp-0.1-gitfcd686f1/gyptest.py 2019-08-14 09:41:48.578208719 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright (c) 2012 Google Inc. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +diff -pruN gyp-0.1-gitfcd686f1.orig/setup.py gyp-0.1-gitfcd686f1/setup.py +--- gyp-0.1-gitfcd686f1.orig/setup.py 2015-04-30 09:48:21.000000000 +0000 ++++ gyp-0.1-gitfcd686f1/setup.py 2019-08-14 09:41:53.510210046 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # Copyright (c) 2009 Google Inc. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be diff --git a/gyp-python38.patch b/gyp-python38.patch new file mode 100644 index 0000000..e1dc703 --- /dev/null +++ b/gyp-python38.patch @@ -0,0 +1,63 @@ +commit 7b0a3fd85beb67c990da3fb1b690444a27a6ee42 +Author: Tom Hughes +Date: Fri Aug 23 09:33:14 2019 +0100 + + Fix python 3.8 warnings + +diff --git a/pylib/gyp/input.py b/pylib/gyp/input.py +index 42c279cf..013231dc 100644 +--- a/pylib/gyp/input.py ++++ b/pylib/gyp/input.py +@@ -1181,7 +1181,7 @@ def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key): + if variable_name in variables: + # If the variable is already set, don't set it. + continue +- if the_dict_key is 'variables' and variable_name in the_dict: ++ if the_dict_key == 'variables' and variable_name in the_dict: + # If the variable is set without a % in the_dict, and the_dict is a + # variables dict (making |variables| a varaibles sub-dict of a + # variables dict), use the_dict's definition. +diff --git a/test/lib/TestCmd.py b/test/lib/TestCmd.py +index 1ec50933..457694c8 100644 +--- a/test/lib/TestCmd.py ++++ b/test/lib/TestCmd.py +@@ -283,7 +283,7 @@ if os.name in ('posix', 'nt'): + else: + tempfile.template = 'testcmd.' + +-re_space = re.compile('\s') ++re_space = re.compile(r'\s') + + _Cleanup = [] + +@@ -882,7 +882,7 @@ class TestCmd(object): + #self.diff_function = difflib.unified_diff + self._dirlist = [] + self._preserve = {'pass_test': 0, 'fail_test': 0, 'no_result': 0} +- if 'PRESERVE' in os.environ and os.environ['PRESERVE'] is not '': ++ if 'PRESERVE' in os.environ and os.environ['PRESERVE'] != '': + self._preserve['pass_test'] = os.environ['PRESERVE'] + self._preserve['fail_test'] = os.environ['PRESERVE'] + self._preserve['no_result'] = os.environ['PRESERVE'] +@@ -1103,7 +1103,7 @@ class TestCmd(object): + the temporary working directories to be preserved for all + conditions. + """ +- if conditions is (): ++ if len(conditions) == 0: + conditions = ('pass_test', 'fail_test', 'no_result') + for cond in conditions: + self._preserve[cond] = 1 +diff --git a/test/lib/TestGyp.py b/test/lib/TestGyp.py +index cba2d3cc..43865ee1 100644 +--- a/test/lib/TestGyp.py ++++ b/test/lib/TestGyp.py +@@ -742,7 +742,7 @@ def FindVisualStudioInstallation(): + build_tool = None + if not build_tool: + args1 = ['reg', 'query', +- 'HKLM\Software\Microsoft\VisualStudio\SxS\VS7', ++ r'HKLM\Software\Microsoft\VisualStudio\SxS\VS7', + '/v', '15.0', '/reg:32'] + build_tool = subprocess.check_output(args1).decode( + 'utf-8', 'ignore').strip().split(b'\r\n').pop().split(b' ').pop() diff --git a/gyp-rpmoptflags.patch b/gyp-rpmoptflags.patch new file mode 100644 index 0000000..b2246e8 --- /dev/null +++ b/gyp-rpmoptflags.patch @@ -0,0 +1,32 @@ +diff -pruN gyp.orig/pylib/gyp/generator/make.py gyp/pylib/gyp/generator/make.py +--- gyp.orig/pylib/gyp/generator/make.py 2011-08-23 16:47:59.000000000 +0900 ++++ gyp/pylib/gyp/generator/make.py 2011-08-23 17:31:13.000000000 +0900 +@@ -1554,6 +1554,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj) + # Write configuration-specific variables for CFLAGS, etc. + for configname in sorted(configs.keys()): + config = configs[configname] ++ rpmoptflags = ['$(RPM_OPT_FLAGS)'] + self.WriteList(config.get('defines'), 'DEFS_%s' % configname, prefix='-D', + quoter=EscapeCppDefine) + +@@ -1565,8 +1566,20 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj) + cflags_objcc = self.xcode_settings.GetCflagsObjCC(configname) + else: + cflags = config.get('cflags') ++ if cflags: ++ cflags += rpmoptflags ++ else: ++ cflags = rpmoptflags + cflags_c = config.get('cflags_c') ++ if cflags_c: ++ cflags_c += rpmoptflags ++ else: ++ cflags_c = rpmoptflags + cflags_cc = config.get('cflags_cc') ++ if cflags_cc: ++ cflags_cc += rpmoptflags ++ else: ++ cflags_cc = rpmoptflags + + self.WriteLn("# Flags passed to all source files."); + self.WriteList(cflags, 'CFLAGS_%s' % configname) diff --git a/gyp.spec b/gyp.spec new file mode 100644 index 0000000..72d8d85 --- /dev/null +++ b/gyp.spec @@ -0,0 +1,57 @@ +%global revision fcd686f1 +%{expand: %%global archivename gyp-%{version}%{?revision:-git%{revision}}} +Name: gyp +Version: 0.1 +Release: 1 +Summary: Generate Your Projects +License: BSD +URL: http://code.google.com/p/gyp +# No released tarball available. so the tarball was generated +# from svn as following: +# +# 1.git clone https://chromium.googlesource.com/external/gyp +# 2.cd gyp +# 3.version=$(grep version= setup.py|cut -d\' -f2) +# 4.revision=$(git log --oneline|head -1|cut -d' ' -f1) +# 5.tar -a --exclude-vcs -cf /tmp/gyp-$version-git$revision.tar.bz2 * +Source0: %{archivename}.tar.xz +Patch0: gyp-rpmoptflags.patch +Patch1: gyp-ninja-build.patch +Patch2: gyp-python3.patch +Patch3: gyp-python38.patch +Patch4: gyp-fix-cmake.patch +BuildRequires: python3-devel python3-setuptools +Requires: python3-setuptools +BuildRequires: gcc gcc-c++ ninja-build +BuildArch: noarch +%description +GYP is a tool to generates native Visual Studio, Xcode and SCons +and/or make build files from a platform-independent input format. +Its syntax is a universal cross-platform build representation +that still allows sufficient per-platform flexibility to accommodate +irreconcilable differences. + +%prep +%autosetup -p1 -c -n %{archivename} +for i in $(find pylib -name '*.py'); do + sed -e '\,#![ \t]*/.*python,{d}' $i > $i.new && touch -r $i $i.new && mv $i.new $i +done + +%build +%{__python3} setup.py build + +%install +%{__python3} setup.py install --root $RPM_BUILD_ROOT --skip-build + +%check +%{__python3} gyptest.py test/hello/gyptest-all.py + +%files +%license LICENSE +%doc AUTHORS +%{_bindir}/gyp +%{python3_sitelib}/* + +%changelog +* Fri Aug 21 2020 Ge Wang - 0.1-1 +- Package init diff --git a/gyp.yaml b/gyp.yaml new file mode 100644 index 0000000..00bbaf0 --- /dev/null +++ b/gyp.yaml @@ -0,0 +1,4 @@ +version_control: NA +src_repo: NA +tag_prefix: NA +seperator: NA