SVX日記

2004|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|09|10|11|12|
2024|01|02|03|04|05|06|07|08|09|10|11|

2009-10-23(Fri) OpenSuSEのRubyもncursesw化する

  ほとんど同じだけれども、一応、SuSEの手順も記録しておく。

opensuse-11.1:/root # cat /etc/SuSE-release 
openSUSE 11.1 (x86_64)
VERSION = 11.1
 
縁起物なので、YaSTでRubyパッケージを「ruby-1.8.7.p72-5.4.1」にアップデートする。
 
opensuse-11.1:/root # wget http://download.opensuse.org/source/distribution/11.1/repo/oss/suse/src/ruby-1.8.7.p72-5.3.src.rpm
 
opensuse-11.1:/root # rpm -ivh ruby-1.8.7.p72-5.3.src.rpm 
 
opensuse-11.1:/root # rpmbuild -bp /usr/src/packages/SPECS/ruby.spec 
error: Failed build dependencies:
	gdbm-devel is needed by ruby-1.8.7.p72-5.3.x86_64
	gperf is needed by ruby-1.8.7.p72-5.3.x86_64
	readline-devel is needed by ruby-1.8.7.p72-5.3.x86_64
	tk-devel is needed by ruby-1.8.7.p72-5.3.x86_64
 
YaSTで各パッケージを導入。こういうトコが、GUIって、却って面倒いな。
 
opensuse-11.1:/root # rpmbuild -bp /usr/src/packages/SPECS/ruby.spec 
 
opensuse-11.1:/root # cd /usr/src/packages/BUILD/ruby-1.8.7-p72/
 
opensuse-11.1:/usr/src/packages/BUILD/ruby-1.8.7-p72 # cd ext/curses/
 
opensuse-11.1:/usr/src/packages/BUILD/ruby-1.8.7-p72/ext/curses # ruby extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib64/ruby/ruby.h
 
YaSTで「ruby-devel」を導入。
 
opensuse-11.1:/usr/src/packages/BUILD/ruby-1.8.7-p72/ext/curses # ruby extconf.rb 
 
opensuse-11.1:/usr/src/packages/BUILD/ruby-1.8.7-p72/ext/curses # make
 
opensuse-11.1:/usr/src/packages/BUILD/ruby-1.8.7-p72/ext/curses # diff -c curses.c.org curses.c
*** curses.c.org	Fri Oct 23 20:35:30 2009
--- curses.c	Fri Oct 23 20:47:21 2009
***************
*** 15,20 ****
--- 15,21 ----
  
  #include "ruby.h"
  #include "rubyio.h"
+ #include "locale.h"
  
  #if defined(HAVE_NCURSES_H)
  # include 
***************
*** 1441,1446 ****
--- 1442,1449 ----
  void
  Init_curses()
  {
+ 	setlocale(LC_ALL, "");
+ 
      mCurses    = rb_define_module("Curses");
      mKey       = rb_define_module_under(mCurses, "Key");
 
opensuse-11.1:/usr/src/packages/BUILD/ruby-1.8.7-p72/ext/curses # diff -c extconf.rb.org extconf.rb
*** extconf.rb.org	Fri Oct 23 20:35:30 2009
--- extconf.rb	Fri Oct 23 20:40:12 2009
***************
*** 1,15 ****
  require 'mkmf'
  
  dir_config('curses')
! dir_config('ncurses')
  dir_config('termcap')
  
  make=false
  have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
  have_library("tinfo", "tgetent") or have_library("termcap", "tgetent")
! if have_header(*curses=%w"ncurses.h") and have_library("ncurses", "initscr")
    make=true
! elsif have_header(*curses=%w"ncurses/curses.h") and have_library("ncurses", "initscr")
    make=true
  elsif have_header(*curses=%w"curses_colr/curses.h") and have_library("cur_colr", "initscr")
    curses.unshift("varargs.h")
--- 1,15 ----
  require 'mkmf'
  
  dir_config('curses')
! dir_config('ncursesw')
  dir_config('termcap')
  
  make=false
  have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
  have_library("tinfo", "tgetent") or have_library("termcap", "tgetent")
! if have_header(*curses=%w"ncurses.h") and have_library("ncursesw", "initscr")
    make=true
! elsif have_header(*curses=%w"ncurses/curses.h") and have_library("ncursesw", "initscr")
    make=true
  elsif have_header(*curses=%w"curses_colr/curses.h") and have_library("cur_colr", "initscr")
    curses.unshift("varargs.h")
 
opensuse-11.1:/usr/src/packages/BUILD/ruby-1.8.7-p72/ext/curses # make distclean
 
opensuse-11.1:/usr/src/packages/BUILD/ruby-1.8.7-p72/ext/curses # ruby extconf.rb
 
opensuse-11.1:/usr/src/packages/BUILD/ruby-1.8.7-p72/ext/curses # make
 
opensuse-11.1:/usr/src/packages/BUILD/ruby-1.8.7-p72/ext/curses # cd /usr/lib64/ruby/1.8/x86_64-linux
 
opensuse-11.1:/usr/lib64/ruby/1.8/x86_64-linux # mv curses.so curses.so.org
 
opensuse-11.1:/usr/lib64/ruby/1.8/x86_64-linux # cp /usr/src/packages/BUILD/ruby-1.8.7-p72/ext/curses/curses.so .
 
  1 #!/usr/bin/ruby
  2 
  3 require "curses"
  4 
  5 Curses.init_screen
  6 begin
  7   s = "こんにちは、世界!"
  8   Curses.setpos(Curses.lines / 2, Curses.cols / 2 - (s.length / 2))
  9   Curses.addstr(s)
 10   Curses.refresh
 11   Curses.getch
 12 ensure
 13   Curses.close_screen
 14 end
 
こんにちは、世界!