Files
BMLFS/build-scripts/ruby.build
2024-02-08 20:42:53 -06:00

88 lines
3.2 KiB
Bash

#! /bin/bash
# Ruby
# Source: https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.xz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: libucontext libyaml
# Recommended: NONE
# Optional: berkeleydb doxygen graphviz tk valgrind dtrace rustc
# NOTE: Fails to compile under clang due to undefine "RUBY_FUNCTION_NAME_STRING" macro
# If GCC not installed in /usr, add these variables to configure
# PATH=/opt/gnu/bin:$PATH:/opt/rustc/bin CC=gcc CXX=g++ \
# LDFLAGS="-Wl,-rpath=/opt/gnu/lib "
# If optimizing with GCC:
unset LDFLAGS
export CFLAGS="-march=native -O2 "
export CFLAGS+="-fno-lto -fstack-protector-strong -fzero-call-used-regs=used "
export CXXFLAGS=$CFLAGS
# Apply patches from Chimera Linux
patch -Np1 -i ../patches/ruby-chimera/fix-riscv64-build.patch
patch -Np1 -i ../patches/ruby-chimera/musl-fix-get_main_stack.patch
patch -Np1 -i ../patches/ruby-chimera/rubygems-avoid-platform-specific-gems.patch
patch -Np1 -i ../patches/ruby-chimera/test_insns-lower-recursion-depth.patch
autoconf -v -f && \
./configure --prefix=/usr \
--enable-shared \
--docdir=/usr/share/doc/ruby-3.3.0 \
--disable-rpath \
--enable-shared \
--disable-install-doc \
ac_cv_func_isnan=yes ac_cv_func_isinf=yes &&
read -p "Compile?" && make -j2 &&
sudo -S make DESTDIR=$BUILD install &&
#sudo -S rm -v ${BUILD}/usr/lib/ruby/3.3.0/rubygems/ssl_certs/*/*.pem &&
#sudo -S rmdir -v ${BUILD}/usr/lib/ruby/3.3.0/rubygems/ssl_certs/* &&
sudo -S mkdir -pv /BMAN/install && \
sudo -S mkdir -pv /BMAN/usr/share && \
sudo -S mv $BUILD/usr/share/doc /BMAN/usr/share/ && \
sudo -S mv $BUILD/usr/share/man /BMAN/usr/share/ && \
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
ruby: ruby (Interpreted object-oriented scripting language)
ruby:
ruby: Ruby is an interpreted scripting language for quick and easy
ruby: object-oriented programming. It has many features to process text
ruby: files and to do system management tasks (as in Perl). It is simple,
ruby: straight-forward, and extensible.
ruby:
ruby: Homepage: http://www.ruby-lang.org/
ruby:
ruby:
ruby:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/ruby-3.3.0-$PSUFFIX && \
cd /BMAN && \
cat > /tmp/slack-desc << "EOF"
ruby-doc: Manuals for ruby (Interpreted object-oriented scripting language)
ruby-doc:
ruby-doc: An interpreted scripting language for quick and easy
ruby-doc: object-oriented programming.
ruby-doc:
ruby-doc: http://www.ruby-lang.org/
ruby-doc:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/ruby-3.3.0-$NOPSUFFIX && \
sudo -S rm -rf ${BUILD}/* /BMAN/*