# note: i store a log of emacs versions i've used in /a/opt/emacs/iank-readme
+set -e; . /usr/local/lib/bash-bear; set +e
+
source /b/distro-functions/src/identify-distros
source /b/distro-functions/src/package-manager-abstractions
source /b/log-quiet/logq-function
+source /b/buildscripts/emacsish-build-lib
+source /b/ds/fsf-script-lib
m() { printf "%s\n" "$*"; "$@"; }
#set -x
# arg = git commit to check out
+usage() {
+ cat <<EOF
+Usage: ${0##*/} [OPTIONS]
+Build emacs if needed or directed to.
+
+If you want this script to build a new version of emacs, you need to do
+2 things. 1: check it out in /a/opt/emacs. 2: Remove
+/a/opt/emacs-DISTRO_CODENAME. We don't test for the git repo to be a
+different version that the codename directory because the repo can be
+used for testing & development, randomly switching around version. Also,
+we might intentionally use a different version for different distro
+codenames.
+
+-h|--help Print help and exit.
+
+Note: Uses util-linux getopt option parsing: spaces between args and
+options, short options can be combined, options before args.
+EOF
+ exit $1
+}
+
+
update=false
bootstrap=false
recompile=false
# autoconf-archive due to come error
pi ${pkgs[@]}
-#git repo
-dir=/a/opt/emacs-$(debian-codename-compat)
-last_build=$dir/iank-emacs-build
-
-# e/e because autofs failing to mount will make it so
-# you cant ls whatever directory it is in, so we
-# need an extra directory. i dunno why this was like this instead of just $dir-nox.
-#dirs=($dir $dir-nox/.iank/e/e)
+done-detect emacs
dirs=($dir $dir-nox)
-m cd /a/opt/emacs
-if [[ -e $dir ]]; then
- m cd $dir
- rev=$(cat $last_build 2>/dev/null) ||:
- if [[ -e .git/iank-head ]]; then
- head=$(cat .git/iank-head)
- fi
- if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then
- echo "already compiled"
- if emacs_path=$(type -P emacs 2>/dev/null); then
- installed_info=$(file -bL $emacs_path)
- build_info=$(file -b $dir/src/emacs)
- if [[ $installed_info == "$build_info" ]]; then
- echo "already installed exiting"
- # this isn't perfect, because install could partially fail or the
- # command after it could
- exit 0
- fi
- fi
- fi
- if [[ $rev != "$head" ]]; then
- echo "$0: rev:$rev != head:$head, setting bootstrap=true"
- bootstrap=true
- fi
-else
- echo "$0: dir=$dir does not exist, setting bootstrap=true"
- head=$(git rev-parse HEAD)
- bootstrap=true
-fi
+m cd /a/opt/emacs
echo recompile=$recompile bootstrap=$bootstrap update=$update
if $dryrun; then
fi
if $bootstrap; then
- m rsync --exclude /.git --delete-excluded -ra /a/opt/emacs/ $dir
- mkdir $dir/.git
- printf "%s\n" "$head" >$dir/.git/iank-head
+ m sudo rsync --exclude /.git --delete-excluded --delete -ra /a/opt/emacs/ $dir
+ { cd /a/opt/emacs; git rev-parse HEAD >$dir/iank-head; }
recompile=true
fi
my-update-info-dir
-echo $head >$last_build
+cat $dir/iank-head >$last_built_rev_path
--- /dev/null
+#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to change
+# to a recommended GPL license.
+
+# Copyright 2025 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
--- /dev/null
+#!/bin/bash
+
+#### detection of already done things #####
+done-detect() {
+ prog=$1
+ dir=/a/opt/$prog-$(debian-codename-compat)
+ last_built_rev_path=$dir/iank-$prog-build
+ last_built_rev=$(cat $last_built_rev_path 2>/dev/null) ||:
+ if [[ -e $dir/iank-head ]]; then
+ target_rev=$(cat $dir/iank-head)
+ else
+ e "$0: file $dir/iank-head doesn't exist, setting bootstrap=true"
+ bootstrap=true
+ fi
+ built_rev_eq_target_rev=false
+ if [[ $last_built_rev && $target_rev && $last_built_rev == "$target_rev" ]]; then
+ echo "note: it looks already compiled"
+ if prog_path=$(type -P $prog 2>/dev/null); then
+ installed_info=$(file -bL $prog_path)
+ build_info=$(file -b $dir/src/$prog)
+ if [[ $installed_info == "$build_info" ]]; then
+ echo "note: it looks already installed"
+ if ! $recompile && ! $bootstrap; then
+ e "looks like nothing needs to be done, exiting early"
+ # this isn't perfect, because install could partially fail or the
+ # command after it could
+ exit 0
+ fi
+ fi
+ fi
+ fi
+}
touch ~/.local/gofetch
tmpf=$(git tag | sort -Vr | grep -E '^go[0-9.]+$' | head)
- maptfile -t vers <<<"$tmpf"
+ mapfile -t vers <<<"$tmpf"
# shellcheck disable=SC2154 # false positive
ver=${vers[0]}
# See the License for the specific language governing permissions and
# limitations under the License.
+# update log:
+# 2025-05-27
+
+# was on:
+# commit 80a2d4cef491df8941e1c9e6cb174286fb80afe9
+# Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
+# Date: Sat Apr 15 23:20:37 2023 +0300
+
+# build: bump version to 1.10.3
+
+set -e; . /usr/local/lib/bash-bear; set +e
source /b/distro-functions/src/identify-distros
source /b/distro-functions/src/package-manager-abstractions
source /b/log-quiet/logq-function
+source /b/buildscripts/emacsish-build-lib
+source /b/ds/fsf-script-lib
+
m() { printf "%s\n" "$*"; "$@"; }
recompile=false
dryrun=false
+bootstrap=false
while [[ $1 == -* ]]; do
case $1 in
+ -b) bootstrap=true; recompile=true ;;
-n) dryrun=true ;;
-r) recompile=true ;;
--no-r) recompile=false ;;
shift
done
-bootstrap=false
-
-#git repo
-dir=/a/opt/mu-$(debian-codename-compat)
-last_build=$dir/iank-mu-build
-
-if [[ -e $dir ]]; then
- m cd $dir
- rev=$(cat $last_build 2>/dev/null) ||:
- if [[ -e .git/iank-head ]]; then
- head=$(cat .git/iank-head)
- fi
- if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then
- echo "already compiled"
- if mu_path=$(type -P mu 2>/dev/null); then
- installed_info=$(file -bL "$mu_path")
- build_info=$(file -b $dir/build/mu/mu)
- if [[ $installed_info == "$build_info" ]]; then
- echo "already installed exiting"
- # this isn't perfect, because install could partially fail or the
- # command after it could
- exit 0
- fi
- fi
- fi
- echo rev=$rev head=$head
- if [[ $rev != "$head" ]]; then
- bootstrap=true
- fi
-else
- head=$(git rev-parse HEAD)
- bootstrap=true
-fi
+done-detect mu
+echo recompile=$recompile bootstrap=$bootstrap
if $dryrun; then
- e recompile=$recompile bootstrap=$bootstrap
exit 0
fi
if $bootstrap; then
m rsync --exclude /.git --delete-excluded -ra /a/opt/mu/ $dir
- mkdir $dir/.git
- printf "%s\n" "$head" >$dir/.git/iank-head
+ { cd /a/opt/mu; git rev-parse HEAD >$dir/iank-head; }
recompile=true
cd $dir
fi
m pi libgmime-3.0-dev meson
fi
if $recompile; then
- m git clean -xfffd
nproc=$(nproc)
m ./autogen.sh && make -j$nproc
# note uninstall is implemented
sudo touch -d @$(($(stat -c%Y build/build.ninja) - 100)) /usr/local/bin/emacs
m sudo make install
fi
-echo $head >$last_build
+cat $dir/iank-head >$last_built_rev_path
# limitations under the License.
-if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
-
-shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
source /a/bin/bash-bear-trap/bash-bear
# fuck pip. i hate it.