summaryrefslogtreecommitdiffstats
path: root/release/Makefile
blob: 6f2c561eb3cfc6436e74da5b22c6207f75ddfad6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
VERSION=0.11.1

VERSION_TAG=v$(VERSION)

SRC_VERSION=master

outbox:
	mkdir -p $@

clean-outbox: outbox
	rm -f outbox/*

PACKAGE_URLS = \
	https://www.libarchive.org/downloads/libarchive-3.6.1.tar.gz \
	https://ftp.gnu.org/gnu/make/make-4.2.1.tar.gz \
	ftp://ftp.gnu.org/gnu/ncurses/ncurses-6.3.tar.gz \
	https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.40/pcre2-10.40.tar.gz \
	https://ftp.gnu.org/gnu/readline/readline-6.3.tar.gz \
	https://zlib.net/zlib-1.2.12.tar.gz \
	https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz \
	https://www.sqlite.org/2022/sqlite-autoconf-3390400.tar.gz \
	https://www.openssl.org/source/openssl-1.0.2n.tar.gz \
	https://www.libssh2.org/download/libssh2-1.9.0.tar.gz \
	https://curl.se/download/curl-7.85.0.tar.gz \
	https://tukaani.org/xz/xz-5.2.5.tar.gz

.PHONY: linux freebsd pkger download-pkgs musl

%-vm: %
	cd vagrant-static && vagrant up $<

download-pkgs:
	mkdir -p vagrant-static/pkgs && cd vagrant-static/pkgs && \
	for pkg in $(PACKAGE_URLS); do \
		if ! wget -N $${pkg}; then \
		  exit 1; \
		fi \
	done

%-build: % %-vm
	cd vagrant-static && vagrant ssh $< -c "/vagrant/build.sh ${SRC_VERSION}"

%-package: % clean-outbox %-build
	mkdir -p $<-pkg/lnav-${VERSION}
	cp ../README ../NEWS.md $<-pkg/lnav-${VERSION}
	mv vagrant-static/lnav $<-pkg/lnav-${VERSION}
	cd $<-pkg && zip -r ../outbox/lnav-${VERSION}-x86_64-linux-$<.zip lnav-${VERSION}
	rm -rf $<-pkg

linux-ospkg: pkger-vm linux-package
	rm -f vagrant-static/lnav\*.deb vagrant-static/lnav\*.rpm
	cd vagrant-static && vagrant ssh pkger -c "/vagrant/build-pkg.sh ${VERSION}"
	mv vagrant-static/lnav*.deb vagrant-static/lnav*.rpm outbox/

osx-build:
	rm -rf osx-build-dir
	mkdir -p osx-build-dir
	cd ../ && ./autogen.sh
	cd osx-build-dir && \
	  ../../configure --enable-static \
	  --with-readline=/usr/local/opt/readline \
	  --with-sqlite3=/usr/local/opt/sqlite \
	  --with-libarchive=/usr/local/opt/libarchive \
	  "CXXFLAGS=-I/usr/local/opt/ncurses/include -g1 -O2" \
	  "CFLAGS=-I/usr/local/opt/ncurses/include -g1 -O2" \
	  "LDFLAGS=-L/usr/local/opt/ncurses/lib -L/usr/local/opt/xz/lib" \
	  "LIBS=-llzma -lzstd -lbrotlidec-static -liconv -llz4" \
	  && make -j8 && make dist -j8 && make dist-bzip2

osx-package: clean-outbox osx-build
	mkdir -p osx-pkg/lnav-${VERSION}
	git pull --rebase
	cp ../README ../NEWS.md osx-pkg/lnav-${VERSION}
	cp osx-build-dir/src/lnav osx-pkg/lnav-${VERSION}
	cp osx-build-dir/lnav-${VERSION}.tar.gz outbox/
	cp osx-build-dir/lnav-${VERSION}.tar.bz2 outbox/
	cd osx-pkg && zip -r ../outbox/lnav-${VERSION}-x86_64-macos.zip lnav-${VERSION}
	rm -rf osx-pkg

release-NEWS.md: ../NEWS.md
	sed -n "/^## lnav v${VERSION}/,/^## /p" $< | sed '$$d' > $@

release-tag: release-NEWS.md
	gh release create ${VERSION_TAG} \
		-d \
		-t "lnav v${VERSION}" \
		--notes-file release-NEWS.md

release: osx-package musl-package release-NEWS.md
	gh release edit ${VERSION_TAG} \
		-t "lnav v${VERSION}" \
		--notes-file release-NEWS.md
	gh release upload ${VERSION_TAG} outbox/*

push:
	env LANG=UTF-8 package_cloud push tstack/lnav/ubuntu/lucid outbox/lnav*.deb
	env LANG=UTF-8 package_cloud push tstack/lnav/el/5 outbox/lnav-0.11.1-1.x86_64.rpm

clean:
	cd vagrant-static && vagrant destroy -f
	rm -rf vagrant-static/pkgs