#freeze
''目次''
#contents
~
----
~
※ [[RPM]] も参照の事。~
~
*準備 [#m57694ed]
~
*インストール [#w20d960f]
+''ソースの取得''
 # su - rpmdevel
 $ cd rpm/SOURCES
 $ wget http://cache.ruby-lang.org/pub/ruby/ruby-2.0.0-p451.tar.bz2
~
+''SPECの作成''
 $ cd /home/rpmdevel/rpm/SPECS
 $ vi ruby200p451.spec
~
以下が中身。~
(参考:[[ソフトウェアエンジニアリング - CentOS 6でrubyのRPMパッケージを作る:http://www.torutk.com/projects/swe/wiki/CentOS_6%E3%81%A7ruby%E3%81%AERPM%E3%83%91%E3%83%83%E3%82%B1%E3%83%BC%E3%82%B8%E3%82%92%E4%BD%9C%E3%82%8B]])
~
 %define rubyver         2.0.0
 %define rubyminorver    p451
 
 Name:           ruby
 Version:        %{rubyver}%{rubyminorver}
 Release:        2%{?dist}
 License:        Ruby License/GPL - see COPYING
 URL:            http://www.ruby-lang.org/
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  readline libyaml libyaml-devel readline-devel ncurses ncurses-devel gdbm gdbm-devel glibc-devel tcl-devel gcc unzip openssl-devel db4-devel byacc make libffi-devel
 Requires:       libyaml
 Source0:        ftp://ftp.ruby-lang.org/pub/ruby/ruby-%{rubyver}-%{rubyminorver}.tar.bz2
 Summary:        An interpreter of object-oriented scripting language
 Group:          Development/Languages
 Provides: ruby(abi) = 2.0
 Provides: ruby-irb
 Provides: ruby-rdoc
 Provides: ruby-libs
 Provides: ruby-devel
 Provides: rubygems
 Obsoletes: ruby
 Obsoletes: ruby-libs
 Obsoletes: ruby-irb
 Obsoletes: ruby-rdoc
 Obsoletes: ruby-devel
 Obsoletes: rubygems
 
 %description
 Ruby is the interpreted scripting language for quick and easy
 object-oriented programming.  It has many features to process text
 files and to do system management tasks (as in Perl).  It is simple,
 straight-forward, and extensible.
 
 %prep
 %setup -n ruby-%{rubyver}-%{rubyminorver}
 
 %build
 export CFLAGS="$RPM_OPT_FLAGS -Wall -fno-strict-aliasing"
 
 %configure \
   --enable-shared \
   --disable-rpath \
   --without-X11 \
   --without-tk \
   --includedir=%{_includedir}/ruby \
   --libdir=%{_libdir}
 
 make %{?_smp_mflags}
 
 %install
 # installing binaries ...
 make install DESTDIR=$RPM_BUILD_ROOT
 
 #we don't want to keep the src directory
 rm -rf $RPM_BUILD_ROOT/usr/src
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(-, root, root)
 %{_bindir}
 %{_includedir}
 %{_datadir}
 %{_libdir}
 
~
+''RPMの作成(1回目:失敗)''
 $ rpmbuild -bb ruby200p451.spec
依存性についてエラーが表示される。~
 エラー: ビルド依存性の失敗:
         libyaml は ruby-2.1.1-1.el6.i686 に必要とされています
         libyaml-devel は ruby-2.1.1-1.el6.i686 に必要とされています
         readline-devel は ruby-2.1.1-1.el6.i686 に必要とされています
         ncurses-devel は ruby-2.1.1-1.el6.i686 に必要とされています
         gdbm-devel は ruby-2.1.1-1.el6.i686 に必要とされています
         tcl-devel は ruby-2.1.1-1.el6.i686 に必要とされています
         libffi-devel は ruby-2.1.1-1.el6.i686 に必要とされています
~
++yumで足りないものをインストールする
 $ exit
 # yum -y install readline-devel ncurses-devel gdbm-devel tcl-devel libffi-devel
~
デフォルトのリポジトリに libyaml、libyaml-devel が無いので EPELのリポジトリからインストールする。
~
(※EPELのリポジトリ設定については[[yumリポジトリにEPELを追加する:http://www.abetake.com/index.php?yum#l7bff16f]]を参照。)
 # yum --enablerepo=epel install libyaml libyaml-devel
~
+''RPMの作成(2回目:成功)''
 $ rpmbuild -bb ruby200p451.spec
~
+''インストール''
 $ sudo rpm -Uvh /home/rpmdevel/rpm/RPMS/i686/ruby-2.0.0p451-2.el6.i686.rpm
~
+''バージョン確認''
 $ ruby -v
 ruby 2.0.0p451 (2014-02-24 revision 45167) [i686-linux]
~
+''bundlerのインストール''~
※Redmineが使用するGemを一括インストールするためのツール。~
 # gem install bundler --no-rdoc --no-ri
 Fetching: bundler-1.5.3.gem (100%)
 Successfully installed bundler-1.5.3
 1 gem installed
~
+''RubyとPassengerのビルドに必要なヘッダファイル等をインストール''
 # yum install libcurl-devel
~
+''ImageMagickとヘッダファイル・日本語フォントのインストール''
 # yum install ImageMagick ImageMagick-devel
 # yum install ipa-pgothic-fonts
ImageMagickと日本語フォントはガントチャートをPNG形式の画像にエクスポートするのに使われる。~
~
''追記:''~
必須ではないと思っていたらRedmineのインストールで''bundle install''する時に下記エラーが出る。~
なので忘れずにインストールする。
 Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
 
     /usr/bin/ruby extconf.rb
 checking for Ruby version >= 1.8.5... yes
 checking for gcc... yes
 checking for Magick-config... no
 Can't install RMagick 2.13.2. Can't find Magick-config in  /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
 
 *** extconf.rb failed ***
 Could not create Makefile due to some reason, probably lack of necessary
 libraries and/or headers.  Check the mkmf.log file for more details.  You may
 need configuration options.
 
 Provided configuration options:
         --with-opt-dir
         --without-opt-dir
         --with-opt-include
         --without-opt-include=${opt-dir}/include
         --with-opt-lib
         --without-opt-lib=${opt-dir}/lib
         --with-make-prog
         --without-make-prog
         --srcdir=.
         --curdir
         --ruby=/usr/bin/ruby
 
 
 Gem files will remain installed in /usr/lib/ruby/gems/2.0.0/gems/rmagick-2.13.2 for inspection.
 Results logged to /usr/lib/ruby/gems/2.0.0/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
 An error occurred while installing rmagick (2.13.2), and Bundler cannot continue.
 Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS