summaryrefslogtreecommitdiffstats
path: root/rules/openssh.make
blob: 5c818d71848e60fd37ec4b1078f122e71f69ff20 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# -*-makefile-*-
# $Id$
#
# Copyright (C) 2002, 2003 by Pengutronix e.K., Hildesheim, Germany
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_OPENSSH) += openssh

#
# Paths and names
#
OPENSSH_VERSION		= 4.3p2
OPENSSH			= openssh-$(OPENSSH_VERSION)
OPENSSH_URL 		= ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/$(OPENSSH).tar.gz
OPENSSH_SOURCE		= $(SRCDIR)/$(OPENSSH).tar.gz
OPENSSH_DIR 		= $(BUILDDIR)/$(OPENSSH)


# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------

openssh_get: $(STATEDIR)/openssh.get

$(STATEDIR)/openssh.get: $(openssh_get_deps_default)
	@$(call targetinfo, $@)
	@$(call touch, $@)

$(OPENSSH_SOURCE):
	@$(call targetinfo, $@)
	@$(call get, OPENSSH)

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

openssh_extract: $(STATEDIR)/openssh.extract

$(STATEDIR)/openssh.extract: $(openssh_extract_deps_default)
	@$(call targetinfo, openssh.extract)
	@$(call clean, $(OPENSSH_DIR))
	@$(call extract, OPENSSH)
	@$(call patchin, OPENSSH)

	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

openssh_prepare: $(STATEDIR)/openssh.prepare

OPENSSH_PATH	= PATH=$(CROSS_PATH)

# openssh is a little F*CKED up, is won't compile without LD=gcc in environment
# perhaps someone should fix this....
OPENSSH_ENV	= $(CROSS_ENV) \
	LD=$(COMPILER_PREFIX)gcc

#
# autoconf
#
OPENSSH_AUTOCONF = \
	$(CROSS_AUTOCONF_USR) \
	--libexecdir=/usr/sbin \
	--sysconfdir=/etc/ssh \
	--with-privsep-path=/var/run/sshd \
	--with-rand-helper=no \
	--without-pam \
	--with-ipv4-default \
	--disable-etc-default-login \
	--disable-lastlog \
	--disable-utmp \
	--disable-utmpx \
	--disable-wtmp \
	--disable-wtmpx

$(STATEDIR)/openssh.prepare: $(openssh_prepare_deps_default)
	@$(call targetinfo, openssh.prepare)
	cd $(OPENSSH_DIR) && \
		$(OPENSSH_PATH) $(OPENSSH_ENV) \
		./configure $(OPENSSH_AUTOCONF)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

openssh_compile: $(STATEDIR)/openssh.compile

$(STATEDIR)/openssh.compile: $(openssh_compile_deps_default)
	@$(call targetinfo, $@)
	cd $(OPENSSH_DIR) && $(OPENSSH_PATH) make
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

openssh_install: $(STATEDIR)/openssh.install

$(STATEDIR)/openssh.install: $(openssh_install_deps_default)
	@$(call targetinfo, $@)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

openssh_targetinstall: $(STATEDIR)/openssh.targetinstall

$(STATEDIR)/openssh.targetinstall: $(openssh_targetinstall_deps_default)
	@$(call targetinfo, $@)

	@$(call install_init, openssh)
	@$(call install_fixup, openssh,PACKAGE,openssh)
	@$(call install_fixup, openssh,PRIORITY,optional)
	@$(call install_fixup, openssh,VERSION,$(OPENSSH_VERSION))
	@$(call install_fixup, openssh,SECTION,base)
	@$(call install_fixup, openssh,AUTHOR,"Robert Schwebel <r.schwebel\@pengutronix.de>")
	@$(call install_fixup, openssh,DEPENDS,)
	@$(call install_fixup, openssh,DESCRIPTION,missing)

ifdef PTXCONF_OPENSSH_SSH
	@$(call install_alternative, openssh, 0, 0, 0644, /etc/ssh/ssh_config)
	@$(call install_copy, openssh, 0, 0, 0755, $(OPENSSH_DIR)/ssh, /usr/bin/ssh)
endif

ifdef PTXCONF_OPENSSH_SSHD
	@$(call install_copy, openssh, 0, 0, 0644, $(OPENSSH_DIR)/moduli.out, \
		/etc/ssh/moduli, n)
	@$(call install_alternative, openssh, 0, 0, 0644, /etc/ssh/sshd_config)
	@$(call install_copy, openssh, 0, 0, 0755, $(OPENSSH_DIR)/sshd, \
		/usr/sbin/sshd)
endif

ifdef PTXCONF_ROOTFS_ETC_INITD_OPENSSH
	@$(call install_alternative, openssh, 0, 0, 0755, /etc/init.d/openssh)
endif

ifdef PTXCONF_OPENSSH_SCP
	@$(call install_copy, openssh, 0, 0, 0755, $(OPENSSH_DIR)/scp, \
		/usr/bin/scp)
endif

ifdef PTXCONF_OPENSSH_SFTP_SERVER
	@$(call install_copy, openssh, 0, 0, 0755, $(OPENSSH_DIR)/sftp-server, \
		/usr/sbin/sftp-server)
endif

ifdef PTXCONF_OPENSSH_KEYGEN
	@$(call install_copy, openssh, 0, 0, 0755, $(OPENSSH_DIR)/ssh-keygen, \
		/usr/bin/ssh-keygen)
endif

ifdef PTXCONF_ROOTFS_ETC_INITD_OPENSSH
ifdef PTXCONF_ROOTFS_ETC_INITD_OPENSSH_DEFAULT
# install the generic one
	@$(call install_copy, openssh, 0, 0, 0755, \
		$(PTXDIST_TOPDIR)/generic/etc/init.d/openssh, \
		/etc/init.d/openssh, n)
endif
ifdef PTXCONF_ROOTFS_ETC_INITD_OPENSSH_USER
# install users one
	@$(call install_copy, openssh, 0, 0, 0755, \
		$(PTXDIST_WORKSPACE)/projectroot/etc/init.d/openssh, \
		/etc/init.d/openssh, n)
endif
#
# FIXME: Is this packet the right location for the link?
#
ifneq ($(PTXCONF_ROOTFS_ETC_INITD_OPENSSH_LINK),"")
	@$(call install_link, openssh, ../init.d/openssh, \
		/etc/rc.d/$(PTXCONF_ROOTFS_ETC_INITD_OPENSSH_LINK))
endif
endif

	@$(call install_finish, openssh)

	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

openssh_clean:
	rm -rf $(STATEDIR)/openssh.*
	rm -rf $(PKGDIR)/openssh_*
	rm -rf $(OPENSSH_DIR)

# vim: syntax=make