From: Ian Kelling Date: Tue, 22 Oct 2019 00:38:00 +0000 (-0400) Subject: add and fix X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=c426f5dc07b0a086a3163697db3abb516955566c;p=buildscripts add and fix --- diff --git a/emacs b/emacs index 727dee8..b2c9740 100755 --- a/emacs +++ b/emacs @@ -58,42 +58,19 @@ if $show_pkgs; then if ! type -p apt-rdepends &>/dev/null; then sudo apt-get -y install --purge --auto-remove apt-rdepends fi - apt-rdepends -p --build-depends --follow=DEPENDS $x|sed -rn 's/^\s*Build-Depends: (\S+).*/\1/p' + apt-rdepends -p --build-depends --follow=DEPENDS $x/$(debian-codename)|sed -rn 's/^\s*Build-Depends: (\S+).*/\1/p' done exit 0 fi +#building emacs, INSTALL.BZR + # gawk and attr were no longer automatically installed in stretch, # looking back, i assume i got some error. # autoconf-archive due to come error pi ${pkgs[@]} - -case $(distro-name) in - fedora ) - logq s yum-builddep -y emacs - logq pi texlive-dvipng - ;;& - debian|ubuntu|trisquel) - # todo: unknown for other distros, this will fail - logq p -y build-dep maildir-utils - # oddly, on ubuntu 14.04 this installs postfix, but I dun care - # ubuntu 14.04 gave this error message - # Unable to satisfy the build-depends: Build-Depends: libpng-dev - # this is satisfied by dvipng. the build-dep is just wrong - # minor bug I'm not going to bother reporting. - # - # note, useful command to see build dep packagages: - # apt-rdepends --build-depends --follow=DEPENDS emacs25 - logq p -y build-dep $latest_emacs - ;;& -esac - - - -#building emacs, INSTALL.BZR - #git repo dir=/a/opt/emacs-`distro-name` dir+=`debian-archive` ||: # we may not be on debian @@ -104,66 +81,105 @@ if [[ ! -e $dir ]]; then fi e cd $dir -if $recompile; then - # todo, consider when this should be uncommented - #logq s make uninstall - find ~/.emacs.d/ -name '*.elc' -delete - - # git version - if [[ $1 ]]; then - e i clean -xxxfd - elif $update; then - e i fetch - e i clean -xxxffd - e i reset --hard origin/master - e i clean -xxxffd +rev=$(cat ~/.local/emacs-build-git-revision 2>/dev/null) ||: +head=$(git rev-parse HEAD) + + + +if $recompile || [[ $rev != "$head" ]]; then + + case $(distro-name) in + fedora ) + logq s yum-builddep -y emacs + logq pi texlive-dvipng + ;;& + debian|ubuntu|trisquel) + # todo: unknown for other distros, this will fail + logq p -y build-dep maildir-utils/$(debian-codename) + # oddly, on ubuntu 14.04 this installs postfix, but I dun care + # ubuntu 14.04 gave this error message + # Unable to satisfy the build-depends: Build-Depends: libpng-dev + # this is satisfied by dvipng. the build-dep is just wrong + # minor bug I'm not going to bother reporting. + # + # note, useful command to see build dep packagages: + # apt-rdepends --build-depends --follow=DEPENDS emacs25 + logq p -y build-dep $latest_emacs + ;;& + esac + + + + if $recompile; then + # todo, consider when this should be uncommented + #logq s make uninstall + find ~/.emacs.d/ -name '*.elc' -delete + + # git version + if [[ $1 ]]; then + e i clean -xxxfd + elif $update; then + e i fetch + e i clean -xxxffd + e i reset --hard origin/master + e i clean -xxxffd + fi + + # autogen is usually only for the first build, assume it works + logq ./autogen.sh all + # I tried changing O2 to O3, don't know if it made it faster or slower so I went back to 02. + # Also, link-time-optimization based on ./INSTALL + + # for debugging, use -Og, or -O0 to make debug really correspond to sources + # dunno why I have had -std=gnu99 in the past + #CFLAGS='-std=gnu99 -g3 -Og' + export CFLAGS='-g3 -Og' + #CFLAGS='-std=gnu99 -g3 -O2' logq ./configure --enable-link-time-optimization + # on ubuntu 12.04, the above fails, says my c compiler won't work, so intead, just use defaults + logq ./configure + logq make -j `nproc` bootstrap fi - # autogen is usually only for the first build, assume it works - logq ./autogen.sh all - # I tried changing O2 to O3, don't know if it made it faster or slower so I went back to 02. - # Also, link-time-optimization based on ./INSTALL - - # for debugging, use -Og, or -O0 to make debug really correspond to sources - # dunno why I have had -std=gnu99 in the past - #CFLAGS='-std=gnu99 -g3 -Og' - export CFLAGS='-g3 -Og' - #CFLAGS='-std=gnu99 -g3 -O2' logq ./configure --enable-link-time-optimization - # on ubuntu 12.04, the above fails, says my c compiler won't work, so intead, just use defaults - logq ./configure - logq make -j `nproc` bootstrap -fi -# temporarily for testing multiple versions -logq make -j `nproc` -logq sudo make install + # temporarily for testing multiple versions + logq make -j `nproc` + logq sudo make install -# make emacs always work for root -s /a/exe/lnf /usr/local/bin/emacs /usr/bin + # make emacs always work for root + s /a/exe/lnf /usr/local/bin/emacs /usr/bin + echo $head >~/.local/emacs-build-git-revision +fi #git clone https://github.com/djcb/mu # note: master failed, i moved back to the commit before a bug https://github.com/djcb/mu/issues/1400 # from its HACKING file cd /a/opt/mu -if [[ $(distro-name) == trisquel ]]; then - # use the flidas branch, stuck behind because - # needs newer crypt libraries that are too troublesome. - cd /a/opt/muflidas -else - # newer version than build-dep installs for buster - sudo apt-get -y install --purge --auto-remove libgmime-3.0-dev + +rev=$(cat ~/.local/mu-build-git-revision 2>/dev/null) ||: +head=$(git rev-parse HEAD) +if $recompile || [[ $rev != "$head" ]]; then + + if [[ $(distro-name) == trisquel ]]; then + # use the flidas branch, stuck behind because + # needs newer crypt libraries that are too troublesome. + cd /a/opt/muflidas + else + # newer version than build-dep installs for buster + sudo apt-get -y install --purge --auto-remove libgmime-3.0-dev + fi + git clean -xfffd + ./autogen.sh + make + sudo make install + echo $head >~/.local/mu-build-git-revision + # note uninstall is implemented fi -git clean -xfffd -./autogen.sh -make -sudo make install -# note uninstall is implemented if $recompile; then # note, not totally sure its right to put this within recompile, but its taking up most of the time, so going for it. - logq emacs --batch -l ~/.emacs.d/init.el -l ~/.emacs.d/compile-init-dir.el + logq emacs --batch -l ~/.emacs.d/compile-init-dir.el fi # as of 01-2017, built-in org mode has a bug that diff --git a/exim b/exim new file mode 100644 index 0000000..6bfeb5a --- /dev/null +++ b/exim @@ -0,0 +1,52 @@ +#!/bin/bash + + +apt-get install -y libopendmarc-dev libspf2-dev +apt-get -y build-dep exim4/flidas +# https://wiki.debian.org/BuildingAPackage +apt-get install build-essential dpatch fakeroot devscripts equivs lintian quilt +mkct +apt-get source exim4/flidas + +# to just patch heavy: +# first apply below patch, then build, then +#diff -u ./EDITME.exim4-light ./EDITME.exim4-heavy > /tmp/EDITME.exim4-heavy.diff +# remove extraneous differences +# meld ./debian/EDITME.exim4-heavy.diff /tmp/EDITME.exim4-heavy.diff +# diff -u ./debian/EDITME.exim4-heavy.diff /tmp/EDITME.exim4-heavy.diff +# edit the diff to get filenames right. + + +patch -p0 <<'EOF' +--- ./exim4-4.86.2/src/EDITME.orig 2019-07-31 11:34:22.284977059 -0400 ++++ ./exim4-4.86.2/src/EDITME 2019-07-31 11:35:01.361206192 -0400 +@@ -445,9 +445,9 @@ + # installed on your system (www.libspf2.org). Depending on where it is installed + # you may have to edit the CFLAGS and LDFLAGS lines. + +-# EXPERIMENTAL_SPF=yes +-# CFLAGS += -I/usr/local/include +-# LDFLAGS += -lspf2 ++EXPERIMENTAL_SPF=yes ++CFLAGS += -I/usr/local/include ++LDFLAGS += -lspf2 + + # Uncomment the following lines to add SRS (Sender rewriting scheme) support. + # You need to have libsrs_alt installed on your system (srs.mirtol.com). +@@ -469,9 +469,9 @@ + + # Uncomment the following line to add DMARC checking capability, implemented + # using libopendmarc libraries. +-# EXPERIMENTAL_DMARC=yes +-# CFLAGS += -I/usr/local/include +-# LDFLAGS += -lopendmarc ++EXPERIMENTAL_DMARC=yes ++CFLAGS += -I/usr/local/include ++LDFLAGS += -lopendmarc + + + # Uncomment the following line to support Events, +EOF + +cd exim4-4.86.2 +fakeroot debian/rules binary diff --git a/go b/go new file mode 100755 index 0000000..9175d0c --- /dev/null +++ b/go @@ -0,0 +1,51 @@ +#!/bin/bash +# Copyright (C) 2019 Ian Kelling +# SPDX-License-Identifier: AGPL-3.0-or-later + +# usage: no args, run to install latest go. + +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 +source /a/bin/errhandle/err + +m() { printf "$pre %s\n" "$*"; "$@"; } +e() { printf "$pre %s\n" "$*"; } +err() { echo "[$(date +'%Y-%m-%d %H:%M:%S%z')]: $0: $*" >&2; } + +m cd /a/opt/go.git +m git fetch +vers=($(git tag | sort -Vr | grep -E '^go[0-9.]+$' | head)) + +ver=${vers[0]} +dl() { + arch=$(dpkg --print-architecture) + f=${ver}.linux-${arch}.tar.gz + + if [[ -e $f ]]; then + timestamp=$(stat -c %Y $f) + else + timestamp=0 + fi + m wget -N https://dl.google.com/go/$f || ret=$? +} +dl +# 8 is return code for 404. for a new release, they might not have a binary out yet +if [[ $ret == 8 ]]; then + ver=${vers[1]} + dl +fi + +new_timestamp=$(stat -c %Y $f) +if [[ $timestamp != $new_timestamp || ! -e /usr/local/go/bin/go ]]; then + m sudo rm -rf /usr/local/go + m sudo tar -C /usr/local -xzf $f +fi + +shopt -s nullglob +for x in go*.tar.gz; do + if [[ $x == $f ]]; then continue; fi + rm -fv $x +done + +go get -u mvdan.cc/fdroidcl diff --git a/misc b/misc new file mode 100755 index 0000000..7aba402 --- /dev/null +++ b/misc @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright (C) 2019 Ian Kelling +# SPDX-License-Identifier: AGPL-3.0-or-later + +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 +# alternatively, using https://iankelling.org/git/?p=errhandle;a=tree +# source /path/errhandle/err +# on my machine +source /a/bin/errhandle/err + +# fuck pip. i hate it. +# pip install --user -U pip +# Traceback (most recent call last): +# File "/usr/local/bin/pip", line 10, in +# sys.exit(main()) +# TypeError: 'module' object is not callable +# if type -t pip &>/dev/null; then +# pip install --user -U pip +# else +# x=$(mktemp) +# wget -O$x https://bootstrap.pypa.io/get-pip.py +# python3 $x --user +# fi + +# https://github.com/jlebon/textern +cd /a/opt/textern +git pull +make native-install USER=1 diff --git a/rust b/rust new file mode 100755 index 0000000..ab70029 --- /dev/null +++ b/rust @@ -0,0 +1,30 @@ +#!/bin/bash +# Copyright (C) 2019 Ian Kelling +# SPDX-License-Identifier: AGPL-3.0-or-later + +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 +# alternatively, using https://iankelling.org/git/?p=errhandle;a=tree +# source /path/errhandle/err +# on my machine +source /a/bin/errhandle/err + +# install rust. +if type -t rustc &>/dev/null; then + rustup update +else + curl https://sh.rustup.rs -sSf | bash -s -- -y +fi +# todo: update this. updates in rust are stupidly complicate +if ! which rg &>/dev/null; then + cargo install ripgrep +fi + +if ! type -t cargo-install-update &>/dev/null; then + cargo-install-update +fi + +cargo install-update -a diff --git a/tor-browser b/tor-browser index f9a6e45..b7f7de9 100755 --- a/tor-browser +++ b/tor-browser @@ -25,29 +25,45 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR # we exclude verions with letters, as that seems to # be a relatively reliable indication of alpha/beta releases. -ver=$(curl -s https://dist.torproject.org/torbrowser/ \ +vers=($(curl -s https://dist.torproject.org/torbrowser/ \ | sed -rn 's#.*href="([0-9]+\.[0-9]+[.0-9]*)/.*#\1#p' \ - | sort -Vr | head -n 1) + | sort -Vr)) + # by default it has perms for just 1 non-root user, which is ok for now. cd /a/opt -f=tor-browser-linux64-${ver}_en-US.tar.xz -timestamp=$(stat -c %Y $f) ||: -wget -N https://www.torproject.org/dist/torbrowser/$ver/$f -new_timestamp=$(stat -c %Y $f) ||: +ver=${vers[0]} +dl() { + f=tor-browser-linux64-${ver}_en-US.tar.xz + if [[ -e $f ]]; then + timestamp=$(stat -c %Y $f) + else + timestamp=0 + fi + echo wget -N https://www.torproject.org/dist/torbrowser/$ver/$f + wget -N https://www.torproject.org/dist/torbrowser/$ver/$f || ret=$? +} +dl +# 8 is return code for 404. for a new release, they might not have released to linux yet. +if [[ $ret == 8 ]]; then + ver=${vers[1]} + dl +fi + +new_timestamp=$(stat -c %Y $f) if [[ $timestamp != $new_timestamp || ! -e /a/opt/tor-browser_en-US/Browser/start-tor-browser ]]; then - # not already installed - rm -rf tor-browser_en-US - ex $f + # not already installed + rm -rf tor-browser_en-US + ex $f fi for x in tor-*.tar.xz; do - # cleanup old tarballs - [[ -e $x ]] || break - [[ $x != $f ]] || continue - command rm -f $x + # cleanup old tarballs + [[ -e $x ]] || break + [[ $x != $f ]] || continue + command rm -f $x done s lnf /a/opt/tor-browser_en-US/Browser/start-tor-browser /usr/local/bin