Added autoinstaller for deps
This commit is contained in:
parent
e717f9f6aa
commit
f8e2916712
5
Makefile
5
Makefile
@ -81,6 +81,9 @@ examples: examples/commands/commands examples/base64/base64 examples/ini/ini exa
|
|||||||
examples/http examples/threads examples/tomodeps examples/tomo-install examples/wrap examples/pthreads examples/colorful
|
examples/http examples/threads examples/tomodeps examples/tomo-install examples/wrap examples/pthreads examples/colorful
|
||||||
./build/tomo examples/learnxiny.tm
|
./build/tomo examples/learnxiny.tm
|
||||||
|
|
||||||
|
deps:
|
||||||
|
./install_dependencies.sh
|
||||||
|
|
||||||
install: build/tomo build/libtomo.so
|
install: build/tomo build/libtomo.so
|
||||||
mkdir -p -m 755 "$(PREFIX)/man/man1" "$(PREFIX)/bin" "$(PREFIX)/include/tomo" "$(PREFIX)/lib" "$(PREFIX)/share/tomo/modules"
|
mkdir -p -m 755 "$(PREFIX)/man/man1" "$(PREFIX)/bin" "$(PREFIX)/include/tomo" "$(PREFIX)/lib" "$(PREFIX)/share/tomo/modules"
|
||||||
cp -v src/stdlib/*.h "$(PREFIX)/include/tomo/"
|
cp -v src/stdlib/*.h "$(PREFIX)/include/tomo/"
|
||||||
@ -93,4 +96,4 @@ uninstall:
|
|||||||
rm -rvf "$(PREFIX)/bin/tomo" "$(PREFIX)/include/tomo" "$(PREFIX)/lib/libtomo.so" "$(PREFIX)/share/tomo"; \
|
rm -rvf "$(PREFIX)/bin/tomo" "$(PREFIX)/include/tomo" "$(PREFIX)/lib/libtomo.so" "$(PREFIX)/share/tomo"; \
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.PHONY: all clean install uninstall test tags examples
|
.PHONY: all clean install uninstall test tags examples deps
|
||||||
|
@ -95,8 +95,10 @@ Tomo has a very small set of dependencies:
|
|||||||
- [Binutils](https://www.gnu.org/software/binutils/) for stack traces.
|
- [Binutils](https://www.gnu.org/software/binutils/) for stack traces.
|
||||||
- and libc/libm, which should definitely already be installed.
|
- and libc/libm, which should definitely already be installed.
|
||||||
|
|
||||||
The Boehm GC, libunistring, and binutils should be available on your package
|
If you're feeling incautious, you can run `make deps` or
|
||||||
manager of choice (for example, `pacman -S gc libunistring binutils`).
|
`./install_dependencies.sh` to install all the necessary dependencies. I can't
|
||||||
|
guarantee this works on all platforms, but has a reasonably high chance of
|
||||||
|
success.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
|
68
install_dependencies.sh
Executable file
68
install_dependencies.sh
Executable file
@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if command -v doas >/dev/null 2>&1; then
|
||||||
|
SUDO="doas"
|
||||||
|
elif command -v sudo >/dev/null 2>&1; then
|
||||||
|
SUDO="sudo"
|
||||||
|
else
|
||||||
|
echo "Neither doas nor sudo found." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Manually specify package manager:
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
PKG_MGR="$1"
|
||||||
|
# Autodetect package manager:
|
||||||
|
elif command -v apt >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="apt"
|
||||||
|
elif command -v dnf >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="dnf"
|
||||||
|
elif command -v yay >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="yay"
|
||||||
|
elif command -v paru >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="paru"
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="pacman"
|
||||||
|
elif command -v xbps-install >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="xbps"
|
||||||
|
elif command -v pkg_add >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="pkg_add"
|
||||||
|
elif command -v pkg >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="freebsd-pkg"
|
||||||
|
elif command -v brew >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="brew"
|
||||||
|
elif command -v port >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="macports"
|
||||||
|
elif command -v zypper >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="zypper"
|
||||||
|
elif command -v nix-env >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="nix"
|
||||||
|
elif command -v spack >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="spack"
|
||||||
|
elif command -v conda >/dev/null 2>&1; then
|
||||||
|
PKG_MGR="conda"
|
||||||
|
else
|
||||||
|
echo "Unsupported package manager" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
case "$PKG_MGR" in
|
||||||
|
apt) $SUDO apt install libgc-dev libunistring-dev binutils patchelf libgmp-dev ;;
|
||||||
|
dnf) $SUDO dnf install gc-devel libunistring-devel binutils patchelf gmp-devel ;;
|
||||||
|
pacman) $SUDO pacman -S gc libunistring binutils patchelf gmp ;;
|
||||||
|
yay|paru) $PKG_MGR -S gc libunistring binutils patchelf gmp ;;
|
||||||
|
xbps) $SUDO xbps-install -S gc libunistring binutils patchelf gmp ;;
|
||||||
|
pkg_add) $SUDO pkg_add boehm-gc libunistring binutils patchelf gmp ;;
|
||||||
|
freebsd-pkg) $SUDO pkg install boehm-gc libunistring binutils patchelf gmp ;;
|
||||||
|
brew) brew install bdw-gc libunistring binutils patchelf gmp ;;
|
||||||
|
macports) $SUDO port install boehm-gc libunistring binutils patchelf gmp ;;
|
||||||
|
zypper) $SUDO zypper install gc-devel libunistring-devel binutils patchelf gmp-devel ;;
|
||||||
|
nix) nix-env -iA nixpkgs.boehm-gc nixpkgs.libunistring nixpkgs.binutils nixpkgs.patchelf nixpkgs.gmp ;;
|
||||||
|
spack) spack install boehm-gc libunistring binutils patchelf gmp ;;
|
||||||
|
conda) conda install boehm-gc libunistring binutils patchelf gmp ;;
|
||||||
|
*)
|
||||||
|
echo "Unknown package manager: $PKG_MGR" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in New Issue
Block a user