aboutsummaryrefslogtreecommitdiffstats
path: root/kerl
diff options
context:
space:
mode:
authorMark Allen <[email protected]>2017-08-03 18:57:24 -0500
committerMark Allen <[email protected]>2017-08-03 18:57:24 -0500
commit38e5fec11f90ec86dcd66cfed4f0d3a476eaf9cc (patch)
treeeb59274a720e3e332a48e96f7bce6bed1ccfd228 /kerl
parent85d97cac82e6125d13d53cf8f3b7c5f8433d5e2c (diff)
downloadkerl-38e5fec11f90ec86dcd66cfed4f0d3a476eaf9cc.tar.gz
kerl-38e5fec11f90ec86dcd66cfed4f0d3a476eaf9cc.tar.bz2
kerl-38e5fec11f90ec86dcd66cfed4f0d3a476eaf9cc.zip
Initial attempt at this. Probably broken.
Diffstat (limited to 'kerl')
-rwxr-xr-xkerl75
1 files changed, 75 insertions, 0 deletions
diff --git a/kerl b/kerl
index c86d782..f45e541 100755
--- a/kerl
+++ b/kerl
@@ -329,6 +329,71 @@ assert_build_name_unused()
fi
}
+_check_required_pkgs()
+{
+ has_dpkg=$(which dpkg)
+ has_rpm=$(which rpm)
+ if [ -n "$has_dpkg" -o -n "$has_rpm" ]; then
+ # found either dpkg or rpm (or maybe even both!)
+ if [ -n "$has_dpkg" -a -n "$has_rpm" ]; then
+ echo "WARNING: You appear to have BOTH rpm and dpkg. This is very strange. No package checks done."
+ elif [ -n "$has_dpkg" ]; then
+ retval=$(_check_dpkg)
+ elif [ -n "$has_rpm" ]; then
+ retval=$(_check_rpm)
+ fi
+ fi
+}
+
+_dpkg_is_installed()
+{
+ # gratefully stolen from
+ # https://superuser.com/questions/427318/test-if-a-package-is-installed-in-apt
+ # returns 0 (true) if found, 1 otherwise
+ dpkg-query -Wf'${db:Status-abbrev}' "$1" 2>/dev/null | grep -q '^i'
+}
+
+_check_dpkg()
+{
+ required=<<_DPKG
+libssl-dev
+make
+automake
+autoconf
+libncurses5-dev
+gcc
+_DPKG
+
+ for pkg in "$required"; do
+ if ! _dpkg_is_installed "$pkg"; then
+ echo "WARNING: It appears that a required development package '$pkg' is not installed."
+ fi
+ done
+}
+
+_rpm_is_installed()
+{
+ rpm --quiet -q "$1" 1>/dev/null 2>&1
+}
+
+_check_rpm()
+{
+ required=<<_RPM
+openssl-devel
+make
+automake
+autoconf
+ncurses-devel
+gcc
+_RPM
+
+ for pkg in "$required"; do
+ if ! _rpm_is_installed "$pkg"; then
+ echo "WARNING: It appears a required development package '$pkg' is not installed."
+ fi
+ done
+}
+
do_git_build()
{
assert_build_name_unused "$3"
@@ -578,6 +643,16 @@ _do_build()
;;
esac
;;
+ Linux)
+ # we are going to check here to see if the Linux uses dpkg or rpms
+ #
+ # this is a "best effort" attempt to discover if a Linux has the
+ # packages needed to build Erlang. We will always assume the user
+ # knows better than us and are going to go ahead and try to build
+ # Erlang anyway. But at least it will be a clear warning to the
+ # user if a build fails.
+ _check_required_pkgs
+ ;;
*)
;;
esac