Skip to content

Commit

Permalink
Move node version to a single static header file.
Browse files Browse the repository at this point in the history
Some compile time variables like the cflags and prefix have been moved to
the node_config.h.in, in the anticipation that they will be removed at
somepoint.
  • Loading branch information
pquerna authored and ry committed Jul 13, 2010
1 parent 99a5d1e commit 480164f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 30 deletions.
7 changes: 7 additions & 0 deletions src/node_config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef NODE_CONFIG_H
#define NODE_CONFIG_H

#define NODE_CFLAGS "@CCFLAGS@ @CPPFLAGS@ -I@PREFIX@/include/node"
#define NODE_PREFIX "@PREFIX@"

#endif /* NODE_CONFIG_H */
28 changes: 28 additions & 0 deletions src/node_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

#include "node_config.h"

#ifndef NODE_VERSION_H
#define NODE_VERSION_H

#define NODE_MAJOR_VERSION 0
#define NODE_MINOR_VERSION 1
#define NODE_PATCH_VERSION 100

#ifndef NODE_STRINGIFY
#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)
#define NODE_STRINGIFY_HELPER(n) #n
#endif

#define NODE_VERSION_STRING NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \
NODE_STRINGIFY(NODE_MINOR_VERSION) "." \
NODE_STRINGIFY(NODE_PATCH_VERSION)

#define NODE_VERSION "v" NODE_VERSION_STRING


#define NODE_VERSION_AT_LEAST(major, minor, patch) \
(( (major) < NODE_MAJOR_VERSION \
|| ((major) == NODE_MAJOR_VERSION && (minor) < NODE_MINOR_VERSION) \
|| ((major) == NODE_MAJOR_VERSION && (minor) == NODE_MINOR_VERSION && (patch) <= NODE_PATCH_VERSION))

#endif /* NODE_VERSION_H */
12 changes: 0 additions & 12 deletions src/node_version.h.in

This file was deleted.

26 changes: 8 additions & 18 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ from os.path import join, dirname, abspath
from logging import fatal

cwd = os.getcwd()
VERSION="0.1.100"
APPNAME="node.js"

import js2c
Expand Down Expand Up @@ -507,38 +506,29 @@ def build(bld):
bld.install_files('${PREFIX}/lib', "build/default/libnode.*")

def subflags(program):
if os.path.exists(join(cwd, ".git")):
try:
actual_version=cmd_output("git describe").strip()
except:
actual_version=VERSION+'+'
else:
actual_version=VERSION

x = { 'CCFLAGS' : " ".join(program.env["CCFLAGS"])
, 'CPPFLAGS' : " ".join(program.env["CPPFLAGS"])
, 'LIBFLAGS' : " ".join(program.env["LIBFLAGS"])
, 'VERSION' : actual_version
, 'PREFIX' : program.env["PREFIX"]
}
return x

# process file.pc.in -> file.pc

node_version = bld.new_task_gen('subst', before="cxx")
node_version.source = 'src/node_version.h.in'
node_version.target = 'src/node_version.h'
node_version.dict = subflags(node)
node_version.install_path = '${PREFIX}/include/node'
node_conf = bld.new_task_gen('subst', before="cxx")
node_conf.source = 'src/node_config.h.in'
node_conf.target = 'src/node_config.h'
node_conf.dict = subflags(node)
node_conf.install_path = '${PREFIX}/include/node'

if bld.env["USE_DEBUG"]:
node_g = node.clone("debug")
node_g.target = "node_g"
node_g.uselib += ' V8_G'

node_version_g = node_version.clone("debug")
node_version_g.dict = subflags(node_g)
node_version_g.install_path = None
node_conf_g = node_conf.clone("debug")
node_conf_g.dict = subflags(node_g)
node_conf_g.install_path = None

# After creating the debug clone, append the V8 dep
node.uselib += ' V8'
Expand Down

0 comments on commit 480164f

Please sign in to comment.