source: freewrt/mk/pkg-bottom.mk@ 8ff35c8

Last change on this file since 8ff35c8 was e9b6e37, checked in by Thorsten Glaser <tg@…>, 18 years ago

some of our developers seem to like adding features, breaking edge
conditions during that and not fixing them… this bugged wbx@ so much
he told me to fix openssl for once and for good… had he known what
I was going to do… well, he had quite a few shock moments watching me
hacking on this, but eventually he said, as long as it works for ms@
it's okay… here we are

copy the bsd make build system for openssl from MirBSD and update it
for openssl 0.9.8 (from 0.9.7); the openssl upstream makefiles are
just much too broken. allow the user to disable patented ciphers, as
in MirBSD, but not more. if you use OpenSSL, you have all ciphers, so
be it.

I'll test this ASAP on real hardware.

git-svn-id: svn://www.freewrt.org/trunk/freewrt@2940 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 6.4 KB
Line 
1# $FreeWRT$
2#-
3# This file is part of the FreeWRT project. FreeWRT is copyrighted
4# material, please see the LICENCE file in the top-level directory
5# or at http://www.freewrt.org/licence for details.
6#-
7# Comments:
8# * pre/do/post-foo are always defined here, but empty. This is so
9# that we can call it (BSD make has .if target(foo) but GNU not)
10# and it won't error out.
11# * ${_foo_COOKIE} are the actual targets
12# * default is "manual" -> define a do-foo: target in the Makefile
13# * if you have a style -> define a pre-foo: and post-foo: if they
14# are required, but the do-foo: magic is done here
15# * we want to use styles (configure:gnu, build/install:auto), for
16# making the Makefiles of the packages more clear
17
18ifneq ($(filter gnu,${CONFIGURE_STYLE}),)
19REORDER_DEPENDENCIES+= ${TOPDIR}/scripts/automake.dep
20endif
21
22REORDER_DEPENDENCIES?=
23
24#--- configure
25pre-configure:
26do-configure:
27post-configure:
28${_CONFIGURE_COOKIE}: ${_PATCH_COOKIE}
29ifneq ($(strip ${REORDER_DEPENDENCIES}),)
30 @sed -e '/^#/d' ${REORDER_DEPENDENCIES} | \
31 tsort -r | while read f; do \
32 cd ${WRKSRC}; \
33 case $$f in \
34 /*) \
35 find . -name "$${f#/}" -print | while read i; do \
36 echo "Touching $$i"; touch "$$i"; \
37 done;; \
38 *) \
39 if test -e "$$f" ; then \
40 echo "Touching $$f"; touch "$$f"; \
41 fi;; \
42 esac; \
43 done
44endif
45 mkdir -p ${WRKBUILD}
46 @${MAKE} pre-configure
47ifneq ($(filter gnu,${CONFIGURE_STYLE}),)
48 cd ${WRKBUILD}; rm -f config.{cache,status}; \
49 env ${CONFIGURE_ENV} \
50 ${MBSH} ${WRKSRC}/configure \
51 --build=${GNU_HOST_NAME} \
52 --host=${GNU_TARGET_NAME} \
53 --target=${GNU_TARGET_NAME} \
54 --program-prefix= \
55 --program-suffix= \
56 --prefix=/usr \
57 --datadir=/usr/share \
58 --mandir=/usr/share/man \
59 --libexecdir=/usr/lib \
60 --localstatedir=/var \
61 --sysconfdir=/etc \
62 --disable-nls \
63 --enable-shared \
64 --disable-static \
65 --disable-dependency-tracking \
66 --disable-libtool-lock \
67 --disable-debug \
68 ${CONFIGURE_ARGS}
69else ifneq ($(filter bsd,${CONFIGURE_STYLE}),)
70 cd ${WRKBUILD} && env ${MAKE_ENV} ${BSDMAKE} -f ${MAKE_FILE} \
71 ${MAKE_FLAGS} obj
72 cd ${WRKBUILD} && env ${MAKE_ENV} ${BSDMAKE} -f ${MAKE_FILE} \
73 ${MAKE_FLAGS} depend
74else ifeq ($(filter-out manual,${CONFIGURE_STYLE}),)
75 env ${CONFIGURE_ENV} ${MAKE} do-configure
76else
77 @echo "Invalid CONFIGURE_STYLE '${CONFIGURE_STYLE}'" >&2
78 @exit 1
79endif
80 @${MAKE} post-configure
81 touch $@
82
83#--- build
84pre-build:
85do-build:
86post-build:
87${_BUILD_COOKIE}: ${_CONFIGURE_COOKIE}
88 @env ${MAKE_ENV} ${MAKE} pre-build
89ifneq ($(filter auto,${BUILD_STYLE}),)
90 cd ${WRKBUILD} && env ${MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \
91 ${MAKE_FLAGS} ${ALL_TARGET}
92else ifneq ($(filter bsd,${BUILD_STYLE}),)
93 cd ${WRKBUILD} && env ${MAKE_ENV} ${BSDMAKE} -f ${MAKE_FILE} \
94 ${MAKE_FLAGS} ${ALL_TARGET}
95else ifeq ($(filter-out manual,${BUILD_STYLE}),)
96 env ${MAKE_ENV} ${MAKE} do-build
97else
98 @echo "Invalid BUILD_STYLE '${BUILD_STYLE}'" >&2
99 @exit 1
100endif
101 @env ${MAKE_ENV} ${MAKE} post-build
102 touch $@
103
104#--- fake
105pre-install:
106do-install:
107post-install:
108${_FAKE_COOKIE}: ${_BUILD_COOKIE}
109 -rm -f ${_ALL_CONTROLS}
110 @mkdir -p '${STAGING_PARENT}/pkg' ${WRKINST} '${STAGING_DIR}/scripts'
111 @${MAKE} ${_ALL_CONTROLS}
112 @env ${MAKE_ENV} ${MAKE} pre-install
113ifneq ($(filter auto,${INSTALL_STYLE}),)
114 cd ${WRKBUILD} && env ${MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \
115 DESTDIR='${WRKINST}' ${FAKE_FLAGS} ${INSTALL_TARGET}
116else ifneq ($(filter bsd,${BUILD_STYLE}),)
117 @mkdir -p ${WRKINST}/{,usr/}{bin,include,lib,sbin}
118 cd ${WRKBUILD} && env ${MAKE_ENV} ${BSDMAKE} -f ${MAKE_FILE} \
119 DESTDIR='${WRKINST}' ${FAKE_FLAGS} ${INSTALL_TARGET}
120else ifeq ($(filter-out manual,${INSTALL_STYLE}),)
121 env ${MAKE_ENV} ${MAKE} do-install
122else
123 @echo "Invalid INSTALL_STYLE '${INSTALL_STYLE}'" >&2
124 @exit 1
125endif
126ifneq ($(filter confprog,${INSTALL_STYLE}),)
127 for a in ${WRKINST}/usr/{bin/*-config,lib/pkgconfig/*.pc}; do \
128 [[ -e $$a ]] || continue; \
129 printf ',g/^prefix=/s,,&${STAGING_DIR},\nwq\n' | ed -s $$a; \
130 done
131 @: # not needed at the moment: ',g/-[IL].{/s,-[IL],&${STAGING_DIR},'
132endif
133 @env ${MAKE_ENV} ${MAKE} post-install
134 @if test -s '${STAGING_PARENT}/pkg/${PKG_NAME}'; then \
135 cd '${STAGING_DIR}'; \
136 while read fn; do \
137 rm -f "$$fn"; \
138 done <'${STAGING_PARENT}/pkg/${PKG_NAME}'; \
139 fi
140 @rm -f '${STAGING_PARENT}/pkg/${PKG_NAME}'
141 @cd ${WRKINST}; \
142 find lib \( -name lib\*.so\* -o -name lib\*.a \) \
143 -exec echo 'WARNING: ${PKG_NAME} installs files in /lib -' \
144 ' fix this!' >&2 \; -quit 2>/dev/null; \
145 find usr ! -type d 2>/dev/null | \
146 grep -v -e '^usr/share' -e '^usr/man' -e '^usr/info' | \
147 tee '${STAGING_PARENT}/pkg/${PKG_NAME}' | \
148 cpio -apdlmu '${STAGING_DIR}'
149 @cd '${STAGING_DIR}'; grep 'usr/lib/.*\.la$$' \
150 '${STAGING_PARENT}/pkg/${PKG_NAME}' | while read fn; do \
151 chmod u+w $$fn; \
152 printf '%s\nwq\n' '/^libdir='\''*/s##&${STAGING_DIR}#' | \
153 ed -s $$fn; \
154 done; grep 'usr/s*bin/' '${STAGING_PARENT}/pkg/${PKG_NAME}' | \
155 while read fn; do \
156 b="$$(dd if="$$fn" bs=2 count=1 2>/dev/null)"; \
157 [[ $$b = '#!' ]] || continue; \
158 cp "$$fn" scripts/; \
159 echo "scripts/$$(basename "$$fn")" \
160 >>'${STAGING_PARENT}/pkg/${PKG_NAME}'; \
161 done
162 touch $@
163
164#--- package
165${_IPKGS_COOKIE}:
166 clean=0; \
167 for f in ${ALL_IPKGS}; do \
168 [[ -e $$f ]] && clean=1; \
169 done; \
170 [[ $$clean = 0 ]] || ${MAKE} clean
171 exec ${MAKE} package
172
173package: ${ALL_IPKGS}
174 @cd $(WRKDIR)/fake-${ARCH}; y=; sp=; for x in ${ALL_IDIRS}; do \
175 y="$$y$$sp$${x#$(WRKDIR)/fake-${ARCH}/}"; \
176 sp=' '; \
177 done; ls=; ln=; x=1; [[ -z $$y ]] || \
178 md5sum $$(find $$y -type f) | \
179 while read sum name; do \
180 inode=$$(ls -i "$$name"); \
181 echo "$$sum $${inode%% *} $$name"; \
182 done | sort | while read sum inode name; do \
183 if [[ $$sum = $$ls ]]; then \
184 [[ $$li = $$inode ]] && continue; \
185 case $$x in \
186 1) echo 'WARNING: duplicate files found in' \
187 'package "${PKG_NAME}"! Fix them.' >&2; \
188 echo -n "> $$ln "; \
189 ;; \
190 2) echo -n "> $$ln "; \
191 ;; \
192 3) echo -n ' '; \
193 ;; \
194 esac; \
195 echo -n "$$name"; \
196 x=3; \
197 else \
198 case $$x in \
199 3) echo; \
200 x=2; \
201 ;; \
202 esac; \
203 fi; \
204 ls=$$sum; \
205 ln=$$name; \
206 li=$$inode; \
207 done
208 touch ${_IPKGS_COOKIE}
209
210#--- clean
211clean-targets: clean-dev-generic
212
213clean-dev-generic:
214 @if test -s '${STAGING_PARENT}/pkg/${PKG_NAME}'; then \
215 cd '${STAGING_DIR}'; \
216 while read fn; do \
217 rm -f "$$fn"; \
218 done <'${STAGING_PARENT}/pkg/${PKG_NAME}'; \
219 fi
220 @rm -f '${STAGING_PARENT}/pkg/${PKG_NAME}'
Note: See TracBrowser for help on using the repository browser.