summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--common.mk9
-rw-r--r--configure.in41
-rw-r--r--include/ruby/defines.h5
-rwxr-xr-xtool/make-snapshot31
-rw-r--r--version.c22
-rw-r--r--version.h38
7 files changed, 147 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 3815379b1e4..010bb913e3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Sat Dec 22 15:14:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
+
+ * configure.in (STRINGIZE): stringizing macro.
+
+ * include/ruby/defines.h (STRINGIZE): fallback.
+
+ * tool/make-snapshot: new file.
+
+ * version.c (ruby_description, ruby_copyright): string constants for
+ -v option.
+
Sat Dec 22 15:03:37 2007 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (initialize): fixed documentation.
diff --git a/common.mk b/common.mk
index 5c9f83efe1c..033b70a5f88 100644
--- a/common.mk
+++ b/common.mk
@@ -341,7 +341,7 @@ $(RBCONFIG): $(srcdir)/mkconfig.rb config.status $(PREP)
encs: enc.mk
$(MINIRUBY) -I$(srcdir)/lib -run -e mkdir -- -p "$(EXTOUT)/$(arch)/enc"
- $(MAKE) -f enc.mk -$(MAKEFLAGS)
+ $(MAKE) -f enc.mk $(MFLAGS)$(MAKEFLAGS)
enc.mk: $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \
$(srcdir)/lib/mkmf.rb $(RBCONFIG)
@@ -650,13 +650,16 @@ miniprelude.c: $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb
prelude.c: $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $(srcdir)/gem_prelude.rb $(RBCONFIG)
$(MINIRUBY) -I$(srcdir) -I$(srcdir)/lib -rrbconfig $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $(srcdir)/gem_prelude.rb $@
-prereq: incs {$(VPATH)}parse.c $(srcdir)/ext/ripper/ripper.c {$(VPATH)}miniprelude.c
+prereq: incs {$(VPATH)}parse.c $(srcdir)/ext/ripper/ripper.c {$(VPATH)}miniprelude.c {$(VPATH)}revision.h
docs:
$(BASERUBY) -I$(srcdir) $(srcdir)/tool/makedocs.rb $(INSNS2VMOPT)
+revision.h:
+ exit > $@
+
$(srcdir)/ext/ripper/ripper.c:
- cd $(srcdir)/ext/ripper && exec $(MAKE) -f depend -$(MAKEFLAGS) top_srcdir=../.. srcdir=.
+ cd $(srcdir)/ext/ripper && exec $(MAKE) -f depend $(MFLAGS)$(MAKEFLAGS) top_srcdir=../.. srcdir=.
##
diff --git a/configure.in b/configure.in
index a80c3732560..f63d80c25a3 100644
--- a/configure.in
+++ b/configure.in
@@ -323,6 +323,41 @@ else
AC_DEFINE(TOKEN_PASTE(x,y),[x/**/y])
fi
+AC_CACHE_CHECK(stringization, rb_cv_stringization, [
+ rb_cv_stringization=no
+ for string in "#expr" '"expr"'; do
+ AC_COMPILE_IFELSE([
+ AC_LANG_BOOL_COMPILE_TRY([
+#define STRINGIZE0(expr) $string
+#define STRINGIZE(expr) STRINGIZE0(expr)
+#undef real_test_for_stringization
+#define test_for_stringization -.real_test_for_stringization.-
+const char stringized[[]] = STRINGIZE(test_for_stringization);
+], [sizeof(stringized) == 32])],
+ [rb_cv_stringization="$string"; break],
+ [rb_cv_stringization=no])
+ done]
+)
+AC_DEFINE(STRINGIZE(expr),STRINGIZE0(expr))
+if test x"$rb_cv_stringization" != xno -a "$rb_cv_stringization" != "#expr"; then
+ AC_DEFINE_UNQUOTED(STRINGIZE0(expr),$rb_cv_stringization)
+ AC_DEFINE(OLD_FASHIONED_STRINGIZATION,1)
+fi
+
+AC_CACHE_CHECK([string literal concatenation],
+ rb_cv_string_literal_concatenation, [
+ AC_COMPILE_IFELSE([
+ AC_LANG_BOOL_COMPILE_TRY([
+const char concatenated_literal[[]] = "literals" "to"
+ "be" "concatenated.";
+], [sizeof(concatenated_literal) == 26])],
+ [rb_cv_string_literal_concatenation=yes],
+ [rb_cv_string_literal_concatenation=no])]
+)
+if test "$rb_cv_string_literal_concatenation" = no; then
+ AC_DEFINE(NO_STRING_LITERAL_CONCATENATION,1)
+fi
+
AC_CACHE_CHECK(for variable length prototypes and stdarg.h, rb_cv_stdarg,
[AC_TRY_COMPILE([
#include <stdarg.h>
@@ -1564,6 +1599,12 @@ case "$build_os" in
esac
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
+test -z "$CFLAGS" || CFLAGS="$CFLAGS "; CFLAGS="$CFLAGS"'${cflags}'
+test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
+AC_SUBST(cppflags, [])dnl
+AC_SUBST(cflags, ["${optflags} ${debugflags}"])dnl
+AC_SUBST(optflags)dnl
+AC_SUBST(debugflags)dnl
AC_SUBST(XCFLAGS)dnl
AC_SUBST(XLDFLAGS)dnl
AC_SUBST(LIBRUBY_LDSHARED)
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index 2fb42219fab..bd9dd0c3346 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -64,6 +64,11 @@ void *xrealloc(void*,size_t);
void *xrealloc2(void*,size_t,size_t);
void xfree(void*);
+#define STRINGIZE(expr) STRINGIZE0(expr)
+#ifndef STRINGIZE0
+#define STRINGIZE0(expr) #expr
+#endif
+
#if SIZEOF_LONG_LONG > 0
# define LONG_LONG long long
#elif SIZEOF___INT64 > 0
diff --git a/tool/make-snapshot b/tool/make-snapshot
new file mode 100755
index 00000000000..b86e13e8166
--- /dev/null
+++ b/tool/make-snapshot
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+LC_ALL=C LANG=C
+SVNURL=http://svn.ruby-lang.org/repos/ruby/trunk
+export LC_ALL LANG
+: ${VPATH=include/ruby} ${YACC=bison} ${BASERUBY=ruby} ${RUBY=ruby} ${MV=mv}
+export VPATH YACC BASERUBY RUBY MV
+
+[ -d "$1" ] || mkdir "$1" || exit 1
+dest=`cd "$1"; pwd`
+
+tmp=${TMP_DIR-/tmp}/ #ruby-snapshot-$$
+mkdir -p "$tmp"
+cd "$tmp"
+revision=`svn export $SVNURL ruby | sed -n '$s/.*\([0-9]+\).*/\1/p'`
+[ $revision ] || revision=`svn info $SVNURL | sed -n 's/Revision: //p'`
+echo "#define RUBY_REVISION $revision" > ruby/revision.h
+v=ruby-r$revision
+mv ruby $v
+(cd $v; sed 's/{[^{}]*}//g' common.mk | make -f - prereq srcdir=.)
+
+for cmd in "bzip tarball.tar.bz2 tar cjf" "gzip tarball.tar.gz tar czf" "zip archive.zip zip -qr"; do
+ mesg="${cmd%%.*}" cmd="${cmd#*.}"
+ ext="${cmd%% *}" cmd="${cmd#* }"
+ echo -n creating $mesg... $dest/$v.$ext
+ if $cmd $dest/$v.$ext $v; then
+ echo " done"
+ else
+ echo " failed"
+ fi
+done
diff --git a/version.c b/version.c
index 4e54d063f74..9006d5e9621 100644
--- a/version.c
+++ b/version.c
@@ -14,34 +14,38 @@
#include "version.h"
#include <stdio.h>
+#define PRINT(type) puts(ruby_##type)
+#define MKSTR(type) rb_obj_freeze(rb_str_new(ruby_##type, sizeof(ruby_##type)-1))
+
const char ruby_version[] = RUBY_VERSION;
const char ruby_release_date[] = RUBY_RELEASE_DATE;
const char ruby_platform[] = RUBY_PLATFORM;
const int ruby_patchlevel = RUBY_PATCHLEVEL;
+const char ruby_description[] = RUBY_DESCRIPTION;
+const char ruby_copyright[] = RUBY_COPYRIGHT;
void
Init_version(void)
{
- VALUE v = rb_obj_freeze(rb_str_new2(ruby_version));
- VALUE d = rb_obj_freeze(rb_str_new2(ruby_release_date));
- VALUE p = rb_obj_freeze(rb_str_new2(ruby_platform));
-
- rb_define_global_const("RUBY_VERSION", v);
- rb_define_global_const("RUBY_RELEASE_DATE", d);
- rb_define_global_const("RUBY_PLATFORM", p);
+ rb_define_global_const("RUBY_VERSION", MKSTR(version));
+ rb_define_global_const("RUBY_RELEASE_DATE", MKSTR(release_date));
+ rb_define_global_const("RUBY_PLATFORM", MKSTR(platform));
rb_define_global_const("RUBY_PATCHLEVEL", INT2FIX(RUBY_PATCHLEVEL));
+ rb_define_global_const("RUBY_REVISION", INT2FIX(RUBY_REVISION));
+ rb_define_global_const("RUBY_DESCRIPTION", MKSTR(description));
+ rb_define_global_const("RUBY_COPYRIGHT", MKSTR(copyright));
}
void
ruby_show_version(void)
{
- printf("ruby %s (%s patchlevel %d) [%s]\n", RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_PATCHLEVEL, RUBY_PLATFORM);
+ PRINT(description);
fflush(stdout);
}
void
ruby_show_copyright(void)
{
- printf("ruby - Copyright (C) 1993-%d Yukihiro Matsumoto\n", RUBY_RELEASE_YEAR);
+ PRINT(copyright);
exit(0);
}
diff --git a/version.h b/version.h
index b4e47dfdf2e..6af45193bd2 100644
--- a/version.h
+++ b/version.h
@@ -16,4 +16,42 @@ RUBY_EXTERN const char ruby_version[];
RUBY_EXTERN const char ruby_release_date[];
RUBY_EXTERN const char ruby_platform[];
RUBY_EXTERN const int ruby_patchlevel;
+RUBY_EXTERN const char ruby_description[];
+RUBY_EXTERN const char ruby_copyright[];
#endif
+
+#define RUBY_AUTHOR "Yukihiro Matsumoto"
+#define RUBY_BIRTH_YEAR 1993
+#define RUBY_BIRTH_MONTH 2
+#define RUBY_BIRTH_DAY 24
+
+#ifndef RUBY_REVISION
+#include "revision.h"
+#endif
+#ifndef RUBY_REVISION
+#define RUBY_REVISION 0
+#endif
+
+#if RUBY_VERSION_TEENY > 0 && RUBY_PATCHLEVEL < 5000 && !RUBY_REVISION
+#define RUBY_RELEASE_STR "patchlevel"
+#define RUBY_RELEASE_NUM RUBY_PATCHLEVEL
+#else
+#ifdef RUBY_BRANCH_NAME
+#define RUBY_RELEASE_STR RUBY_BRANCH_NAME
+#else
+#define RUBY_RELEASE_STR "revision"
+#endif
+#define RUBY_RELEASE_NUM RUBY_REVISION
+#endif
+
+# define RUBY_DESCRIPTION \
+ "ruby "RUBY_VERSION \
+ " ("RUBY_RELEASE_DATE" " \
+ RUBY_RELEASE_STR" " \
+ STRINGIZE(RUBY_RELEASE_NUM)") " \
+ "["RUBY_PLATFORM"]"
+# define RUBY_COPYRIGHT \
+ "ruby - Copyright (C) " \
+ STRINGIZE(RUBY_BIRTH_YEAR)"-" \
+ STRINGIZE(RUBY_RELEASE_YEAR)" " \
+ RUBY_AUTHOR