Compare commits
8 Commits
master
...
by-makefil
| Author | SHA1 | Date | |
|---|---|---|---|
| bf3336ce3e | |||
| 3f3223934c | |||
| cd79005a27 | |||
| 2a6f3e978c | |||
| c61d76b95b | |||
| e1df109b79 | |||
| 995353f958 | |||
| 552fcb317d |
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/prebuilt
|
||||
/libevent-*
|
||||
/ncurses-*
|
||||
/utf8proc-*
|
||||
/musl-*
|
||||
/tmux-*
|
||||
@@ -1,4 +0,0 @@
|
||||
FROM alpine:3
|
||||
ARG VERSION
|
||||
|
||||
RUN echo "Building: tmux v${VERSION}" >&2
|
||||
195
Makefile
195
Makefile
@@ -1,28 +1,183 @@
|
||||
.PHONY: help build extract
|
||||
.PHONY: help
|
||||
|
||||
TMUX := https://github.com/tmux/tmux.git
|
||||
LATEST = $(shell git ls-remote --tags $(TMUX) \
|
||||
| egrep 'refs/tags/[0-9]+(\.[0-9]+)+[a-z]*$$' \
|
||||
| tail -1 | cut -d/ -f3)
|
||||
TMUX_VERSION := 3.1b
|
||||
NCURSES_VERSION := 6.2
|
||||
LIBEVENT_VERSION := 2.1.10-stable
|
||||
UTF8PROC_VERSION := 2.4.0
|
||||
MUSL_VERSION := 1.2.1
|
||||
|
||||
IMAGE = tmux:$(LATEST)
|
||||
BUILD_DIR = $(CURDIR)
|
||||
BUILD_PREBUILT_DEP = $(BUILD_DIR)/prebuilt/dep
|
||||
BUILD_PREBUILT_TMUX = $(BUILD_DIR)/prebuilt/tmux
|
||||
|
||||
LIBEVENT = libevent-$(LIBEVENT_VERSION)
|
||||
LIBEVENT_TGZ = $(LIBEVENT).tar.gz
|
||||
LIBEVENT_URL = https://github.com/libevent/libevent/releases/download/release-$(LIBEVENT_VERSION)/$(LIBEVENT_TGZ)
|
||||
LIBEVENT_LIB = $(BUILD_PREBUILT_DEP)/lib/libevent.a
|
||||
|
||||
NCURSES = ncurses-$(NCURSES_VERSION)
|
||||
NCURSES_TGZ = $(NCURSES).tar.gz
|
||||
NCURSES_URL = https://invisible-mirror.net/archives/ncurses/$(NCURSES_TGZ)
|
||||
NCURSES_LIB = $(BUILD_PREBUILT_DEP)/lib/libncurses.a
|
||||
|
||||
UTF8PROC = utf8proc-$(UTF8PROC_VERSION)
|
||||
UTF8PROC_TGZ = $(UTF8PROC).tar.gz
|
||||
UTF8PROC_URL = https://github.com/JuliaLang/utf8proc/archive/v$(UTF8PROC_VERSION).tar.gz
|
||||
UTF8PROC_LIB = $(BUILD_PREBUILT_DEP)/lib/utf8proc.a
|
||||
|
||||
MUSL = musl-$(MUSL_VERSION)
|
||||
MUSL_TGZ = $(MUSL).tar.gz
|
||||
MUSL_URL = https://musl.libc.org/releases/$(MUSL_TGZ)
|
||||
MUSL_GCC = $(BUILD_PREBUILT_DEP)/bin/musl-gcc
|
||||
|
||||
TMUX = tmux-$(TMUX_VERSION)
|
||||
TMUX_TGZ = $(TMUX).tar.gz
|
||||
TMUX_DIST := $(TMUX).musl-bin.tar.gz
|
||||
TMUX_URL = https://github.com/tmux/tmux/releases/download/$(TMUX_VERSION)/$(TMUX_TGZ)
|
||||
|
||||
help: ## Display this help message
|
||||
@echo "Latest: $(LATEST)"
|
||||
@echo "Tmux: v$(TMUX_VERSION)"
|
||||
@echo "NCurses: v$(NCURSES_VERSION)"
|
||||
@echo "LibEvent: v$(LIBEVENT_VERSION)"
|
||||
@echo "UTF8Proc: v$(UTF8PROC_VERSION)"
|
||||
@echo ""
|
||||
@echo "Usage:"
|
||||
@sed -nE "s/^([^:]+):\s+##\s+(.+)$$/\tmake \\1\t- \\2/p" \
|
||||
@sed -nE "s/^([^:]+):\\s+##\\s+(.+)$$/\tmake \\1\t- \\2/p" \
|
||||
$(lastword $(MAKEFILE_LIST))
|
||||
|
||||
build: ## Build tmux in a docker image
|
||||
docker build \
|
||||
--build-arg VERSION=$(LATEST) \
|
||||
--tag $(IMAGE) \
|
||||
--rm .
|
||||
clean: ## Remove all build and dist directories
|
||||
-rm -rf prebuilt $(LIBEVENT) $(NCURSES) $(UTF8PROC) $(MUSL) $(TMUX)
|
||||
|
||||
####
|
||||
#### musl-libc
|
||||
####
|
||||
musl: ## Build musl static library
|
||||
$(MAKE) $(BUILD_PREBUILT_DEP) $(MUSL_GCC)
|
||||
|
||||
$(MUSL_GCC): $(MUSL)
|
||||
cd $(MUSL) \
|
||||
&& ./configure \
|
||||
--prefix="$(BUILD_PREBUILT_DEP)" \
|
||||
--enable-wrapper \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--enable-optimize \
|
||||
&& make -j4 \
|
||||
&& make install
|
||||
|
||||
$(MUSL): $(MUSL_TGZ)
|
||||
tar xzf $<
|
||||
|
||||
$(MUSL_TGZ):
|
||||
curl -Lk $(MUSL_URL) -o $@
|
||||
|
||||
####
|
||||
#### Libevent
|
||||
####
|
||||
libevent: ## Download and build libevent library
|
||||
$(MAKE) $(MUSL_GCC) $(LIBEVENT_LIB)
|
||||
|
||||
$(LIBEVENT_LIB): $(LIBEVENT)
|
||||
cd $(LIBEVENT) \
|
||||
&& ./configure \
|
||||
--prefix="$(BUILD_PREBUILT_DEP)" \
|
||||
--disable-openssl \
|
||||
--enable-shared=no \
|
||||
--enable-static=yes \
|
||||
--with-pic
|
||||
$(MAKE) -C $(LIBEVENT) -j4
|
||||
$(MAKE) -C $(LIBEVENT) install
|
||||
|
||||
$(LIBEVENT): $(LIBEVENT_TGZ)
|
||||
tar xzf $<
|
||||
|
||||
$(LIBEVENT_TGZ):
|
||||
curl -Lk $(LIBEVENT_URL) -o $@
|
||||
|
||||
####
|
||||
#### tmux
|
||||
####
|
||||
tmux: ## Build static tmux archive
|
||||
$(MAKE) $(TMUX_DIST)
|
||||
|
||||
$(TMUX_DIST): $(TMUX)
|
||||
cd $(TMUX) && \
|
||||
PKG_CONFIG_PATH="$(BUILD_PREBUILT_DEP)/lib/pkgconfig" \
|
||||
LIBNCURSES_CFLAGS="-I$(BUILD_PREBUILT_DEP)/include/ncurses" \
|
||||
LIBNCURSES_LIBS="-L$(BUILD_PREBUILT_DEP)/lib" \
|
||||
LIBEVENT_CFLAGS="-I$(BUILD_PREBUILT_DEP)/include" \
|
||||
LIBEVENT_LIBS="-L$(BUILD_PREBUILT_DEP)/lib -levent" \
|
||||
./configure \
|
||||
--prefix="$(BUILD_PREBUILT_TMUX)" \
|
||||
--enable-static \
|
||||
--enable-utf8proc
|
||||
$(MAKE) -C $(TMUX) -j4
|
||||
|
||||
$(TMUX): $(TMUX_TGZ)
|
||||
tar xzf $<
|
||||
|
||||
$(TMUX_TGZ):
|
||||
curl -Lk $(TMUX_URL) -o $@
|
||||
|
||||
####
|
||||
#### UTF8Proc
|
||||
####
|
||||
utf8proc: ## Download and build the UTF8Proc library
|
||||
$(MAKE) $(BUILD_PREBUILT_DEP) $(UTF8PROC_LIB)
|
||||
|
||||
$(UTF8PROC_LIB): $(UTF8PROC)
|
||||
mkdir -p $(UTF8PROC)/build
|
||||
cd $(UTF8PROC)/build \
|
||||
&& cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="$(BUILD_PREBUILT_DEP)" \
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
cd $(UTF8PROC)/build \
|
||||
&& cmake --build .
|
||||
cp -v $(UTF8PROC)/build/*.a $(BUILD_PREBUILT_DEP)/lib
|
||||
cp -v $(UTF8PROC)/*.h $(BUILD_PREBUILT_DEP)/include
|
||||
|
||||
$(UTF8PROC): $(UTF8PROC_TGZ)
|
||||
tar xzf $(UTF8PROC_TGZ)
|
||||
|
||||
$(UTF8PROC_TGZ):
|
||||
curl -Lk $(UTF8PROC_URL) -o $@
|
||||
|
||||
####
|
||||
#### Ncurses
|
||||
####
|
||||
ncurses: ## Download and build the ncurses libraru
|
||||
$(MAKE) $(BUILD_PREBUILT_DEP) $(NCURSES_LIB)
|
||||
|
||||
$(NCURSES_LIB): $(NCURSES)
|
||||
cd $(NCURSES) \
|
||||
&& ./configure \
|
||||
--prefix="$(BUILD_PREBUILT_DEP)" \
|
||||
--without-cxx \
|
||||
--without-cxx-binding \
|
||||
--with-termlib \
|
||||
--enable-termcap \
|
||||
--enable-ext-colors \
|
||||
--enable-ext-mouse \
|
||||
--enable-bsdpad \
|
||||
--enable-opaque-curses \
|
||||
--with-terminfo-dirs=/etc/terminfo:/usr/share/terminfo:/lib/terminfo \
|
||||
--with-termpath=/etc/termcap:/usr/share/misc/termcap \
|
||||
--with-fallbacks="linux,xterm,xterm-color,xterm-256color,vt100"
|
||||
$(MAKE) -C $(NCURSES) -j4
|
||||
$(MAKE) -C $(NCURSES) install
|
||||
|
||||
$(NCURSES): $(NCURSES_TGZ)
|
||||
tar xzf $<
|
||||
|
||||
$(NCURSES_TGZ):
|
||||
curl -Lk $(NCURSES_URL) -o $@
|
||||
|
||||
####
|
||||
#### prebuilt dirs
|
||||
####
|
||||
$(BUILD_PREBUILT_DEP):
|
||||
mkdir -pv $@
|
||||
|
||||
$(BUILD_PREBUILT_TMUX):
|
||||
mkdir -pv $@
|
||||
|
||||
extract: ## Extract the binaries from the docker image
|
||||
docker run \
|
||||
-ti --rm \
|
||||
-u $(shell id -u):$(shell id -g) \
|
||||
-v $(CURDIR):/mnt/cwd \
|
||||
-w /usr/local/lib \
|
||||
$(IMAGE) tar czf /mnt/cwd/tmux_v$(LATEST).tar.gz tmux_v$(LATEST)
|
||||
|
||||
17
README.md
17
README.md
@@ -1,17 +0,0 @@
|
||||
# static-tmux
|
||||
|
||||
Build a static tmux that can be copied anywhere.
|
||||
|
||||
## Usage
|
||||
|
||||
Run `make` for a usage display:
|
||||
|
||||
```shell
|
||||
$ make
|
||||
Latest: 3.1b
|
||||
Usage:
|
||||
make help - Display this help message
|
||||
make build - Build tmux in a docker image
|
||||
make extract - Extract the binaries from the docker image
|
||||
```
|
||||
|
||||
0
build-tmux.sh
Normal file → Executable file
0
build-tmux.sh
Normal file → Executable file
Reference in New Issue
Block a user