fork of https://github.com/sourcegraph/zoekt
1#!/bin/sh
2
3# This script installs universal-ctags within an alpine container.
4
5# Commit hash of github.com/universal-ctags/ctags.
6# Last bumped 2023-10-24.
7CTAGS_VERSION=v6.0.0
8CTAGS_ARCHIVE_TOP_LEVEL_DIR=ctags-6.0.0
9# When using commits you can rely on
10# CTAGS_ARCHIVE_TOP_LEVEL_DIR=ctags-$CTAGS_VERSION
11
12cleanup() {
13 apk --no-cache --purge del ctags-build-deps || true
14 cd /
15 rm -rf /tmp/ctags-$CTAGS_VERSION
16}
17
18trap cleanup EXIT
19
20set -eux
21
22apk --no-cache add \
23 --virtual ctags-build-deps \
24 autoconf \
25 automake \
26 binutils \
27 curl \
28 g++ \
29 gcc \
30 jansson-dev \
31 make \
32 pkgconfig
33
34# ctags is dynamically linked against jansson
35apk --no-cache add jansson
36
37NUMCPUS=$(grep -c '^processor' /proc/cpuinfo)
38
39# Installation
40curl --retry 5 "https://codeload.github.com/universal-ctags/ctags/tar.gz/$CTAGS_VERSION" | tar xz -C /tmp
41cd /tmp/$CTAGS_ARCHIVE_TOP_LEVEL_DIR
42./autogen.sh
43./configure --program-prefix=universal- --enable-json
44make -j"$NUMCPUS" --load-average="$NUMCPUS"
45make install