Marcos Cruz escribió/skribis/wrote/scrit (2024-04-09T15:12:49+0200):
> One year ago, when I tried Ring for the first time, I was surprised that
> the compilation and installation process needed several specific steps,
> not just the usual `make` or similar.
>
> Then I wrote a fish shell script in order to automate the steps and fix
> some issues.
I have used my script again, without any change, in order to update Ring
from version 1.20 to 1.21, compiling from my repo clone.
I think my script could be useful to others. Anyway, it's interesting
because it shows how peculiar the installation process is, at least in
my case…
Here you are:
```fish
#!/usr/bin/env fish
# build_ring
# A Ring language installer for Debian
# By Marcos Cruz (
programandala.net), 2023, 2024.
# References:
# <
https://ring-lang.github.io/doc1.17/sourcecode.html>
# <
https://ring-lang.github.io/doc1.19/sourcecode.html>
# <
https://groups.google.com/d/msgid/ring-lang/153bc518-5652-4e34-8df8-cb33940094c9n%40googlegroups.com>
# Last modified 20240409T1746+0200.
# Config # {{{1
# ==============================================================
# Set the absolute path to the Ring release.
set RING ~/PATH-TO-RING-SOURCE # XXX ADAPT TO YOUR NEEDS
# Guess the type of release.
if test -d $RING/build
# The <build> directory exists; therefore we are compiling the repository.
set repo
else if ! test -d $RING/samples
# The <samples> directory does not exist; therefore we are compiling a light
# release.
set light_release
else
# Otherwise, we are compiling the full release.
set full_release
end
if ! set --query repo
# Convert the format of the Linux scripts and make them executable.
for script in (find $RING -name "*.sh")
sudo dos2unix $script
sudo chmod u+x $script
end
end
# Install Libraries # {{{1
# ==============================================================
# The following command is an updated version of the content of <./language/src/installdep.sh>
# ("libmysqlclient-dev" is renamed to "default-libmysqlclient-dev";
# "apache2" is removed):
sudo apt-get install \
default-libmysqlclient-dev \
freeglut3-dev \
g++ \
g++-multilib \
liballegro-acodec5-dev \
liballegro-audio5-dev \
liballegro-dialog5-dev \
liballegro-image5-dev \
liballegro-physfs5-dev \
liballegro-ttf5-dev \
liballegro5-dev \
libcurl4-gnutls-dev \
libpng-dev \
libpq-dev \
libqt5charts5 \
libqt5charts5-dev \
libqt5opengl5-dev \
libqt5serialport5-dev \
libqt5texttospeech5-dev \
libqt5webkit5-dev \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-net-dev \
libsdl2-ttf-dev \
libssl-dev \
make \
mesa-common-dev \
qt3d5-dev \
qt3d5-dev-tools \
qt5-qmake \
qtbase5-dev \
qtbase5-dev-tools \
qtchooser \
qtconnectivity5-dev \
qtdeclarative5-dev \
qtmultimedia5-dev \
qtpositioning5-dev \
qtwebengine5-dev \
unixodbc \
unixodbc-dev
or exit 1
# Build # {{{1
# ==============================================================
if set --query repo
# Build from the repository.
cd $RING/build
bash ./buildgcc.sh
else
# Build a light release or an Ubuntu release.
if ! set --query light_release
cd $RING/language/src
bash ./buildgcc.sh
or exit 1
end
cd $RING/tools/ring2exe
sudo sh ./build.sh
or exit 1
# XXX FIXME
cd $RING/extensions/ringconsolecolors
sh ./gencode.sh
or exit 1
sh ./buildgcc.sh
or exit 1
cd $RING/extensions/ringinternet
sh ./buildgcc.sh
or exit 1
cd $RING/extensions/ringcurl
sh ./gencode.sh
sh ./buildgcc.sh
or exit 1
if ! set --query light_release
cd $RING/extensions/ringzip
sh ./gencode.sh
sh ./buildgcc.sh
end
cd $RING/tools/ringpm
sudo sh ./build.sh
if ! set --query light_release
cd $RING/extensions/ringodbc
sh ./buildgcc.sh
end
if ! set --query light_release
cd $RING/extensions/ringmysql
sh ./buildgcc.sh
end
if ! set --query light_release
cd $RING/extensions/ringsqlite
sh ./buildgcc.sh
end
if ! set --query light_release
cd $RING/extensions/ringopenssl
sh ./buildgcc.sh
end
if ! set --query light_release
cd $RING/extensions/ringmurmurhash
sh ./buildgcc.sh
end
if ! set --query light_release
cd $RING/extensions/ringallegro
sh ./gencode.sh
sh ./buildgcc.sh
end
if ! set --query light_release
# Build Libuv first.
cd $RING/extensions/ringlibuv/libuv
sudo apt-get install libtool m4 automake
sh autogen.sh
sh ./configure
make
make check
sudo make install
# Then build RingLibuv.
cd $RING/extensions/ringlibuv
sh ./gencode.sh
sh ./buildgcc.sh
end
if ! set --query light_release
cd $RING/extensions/ringfreeglut
sh ./gencode.sh
sh ./buildgcc.sh
end
if ! set --query light_release
# The ringopengl folder contains many sub folders for different OpenGL versions
# starting from OpenGL 1.1 to OpenGL 4.6.
cd $RING/extensions/ringopengl/opengl21
sh gencode.sh
sh buildgcc.sh
end
if ! set --query light_release
cd $RING/extensions/ringpostgresql
sh gencode.sh
sh buildgcc.sh
end
if ! set --query light_release
cd $RING/extensions/ringqt
sh ./gencode.sh
sh ./buildgcc.sh
end
end
# Install # {{{1
# ==============================================================
cd $RING/bin
sudo sh ./install.sh
or exit 1
# vim: filetype=fish
```