diff options
author | Mehrad Mahmoudian | 2023-04-20 13:46:16 +0300 |
---|---|---|
committer | Mehrad Mahmoudian | 2023-04-20 13:46:16 +0300 |
commit | b89f4c399c5711194584351331ce978b6aefbae5 (patch) | |
tree | 3884792cbfc65586de520ea6da237407b47b3b3d | |
parent | f88856b117d0753aaa11e129fb409d3d8e416dad (diff) | |
download | aur-b89f4c399c5711194584351331ce978b6aefbae5.tar.gz |
[add] makefile was added to facilitate the workflow
-rwxr-xr-x | Makefile | 71 | ||||
-rw-r--r-- | PKGBUILD | 6 |
2 files changed, 74 insertions, 3 deletions
diff --git a/Makefile b/Makefile new file mode 100755 index 000000000000..24d305d16127 --- /dev/null +++ b/Makefile @@ -0,0 +1,71 @@ +#!/usr/bin/env -S make -s -f + +# To debug the issues, start with checking if you have mistakenly used spaces +# instead of tabs (It shows the presence of tabs with `^I` and line endings +# with `$`): +# cat -e -t -v Makefile +# Source: https://stackoverflow.com/a/16945143/1613005 + + +SHELL = /bin/sh + +# define a variable to store the dependencies +REQUIRED_BINS := sh bash namcap makepkg pacman git cmake + +# define a newline character to be used in messages +define LINEBREAK + + +endef + + +COLOR ?= TRUE + +ifeq ($(COLOR),TRUE) + COLOR_RESET :=$(shell tput sgr0) + COLOR_ERROR :=$(shell tput setaf 1) + COLOR_SUCCESS :=$(shell tput setaf 2) + COLOR_MESSAGE :=$(shell tput setaf 3) +else + COLOR_RESET := + COLOR_ERROR := + COLOR_SUCCESS := + COLOR_MESSAGE := +endif + + +.PHONY: all help deps clean test patch + +all help: + $(info --------------------------------------------------------------------------------) + $(info Available arguments:) + $(info - "make test" to test the PKGBUILD file) + $(info - "make deps" to check if dependencies are installed) + $(info - "make clean" to clean the left-over files) + $(info - "make patch" to create a patch to be submitted as contribution) + $(info - "make help" to show this help) + $(info ) + $(info You can turn off colorizing the make output by $(COLOR_MESSAGE)"COLOR=FALSE"$(COLOR_RESET)) + $(info --------------------------------------------------------------------------------) + @: + +deps: +# checking if the dependencies are me# checking if the dependencies are mett + $(foreach bin,$(REQUIRED_BINS),\ + $(if $(shell command -v $(bin) 2> /dev/null),$(info $(COLOR_SUCCESS)[Ok]$(COLOR_RESET) Found `$(bin)`),$(error ${LINEBREAK}[Error] Missing Dependency. Please install `$(bin)`))) + @: + +clean: + @declare -a REMOVABLE_PATTERN=('my.patch' 'flameshot-git-r*.zst') && \ + for F in "$${REMOVABLE_PATTERN[@]}"; do \ + find ./ -maxdepth 1 -name $${F} -exec rm --interactive '{}' \; ; \ + done + +test: clean + namcap -i PKGBUILD + makepkg + sudo pacman -U flameshot-git-r*.zst + +patch: + git diff --oneline --graph > my.patch + @@ -23,7 +23,7 @@ # # 3. In terminal, naviagate to the folder you have the PKGBUILD in # -# 4. Test the modified PKGBUILD file with all of the following commands +# 4. Test the modified PKGBUILD file with `make test`, or alternatively all of the following commands # ```sh # # remove the possible builds # rm -f flameshot-git-r*.zst @@ -39,7 +39,7 @@ # # 5. Fix any possible errors # -# 6. create a patch with your modifications: +# 6. create a patch with your modifications by `make patch` or alternatively: # ```sh # git diff --oneline --graph > my.patch # ``` @@ -51,7 +51,7 @@ pkgname=flameshot-git _pkgname=flameshot -pkgver=r1646.1cc5a262 +pkgver=r1867.3ededae5 pkgrel=1 pkgdesc="Powerful yet simple to use screenshot software" arch=('i686' 'x86_64') |