1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
6 TCFLAGS
:= ${TARGET_CFLAGS}
7 TCXXFLAGS
:= ${TARGET_CFLAGS}
8 TCPPFLAGS
:= ${TARGET_CPPFLAGS}
12 TLDFLAGS
:= ${TARGET_LDFLAGS} -Wl
,-rpath
-Wl
,/usr
/lib \
13 -Wl
,-rpath-link
-Wl
,${STAGING_DIR}/usr
/lib \
14 -L
${STAGING_DIR}/lib
-L
${STAGING_DIR}/usr
/lib
16 CONFIGURE_ARGS
+= --enable-debug
18 CONFIGURE_ARGS
+= --disable-debug
21 CONFIGURE_ARGS
+= --enable-ipv6
23 CONFIGURE_ARGS
+= --disable-ipv6
26 ifeq ($(ADK_NATIVE
),y
)
27 CONFIG_SHELL
='$(strip ${SHELL})'
29 CONFIGURE_ENV
+= ${TARGET_CONFIGURE_OPTS} \
30 ${HOST_CONFIGURE_OPTS} \
31 CC
='${TARGET_CC}' CXX
='${TARGET_CXX}' \
32 CFLAGS
='$(strip ${TCFLAGS})' \
33 CXXFLAGS
='$(strip ${TCXXFLAGS})' \
34 CPPFLAGS
='$(strip ${TCPPFLAGS})' \
35 LDFLAGS
='$(strip ${TLDFLAGS})' \
36 PKG_CONFIG_PATH
='${STAGING_DIR}/usr/lib/pkgconfig' \
37 PKG_CONFIG_LIBDIR
=/dev
/null \
38 CONFIG_SHELL
='$(strip ${SHELL})' \
39 ac_cv_func_realloc_0_nonnull
=yes \
40 ac_cv_func_malloc_0_nonnull
=yes
43 # this is environment for 'make all' and 'make install'
45 # this is arguments for 'make all' and 'make install'
47 # this is arguments for 'make all' ONLY
49 # this is arguments for 'make install' ONLY
52 INSTALL_TARGET?
= install
53 ifeq ($(ADK_NATIVE
),y
)
55 WRKDIR
='${WRKDIR}' WRKDIST
='${WRKDIST}' \
56 WRKSRC
='${WRKSRC}' WRKBUILD
='${WRKBUILD}'
58 MAKE_ENV
+= PATH
='${TARGET_PATH}' \
59 ${HOST_CONFIGURE_OPTS} \
60 WRKDIR
='${WRKDIR}' WRKDIST
='${WRKDIST}' \
61 WRKSRC
='${WRKSRC}' WRKBUILD
='${WRKBUILD}' \
62 PKG_CONFIG_PATH
='${STAGING_DIR}/usr/lib/pkgconfig' \
63 PKG_CONFIG_LIBDIR
=/dev
/null \
64 CC
='${TARGET_CC}' CXX
='${TARGET_CXX}' \
65 AR
='${TARGET_CROSS}ar' RANLIB
='${TARGET_CROSS}ranlib' \
66 NM
='${TARGET_CROSS}nm' \
67 CFLAGS
='$(strip ${TCFLAGS})' \
68 CXXFLAGS
='$(strip ${TCXXFLAGS})' \
69 CPPFLAGS
='$(strip ${TCPPFLAGS})' \
70 LDFLAGS
='$(strip ${TLDFLAGS})'
72 MAKE_FLAGS
+= ${XAKE_FLAGS}
73 FAKE_FLAGS
+= ${XAKE_FLAGS}
75 ifeq ($(strip ${WRKDIR_BSD}),)
76 WRKDIR_BASE
:= ${BUILD_DIR}
78 WRKDIR_BASE
:= $(shell pwd
)
81 _EXTRACT_COOKIE
= ${WRKDIST}/.extract_done
82 _PATCH_COOKIE
= ${WRKDIST}/.prepared
83 _CONFIGURE_COOKIE
= ${WRKBUILD}/.configure_done
84 _BUILD_COOKIE
= ${WRKBUILD}/.build_done
85 _FAKE_COOKIE
= ${WRKINST}/.fake_done
86 _IPKGS_COOKIE
= ${PACKAGE_DIR}/.stamps
/${PKG_NAME}\x01${PKG_VERSION}-${PKG_RELEASE}
89 include ${TOPDIR}/mk
/buildhlp.mk
92 # defined in buildhlp.mk ('extract' can fail, use 'patch' then)
93 extract
: ${_EXTRACT_COOKIE}
94 patch
: ${_PATCH_COOKIE}
96 # defined below (will be moved to pkg-bottom.mk!)
97 configure
: ${_CONFIGURE_COOKIE}
98 build
: ${_BUILD_COOKIE}
101 # our recursive build entry point
102 build-all-ipkgs
: ${_IPKGS_COOKIE}
104 # there are some parameters to the PKG_template function
105 # 1.) Config.in identifier ADK_PACKAGE_$(1)
106 # 2.) name of the package, for single package mostly $(PKG_NAME)
107 # 3.) package version (upstream version) and package release (adk version),
108 # always $(PKG_VERSION)-$(PKG_RELEASE)
109 # 4.) dependencies to other packages, $(PKG_DEPENDS)
110 # 5.) description for the package, $(PKG_DESCR)
111 # 6.) section of the package, $(PKG_SECTION)
112 # 7.) special package options
113 # noscripts -> do not install scripts to $(STAGING_DIR)/target/scripts
114 # (needed for example for autoconf/automake)
115 # noremove -> do not remove files from $(STAGING_DIR)/target while
116 # cleaning (needed for toolchain packages like glibc/eglibc)
117 # should be package format independent and modular in the future
119 IPKG_
$(1)= $(PACKAGE_DIR
)/$(2)_
$(3)_
${CPU_ARCH}.ipk
120 IDIR_
$(1)= $(WRKDIR
)/fake-
${CPU_ARCH}/ipkg-
$(2)
121 ifneq (${ADK_PACKAGE_
$(1)}${DEVELOPER},)
122 ALL_IPKGS
+= $$(IPKG_
$(1))
123 ALL_IDIRS
+= $${IDIR_
$(1)}
125 INFO_
$(1)= $(IPKG_STATE_DIR
)/info/$(2).list
127 ifeq ($(ADK_PACKAGE_
$(1)),y
)
128 install-targets
: $$(INFO_
$(1))
131 IDEPEND_
$(1):= $$(strip $(4))
133 _ALL_CONTROLS
+= $$(IDIR_
$(1))/CONTROL
/control
134 ICONTROL_
$(1)?
= $(WRKDIR
)/.
$(2).control
135 $$(IDIR_
$(1))/CONTROL
/control
: ${_PATCH_COOKIE}
136 @echo
"Package: $(2)" > $(WRKDIR
)/.
$(2).control
137 @echo
"Section: $(6)" >> $(WRKDIR
)/.
$(2).control
138 @echo
"Description: $(5)" >> $(WRKDIR
)/.
$(2).control
139 ${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh
$${IDIR_
$(1)} $${ICONTROL_
$(1)} $(3) ${CPU_ARCH}
140 @adeps
='$$(strip $${IDEPEND_$(1)})'; if
[[ -n
$$$$adeps ]]; then \
144 for dep in
$$$$adeps; do \
145 if
[[ $$$$last = kernel
&& $$$$dep = \
(* ]]; then \
146 deps
="$$$$deps $$$$dep"; \
148 deps
="$$$$deps$$$$comma$$$$dep"; \
153 echo
"Depends: $$$$deps" >>$${IDIR_
$(1)}/CONTROL
/control
; \
155 @for file in conffiles preinst postinst prerm postrm
; do \
156 [ ! -f .
/files
/$(2).
$$$$file ] || cp .
/files
/$(2).
$$$$file $$(IDIR_
$(1))/CONTROL
/$$$$file; \
159 $$(IPKG_
$(1)): $$(IDIR_
$(1))/CONTROL
/control
$${_FAKE_COOKIE}
161 $${RSTRIP} $${IDIR_
$(1)} $(MAKE_TRACE
)
163 @for file in
$$$$(ls .
/files
/*.init
2>/dev
/null
); do \
164 fname
=$$$$(echo
$$$$file| sed
-e
"s#.*/##" -e
"s#.init##"); \
165 check=$$$$(grep PKG
$$$$file|cut
-d
' ' -f
2); \
166 if
[ "$$$$check" == $(2) ];then \
167 mkdir
-p
$$(IDIR_
$(1))/etc
/init.d
&& cp
$$$$file $$(IDIR_
$(1))/etc
/init.d
/$$$$fname; \
170 @cd
$${IDIR_
$(1)}; for script in etc
/init.d
/*; do \
171 [[ -e
$$$$script ]] || continue
; \
172 chmod
0755 "$$$$script"; \
174 @mkdir
-p
$${PACKAGE_DIR} '$${STAGING_PARENT}/pkg' \
175 '$${STAGING_DIR}/scripts'
176 ifneq ($(strip $(7)),noremove
)
177 echo
"Calling from package.mk"
178 if
test -s
'$${STAGING_PARENT}/pkg/$(1)'; then \
179 cd
'$${STAGING_DIR}'; \
182 done
<'$${STAGING_PARENT}/pkg/$(1)'; \
185 @
rm -f
'$${STAGING_PARENT}/pkg/$(1)'
187 x
=$$$$(find tmp var
-mindepth
1 2>/dev
/null
); if
[[ -n
$$$$x ]]; then \
188 echo
'WARNING: $${IPKG_$(1)} installs files into a' \
189 'ramdisk location:' >&2; \
190 echo
"$$$$x" | sed
's/^/- /' >&2; \
192 if
[ "${PKG_NAME}" != "uClibc" -a
"${PKG_NAME}" != "glibc" -a
"${PKG_NAME}" != "libpthread" -a
"${PKG_NAME}" != "libstdcxx" -a
"${PKG_NAME}" != "libthread-db" ];then \
193 find lib \
( -name lib\
*.so\
* -o
-name lib\
*.a \
) \
194 -exec echo
'WARNING: $${IPKG_$(1)} installs files in /lib -' \
195 ' fix this!' >&2 \
; -quit
2>/dev
/null
; fi
; \
196 find usr
! -type d
2>/dev
/null | \
197 grep
-v
-e
'^usr/share' -e
'^usr/man' -e
'^usr/info' | \
198 tee
'$${STAGING_PARENT}/pkg/$(1)' | \
199 cpio
-apdlmu
--quiet
'$${STAGING_DIR}'
200 cd
'$${STAGING_DIR}'; grep
'usr/lib/.*\.la$$$$' \
201 '$${STAGING_PARENT}/pkg/$(1)' | while read fn
; do \
203 $(SED
) "s,\(^libdir='\| \|-L\|^dependency_libs='\)/usr/lib,\1$(STAGING_DIR)/usr/lib,g" $$fn; \
204 done
; grep
'usr/s*bin/' '$${STAGING_PARENT}/pkg/$(1)' | \
206 b
="$$$$(dd if="$$$$fn" bs=2 count=1 2>/dev/null)"; \
207 [[ $$$$b = '#!' ]] || continue
; \
208 cp
"$$$$fn" scripts
/; \
209 echo
"scripts/$$$$(basename "$$$$fn")" \
210 >>'$${STAGING_PARENT}/pkg/$(1)'; \
212 $${IPKG_BUILD} $${IDIR_
$(1)} $${PACKAGE_DIR} $(MAKE_TRACE
)
214 clean-targets
: clean-dev-
$(1)
217 ifneq ($(strip $(7)),noremove
)
218 echo
"Calling from package.mk clean-dev"
219 if
test -s
'$${STAGING_PARENT}/pkg/$(1)'; then \
220 cd
'$${STAGING_DIR}'; \
223 done
<'$${STAGING_PARENT}/pkg/$(1)'; \
226 @
rm -f
'$${STAGING_PARENT}/pkg/$(1)'
228 $$(INFO_
$(1)): $$(IPKG_
$(1))
229 $(IPKG
) install $$(IPKG_
$(1))
234 @
$(CMD_TRACE
) "installing... "
235 @
$(MAKE
) install-targets
$(MAKE_TRACE
)
239 @
$(CMD_TRACE
) "cleaning... "
240 @
$(MAKE
) clean-targets
$(MAKE_TRACE
)
241 rm -rf
${WRKDIR} ${ALL_IPKGS} ${PACKAGE_DIR}/.stamps
/${PKG_NAME}\x01*
244 rm -f
${FULLDISTFILES}
246 .PHONY
: all refetch extract patch configure \
247 build fake package
install clean build-all-ipkgs