From f77a7edd19cf4ea6f41c1f54182048452d3dc95a Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Sun, 26 Oct 2025 20:27:22 +0400 Subject: build: use shell scripts instead of makefile --- Makefile | 121 --------------------------------------------------------------- build.sh | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++ install | 49 ++++++++++++++++++++++++++ 3 files changed, 149 insertions(+), 121 deletions(-) delete mode 100644 Makefile create mode 100644 build.sh create mode 100755 install diff --git a/Makefile b/Makefile deleted file mode 100644 index 68bf3f1..0000000 --- a/Makefile +++ /dev/null @@ -1,121 +0,0 @@ -.POSIX: - -VERSION = 0.1 - -DMENU = dmenu_farajli-5.3.0 -DWM = dwm_farajli-6.5.2 -FONT1 = LiberationMono -FONT2 = JetBrainsMono -SLSTATUS = slstatus_farajli-1.0.1 -ST = st_farajli-0.9.2.1 - -FONTS = $(FONT1) $(FONT2) -SOFTWARE = $(DWM) $(DMENU) $(SLSTATUS) $(ST) -ARCHIVE = $(SOFTWARE:=.tar.gz) $(FONTS:=.tar.gz) - -BINDIR = $(HOME)/.local/bin -CONFDIR = $(HOME)/.config -FONTDIR = $(HOME)/.local/share/fonts/ - -BASHPROFILE = $(HOME)/.bash_profile -BASHRC = $(HOME)/.bashrc -GITCONFIG = $(HOME)/.gitconfig -ZCACHE = $(HOME)/.cache/zsh/history -ZPROFILE = $(HOME)/.zprofile -ZSHRC = $(HOME)/.zshrc - -INSTALL_TARGETS = dmenu-install dwm-install font1-install font2-install slstatus-install st-install -DIRECTORIES = $(BINDIR) $(CONFDIR) $(FONTDIR) - -COPY = cp -r -LINK = ln -sf - -all: config $(DIRECTORIES) scripts desktop - -desktop: $(INSTALL_TARGETS) - -$(BINDIR) $(CONFDIR) $(FONTDIR): - mkdir -p $@ - -config: $(CONFDIR) - mkdir -p $$(dirname $(ZCACHE)) - mkdir -p $(CONFDIR)/sites - touch $(ZCACHE) - $(COPY) config/bash/bashrc $(BASHRC) - $(COPY) config/dunst $(CONFDIR) - $(COPY) config/lf $(CONFDIR) - $(COPY) config/mimeapps.list $(CONFDIR) - $(COPY) config/mpv $(CONFDIR) - $(COPY) config/nsxiv $(CONFDIR) - $(COPY) config/nvim $(CONFDIR) - $(COPY) config/picom $(CONFDIR) - $(COPY) config/qutebrowser $(CONFDIR) - $(COPY) config/shell $(CONFDIR) - $(COPY) config/sites/bookmarks.txt $(CONFDIR)/sites - $(COPY) config/sxiv $(CONFDIR) - $(COPY) config/vim $(CONFDIR) - $(COPY) config/wallpapers $(CONFDIR) - $(COPY) config/x11 $(CONFDIR) - $(COPY) config/zathura $(CONFDIR) - $(COPY) config/zsh/zshrc $(ZSHRC) - $(LINK) $(CONFDIR)/shell/profile $(BASHPROFILE) - $(LINK) $(CONFDIR)/shell/profile $(ZPROFILE) - -git: - sed '/# signingkey = /d' config/git/gitconfig > $(GITCONFIG) - @echo "#####################################################################" - @echo "Warning: Git commit/tag signing is enabled but signingKey is not set." >&2 - @echo "#####################################################################" - @echo "Configure it manually using:" >&2 - @echo " gpg --list-secret-keys --keyid-format=long" >&2 - @echo " git config --global user.signingkey " >&2 - -scripts: $(BINDIR) - mkdir -p $(BINDIR) - $(COPY) scripts/* $(BINDIR) - -server: $(BINDIR) $(CONFDIR) - $(COPY) config/bash/bashrc $(BASHRC) - $(COPY) config/lf $(CONFDIR) - $(COPY) config/shell $(CONFDIR) - $(COPY) config/vim $(CONFDIR) - $(COPY) config/zsh/zshrc $(ZSHRC) - $(COPY) scripts/noc $(BINDIR) - -arch-linux: - sudo $(COPY) distros/arch-linux/pacman.conf /etc - -sync: $(ARCHIVE) - -$(ARCHIVE): - curl -LO https://farajli.net/archive/$@ - -dmenu-install: $(DMENU).tar.gz $(BINDIR) -dwm-install: $(DWM).tar.gz $(BINDIR) -slstatus-install: $(SLSTATUS).tar.gz $(BINDIR) -st-install: $(ST).tar.gz $(BINDIR) -font1-install: $(FONT1).tar.gz $(FONTDIR) -font2-install: $(FONT2).tar.gz $(FONTDIR) - -dmenu-install dwm-install slstatus-install st-install: - tar xf $< - PREFIX=~/.local make -C $$(basename $< .tar.gz) install - -font1-install font2-install: - tar xf $< - $(COPY) $$(basename $< .tar.gz) $(FONTDIR) - fc-cache - -dist: clean - mkdir -p slcf-$(VERSION) - cp -R config/ distros/ scripts/ LICENSE Makefile README.md \ - screenshot.png TODO slcf-$(VERSION) - tar -czf slcf-$(VERSION).tar.gz slcf-$(VERSION) - rm -rf slcf-$(VERSION) - -clean: - rm -rf slcf-$(VERSION) slcf-$(VERSION).tar.gz $(ARCHIVE) $(FONTS) $(SOFTWARE) - -.PHONY: all arch-linux clean config desktop directory dist \ - fonts git scripts server sync \ - $(INSTALL_TARGETS) diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..da1ded6 --- /dev/null +++ b/build.sh @@ -0,0 +1,100 @@ +#!/bin/sh + +set -e + +dwm_version="dwm_farajli-6.5.2" +dmenu_version="dmenu_farajli-5.3.0" +slstatus_version="slstatus_farajli-1.0.1" +st_version="st_farajli-0.9.2.1" + +MAKEDIR() { mkdir -pv "${1}" } + +COPY() { + cp -r "${1}" "${2}" + echo "copied" "${1}" '->' "${2}" +} + +LINK() { + ln -sf "${1}" "${2}" + echo "linked" "${1}" '->' "${2}" +} + +pkg() { + package="${1}" + shift + for action in "${@}"; do + case "${action}" in + "sync") curl -LO https://farajli.net/archive/"${package}".tar.gz ;; + "unpack") tar xf "${package}".tar.gz ;; + "compile") make -C "${package}" ;; + "install") PREFIX=${BINDIR} make -C "${package}" install ;; + "font_install") cp -r font $(FONTDIR) ;; + ?) + echo Invalid usage of pkg >&2 + return 1 + ;; + esac + done +} + +create_dirs() { + MAKEDIR "${BINDIR}" + MAKEDIR "${CONFDIR}" + MAKEDIR "${DATADIR}" + MAKEDIR "${FONTDIR}" +} + +install_bash() { COPY config/bash/bashrc "${BASHRC}" } +install_dunst() { COPY config/dunst "${CONFDIR}" } +install_lf() { COPY config/lf "${CONFDIR}" } +install_mimeapps() { COPY config/mimeapps.list "${CONFDIR}" } +install_mpv() { COPY config/mpv "${CONFDIR}" } +install_nsxiv() { COPY config/nsxiv "${CONFDIR}" } +install_nvim() { COPY config/nvim "${CONFDIR}" } +install_picom() { COPY config/picom "${CONFDIR}" } +install_qutebrowser() { COPY config/qutebrowser "${CONFDIR}" } +install_sxiv() { COPY config/sxiv "${CONFDIR}" } +install_vim() { COPY config/vim "${CONFDIR}" } +install_x11() { COPY config/x11 "${CONFDIR}" } +install_zathura() { COPY config/zathura "${CONFDIR}" } +install_wallpapers() { COPY config/wallpapers "${DATADIR}" } +install_pacman() { sudo cp distros/arch-linux/pacman.conf /etc } + +install_git() { + sed '/# signingkey = /d' config/git/gitconfig > $(GITCONFIG) + printf '%s\n' \ + "#####################################################################" \ + "Warning: Git commit/tag signing is enabled but signingKey is not set." \ + "#####################################################################" \ + "Configure it manually using:" \ + " gpg --list-secret-keys --keyid-format=long" \ + " git config --global user.signingkey " >&2 +} + +install_sites() { + MAKEDIR "${CONFDIR}"/sites + COPY config/sites/bookmarks.txt "${CONFDIR}"/sites +} + +install_zsh() { + MAKEDIR $(dirname "${ZCACHE}") + touch "${ZCACHE}" + COPY config/zsh/zshrc "${ZSHRC}" +} + +install_shell() { + COPY config/shell "${CONFDIR}" + LINK "${CONFDIR}"/shell/profile "${BASHPROFILE}" + LINK "${CONFDIR}"/shell/profile "${ZPROFILE}" +} + +install_scripts() { + mkdir -p "${BINDIR}" + COPY scripts/* "${BINDIR}" +} + +install_liberationmono() { pkg LiberationMono sync unpack font_install } +install_dwm() { pkg "${dwm_version}" sync unpack install } +install_st() { pkg "${st_version}" sync unpack install } +install_dmenu() { pkg "${dmenu_version}" sync unpack install } +install_slstatus() { pkg "${slstatus_version}" sync unpack install } diff --git a/install b/install new file mode 100755 index 0000000..77ae239 --- /dev/null +++ b/install @@ -0,0 +1,49 @@ +#!/bin/sh + +BINDIR="${HOME}/.local/bin}" +CONFDIR="${HOME}/.config}" +DATADIR="${HOME}/.local/share}" +FONTDIR="${HOME}/.local/share/fonts}" +BASHRC="${HOME}/.bashrc}" +BASHPROFILE="${HOME}/.bash_profile}" +ZPROFILE="${HOME}/.zprofile}" +ZSHRC="${HOME}/.zshrc}" +ZCACHE="${HOME}/.cache/zsh/history" +GITCONFIG="${HOME}/.gitconfig}" + +. build.sh + +create_dirs + +# CLI +install_bash +install_git +install_lf +install_nvim +install_scripts +install_shell +install_sites +install_vim +install_zsh + +# GUI +install_dunst +install_liberationmono +install_mimeapps +install_mpv +install_nsxiv +install_picom +install_qutebrowser +install_sxiv +install_wallpapers +install_x11 +install_zathura + +# Suckless +install_dmenu +install_dwm +install_slstatus +install_st + +# Arch Linux +install_pacman -- cgit v1.2.3