general: Clean up unused scripts & make targets

This commit is contained in:
cmacrae 2020-07-17 00:41:18 +01:00
parent b1f4bcb2d3
commit d298631f93
No known key found for this signature in database
GPG key ID: 53922D7E54A14F5D
3 changed files with 0 additions and 76 deletions

View file

@ -3,10 +3,7 @@ FRAMEWORK = -framework Carbon -framework Cocoa -framework CoreServices -fra
BUILD_FLAGS = -std=c99 -Wall -DDEBUG -g -O0 -fvisibility=hidden -mmacosx-version-min=10.13
BUILD_PATH = ./bin
DOC_PATH = ./doc
SCRIPT_PATH = ./scripts
ASSET_PATH = ./assets
SMP_PATH = ./examples
ARCH_PATH = ./archive
SPACEBAR_SRC = ./src/manifest.m
BINS = $(BUILD_PATH)/spacebar
@ -23,21 +20,6 @@ stats: clean $(BINS)
man:
asciidoctor -b manpage $(DOC_PATH)/spacebar.asciidoc -o $(DOC_PATH)/spacebar.1
icon:
python $(SCRIPT_PATH)/seticon.py $(ASSET_PATH)/icon/2x/icon-512px@2x.png $(BUILD_PATH)/spacebar
archive: man install sign icon
rm -rf $(ARCH_PATH)
mkdir -p $(ARCH_PATH)
cp -r $(BUILD_PATH) $(ARCH_PATH)/
cp -r $(DOC_PATH) $(ARCH_PATH)/
cp -r $(SMP_PATH) $(ARCH_PATH)/
tar -cvzf $(BUILD_PATH)/$(shell $(BUILD_PATH)/spacebar --version).tar.gz $(ARCH_PATH)
rm -rf $(ARCH_PATH)
sign:
codesign -fs "spacebar-cert" $(BUILD_PATH)/spacebar
clean:
rm -rf $(BUILD_PATH)

View file

@ -1,47 +0,0 @@
#! /usr/bin/env bash
identities="$(security find-identity -v -p codesigning | sed '$d')"
id_count="$(echo "${identities}" | wc -l)"
target="$(command -v "${1:-}")"
function error() {
{
echo "$(tput bold)Error: ${@}$(tput sgr0)"
echo
echo "Usage: ./scripts/codesign <path/to/executable> [<certificate>]"
echo "Available codesigning certificates:"
echo "${identities}"
} >&2
exit 1
}
if [ "${id_count}" -lt 1 ]; then
>&2 echo "Unable to find a codesigning identity"
exit 1
elif [ "${id_count}" -eq 1 ]; then
selection="1"
elif [ "${id_count}" -gt 1 ] && [ "${#}" -eq 2 ]; then
selection="${2}"
elif [ -x "${target}" ]; then
error "Unable to auto-select codesigning certificate"
else
error "Unable to find executable \"${target}\""
fi
if [[ "${selection}" =~ ^[0-9]+$ ]]; then
certificate="$(echo "${identities}" \
| awk "NR==${selection} {print \$2}")"
else
certificate="$(echo "${identities}" \
| awk 'BEGIN{FS=OFS="\""} {gsub(/ /,"_",$2)} 1' \
| awk "\$3 ~ /${selection// /_}/ {print \$2}")"
fi
if [ -z "${certificate}" ]; then
error "Unable to find codesigning certificate \"${selection}\""
elif [ "$(echo "${certificate}" | wc -l)" -ne 1 ]; then
error "Unable to uniquely identify codesigning certificate \"${selection}\""
fi
command codesign --deep --force --verbose --sign "${certificate}" "${target}"

View file

@ -1,11 +0,0 @@
#!/usr/bin/env python
import Cocoa
import sys
image = Cocoa.NSImage.alloc().initWithContentsOfFile_(sys.argv[1].decode('utf-8'));
binary = sys.argv[2].decode('utf-8');
options = 0;
result = Cocoa.NSWorkspace.sharedWorkspace().setIcon_forFile_options_(image, binary, options);
if result == 0: print("could not set icon for file..");