Skip to content

Instantly share code, notes, and snippets.

@nanobeep
Created January 14, 2016 04:11
Show Gist options
  • Save nanobeep/ff3b686c4da8abab0d37 to your computer and use it in GitHub Desktop.
Save nanobeep/ff3b686c4da8abab0d37 to your computer and use it in GitHub Desktop.

Revisions

  1. nanobeep created this gist Jan 14, 2016.
    85 changes: 85 additions & 0 deletions create-ruby-package-with-fpm.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,85 @@
    # Create Ruby package with FPM

    # Do this or you'll get 404 errors from outdated package URLs
    sudo apt-get update

    # Need this for mkmf
    sudo apt-get install -y ruby-dev

    # Install dependencies (these match the dependency list in the fpm command)
    sudo apt-get install -y \
    git \
    git-core \
    g++ \
    gcc \
    make \
    libc6-dev \
    patch \
    openssl \
    ca-certificates \
    libreadline6 \
    libreadline6-dev \
    curl \
    zlib1g \
    zlib1g-dev \
    libssl-dev \
    libyaml-dev \
    libsqlite3-dev \
    sqlite3 \
    autoconf \
    libgdbm-dev \
    libncurses5-dev \
    automake \
    libtool \
    bison \
    pkg-config \
    libffi-dev \
    imagemagick

    # Install the fpm gem so we can use it for the build
    sudo gem install fpm --no-rdoc --no-ri

    # Download and compile ruby
    wget "http://cache.ruby-lang.org/pub/ruby/ruby-2.2.4.tar.gz"
    tar -zxf ruby-2.2.4.tar.gz
    cd ruby-2.2.4/
    ./configure --prefix=/usr --disable-install-doc
    make
    mkdir /tmp/installdir
    make install DESTDIR=/tmp/installdir

    # Create the package from the built ruby
    fpm \
    -s dir \
    -t deb \
    -n ruby-2.2.4 \
    -v 1 \
    -C /tmp/installdir \
    -d git \
    -d git-core \
    -d g++ \
    -d gcc \
    -d make \
    -d libc6-dev \
    -d patch \
    -d openssl \
    -d ca-certificates \
    -d libreadline6 \
    -d libreadline6-dev \
    -d curl \
    -d zlib1g \
    -d zlib1g-dev \
    -d libssl-dev \
    -d libyaml-dev \
    -d libsqlite3-dev \
    -d sqlite3 \
    -d autoconf \
    -d libgdbm-dev \
    -d libncurses5-dev \
    -d automake \
    -d libtool \
    -d bison \
    -d pkg-config \
    -d libffi-dev \
    -d imagemagick \
    .