Skip to content
Permalink
Browse files

Static build for Dave

  • Loading branch information...
ganwell committed Aug 7, 2019
1 parent be3d0f8 commit d261fe9a37920dc11f2229d3bd30f3005ae14cf2
Showing with 41 additions and 5 deletions.
  1. +18 −0 Dockerfile
  2. +15 −0 build
  3. +2 −2 share/kak/kakrc
  4. +6 −3 src/Makefile
@@ -0,0 +1,18 @@
FROM alpine:3.10
RUN apk --no-cache add \
pkgconf \
make \
git \
gcc \
g++ \
ncurses-static \
ncurses-dev \
|| rm -rf /etc/apk/cache/*
ARG BUILD_USER=1000
ARG BUILD_GROUP=1000
RUN addgroup -S kak -g $BUILD_GROUP && adduser -S kak -G kak -u $BUILD_USER
RUN mkdir -p /build && chown -R kak:kak /build
USER $BUILD_USER:$BUILD_GROUP
COPY --chown=kak:kak src /build/src
RUN cd /build/src && make -j9
COPY --chown=kak:kak . /build
15 build
@@ -0,0 +1,15 @@
#!/bin/sh

set -e

INSTALL_DIR="$HOME/jlf/kak/inst"
BUILD_USER="$(id -u)"
BUILD_GROUP="$(id -g)"

docker build --rm -t kak_build \
--build-arg BUILD_USER="$BUILD_USER" \
--build-arg BUILD_GROUP="$BUILD_GROUP" \
.
mkdir -p "$INSTALL_DIR"
docker run --rm -u "$BUILD_USER" -v "$HOME:$HOME" kak_build sh -c "cd /build/src && make install"
strip "$INSTALL_DIR/bin/kak"
@@ -43,7 +43,7 @@ evaluate-commands %sh{
echo "source '${kak_runtime}/kakrc.local'"
fi

if [ -f "${kak_config}/kakrc" ]; then
echo "source '${kak_config}/kakrc'"
if [ -f "${HOME}/jlf/kakrc" ]; then
echo "source '${HOME}/jlf/kakrc'"
fi
}
@@ -1,7 +1,10 @@
debug ?= no
static ?= no
static ?= yes
gzip_man ?= yes

LDFLAGS += -Wl,--gc-sections
CPPFLAGS += -fdata-sections -ffunction-sections

ifneq ($(gzip_man),yes)
ifneq ($(gzip_man),no)
$(error gzip_man should be either yes or no)
@@ -14,7 +17,7 @@ ifeq ($(debug),yes)
suffix := .debug
else
ifeq ($(debug),no)
CXXFLAGS += -O3
CXXFLAGS += -Os
suffix := .opt
else
$(error debug should be either yes or no)
@@ -49,7 +52,7 @@ ifeq ($(static),yes)
LDFLAGS += -static -pthread
endif

PREFIX ?= /usr/local
PREFIX ?= /home/ganwell/jlf/kak/inst
DESTDIR ?= # root dir

bindir := $(DESTDIR)$(PREFIX)/bin

0 comments on commit d261fe9

Please sign in to comment.
You can’t perform that action at this time.