[前][次][番号順一覧][スレッド一覧]

ruby-changes:42498

From: nobu <ko1@a...>
Date: Thu, 14 Apr 2016 09:33:36 +0900 (JST)
Subject: [ruby-changes:42498] nobu:r54572 (trunk): ruby-runner.h

nobu	2016-04-14 10:30:12 +0900 (Thu, 14 Apr 2016)

  New Revision: 54572

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54572

  Log:
    ruby-runner.h
    
    * template/ruby-runner.h.in: separate configured part from
      ruby-runner.c.

  Added files:
    trunk/ruby-runner.c
    trunk/template/ruby-runner.h.in
  Removed files:
    trunk/template/ruby-runner.c.in
  Modified files:
    trunk/.gitignore
    trunk/Makefile.in
Index: .gitignore
===================================================================
--- .gitignore	(revision 54571)
+++ .gitignore	(revision 54572)
@@ -103,7 +103,7 @@ y.tab.c https://github.com/ruby/ruby/blob/trunk/.gitignore#L103
 /rubicon
 /ruby
 /ruby-runner
-/ruby-runner.c
+/ruby-runner.h
 /ruby-man.rd.gz
 /sizes.c
 /test.rb
Index: ruby-runner.c
===================================================================
--- ruby-runner.c	(revision 0)
+++ ruby-runner.c	(revision 54572)
@@ -0,0 +1,35 @@ https://github.com/ruby/ruby/blob/trunk/ruby-runner.c#L1
+#define _POSIX_C_SOURCE 200809L
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "ruby-runner.h"
+
+#define STRINGIZE(expr) STRINGIZE0(expr)
+#define STRINGIZE0(expr) #expr
+
+int
+main(int argc, char **argv)
+{
+    static const char builddir[] = BUILDDIR;
+    const char *libpath = getenv(LIBPATHENV);
+    char c = 0;
+
+    if (libpath) {
+	while ((c = *libpath) == PATH_SEP) ++libpath;
+    }
+    if (c) {
+	size_t n = strlen(libpath);
+	char *e = malloc(sizeof(builddir)+n+1);
+	memcpy(e, builddir, sizeof(builddir)-1);
+	e[sizeof(builddir)-1] = PATH_SEP;
+	memcpy(e+sizeof(builddir), libpath, n+1);
+	libpath = e;
+    }
+    else {
+	libpath = builddir;
+    }
+    setenv(LIBPATHENV, libpath, 1);
+    execv(BUILDDIR"/"STRINGIZE(RUBY_INSTALL_NAME), argv);
+    return -1;
+}

Property changes on: ruby-runner.c
___________________________________________________________________
Added: svn:eol-style
   + LF

Index: template/ruby-runner.c.in
===================================================================
--- template/ruby-runner.c.in	(revision 54571)
+++ template/ruby-runner.c.in	(revision 54572)
@@ -1,37 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/template/ruby-runner.c.in#L0
-#define _POSIX_C_SOURCE 200809L
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define BUILDDIR "@abs_top_builddir@"
-#define LIBPATHENV "@LIBPATHENV@"
-#define PATH_SEP '@PATH_SEPARATOR@'
-
-#define STRINGIZE(expr) STRINGIZE0(expr)
-#define STRINGIZE0(expr) #expr
-
-int
-main(int argc, char **argv)
-{
-    static const char builddir[] = BUILDDIR;
-    const char *libpath = getenv(LIBPATHENV);
-    char c = 0;
-
-    if (libpath) {
-	while ((c = *libpath) == PATH_SEP) ++libpath;
-    }
-    if (c) {
-	size_t n = strlen(libpath);
-	char *e = malloc(sizeof(builddir)+n+1);
-	memcpy(e, builddir, sizeof(builddir)-1);
-	e[sizeof(builddir)-1] = PATH_SEP;
-	memcpy(e+sizeof(builddir), libpath, n+1);
-	libpath = e;
-    }
-    else {
-	libpath = builddir;
-    }
-    setenv(LIBPATHENV, libpath, 1);
-    execv(BUILDDIR"/"STRINGIZE(RUBY_INSTALL_NAME), argv);
-    return -1;
-}
Index: template/ruby-runner.h.in
===================================================================
--- template/ruby-runner.h.in	(revision 0)
+++ template/ruby-runner.h.in	(revision 54572)
@@ -0,0 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/template/ruby-runner.h.in#L1
+#define BUILDDIR   "@abs_top_builddir@"
+#define LIBPATHENV "@LIBPATHENV@"
+#define PATH_SEP   '@PATH_SEPARATOR@'

Property changes on: template/ruby-runner.h.in
___________________________________________________________________
Added: svn:eol-style
   + LF

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 54571)
+++ Makefile.in	(revision 54572)
@@ -254,11 +254,11 @@ ruby_pc = @ruby_pc@ https://github.com/ruby/ruby/blob/trunk/Makefile.in#L254
 $(ruby_pc):
 		@./config.status --file=$@:$(srcdir)/template/ruby.pc.in
 
-ruby-runner.c: template/ruby-runner.c.in
+ruby-runner.h: template/ruby-runner.h.in
 		@./config.status --file=$@:$(srcdir)/template/$(@F).in
 
-ruby-runner$(EXEEXT): ruby-runner.c
-	$(Q) $(PURIFY) $(CC) $(CFLAGS) $(CPPFLAGS) -DRUBY_INSTALL_NAME=$(RUBY_INSTALL_NAME) $(LDFLAGS) $(LIBS) $(OUTFLAG)$@ ruby-runner.c
+ruby-runner$(EXEEXT): ruby-runner.c ruby-runner.h
+	$(Q) $(PURIFY) $(CC) $(CFLAGS) $(CPPFLAGS) -DRUBY_INSTALL_NAME=$(RUBY_INSTALL_NAME) $(LDFLAGS) $(LIBS) $(OUTFLAG)$@ $<
 
 $(RBCONFIG): $(PREP)
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]