I've been searching google and I found another question on stackoverflow with no answer and some people saying they had success with checkinstall. I'm following this:
sudo apt-get install uuid-dev libsystemd-dev libssl-dev checkinstall
sudo apt-get install libjemalloc1 libjemalloc-dev
wget http://ftp.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0.tar.gz
tar -xzvf ruby-2.7.0.tar.gz
cd ruby-2.7.0/
./configure --with-jemalloc
make
sudo checkinstall --default --backup=no --deldoc=yes --install=yes --pkgname=ruby --pkgversion='2.7.0'
But it's getting stuck on:
# sudo checkinstall -D --default --fstrans=no --backup=no --deldoc=yes --install=no --pkgname=ruby --pkgversion='2.7.0'
checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran
This software is released under the GNU GPL.
The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs? [y]: y
Preparing package documentation...OK
*****************************************
**** Debian package creation selected ***
*****************************************
This package will be built according to these values:
0 - Maintainer: [ root@hdd-rig ]
1 - Summary: [ Package created with checkinstall 1.6.2 ]
2 - Name: [ ruby ]
3 - Version: [ 2.7.0 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ checkinstall ]
7 - Architecture: [ amd64 ]
8 - Source location: [ ruby-2.7.0 ]
9 - Alternate source location: [ ]
10 - Requires: [ ]
11 - Provides: [ ruby ]
12 - Conflicts: [ ]
13 - Replaces: [ ]
Enter a number to change any of them or press ENTER to continue:
Installing with make install...
========================= Installation results ===========================
BASERUBY = /usr/bin/ruby --disable=gems
CC = gcc
LD = ld
LDSHARED = gcc -shared
CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -std=gnu99
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/12.1.0
CPPFLAGS =
DLDFLAGS = -Wl,--compress-debug-sections=zlib -fstack-protector-strong -pie
SOLIBS = -lz -lpthread -lrt -lrt -ljemalloc -lgmp -ldl -lcrypt -lm
LANG = en_US.UTF-8
LC_ALL =
LC_CTYPE =
MFLAGS =
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
./revision.h unchanged
generating enc.mk
It has been hanging there for hours. Does anyone have instructions on how to build a .deb package of ruby 2.9.0 with ./configure --with-jemalloc?
I can't use rbenv or anything like that as I need to deploy this binary package to thousands of systems and compiling on each one is prohibitively slow.
I could not get checkinstall to work but I managed to compile like this in the end:
sudo apt-get update; sudo apt-get -y dist-upgrade
sudo apt-get -y install uuid-dev libsystemd-dev libssl-dev libreadline-dev libyaml-dev libedit-dev checkinstall build-essential libjemalloc-dev
wget https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.1.tar.gz
tar -xzvf ruby-3.2.1.tar.gz
cd ruby-3.2.1
./configure --disable-install-rdoc --enable-yjit
make -j4
mkdir -p ~/ruby-3.2.1-installer/DEBIAN/
make install DESTDIR=~/ruby-3.2.1-installer
du -s ~/ruby-3.2.1-installer # To put in Installed-Size
vim ~/ruby-3.2.1-installer/DEBIAN/control
## FOR AMD64 - Ubuntu 20.04
# Package: ruby3.2.1
# Version: 3.2.1
# Section: custom
# Priority: optional
# Architecture: amd64
# Maintainer: tetherx
# Installed-Size: 211756
# Depends: libc6 (>= 2.31), libffi7 (>= 3.3), libgdbm6 (>= 1.18.1), libreadline8 (>= 8.0), libssl1.1 (>= 1.1.1), libyaml-0-2, zlib1g (>= 1:1.2.11)
# Description: ruby language interpreter
cd ~
dpkg-deb --build ruby-3.2.1-installer
sudo dpkg -i ruby-3.2.1-installer.deb