Author: Kevin Schoon [kevinschoon@gmail.com]
Hash: 142e6374daa9cf9720d41e527901821b7f7efd33
Timestamp: Mon, 26 Oct 2020 20:28:32 +0000 (3 years ago)

+0 -130 +/-5 browse
rm excess build tooling
1diff --git a/.gitignore b/.gitignore
2index 2c87c11..7bcace9 100644
3--- a/.gitignore
4+++ b/.gitignore
5 @@ -1,3 +1,2 @@
6 .merlin
7 _build/
8- pkg
9 diff --git a/scripts/generate_build.sh b/scripts/generate_build.sh
10deleted file mode 100755
11index 02b75af..0000000
12--- a/scripts/generate_build.sh
13+++ /dev/null
14 @@ -1,48 +0,0 @@
15- #!/bin/bash
16- # Generate a compiled build artifact. This is a hack because
17- # to the best of my knowledge the distribution story for OCaml
18- # binaries is terrible. Dynamic linking means we need to
19- # compile against the oldest version of GLIBC we wish to support.
20- # We also link against Alpine muslc for convenience. It is not
21- # possible to compile Mach-O Darwin executables from Linux, again,
22- # AFAICT. ARM binaries would be nice too. TODO: Use a Docker buildx
23- # workflow or perferably something without Docker at all.
24- set -e
25-
26- DOCKER_FILE="$1"
27- PREFIX="$2"
28-
29- _usage() {
30- echo "USAGE: "
31- echo "generate_build_artifact.sh DOCKERFILE PREFIX"
32- }
33-
34- [[ -z "$DOCKER_FILE" ]] || [[ -z "$PREFIX" ]] && {
35- _usage
36- exit 1
37- }
38-
39- # TODO: Capture more build specifics
40- VERSION="$(git describe --always)"
41-
42- PKG="note-$PREFIX-$VERSION"
43- PKG_PATH="pkg/$PKG"
44- PKG_TARGET="pkg/$PKG.tar.gz"
45- SOURCE="$(realpath "_build/install/default")"
46-
47- mkdir -p "$PKG_PATH"
48- pushd "$PKG_PATH"
49- mkdir -p usr/bin
50- mkdir -p usr/share/man/man7
51- cp "$SOURCE/man/man7/note.7" usr/share/man/man7/
52- mkdir -p usr/share/bash-completion/completions
53- cp "$SOURCE/share/note/note" usr/share/bash-completion/completions/
54- gzip usr/share/man/man7/note.7
55- popd
56-
57- docker build -t "$PKG" -f "$DOCKER_FILE" .
58- container_id="$(docker create $PKG)"
59- docker cp "$container_id:/usr/bin/note" "$PKG_PATH/usr/bin/note"
60- docker rm "$container_id" 1>/dev/null
61- tar --owner root --group root -C "$PKG_PATH" -czvf "$PKG_TARGET" .
62- md5sum "$PKG_TARGET" > "$PKG_TARGET.md5"
63 diff --git a/scripts/generate_deb.sh b/scripts/generate_deb.sh
64deleted file mode 100755
65index f602af9..0000000
66--- a/scripts/generate_deb.sh
67+++ /dev/null
68 @@ -1,36 +0,0 @@
69- #!/bin/bash
70- # generate a deb package for debian based systems
71- set -e
72-
73-
74- _usage () {
75- echo "USAGE: "
76- echo "generate_debian_artifact.sh VERSION"
77- }
78-
79- VERSION="$1"
80-
81- [[ -z "$VERSION" ]] && {
82- _usage
83- exit 1
84- }
85-
86- BUILD_ARTIFACT="pkg/note-glibc-$VERSION"
87- PKG="note-$VERSION-debian"
88- PKG_PATH="pkg/$PKG"
89- PKG_TARGET="$PKG_PATH.deb"
90- mkdir -p "$PKG_PATH/DEBIAN"
91-
92- cat >"$PKG_PATH/DEBIAN/control"<<EOF
93- Package: note-ocaml
94- Version: $VERSION
95- Maintainer: Kevin Schoon <kevinschoon@gmail.com>
96- Architecture: amd64
97- Description: simple note taking cli
98- EOF
99-
100- cp -r "$BUILD_ARTIFACT"/* "$PKG_PATH/"
101-
102- # TODO: dune doesn't allow this path somehow
103- dpkg-deb --root-owner-group -b "$PKG_PATH"
104- md5sum "$PKG_TARGET" > "$PKG_TARGET.md5"
105 diff --git a/scripts/generate_pkgbuild.sh b/scripts/generate_pkgbuild.sh
106deleted file mode 100755
107index d58b175..0000000
108--- a/scripts/generate_pkgbuild.sh
109+++ /dev/null
110 @@ -1,31 +0,0 @@
111- #!/bin/bash
112- set -e
113-
114- VERSION="$1"
115-
116- TARBALL="note-glibc-$VERSION.tar.gz"
117- REMOTE_URL="https://github.com/kevinschoon/note/releases/download/$VERSION/$TARBALL"
118- MD5SUM="$(cat "pkg/$TARBALL.md5" |cut -d ' ' -f 1)"
119-
120- cat >pkg/PKGBUILD-$VERSION<<EOF
121- # Maintainer: Kevin Schoon <kevinschoon@gmail.com>
122- pkgname=note-bin
123- pkgver=$VERSION
124- pkgrel=1
125- pkgdesc="Simple Note Taking CLI"
126- url="https://github.com/kevinschoon/note"
127- arch=(x86_64)
128- license=('AGPL3')
129- source=("$TARBALL::$REMOTE_URL")
130- md5sums=($MD5SUM)
131-
132- package() {
133- install -Dm755 usr/bin/note -t "\${pkgdir}/usr/bin/"
134- install -Dm644 usr/share/bash-completion/completions/note -t \${pkgdir}/usr/share/bash-completion/completions/
135- install -Dm644 usr/share/man/man7/note.7.gz -t \${pkgdir}/usr/share/man/man7/
136- }
137- EOF
138-
139- pushd pkg
140- makepkg -p "PKGBUILD-$VERSION" --printsrcinfo > "SRCINFO-$VERSION"
141- popd
142 diff --git a/scripts/release.sh b/scripts/release.sh
143deleted file mode 100755
144index e8499ec..0000000
145--- a/scripts/release.sh
146+++ /dev/null
147 @@ -1,14 +0,0 @@
148- #!/bin/bash
149- set -e
150-
151- VERSION="$(git describe --always)"
152-
153- dune clean
154- dune build
155-
156- scripts/generate_build.sh docker/Dockerfile.debian glibc
157- scripts/generate_deb.sh "$VERSION"
158-
159- scripts/generate_build.sh docker/Dockerfile.alpine muslc
160-
161- scripts/generate_pkgbuild.sh "$VERSION"