This repository has been archived by the owner on Jan 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
lighttpd.mk
161 lines (117 loc) · 4.05 KB
/
lighttpd.mk
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
# lighttpd BAPS package by Mike Taht and David Rowe Feb 8 2008
#
# NOTES:
#
# 1/ You may need to stop asterisk (or disable it's web server)
# before starting lighttpd.
include rules.mk
LIGHTTPD_VERSION=1.4.18
LIGHTTPD_NAME=lighttpd-$(LIGHTTPD_VERSION)
LIGHTTPD_DIR=$(BUILD_DIR)/$(LIGHTTPD_NAME)
LIGHTTPD_SOURCE=$(LIGHTTPD_NAME).tar.gz
LIGHTTPD_SITE=http://www.lighttpd.net/download/
LIGHTTPD_UNZIP=zcat
TARGET_DIR=$(TOPDIR)/tmp/lighttpd/ipkg/lighttpd
PKG_NAME:=lighttpd
PKG_VERSION:=$(LIGHTTPD_VERSION)
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(TOPDIR)/tmp/lighttpd
STAGING_INC=$(STAGING_DIR)/usr/include
STAGING_LIB=$(STAGING_DIR)/usr/lib
LIGHTTPD_CONFIGURE_OPTS=--host=bfin-linux-uclibc --disable-ipv6 \
--prefix=$(TARGET_DIR)
$(DL_DIR)/$(LIGHTTPD_SOURCE):
mkdir -p $(DL_DIR)
$(WGET) -P $(DL_DIR) $(LIGHTTPD_SITE)/$(LIGHTTPD_SOURCE)
$(LIGHTTPD_DIR)/.unpacked: $(DL_DIR)/$(LIGHTTPD_SOURCE)
$(LIGHTTPD_UNZIP) $(DL_DIR)/$(LIGHTTPD_SOURCE) | \
tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
$(PATCH_KERNEL) $(LIGHTTPD_DIR) patch lighttpd.patch
touch $(LIGHTTPD_DIR)/.unpacked
$(LIGHTTPD_DIR)/.configured: $(LIGHTTPD_DIR)/.unpacked
cd $(LIGHTTPD_DIR); ./configure $(LIGHTTPD_CONFIGURE_OPTS)
touch $(LIGHTTPD_DIR)/.configured
# this target useful when u just want to compile without install, e.g. to
# test a small tweak
lighttpd-build: $(LIGHTTPD_DIR)/.configured
$(MAKE) -C $(LIGHTTPD_DIR)
lighttpd: lighttpd-build
$(MAKE) -C $(LIGHTTPD_DIR) install
# rm stuff we don't need
cd $(TARGET_DIR); \
rm -Rf bin lib/*.la sbin/lighttpd-angel var share
# conf file
mkdir -p $(TARGET_DIR)/etc
cp files/lighttpd.conf $(TARGET_DIR)/etc
# server root dir and test file
mkdir -p $(TARGET_DIR)/www
cp files/lighttpd.html $(TARGET_DIR)/www/index.html
# init file
mkdir -p $(TARGET_DIR)/etc/init.d
cp files/lighttpd.init $(TARGET_DIR)/etc/init.d/lighttpd
chmod a+x $(TARGET_DIR)/etc/init.d/lighttpd
# doc
mkdir -p $(TARGET_DIR)/usr/doc
cp doc/lighttpd.txt $(TARGET_DIR)/usr/doc
touch $(PKG_BUILD_DIR)/.built
all: lighttpd
distclean:
rm -rf $(LIGHTTPD_BUILD_DIR)
#---------------------------------------------------------------------------
# CREATING PATCHES
#---------------------------------------------------------------------------
# Generate patches between vanilla asterisk tar ball and our asterisk
# version. Run this target after you have made any changes to
# asterisk to capture.
LO = lighttpd-$(LIGHTTPD_VERSION)-orig
L = lighttpd-$(LIGHTTPD_VERSION)
lighttpd-make-patch:
# untar original, to save time we check if the orig is already there
if [ ! -d $(LIGHTTPD_DIR)-orig ] ; then \
cd $(DL_DIR); tar xzf $(LIGHTTPD_SOURCE); \
mv $(L) $(LIGHTTPD_DIR)-orig; \
fi
# mmap MAP_SHARED -> MAP_PRIVATE
-cd $(BUILD_DIR); diff -uN \
$(LO)/src/stream.c \
$(L)/src/stream.c \
> $(PWD)/patch/lighttpd.patch
-cd $(BUILD_DIR); diff -uN \
$(LO)/src/network_writev.c \
$(L)/src/network_writev.c \
>> $(PWD)/patch/lighttpd.patch
# make /var/www/html the server root, enable mod_cgi
-cd $(BUILD_DIR); diff -uN \
$(LO)/openwrt/lighttpd.conf \
$(L)/openwrt/lighttpd.conf \
>> $(PWD)/patch/lighttpd.patch
# fork -> vfork to get mod CGI working
-cd $(BUILD_DIR); diff -uN \
$(LO)/src/mod_cgi.c \
$(L)/src/mod_cgi.c \
>> $(PWD)/patch/lighttpd.patch
#---------------------------------------------------------------------------
# CREATING PACKAGE
#---------------------------------------------------------------------------
define Package/lighttpd
SECTION:=net
CATEGORY:=Network
TITLE:=lighttpd
DESCRIPTION:=\
Light web server with PHP support.
URL:=http://www.lighttpd.net/
ARCHITECTURE:=bfin-uclinux
endef
# post installation - add the sym link for auto start
define Package/lighttpd/postinst
#!/bin/sh
/etc/init.d/lighttpd enable
/etc/init.d/lighttpd start
endef
# pre-remove - remove sym link
define Package/lighttpd/prerm
#!/bin/sh
/etc/init.d/lighttpd disable
endef
$(eval $(call BuildPackage,lighttpd))
lighttpd-package: lighttpd $(PACKAGE_DIR)/lighttpd_$(VERSION)_$(PKGARCH).ipk