From 887d12b71d7018eda53468bf95c1771108a7274d Mon Sep 17 00:00:00 2001 From: T.C. Hollingsworth Date: Jan 19 2013 09:15:03 +0000 Subject: initial import --- diff --git a/.gitignore b/.gitignore index e69de29..ed3cccc 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/node-gyp-0.8.2.tgz diff --git a/node-gyp-addon-gypi.patch b/node-gyp-addon-gypi.patch new file mode 100644 index 0000000..11dea94 --- /dev/null +++ b/node-gyp-addon-gypi.patch @@ -0,0 +1,115 @@ +From 32f9dc9b1e22ce0ba4a7ca4f40dee023682e5e52 Mon Sep 17 00:00:00 2001 +From: "T.C. Hollingsworth" +Date: Sat, 5 Jan 2013 02:28:01 -0700 +Subject: [PATCH 1/2] use custom addon.gypi by default instead of downloading + node source + +--- + addon-rpm.gypi | 35 +++++++++++++++++++++++++++++++++++ + lib/configure.js | 38 ++++++++++++++++++++------------------ + 2 files changed, 55 insertions(+), 18 deletions(-) + create mode 100644 addon-rpm.gypi + +diff --git a/addon-rpm.gypi b/addon-rpm.gypi +new file mode 100644 +index 0000000..3e259ef +--- /dev/null ++++ b/addon-rpm.gypi +@@ -0,0 +1,35 @@ ++{ ++ 'target_defaults': { ++ 'type': 'loadable_module', ++ 'product_prefix': '', ++ 'include_dirs': [ ++ '/usr/include/node/', ++ '/usr/include/' ++ ], ++ ++ 'target_conditions': [ ++ ['_type=="loadable_module"', { ++ 'product_extension': 'node', ++ 'defines': [ 'BUILDING_NODE_EXTENSION' ], ++ }] ++ ], ++ ++ 'conditions': [ ++ [ 'OS=="mac"', { ++ 'libraries': [ '-undefined dynamic_lookup' ], ++ 'xcode_settings': { ++ 'DYLIB_INSTALL_NAME_BASE': '@rpath' ++ }, ++ }], ++ [ 'OS=="win"', { ++ 'libraries': [ '-l<(node_root_dir)/$(Configuration)/node.lib' ], ++ # warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent' ++ # needs to have dll-interface to be used by clients of class 'node::ObjectWrap' ++ 'msvs_disabled_warnings': [ 4251 ], ++ }], ++ [ 'OS=="freebsd" or OS=="openbsd" or OS=="solaris" or (OS=="linux" and target_arch!="ia32")', { ++ 'cflags': [ '-fPIC' ], ++ }] ++ ] ++ } ++} +diff --git a/lib/configure.js b/lib/configure.js +index 82de1e6..0e6f76a 100644 +--- a/lib/configure.js ++++ b/lib/configure.js +@@ -206,26 +206,27 @@ function configure (gyp, argv, callback) { + // if --target was given, then determine a target version to compile for + versionStr = gyp.opts.target + log.verbose('get node dir', 'compiling against --target node version: %s', versionStr) +- } else { +- // if no --target was specified then use the current host node version +- versionStr = process.version +- log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', versionStr) +- } + +- // make sure we have a valid version +- version = semver.parse(versionStr) +- if (!version) { +- return callback(new Error('Invalid version number: ' + versionStr)) +- } ++ // make sure we have a valid version ++ version = semver.parse(versionStr) ++ if (!version) { ++ return callback(new Error('Invalid version number: ' + versionStr)) ++ } + +- // ensure that the target node version's dev files are installed +- gyp.opts.ensure = true +- gyp.commands.install([ versionStr ], function (err, version) { +- if (err) return callback(err) +- log.verbose('get node dir', 'target node version installed:', version) +- nodeDir = path.resolve(gyp.devDir, version) ++ // ensure that the target node version's dev files are installed ++ gyp.opts.ensure = true ++ gyp.commands.install([ versionStr ], function (err, version) { ++ if (err) return callback(err) ++ log.verbose('get node dir', 'target node version installed:', version) ++ nodeDir = path.resolve(gyp.devDir, version) ++ createBuildDir() ++ }) ++ } else { ++ // if no --target was specified then use RPM-installed headers ++ log.verbose('get node dir', 'no --target version specified, falling back to RPM installed headers') ++ nodeDir = '/usr/share/node' + createBuildDir() +- }) ++ } + } + } + +@@ -379,7 +380,8 @@ function configure (gyp, argv, callback) { + + // this logic ported from the old `gyp_addon` python file + var gyp_script = path.resolve(__dirname, '..', 'gyp', 'gyp') +- var addon_gypi = path.resolve(__dirname, '..', 'addon.gypi') ++ var addon_gypi_file = gyp.opts.target || gyp.opts.nodeDir ? 'addon.gypi' : 'addon-rpm.gypi' ++ var addon_gypi = path.resolve(__dirname, '..', addon_gypi_file) + var common_gypi = path.resolve(nodeDir, 'common.gypi') + var output_dir = 'build' + if (win) { +-- +1.7.11.7 + diff --git a/node-gyp-system-gyp.patch b/node-gyp-system-gyp.patch new file mode 100644 index 0000000..34d10cc --- /dev/null +++ b/node-gyp-system-gyp.patch @@ -0,0 +1,25 @@ +From f9a4f02189f3ebac3cca0f4d1ea4bd235484d4c6 Mon Sep 17 00:00:00 2001 +From: "T.C. Hollingsworth" +Date: Sat, 5 Jan 2013 02:37:57 -0700 +Subject: [PATCH 2/2] use the system gyp + +--- + lib/configure.js | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/configure.js b/lib/configure.js +index 0e6f76a..3cd8ce8 100644 +--- a/lib/configure.js ++++ b/lib/configure.js +@@ -379,7 +379,7 @@ function configure (gyp, argv, callback) { + }) + + // this logic ported from the old `gyp_addon` python file +- var gyp_script = path.resolve(__dirname, '..', 'gyp', 'gyp') ++ var gyp_script = '/usr/bin/gyp' + var addon_gypi_file = gyp.opts.target || gyp.opts.nodeDir ? 'addon.gypi' : 'addon-rpm.gypi' + var addon_gypi = path.resolve(__dirname, '..', addon_gypi_file) + var common_gypi = path.resolve(nodeDir, 'common.gypi') +-- +1.7.11.7 + diff --git a/node-gyp.spec b/node-gyp.spec new file mode 100644 index 0000000..b0603f7 --- /dev/null +++ b/node-gyp.spec @@ -0,0 +1,101 @@ +Name: node-gyp +Version: 0.8.2 +Release: 3%{?dist} +Summary: Node.js native addon build tool +License: MIT +Group: System Environment/Libraries +URL: https://github.com/TooTallNate/node-gyp +Source0: http://registry.npmjs.org/node-gyp/-/node-gyp-%{version}.tgz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch + +# These patches are Fedora-specific for the moment, although I'd like to find +# a way to support this kind of stuff upstream. + +# use RPM installed headers by default instead of downloading a source tree +# for the currently running node version +Patch1: node-gyp-addon-gypi.patch + +# use the system gyp +Patch2: node-gyp-system-gyp.patch + +BuildRequires: nodejs-devel + +Requires: gyp +Requires: nodejs-devel v8-devel libuv-devel +Requires: gcc-c++ + +%description +node-gyp is a cross-platform command-line tool written in Node.js for compiling +native addon modules for Node.js, which takes away the pain of dealing with the +various differences in build platforms. It is the replacement to the node-waf +program which is removed for node v0.8. + +%prep +%setup -q -n package +%patch1 -p1 +%patch2 -p1 + +%nodejs_fixdep request + +#remove the bundled gyp +rm -rf gyp + +%build +#nothing to do + +%install +rm -rf %{buildroot} + +mkdir -p %{buildroot}%{nodejs_sitelib}/node-gyp +cp -pr addon*.gypi bin lib legacy package.json %{buildroot}%{nodejs_sitelib}/node-gyp + +mkdir -p %{buildroot}%{_bindir} +ln -sf ../lib/node_modules/node-gyp/bin/node-gyp.js %{buildroot}%{_bindir}/node-gyp + +%nodejs_symlink_deps + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%{nodejs_sitelib}/node-gyp +%{_bindir}/node-gyp +%doc README.md LICENSE + +%changelog +* Tue Jan 08 2013 T.C. Hollingsworth - 0.8.2-3 +- add missing build section + +* Sat Jan 05 2013 T.C. Hollingsworth - 0.8.2-2 +- use RPM-installed headers by default +- now patched to use the system gyp instead of relying on a symlink + +* Mon Dec 31 2012 T.C. Hollingsworth - 0.8.2-1 +- new upstream release 0.8.2 +- clean up for submission + +* Thu Apr 26 2012 T.C. Hollingsworth - 0.4.1-2 +- fix dependencies + +* Wed Apr 18 2012 T.C. Hollingsworth - 0.4.1-1 +- New upstream release 0.4.1 + +* Fri Apr 06 2012 T.C. Hollingsworth - 0.3.11-1 +- New upstream release 0.3.11 + +* Mon Apr 02 2012 T.C. Hollingsworth - 0.3.10-1 +- New upstream release 0.3.10 + +* Thu Mar 29 2012 T.C. Hollingsworth - 0.3.9-1 +- New upstream release 0.3.9 + +* Wed Mar 28 2012 T.C. Hollingsworth - 0.3.8-1 +- new upstream release 0.3.8 + +* Thu Mar 22 2012 T.C. Hollingsworth - 0.3.7-1 +- new upstream release 0.3.7 + +* Thu Mar 15 2012 T.C. Hollingsworth - 0.3.5-1 +- initial package diff --git a/sources b/sources index e69de29..9ed7029 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +4fd0c5fdf4f5928f8efb665d9a2baf49 node-gyp-0.8.2.tgz