summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-29 11:07:59 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-29 11:07:59 +0000
commitb67592ed7b8077286b76dcaef3be527023a7d825 (patch)
tree5b233e218a72cf9794610e48ec565ce60a5d8019
parentaefc05cd078c62cb6ec8871f9d6cee2fd61534e7 (diff)
* configure.in, win32/Makefile.sub, mkconfig.rb, instruby.rb,
ruby.c, lib/mkmf.rb, README.EXT, README.EXT.ja: Backport the vendor_ruby directory support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--NEWS19
-rw-r--r--README.EXT5
-rw-r--r--README.EXT.ja6
-rw-r--r--bcc32/Makefile.sub4
-rw-r--r--configure.in22
-rwxr-xr-xinstruby.rb6
-rw-r--r--lib/mkmf.rb13
-rwxr-xr-xmkconfig.rb2
-rw-r--r--ruby.c7
-rw-r--r--win32/Makefile.sub4
11 files changed, 92 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2902d91080..bf9708a17d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu May 29 20:07:45 2008 Akinori MUSHA <[email protected]>
+
+ * configure.in, win32/Makefile.sub, mkconfig.rb, instruby.rb,
+ ruby.c, lib/mkmf.rb, README.EXT, README.EXT.ja: Backport the
+ vendor_ruby directory support.
+
Wed May 28 17:54:29 2008 Akinori MUSHA <[email protected]>
* string.c (rb_str_start_with): Remove an unused variable.
diff --git a/NEWS b/NEWS
index 067086ecc2..ea7fee0e51 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,25 @@ with all sufficient information, see the ChangeLog file.
== Changes since the 1.8.6 release
+=== Configuration changes
+
+* vendor_ruby directory
+
+ A new library directory named `vendor_ruby' is introduced in
+ addition to `site_ruby'. The idea is to separate libraries
+ installed by the package system (`vendor') from manually (`site')
+ installed libraries preventing the former from getting overwritten
+ by the latter, while preserving the user option to override vendor
+ libraries with site libraries. (`site_ruby' takes precedence over
+ `vendor_ruby')
+
+ If you are a package maintainer, make each library package configure
+ the library passing the `--vendor' option to `extconf.rb' so that
+ the library files will get installed under `vendor_ruby'.
+
+ You can change the directory locations using configure options such
+ as `--with-sitedir=DIR' and `--with-vendordir=DIR'.
+
=== Library updates (outstanding ones only)
* new library
diff --git a/README.EXT b/README.EXT
index 2fc2fd606a..637b19d25b 100644
--- a/README.EXT
+++ b/README.EXT
@@ -662,6 +662,11 @@ Try generating the Makefile by:
ruby extconf.rb
+If the library should be installed under vendor_ruby directory
+instead of site_ruby directory, use --vendor option as follows.
+
+ ruby extconf.rb --vendor
+
You don't need this step if you put the extension library under the ext
directory of the ruby source tree. In that case, compilation of the
interpreter will do this step for you.
diff --git a/README.EXT.ja b/README.EXT.ja
index 30c4d520ba..73425c2cdb 100644
--- a/README.EXT.ja
+++ b/README.EXT.ja
@@ -765,6 +765,12 @@ Makefile��ºݤ��������뤿��ˤ�
�Ȥ��Ƥ���������
+site_ruby �ǥ��쥯�ȥ�Ǥʤ���
+vendor_ruby �ǥ��쥯�ȥ�˥��󥹥ȡ��뤹����ˤ�
+�ʲ��Τ褦�� --vendor ���ץ�����ä��Ƥ���������
+
+ ruby extconf.rb --vendor
+
�ǥ��쥯�ȥ��ext�ʲ����Ѱդ������ˤ�Ruby���Τ�make�λ���
��ưŪ��Makefile����������ޤ��Τǡ����Υ��ƥåפ����פǤ���
diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub
index 98e0b3da23..713b5c69df 100644
--- a/bcc32/Makefile.sub
+++ b/bcc32/Makefile.sub
@@ -294,9 +294,12 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/bcc32/Makefile.sub
\#define RUBY_LIB "/lib/ruby/$(MAJOR).$(MINOR)"
\#define RUBY_SITE_LIB "/lib/ruby/site_ruby"
\#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)"
+\#define RUBY_VENDOR_LIB "/lib/ruby/vendor_ruby"
+\#define RUBY_VENDOR_LIB2 "/lib/ruby/vendor_ruby/$(MAJOR).$(MINOR)"
\#define RUBY_PLATFORM "$(ARCH)-$(OS)"
\#define RUBY_ARCHLIB "/lib/ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
\#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
+\#define RUBY_VENDOR_ARCHLIB "/lib/ruby/vendor_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
|
@exit > $@
@@ -409,6 +412,7 @@ s,@EXPORT_PREFIX@,_,;t t
s,@arch@,$(ARCH)-$(OS),;t t
s,@sitearch@,$(ARCH)-$(OS),;t t
s,@sitedir@,$${prefix}/lib/ruby/site_ruby,;t t
+s,@vendordir@,$${prefix}/lib/ruby/vendor_ruby,;t t
s,@configure_args@,--enable-shared $(configure_args),;t t
s,@configure_input@,$$configure_input,;t t
s,@srcdir@,$(srcdir),;t t
diff --git a/configure.in b/configure.in
index 57be9766a8..d5e5be9e86 100644
--- a/configure.in
+++ b/configure.in
@@ -1710,9 +1710,28 @@ AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}")
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RUBY_SITE_LIB_PATH2}")
+AC_ARG_WITH(vendordir,
+ [ --with-vendordir=DIR vendor libraries in DIR [PREFIX/lib/ruby/vendor_ruby]],
+ [vendordir=$withval],
+ [vendordir='${prefix}/lib/ruby/vendor_ruby'])
+VENDOR_DIR=`eval echo \\"${vendordir}\\"`
+case "$target_os" in
+ cygwin*|mingw*|*djgpp*|os2-emx*)
+ RUBY_VENDOR_LIB_PATH="`expr "$VENDOR_DIR" : "$prefix\(/.*\)"`" ||
+ RUBY_VENDOR_LIB_PATH="$VENDOR_DIR";;
+ *)
+ RUBY_VENDOR_LIB_PATH="$VENDOR_DIR";;
+esac
+RUBY_VENDOR_LIB_PATH2="${RUBY_VENDOR_LIB_PATH}/${MAJOR}.${MINOR}"
+
+AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, "${RUBY_VENDOR_LIB_PATH}")
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB2, "${RUBY_VENDOR_LIB_PATH2}")
+
AC_SUBST(arch)dnl
AC_SUBST(sitearch)dnl
AC_SUBST(sitedir)dnl
+AC_SUBST(vendordir)dnl
configure_args=$ac_configure_args
AC_SUBST(configure_args)dnl
@@ -1725,6 +1744,8 @@ if test "$fat_binary" != no ; then
AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB,
"${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
+ AC_DEFINE_UNQUOTED(RUBY_VENDOR_THIN_ARCHLIB,
+ "${RUBY_VENDOR_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}")
else
arch="${target_cpu}-${target_os}"
@@ -1738,6 +1759,7 @@ esac
AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${sitearch}")
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_ARCHLIB, "${RUBY_VENDOR_LIB_PATH2}/${sitearch}")
AC_ARG_WITH(search-path,
[ --with-search-path=DIR specify the additional search path],
diff --git a/instruby.rb b/instruby.rb
index 0201f28883..2903a7c739 100755
--- a/instruby.rb
+++ b/instruby.rb
@@ -213,6 +213,8 @@ rubylibdir = CONFIG["rubylibdir"]
archlibdir = CONFIG["archdir"]
sitelibdir = CONFIG["sitelibdir"]
sitearchlibdir = CONFIG["sitearchdir"]
+vendorlibdir = CONFIG["vendorlibdir"]
+vendorarchlibdir = CONFIG["vendorarchdir"]
mandir = File.join(CONFIG["mandir"], "man")
configure_args = Shellwords.shellwords(CONFIG["configure_args"])
enable_shared = CONFIG["ENABLE_SHARED"] == 'yes'
@@ -253,7 +255,7 @@ if $extout
extout = "#$extout"
install?(:ext, :arch, :'ext-arch') do
puts "installing extension objects"
- makedirs [archlibdir, sitearchlibdir]
+ makedirs [archlibdir, sitearchlibdir, vendorarchlibdir]
if noinst = CONFIG["no_install_files"] and noinst.empty?
noinst = nil
end
@@ -261,7 +263,7 @@ if $extout
end
install?(:ext, :comm, :'ext-comm') do
puts "installing extension scripts"
- makedirs [rubylibdir, sitelibdir]
+ makedirs [rubylibdir, sitelibdir, vendorlibdir]
install_recursive("#{extout}/common", rubylibdir, :mode => $data_mode)
end
end
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index c9777fcc7b..a532b5c0a8 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -51,6 +51,9 @@ $archdir = CONFIG["archdir"]
$sitedir = CONFIG["sitedir"]
$sitelibdir = CONFIG["sitelibdir"]
$sitearchdir = CONFIG["sitearchdir"]
+$vendordir = CONFIG["vendordir"]
+$vendorlibdir = CONFIG["vendorlibdir"]
+$vendorarchdir = CONFIG["vendorarchdir"]
$mswin = /mswin/ =~ RUBY_PLATFORM
$bccwin = /bccwin/ =~ RUBY_PLATFORM
@@ -76,11 +79,14 @@ end
INSTALL_DIRS = [
[dir_re('commondir'), "$(RUBYCOMMONDIR)"],
[dir_re('sitedir'), "$(RUBYCOMMONDIR)"],
+ [dir_re('vendordir'), "$(RUBYCOMMONDIR)"],
[dir_re('rubylibdir'), "$(RUBYLIBDIR)"],
[dir_re('archdir'), "$(RUBYARCHDIR)"],
[dir_re('sitelibdir'), "$(RUBYLIBDIR)"],
+ [dir_re('vendorlibdir'), "$(RUBYLIBDIR)"],
[dir_re('sitearchdir'), "$(RUBYARCHDIR)"],
[dir_re('bindir'), "$(BINDIR)"],
+ [dir_re('vendorarchdir'), "$(RUBYARCHDIR)"],
]
def install_dirs(target_prefix = nil)
@@ -100,6 +106,13 @@ def install_dirs(target_prefix = nil)
['RUBYLIBDIR', '$(rubylibdir)$(target_prefix)'],
['RUBYARCHDIR', '$(archdir)$(target_prefix)'],
]
+ elsif $configure_args.has_key?('--vendor')
+ dirs = [
+ ['BINDIR', '$(bindir)'],
+ ['RUBYCOMMONDIR', '$(vendordir)$(target_prefix)'],
+ ['RUBYLIBDIR', '$(vendorlibdir)$(target_prefix)'],
+ ['RUBYARCHDIR', '$(vendorarchdir)$(target_prefix)'],
+ ]
else
dirs = [
['BINDIR', '$(bindir)'],
diff --git a/mkconfig.rb b/mkconfig.rb
index 669e195f91..2afc07c1ef 100755
--- a/mkconfig.rb
+++ b/mkconfig.rb
@@ -144,6 +144,8 @@ print <<EOS
CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
+ CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)"
+ CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)"
CONFIG["topdir"] = File.dirname(__FILE__)
MAKEFILE_CONFIG = {}
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
diff --git a/ruby.c b/ruby.c
index f9788edf5c..934cb8fd8b 100644
--- a/ruby.c
+++ b/ruby.c
@@ -322,6 +322,13 @@ ruby_init_loadpath()
incpush(RUBY_RELATIVE(RUBY_SITE_ARCHLIB));
incpush(RUBY_RELATIVE(RUBY_SITE_LIB));
+ incpush(RUBY_RELATIVE(RUBY_VENDOR_LIB2));
+#ifdef RUBY_VENDOR_THIN_ARCHLIB
+ incpush(RUBY_RELATIVE(RUBY_VENDOR_THIN_ARCHLIB));
+#endif
+ incpush(RUBY_RELATIVE(RUBY_VENDOR_ARCHLIB));
+ incpush(RUBY_RELATIVE(RUBY_VENDOR_LIB));
+
incpush(RUBY_RELATIVE(RUBY_LIB));
#ifdef RUBY_THIN_ARCHLIB
incpush(RUBY_RELATIVE(RUBY_THIN_ARCHLIB));
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 85b58ac586..972e6933f5 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -396,9 +396,12 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
#define RUBY_LIB "/lib/ruby/$(MAJOR).$(MINOR)"
#define RUBY_SITE_LIB "/lib/ruby/site_ruby"
#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)"
+#define RUBY_VENDOR_LIB "/lib/ruby/vendor_ruby"
+#define RUBY_VENDOR_LIB2 "/lib/ruby/vendor_ruby/$(MAJOR).$(MINOR)"
#define RUBY_PLATFORM "$(arch)"
#define RUBY_ARCHLIB "/lib/ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(RT)"
+#define RUBY_VENDOR_ARCHLIB "/lib/ruby/vendor_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(RT)"
#define LIBRUBY_SO "$(LIBRUBY_SO)"
#if 0
$(BANG)if "$(RUBY_SO_NAME)"!="$$(RUBY_SO_NAME)" || "$(ARCH)-$(OS)"!="$$(ARCH)-$$(OS)"
@@ -546,6 +549,7 @@ s,@EXPORT_PREFIX@, ,;t t
s,@arch@,$(ARCH)-$(OS),;t t
s,@sitearch@,$(ARCH)-$(RT),;t t
s,@sitedir@,$${prefix}/lib/ruby/site_ruby,;t t
+s,@vendordir@,$${prefix}/lib/ruby/vendor_ruby,;t t
s,@configure_args@,--with-make-prog=nmake --enable-shared $(configure_args),;t t
s,@configure_input@,$$configure_input,;t t
s,@srcdir@,$(srcdir),;t t