summaryrefslogtreecommitdiff
path: root/sub/dropbear/Makefile.sftp-server
blob: aa10735c63158f055bdb1f8677ab8c4ffd9f0ec3 (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
103
104
105
106
107
ZLIB_VERSION := 1.2.11

$(OUTPUT)/sources/zlib-$(ZLIB_VERSION).tar.gz: | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources wget http://zlib.net/zlib-$(ZLIB_VERSION).tar.gz

$(OUTPUT)/sources/.lh_zlib_dled: $(OUTPUT)/sources/zlib-$(ZLIB_VERSION).tar.gz
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/.lh_zlib_copied: $(OUTPUT)/sources/.lh_zlib_dled $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/build-host/zlib-$(ZLIB_VERSION)
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host tar zxpvf $(OUTPUT)/sources/zlib-$(ZLIB_VERSION).tar.gz
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/.lh_zlib_configured: $(OUTPUT)/build-host/.lh_zlib_copied $(OUTPUT)/build-host/bin/muslgcc | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host/zlib-$(ZLIB_VERSION) export CHOST $(TRIPLE) ./configure --prefix=/opt/zlib-$(ZLIB_VERSION) --static
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/.lh_zlib_built: $(OUTPUT)/build-host/.lh_zlib_configured $(OUTPUT)/build-host/bin/muslgcc | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host/zlib-$(ZLIB_VERSION) $(MAKE) CHOST=$(TRIPLE) CC=$(TRIPLE)-muslgcc
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/.lh_zlib_installed: $(OUTPUT)/build-host/.lh_zlib_built $(OUTPUT)/build-host/bin/muslgcc | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
	exec cd $(OUTPUT)/build-host/zlib-$(ZLIB_VERSION) $(MAKE) install CHOST=$(TRIPLE) CC=$(TRIPLE)-muslgcc DESTDIR=$(OUTPUT)/build-host
	exec makenamelink $(OUTPUT)/build-host/opt zlib zlib-$(ZLIB_VERSION) $(OUTPUT)/tmp
	exec setuidgid $(NORMALUSER) s6-touch $@


LIBRESSL_NAME := libressl
LIBRESSL_VERSION := 2.5.4
LIBRESSL_URLDIR := https://ftp.openbsd.org/pub/OpenBSD/LibreSSL
LIBRESSL_TAREXT := tar.gz
LIBRESSL_TARLETTER := z
LIBRESSL_CONFIGURE_OPTIONS := --enable-extratests --disable-shared --enable-static --with-gnu-ld
LIBRESSL_CFLAGS := ""
LIBRESSL_CONFLDFLAGS := "-s -static"
LIBRESSL_MAKELDFLAGS := "-s -all-static"

$(OUTPUT)/sources/$(LIBRESSL_NAME)-$(LIBRESSL_VERSION).$(LIBRESSL_TAREXT): | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources wget $(LIBRESSL_URLDIR)/$(LIBRESSL_NAME)-$(LIBRESSL_VERSION).$(LIBRESSL_TAREXT)

$(OUTPUT)/sources/.lh_$(LIBRESSL_NAME)_dled: $(OUTPUT)/sources/$(LIBRESSL_NAME)-$(LIBRESSL_VERSION).$(LIBRESSL_TAREXT) | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/.lh_$(LIBRESSL_NAME)_copied: $(OUTPUT)/sources/.lh_$(LIBRESSL_NAME)_dled | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/build-host/$(LIBRESSL_NAME)-$(LIBRESSL_VERSION)
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host tar $(LIBRESSL_TARLETTER)xpvf $(OUTPUT)/sources/$(LIBRESSL_NAME)-$(LIBRESSL_VERSION).$(LIBRESSL_TAREXT)
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/.lh_$(LIBRESSL_NAME)_configured: $(OUTPUT)/build-host/.lh_$(LIBRESSL_NAME)_copied $(OUTPUT)/build-host/.lh_zlib_installed $(OUTPUT)/build-host/bin/muslgcc | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host/$(LIBRESSL_NAME)-$(LIBRESSL_VERSION) export CFLAGS $(LIBRESSL_CFLAGS) export LDFLAGS $(LIBRESSL_CONFLDFLAGS) export CC muslgcc ./configure --host=$(TRIPLE) --prefix=/opt/$(LIBRESSL_NAME)-$(LIBRESSL_VERSION) $(LIBRESSL_CONFIGURE_OPTIONS)
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/.lh_$(LIBRESSL_NAME)_built: $(OUTPUT)/build-host/.lh_$(LIBRESSL_NAME)_configured $(OUTPUT)/build-host/bin/muslgcc | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host/$(LIBRESSL_NAME)-$(LIBRESSL_VERSION) $(MAKE) LDFLAGS=$(LIBRESSL_MAKELDFLAGS) CC=muslgcc
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/.lh_$(LIBRESSL_NAME)_installed: $(OUTPUT)/build-host/.lh_$(LIBRESSL_NAME)_built $(OUTPUT)/build-host/bin/muslgcc | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
	exec cd $(OUTPUT)/build-host/$(LIBRESSL_NAME)-$(LIBRESSL_VERSION) $(MAKE) install DESTDIR=$(OUTPUT)/build-host
	exec makenamelink $(OUTPUT)/build-host/opt $(LIBRESSL_NAME) $(LIBRESSL_NAME)-$(LIBRESSL_VERSION) $(OUTPUT)/tmp
	exec makelinks $(OUTPUT)/build-host /bin /opt/$(LIBRESSL_NAME)/bin
	exec setuidgid $(NORMALUSER) s6-touch $@


OPENSSH_NAME := openssh
OPENSSH_VERSION := 7.5p1
OPENSSH_URLDIR := http://ftp2.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable
OPENSSH_TAREXT := tar.gz
OPENSSH_TARLETTER := z
OPENSSH_CONFIGURE_OPTIONS := \
 --disable-etc-default-login \
 --disable-lastlog \
 --disable-utmp \
 --disable-utmpx \
 --disable-wtmp \
 --disable-wtmpx \
 --disable-libutil \
 --disable-pututline \
 --disable-pututxline \
 --without-rpath \
 --without-pie \
 --with-ssl-dir=$(OUTPUT)/build-host/opt/libressl \
 --with-cflags="-I$(OUTPUT)/build-host/opt/zlib/include -I$(OUTPUT)/build-host/opt/libressl/include" \
 --with-ldflags="-s -static -L$(OUTPUT)/build-host/opt/zlib/lib -L$(OUTPUT)/build-host/opt/libressl/lib"
 --with-privsep-user=65534 \
 --with-sandbox=rlimit \
 --with-mantype=cat \
 --with-md5-passwords


$(OUTPUT)/sources/$(OPENSSH_NAME)-$(OPENSSH_VERSION).$(OPENSSH_TAREXT): | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources wget $(OPENSSH_URLDIR)/$(OPENSSH_NAME)-$(OPENSSH_VERSION).$(OPENSSH_TAREXT)

$(OUTPUT)/sources/.lh_$(OPENSSH_NAME)_dled: $(OUTPUT)/sources/$(OPENSSH_NAME)-$(OPENSSH_VERSION).$(OPENSSH_TAREXT) | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/.lh_$(OPENSSH_NAME)_copied: $(OUTPUT)/sources/.lh_$(OPENSSH_NAME)_dled | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/build-host/$(OPENSSH_NAME)-$(OPENSSH_VERSION)
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host tar $(OPENSSH_TARLETTER)xpvf $(OUTPUT)/sources/$(OPENSSH_NAME)-$(OPENSSH_VERSION).$(OPENSSH_TAREXT)
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/.lh_$(OPENSSH_NAME)_configured: $(OUTPUT)/build-host/.lh_$(OPENSSH_NAME)_copied $(OUTPUT)/build-host/.lh_zlib_installed $(OUTPUT)/build-host/.lh_$(LIBRESSL_NAME)_installed $(OUTPUT)/build-host/bin/muslgcc | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host/$(OPENSSH_NAME)-$(OPENSSH_VERSION) export CC "muslgcc -I$(OUTPUT)/build-host/opt/zlib/include -I$(OUTPUT)/build-host/opt/libressl/include -L$(OUTPUT)/build-host/opt/zlib/lib -L$(OUTPUT)/build-host/opt/libressl/lib -s -static" ./configure --host=$(TRIPLE) --prefix=/opt/$(OPENSSH_NAME)-$(OPENSSH_VERSION) $(OPENSSH_CONFIGURE_OPTIONS)
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-host/$(OPENSSH_NAME)-$(OPENSSH_VERSION)/sftp-server: $(OUTPUT)/build-host/.lh_$(OPENSSH_NAME)_configured $(OUTPUT)/build-host/bin/muslgcc | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host/$(OPENSSH_NAME)-$(OPENSSH_VERSION) $(MAKE) sftp-server CC=muslgcc