目次




RPM も参照の事。

準備


インストール

  1. ソースの取得
    # su - rpmdevel
    $ cd rpm/SOURCES
    $ wget http://cache.ruby-lang.org/pub/ruby/ruby-2.0.0-p451.tar.bz2

  2. SPECの作成
    $ cd /home/rpmdevel/rpm/SPECS
    $ vi ruby200p451.spec

    以下が中身。
    (参考:ソフトウェアエンジニアリング - CentOS 6でrubyのRPMパッケージを作る
    %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}
    

  3. 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 に必要とされています

    1. yumで足りないものをインストールする
      $ exit
      # yum -y install readline-devel ncurses-devel gdbm-devel tcl-devel libffi-devel

      デフォルトのリポジトリに libyaml、libyaml-devel が無いので EPELのリポジトリからインストールする。
      (※EPELのリポジトリ設定についてはyumリポジトリにEPELを追加するを参照。)
      # yum --enablerepo=epel install libyaml libyaml-devel

  4. RPMの作成(2回目:成功)
    $ rpmbuild -bb ruby200p451.spec

  5. インストール
    $ sudo rpm -Uvh /home/rpmdevel/rpm/RPMS/i686/ruby-2.0.0p451-2.el6.i686.rpm

  6. バージョン確認
    $ ruby -v
    ruby 2.0.0p451 (2014-02-24 revision 45167) [i686-linux]

  7. 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

  8. RubyとPassengerのビルドに必要なヘッダファイル等をインストール
    # yum install libcurl-devel

  9. 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
Last-modified: 2023-05-10 (水) 20:53:57