shithub: scc

Download patch

ref: e6128b22b6f016d1e0d22177f111a346e36d8705
parent: 75859a6c2f7458ff82bd61ad1f031837155cb03e
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Oct 22 02:34:41 EDT 2019

Add install script

This script makes easier to install scc because
there is a proto file that specifies the list
of files to be installed and the permisions of
every file.

--- a/Makefile
+++ b/Makefile
@@ -3,8 +3,7 @@
 PROJECTDIR = .
 include $(PROJECTDIR)/scripts/rules.mk
 
-PREFIX    = $(HOME)
-MANPREFIX = $(PREFIX)/share/man
+PREFIX= /usr/local
 DIRS  = src include/scc/scc tests
 
 all: src
@@ -34,6 +33,9 @@
 
 dep:
 	$(FORALL)
+
+install: all
+	$(SCRIPTDIR)/install $(PREFIX)
 
 distclean: clean
 	$(MAKE) $(ENVIRON)
--- a/README
+++ b/README
@@ -5,6 +5,9 @@
 out of the box. It supports four main configuration options that
 can be passed to the command line:
 
+	- PREFIX: Prefix of the path where scc toolchain is going
+	  to be installed. /usr/local by default.
+
 	- CROSS_COMPILE:
           Specify a prefix name for the tools called by the Makefile.
 
--- /dev/null
+++ b/scripts/install
@@ -1,0 +1,38 @@
+#!/bin/sh
+
+set -e
+
+for i
+do
+	case "$i" in
+	-p)
+		proto=$2
+		shift 2
+		;;
+	-*)
+		echo 1=$1
+		echo usage: install -t prefix [-p proto] >&2
+		exit 1
+		;;
+	esac
+done
+
+prefix=$1
+
+while read type perm name
+do
+	case $type in
+	d)
+		mkdir -p ${prefix?}/$name
+		;;
+	f)
+		cp $name ${prefix?}/$name
+		;;
+	*)
+		echo install: wrong entry type >&2
+		exit 1
+		;;
+	esac
+
+	chmod $perm $prefix/$name
+done < ${proto:-scripts/proto}
--- /dev/null
+++ b/scripts/proto
@@ -1,0 +1,146 @@
+d 755 lib
+d 755 lib/scc
+f 644 lib/scc/libmach.a
+d 755 lib/scc/amd64-netbsd
+d 755 lib/scc/i386-linux
+d 755 lib/scc/i386-openbsd
+d 755 lib/scc/amd64-linux
+f 644 lib/scc/amd64-linux/libc.a
+f 644 lib/scc/amd64-linux/crt.o
+f 644 lib/scc/amd64-linux/libcrt.a
+f 644 lib/scc/libscc.a
+d 755 lib/scc/amd64-openbsd
+d 755 bin
+f 755 bin/ld
+f 755 bin/cpp
+f 755 bin/cc
+f 755 bin/nm
+f 755 bin/objdump
+f 755 bin/addr2line
+f 755 bin/objcopy
+f 755 bin/strip
+f 755 bin/ranlib
+f 755 bin/size
+f 755 bin/ar
+d 755 include
+f 644 include/string.h
+f 644 include/wchar.h
+f 644 include/float.h
+d 755 include/scc
+d 755 include/scc/scc
+f 644 include/scc/scc/ar.h
+d 755 include/scc/scc/coff32
+f 644 include/scc/scc/coff32/linenum.h
+f 644 include/scc/scc/coff32/scnhdr.h
+f 644 include/scc/scc/coff32/filehdr.h
+f 644 include/scc/scc/coff32/aouthdr.h
+f 644 include/scc/scc/coff32/reloc.h
+f 644 include/scc/scc/coff32/syms.h
+f 644 include/scc/scc/scc.h
+f 644 include/scc/scc/mach.h
+f 644 include/limits.h
+f 644 include/wctype.h
+f 644 include/ctype.h
+f 644 include/assert.h
+f 644 include/stdarg.h
+f 644 include/stdlib.h
+f 644 include/signal.h
+f 644 include/math.h
+f 644 include/errno.h
+f 644 include/stdio.h
+f 644 include/stdbool.h
+f 644 include/locale.h
+f 644 include/stddef.h
+f 644 include/setjmp.h
+f 644 include/time.h
+f 644 include/stdint.h
+d 755 include/bits
+d 755 include/bits/darwin
+d 755 include/bits/darwin/sys
+f 644 include/bits/darwin/sys/signal.h
+f 644 include/bits/darwin/sys/errno.h
+f 644 include/bits/darwin/sys.h
+d 755 include/bits/linux
+d 755 include/bits/linux/sys
+f 644 include/bits/linux/sys/signal.h
+f 644 include/bits/linux/sys/errno.h
+f 644 include/bits/linux/sys.h
+d 755 include/bits/openbsd
+d 755 include/bits/openbsd/sys
+f 644 include/bits/openbsd/sys/signal.h
+f 644 include/bits/openbsd/sys/errno.h
+f 644 include/bits/openbsd/sys.h
+d 755 include/bits/dragonfly
+d 755 include/bits/dragonfly/sys
+f 644 include/bits/dragonfly/sys/signal.h
+f 644 include/bits/dragonfly/sys/errno.h
+f 644 include/bits/dragonfly/sys.h
+d 755 include/bits/arm32
+d 755 include/bits/arm32/arch
+f 644 include/bits/arm32/arch/string.h
+f 644 include/bits/arm32/arch/limits.h
+f 644 include/bits/arm32/arch/stdlib.h
+f 644 include/bits/arm32/arch/stdio.h
+f 644 include/bits/arm32/arch/stddef.h
+f 644 include/bits/arm32/arch/setjmp.h
+f 644 include/bits/arm32/arch/time.h
+f 644 include/bits/arm32/arch/stdint.h
+d 755 include/bits/z80
+d 755 include/bits/z80/arch
+f 644 include/bits/z80/arch/string.h
+f 644 include/bits/z80/arch/limits.h
+f 644 include/bits/z80/arch/stdlib.h
+f 644 include/bits/z80/arch/stdio.h
+f 644 include/bits/z80/arch/stddef.h
+f 644 include/bits/z80/arch/time.h
+f 644 include/bits/z80/arch/stdint.h
+d 755 include/bits/arm64
+d 755 include/bits/arm64/arch
+f 644 include/bits/arm64/arch/string.h
+f 644 include/bits/arm64/arch/limits.h
+f 644 include/bits/arm64/arch/stdlib.h
+f 644 include/bits/arm64/arch/stdio.h
+f 644 include/bits/arm64/arch/stddef.h
+f 644 include/bits/arm64/arch/setjmp.h
+f 644 include/bits/arm64/arch/time.h
+f 644 include/bits/arm64/arch/stdint.h
+d 755 include/bits/amd64
+d 755 include/bits/amd64/arch
+f 644 include/bits/amd64/arch/string.h
+f 644 include/bits/amd64/arch/limits.h
+f 644 include/bits/amd64/arch/stdlib.h
+f 644 include/bits/amd64/arch/stdio.h
+f 644 include/bits/amd64/arch/stddef.h
+f 644 include/bits/amd64/arch/setjmp.h
+f 644 include/bits/amd64/arch/time.h
+f 644 include/bits/amd64/arch/stdint.h
+d 755 include/bits/netbsd
+d 755 include/bits/netbsd/sys
+f 644 include/bits/netbsd/sys/signal.h
+f 644 include/bits/netbsd/sys/errno.h
+f 644 include/bits/netbsd/sys.h
+d 755 include/bits/i386
+d 755 include/bits/i386/arch
+f 644 include/bits/i386/arch/string.h
+f 644 include/bits/i386/arch/limits.h
+f 644 include/bits/i386/arch/stdlib.h
+f 644 include/bits/i386/arch/stdio.h
+f 644 include/bits/i386/arch/stddef.h
+f 644 include/bits/i386/arch/time.h
+f 644 include/bits/i386/arch/stdint.h
+d 755 libexec
+d 755 libexec/scc
+f 755 libexec/scc/as-i386
+f 755 libexec/scc/as-i286
+f 755 libexec/scc/cc2-qbe_amd64-sysv
+f 755 libexec/scc/cc1-amd64-sysv
+f 755 libexec/scc/as-powerpc64
+f 755 libexec/scc/cc1-i386-sysv
+f 755 libexec/scc/cc1-z80-scc
+f 755 libexec/scc/cc2-i386-sysv
+f 755 libexec/scc/cc1-arm64-sysv
+f 755 libexec/scc/as-powerpc
+f 755 libexec/scc/as-amd64
+f 755 libexec/scc/cc2-amd64-sysv
+f 755 libexec/scc/cc2-z80-scc
+f 755 libexec/scc/as-z80