소스 검색

enable xbmc for ibmx40+musl, add system specific dependency for pkgmaker/depmaker, port eudev and rework systemd package (not ready)

Waldemar Brodkorb 10 년 전
부모
커밋
df6e1dfc6d

+ 8 - 2
package/boost/Makefile

@@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk
 
 PKG_NAME:=		boost
 PKG_VERSION:=		1.55.0
-PKG_RELEASE:=		1
+PKG_RELEASE:=		2
 PKG_MD5SUM:=		93780777cfbf999a600f62883bd54b17
 PKG_DESCR:=		boost C++ library
 PKG_SECTION:=		libs
@@ -97,6 +97,12 @@ ifeq (${ADK_PACKAGE_BOOST_WAVE},)
 	CONFIGURE_ARGS+=--without-wave
 endif
 
+ifeq ($(ARCH),x86_64)
+BOOST_ARCH:=	x86
+else
+BOOST_ARCH:=	$(ARCH)
+endif
+
 # some variables for build
 GPP_PATH:=	${STAGING_HOST_DIR}/bin/${GNU_TARGET_NAME}-g++
 GPP_VERSION:=	"`${GPP_PATH} -v 2>&1 | tail -1 | awk '{print $$3}'`"
@@ -128,7 +134,7 @@ endif
 			-sBUILD=release \
 			-d 2 \
 			target-os=linux \
-			architecture=$(CPU_ARCH) \
+			architecture=$(BOOST_ARCH) \
 			binary-format=elf \
 			toolset=gcc-${GPP_VERSION} \
 			--build-type=minimal \

+ 3 - 3
package/bzip2/Makefile

@@ -55,9 +55,9 @@ libbz2-install:
 	$(CP) ${WRKBUILD}/libbz2.so* \
 		${IDIR_LIBBZ2}/usr/lib
 	$(CP) ${WRKBUILD}/libbz2.so* \
-		${STAGING_DIR}/usr/lib
-	(cd ${STAGING_DIR}/usr/lib; ln -sf libbz2.so.1.0.6 libbz2.so)
-	$(CP) $(WRKBUILD)/bzlib.h $(STAGING_DIR)/usr/include
+		${STAGING_TARGET_DIR}/usr/lib
+	(cd ${STAGING_TARGET_DIR}/usr/lib; ln -sf libbz2.so.1.0.6 libbz2.so)
+	$(CP) $(WRKBUILD)/bzlib.h $(STAGING_TARGET_DIR)/usr/include
 	${INSTALL_DIR} $(IDIR_LIBBZ2_DEV)/usr/include
 	$(CP) $(WRKBUILD)/bzlib.h $(IDIR_LIBBZ2_DEV)/usr/include
 

+ 13 - 5
package/bzip2/patches/patch-Makefile-libbz2_so

@@ -1,9 +1,17 @@
 --- bzip2-1.0.6.orig/Makefile-libbz2_so	2010-09-11 01:07:52.000000000 +0200
-+++ bzip2-1.0.6/Makefile-libbz2_so	2014-01-10 21:37:37.000000000 +0100
-@@ -25,6 +25,12 @@ SHELL=/bin/sh
- CC=gcc
++++ bzip2-1.0.6/Makefile-libbz2_so	2014-01-13 14:31:10.000000000 +0100
+@@ -21,10 +21,17 @@
+ # ------------------------------------------------------------------
+ 
+ 
+-SHELL=/bin/sh
+-CC=gcc
++SHELL?=/bin/sh
++CC?=gcc
  BIGFILES=-D_FILE_OFFSET_BITS=64
- CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES)
+-CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES)
++CFLAGS?=
++CFLAGS+=-fpic -fPIC -Wall -Winline $(BIGFILES)
 +OS=$(shell uname)
 +ifeq ($(OS),Darwin)
 +LDOPT=-install_name
@@ -13,7 +21,7 @@
  
  OBJS= blocksort.o  \
        huffman.o    \
-@@ -35,7 +41,7 @@ OBJS= blocksort.o  \
+@@ -35,7 +42,7 @@ OBJS= blocksort.o  \
        bzlib.o
  
  all: $(OBJS)

+ 48 - 0
package/eudev/Makefile

@@ -0,0 +1,48 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=		eudev
+PKG_VERSION:=		1.3
+PKG_RELEASE:=		1
+PKG_MD5SUM:=		164df78f6f0093578a20bdd00335845f
+PKG_DESCR:=		udev device manager
+PKG_SECTION:=		utils
+PKG_URL:=		http://www.gentoo.org/proj/en/eudev/
+PKG_SITES:=		http://dev.gentoo.org/~blueness/eudev/
+PKG_LIBNAME:=		libudev
+PKG_OPTS:=		dev
+
+PKG_SUBPKGS:=		UDEV LIBUDEV LIBGUDEV
+PKGSC_LIBGUDEV:=	libs
+PKGSD_LIBGUDEV:=	GUDEV library
+PKGSC_LIBUDEV:=		libs
+PKGSD_LIBUDEV:=		UDEV library
+PKGSD_UDEV:=		Dynamic device management subsystem
+
+include $(TOPDIR)/mk/package.mk
+
+$(eval $(call PKG_template,UDEV,udev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
+$(eval $(call PKG_template,LIBUDEV,libudev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
+$(eval $(call PKG_template,LIBGUDEV,libgudev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
+
+CONFIGURE_ARGS+=	--disable-manpages \
+			--disable-gtk-doc
+
+udev-install:
+	${INSTALL_DIR} ${IDIR_UDEV}/usr/bin ${IDIR_UDEV}/etc/udev
+	${INSTALL_DIR} ${IDIR_UDEV}/usr/lib/udev
+	${CP} ${WRKINST}/etc/udev/* ${IDIR_UDEV}/etc/udev
+	${CP} ${WRKINST}/usr/lib/udev/* ${IDIR_UDEV}/usr/lib/udev
+	${CP} ${WRKINST}/usr/bin/udevadm ${IDIR_UDEV}/usr/bin
+
+libudev-install:
+	${INSTALL_DIR} ${IDIR_LIBUDEV}/usr/lib
+	$(CP) $(WRKINST)/usr/lib/libudev.so* $(IDIR_LIBUDEV)/usr/lib
+
+libgudev-install:
+	${INSTALL_DIR} ${IDIR_LIBGUDEV}/usr/lib
+	$(CP) $(WRKINST)/usr/lib/libgudev*.so* $(IDIR_LIBGUDEV)/usr/lib
+
+include ${TOPDIR}/mk/pkg-bottom.mk

+ 5 - 1
package/libcec/Makefile

@@ -14,7 +14,9 @@ PKG_URL:=		http://libcec.pulse-eight.com/
 PKG_SITES:=		http://www.openadk.org/distfiles
 PKG_OPTS:=		dev
 
-PKG_SYSTEM_DEPENDS:=    raspberry-pi
+PKG_DEPENDS_RASPBERRY_PI:=	bcm2835-vc
+PKG_BUILDDEP_RASPBERRY_PI:=	bcm2835-vc
+PKG_SYSTEM_DEPENDS:=    raspberry-pi ibm-x40
 PKG_LIBC_DEPENDS:=      eglibc glibc musl
 
 include $(TOPDIR)/mk/package.mk
@@ -22,9 +24,11 @@ include $(TOPDIR)/mk/package.mk
 $(eval $(call PKG_template,LIBCEC,libcec,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
 
 AUTOTOOL_STYLE:=	autoreconf
+ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
 CONFIGURE_ARGS+=	--enable-rpi \
 			--with-rpi-include-path=$(STAGING_TARGET_DIR)/opt/vc/include \
 			--with-rpi-lib-path=$(STAGING_TARGET_DIR)/opt/vc/lib
+endif
 
 libcec-install:
 	$(INSTALL_DIR) $(IDIR_LIBCEC)/usr/lib

+ 11 - 0
package/libcec/patches/patch-src_lib_platform_posix_serialport_cpp

@@ -0,0 +1,11 @@
+--- libcec-2.1.4.orig/src/lib/platform/posix/serialport.cpp	2013-12-15 12:48:14.000000000 +0100
++++ libcec-2.1.4/src/lib/platform/posix/serialport.cpp	2014-01-12 22:04:41.000000000 +0100
+@@ -37,7 +37,7 @@
+ #include "lib/platform/util/baudrate.h"
+ #include "lib/platform/posix/os-socket.h"
+ 
+-#if defined(__APPLE__) || defined(__FreeBSD__)
++#if defined(__APPLE__) || defined(__FreeBSD__) || !defined(__GLIBC__)
+ #ifndef XCASE
+ #define XCASE	0
+ #endif

+ 1 - 1
package/libvirt/Makefile

@@ -9,7 +9,7 @@ PKG_RELEASE:=		2
 PKG_MD5SUM:=		3d9f85d586c9aa3d819b626622f3fc97
 PKG_DESCR:=		virtualization API
 PKG_SECTION:=		libs
-PKG_BUILDDEP:=		libxml2 gnutls python2 libpcap parted systemd
+PKG_BUILDDEP:=		libxml2 gnutls python2 libpcap parted eudev
 PKG_DEPENDS:=		libxml2 libgnutls python2 libpcap libreadline
 PKG_DEPENDS+=		dmidecode kmod-netfilter-xt-target-checksum
 PKG_DEPENDS+=		dnsmasq qemu libnl libudev

+ 8 - 3
package/nasm/Makefile

@@ -4,23 +4,28 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=		nasm
-PKG_VERSION:=		2.07
+PKG_VERSION:=		2.11
 PKG_RELEASE:=		1
-PKG_MD5SUM:=		84d8e009b3d2565a810ab3ddad1f4f63
+PKG_MD5SUM:=		a884450ee65201473af4d270bdc132f8
 PKG_DESCR:=		the netwide assembler
 PKG_SECTION:=		lang
+PKG_BUILDDEP:=		nasm-host
 PKG_URL:=		http://sourceforge.net/projects/nasm/
-PKG_SITES:=		${MASTER_SITE_SOURCEFORGE:=nasm/nasm%20sources/2.07/}
+PKG_SITES:=		http://www.nasm.us/pub/nasm/releasebuilds/${PKG_VERSION}/
 
+include $(TOPDIR)/mk/host.mk
 include $(TOPDIR)/mk/package.mk
 
+$(eval $(call HOST_template,NASM,nasm,$(PKG_VERSION)-${PKG_RELEASE}))
 $(eval $(call PKG_template,NASM,nasm,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 FAKE_FLAGS+=		INSTALLROOT=${WRKINST}
+HOST_STYLE:=		auto
 
 nasm-install:
 	$(INSTALL_DIR) $(IDIR_NASM)/usr/bin
 	$(INSTALL_BIN) $(WRKINST)/usr/bin/nasm \
 		$(IDIR_NASM)/usr/bin
 
+include ${TOPDIR}/mk/host-bottom.mk
 include ${TOPDIR}/mk/pkg-bottom.mk

+ 0 - 2
package/polkit/Makefile

@@ -15,8 +15,6 @@ PKG_URL:=		http://www.freedesktop.org/wiki/Software/polkit/
 PKG_SITES:=		http://openadk.org/distfiles/
 PKG_OPTS:=		dev
 
-PKG_LIBC_DEPENDS:=	eglibc glibc
-
 include $(TOPDIR)/mk/package.mk
 
 $(eval $(call PKG_template,POLKIT,polkit,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))

+ 4 - 31
package/systemd/Makefile

@@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk
 
 PKG_NAME:=		systemd
 PKG_VERSION:=		208
-PKG_RELEASE:=		3
+PKG_RELEASE:=		4
 PKG_MD5SUM:=		df64550d92afbffb4f67a434193ee165
 PKG_DESCR:=		System and Service Manager
 PKG_SECTION:=		utils
@@ -14,28 +14,13 @@ PKG_BUILDDEP:=		autotool usbutils glib kmod util-linux libcap
 PKG_BUILDDEP+=		libgcrypt gperf-host
 PKG_URL:=		http://freedesktop.org/wiki/Software/systemd/
 PKG_SITES:=		http://www.freedesktop.org/software/systemd/
-PKG_LIBNAME:=		libudev
-PKG_OPTS:=		dev
 
 PKG_LIBC_DEPENDS:=	eglibc glibc
-PKG_SUBPKGS:=		UDEV LIBUDEV LIBGUDEV
-PKGSC_LIBGUDEV:=	libs
-PKGSD_LIBGUDEV:=	GUDEV library
-PKGSC_LIBUDEV:=		libs
-PKGSD_LIBUDEV:=		UDEV library
-PKGSD_UDEV:=		Dynamic device management subsystem
-
 DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.xz
 
-ifeq ($(ADK_STATIC),y)
-PKG_OPTS+=		libmix
-endif
-
 include ${TOPDIR}/mk/package.mk
 
-$(eval $(call PKG_template,UDEV,udev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
-$(eval $(call PKG_template,LIBUDEV,libudev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
-$(eval $(call PKG_template,LIBGUDEV,libgudev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
+$(eval $(call PKG_template,SYSTEMD,systemd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 AUTOTOOL_STYLE:=	autoreconf
 TARGET_LDFLAGS+=	-lrt
@@ -45,19 +30,7 @@ CONFIGURE_ARGS+=	--disable-static \
 			--disable-manpages \
 			--disable-polkit
 
-udev-install:
-	${INSTALL_DIR} ${IDIR_UDEV}/usr/bin ${IDIR_UDEV}/etc/udev
-	${INSTALL_DIR} ${IDIR_UDEV}/usr/lib/udev
-	${CP} ${WRKINST}/etc/udev/* ${IDIR_UDEV}/etc/udev
-	${CP} ${WRKINST}/usr/lib/udev/* ${IDIR_UDEV}/usr/lib/udev
-	${CP} ${WRKINST}/usr/bin/udevadm ${IDIR_UDEV}/usr/bin
-
-libudev-install:
-	${INSTALL_DIR} ${IDIR_LIBUDEV}/usr/lib
-	$(CP) $(WRKINST)/usr/lib/libudev.so* $(IDIR_LIBUDEV)/usr/lib
-
-libgudev-install:
-	${INSTALL_DIR} ${IDIR_LIBGUDEV}/usr/lib
-	$(CP) $(WRKINST)/usr/lib/libgudev*.so* $(IDIR_LIBGUDEV)/usr/lib
+# TODO
+systemd-install:
 
 include ${TOPDIR}/mk/pkg-bottom.mk

+ 1 - 3
package/upower/Makefile

@@ -9,13 +9,11 @@ PKG_RELEASE:=		1
 PKG_MD5SUM:=		14f43bc13353e23e7280863f33ac50d2
 PKG_DESCR:=		powermanagement
 PKG_SECTION:=		misc
-PKG_BUILDDEP:=		glib dbus-glib polkit systemd
+PKG_BUILDDEP:=		glib dbus-glib polkit eudev
 PKG_DEPENDS:=		glib dbus-glib polkit libgudev
 PKG_URL:=		http://upower.freedesktop.org/
 PKG_SITES:=		http://upower.freedesktop.org/releases/
 
-PKG_LIBC_DEPENDS:=	eglibc glibc
-
 DISTFILES:=             ${PKG_NAME}-${PKG_VERSION}.tar.xz
 
 include $(TOPDIR)/mk/package.mk

+ 26 - 15
package/xbmc/Makefile

@@ -9,27 +9,30 @@ PKG_RELEASE:=		1
 PKG_MD5SUM:=		7ae385ebf8e5cfcb917393235e6efbdb
 PKG_DESCR:=		software media player
 PKG_SECTION:=		multimedia
-PKG_DEPENDS:=		boost libffmpeg python2 libstdcxx bcm2835-vc
+PKG_DEPENDS:=		boost libffmpeg python2 libstdcxx
 PKG_DEPENDS+=		libglew mesalib libass libmpeg2 libmad dbus
 PKG_DEPENDS+=		libjpeg-turbo libogg libvorbis libmodplug libcurl
 PKG_DEPENDS+=		libflac libopenssl libbz2 libtiff liblzo
 PKG_DEPENDS+=		yajl tinyxml libsqlite libpcrecpp libpng
 PKG_DEPENDS+=		libpcre libcdio libfreetype libsamplerate
 PKG_DEPENDS+=		taglib libjasper libmp3lame libmicrohttpd
-PKG_DEPENDS+=		omxplayer libbluray libgpg-error libudev
+PKG_DEPENDS+=		libbluray libgpg-error libudev
 PKG_DEPENDS+=		libssh libcec libnfs librtmp samba-lib libncurses
 PKG_BUILDDEP:=		autotool boost ffmpeg python2 MesaLib libglew libass
 PKG_BUILDDEP+=		libmpeg2 libmad libjpeg-turbo libogg libvorbis libmodplug
 PKG_BUILDDEP+=		curl flac openssl bzip2 libtiff liblzo yajl
 PKG_BUILDDEP+=		tinyxml sqlite pcre libpng libcdio freetype 
 PKG_BUILDDEP+=		libsamplerate taglib libjasper lame libmicrohttpd
-PKG_BUILDDEP+=		bcm2835-vc libgpg-error libbluray dbus
-PKG_BUILDDEP+=		libssh libcec libnfs samba rtmpdump systemd
+PKG_BUILDDEP+=		libssh libcec libnfs samba rtmpdump eudev
+PKG_BUILDDEP+=		libgpg-error libbluray dbus
 PKG_BUILDDEP+=		swig-host sdl-host sdl-image-host liblzo-host
 PKG_URL:=		http://xbmc.org/
 PKG_SITES:=		http://mirrors.xbmc.org/releases/source/
 
-PKG_SYSTEM_DEPENDS:=	raspberry-pi
+PKG_DEPENDS_RASPBERRY_PI:=	bcm2835-vc omxplayer
+PKG_BUILDDEP_RASPBERRY_PI:=	bcm2835-vc omxplayer
+PKG_BUILDDEP_IBM_X40:=	nasm-host
+PKG_SYSTEM_DEPENDS:=	raspberry-pi ibm-x40
 PKG_LIBC_DEPENDS:=	eglibc glibc musl
 
 WRKDIST=		$(WRKDIR)/$(PKG_NAME)-$(PKG_VERSION)-Frodo
@@ -41,12 +44,15 @@ $(eval $(call PKG_template,XBMC,xbmc,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS
 XAKE_FLAGS+=		V=1 TIXML_USE_STL=1
 XAKE_FLAGS+=		GCC_HONOUR_COPTS=s
 TARGET_CPPFLAGS+=	-I$(STAGING_DIR)/usr/include/boost-1_55 \
-			-DTIXML_USE_STL=1 \
-			-I$(STAGING_DIR)/opt/vc/include \
+			-DTIXML_USE_STL=1
+
+ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
+TARGET_CPPFLAGS+=	-I$(STAGING_DIR)/opt/vc/include \
 			-I$(STAGING_DIR)/opt/vc/include/interface/vcos/pthreads \
 			-I$(STAGING_DIR)/opt/vc/include/interface/vmcs_host/linux
-TARGET_LDFLAGS+=	-L$(STAGING_DIR)/opt/vc/lib -lkhrn_static \
-			-L$(STAGING_DIR)/usr/lib/samba
+TARGET_LDFLAGS+=	-L$(STAGING_DIR)/opt/vc/lib -lkhrn_static
+endif
+
 AUTOTOOL_STYLE:=	autoreconf
 CONFIGURE_ENV+=		DESTDIR='${WRKINST}' \
 			TEXTUREPACKER_NATIVE_ROOT='$(STAGING_HOST_DIR)/usr'
@@ -58,20 +64,25 @@ CONFIGURE_ARGS+=	--disable-optical-drive \
 			--enable-udev \
 			--enable-libbluray \
 			--enable-external-libraries \
-			--enable-player=omxplayer \
-			--enable-gles \
 			--enable-rtmp \
 			--disable-libusb \
 			--disable-libcap \
 			--disable-sdl \
 			--disable-joystick \
 			--disable-dvdcss \
-			--disable-x11 \
-			--disable-debug \
-			--with-platform=raspberry-pi
+			--disable-debug
+
+ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
+CONFIGURE_ARGS+=	--with-platform=raspberry-pi \
+			--enable-player=omxplayer \
+			--enable-gles \
+			--disable-x11
+else
+CONFIGURE_ARGS+=	--enable-x11
+endif
 
 pre-configure:
-	(cd $(WRKBUILD)/lib/cpluff && ./autogen.sh)
+	(cd $(WRKBUILD)/lib/cpluff && env PATH=$(AUTOTOOL_PATH) ./autogen.sh)
 
 xbmc-install:
 	$(INSTALL_DIR) $(IDIR_XBMC)/usr/lib/xbmc

+ 1 - 1
package/xf86-input-evdev/Makefile

@@ -10,7 +10,7 @@ PKG_MD5SUM:=		2d3f7111b8284cec81884023c4bb4a11
 PKG_DESCR:=		X11 driver for Event driver
 PKG_SECTION:=		x11/drivers
 PKG_DEPENDS:=		xorg-server kmod-input-evdev libudev
-PKG_BUILDDEP:=		xorg-server systemd
+PKG_BUILDDEP:=		xorg-server eudev
 PKG_SITES:=		${MASTER_SITE_XORG}
 
 PKG_LIBC_DEPENDS:=	eglibc glibc

+ 1 - 1
package/xf86-video-ati/Makefile

@@ -9,7 +9,7 @@ PKG_RELEASE:=		1
 PKG_MD5SUM:=		6bb71cff9ad9c5c7b258b2b6c56fdc95
 PKG_DESCR:=		X11 driver for ATI VGA chip
 PKG_SECTION:=		x11/drivers
-PKG_BUILDDEP:=		xorg-server libdrm xf86driproto MesaLib systemd
+PKG_BUILDDEP:=		xorg-server libdrm xf86driproto MesaLib eudev
 PKG_DEPENDS:=		xorg-server libdrm mesalib libudev
 PKG_SITES:=		${MASTER_SITE_XORG}
 PKG_NEED_CXX:=		1

+ 39 - 17
tools/adk/depmaker.c

@@ -1,7 +1,7 @@
 /*
  * depmaker - create package/Depends.mk for OpenADK buildsystem
  *
- * Copyright (C) 2010,2011 Waldemar Brodkorb <wbx@openadk.org>
+ * Copyright (C) 2010-2014 Waldemar Brodkorb <wbx@openadk.org>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -64,7 +64,7 @@ static int check_symbol(char *symbol) {
 }
 
 /*@null@*/
-static char *parse_line(char *package, char *pkgvar, char *string, int checksym, int pprefix) {
+static char *parse_line(char *package, char *pkgvar, char *string, int checksym, int pprefix, int system) {
 
 	char *key, *value, *dep, *key_sym, *pkgdeps;
 	char temp[MAXLINE];
@@ -83,15 +83,20 @@ static char *parse_line(char *package, char *pkgvar, char *string, int checksym,
 			perror("Can not allocate memory.");
 			exit(EXIT_FAILURE);
 		}
-		if (pprefix == 0) {
-			if (snprintf(key_sym, MAXLINE, "ADK_PACKAGE_%s_", pkgvar) < 0)
-				perror("Can not create string variable.");
+		if (system == 0) {
+			if (pprefix == 0) {
+				if (snprintf(key_sym, MAXLINE, "ADK_PACKAGE_%s_", pkgvar) < 0)
+					perror("Can not create string variable.");
+			} else {
+				if (snprintf(key_sym, MAXLINE, "ADK_PACKAGE_") < 0)
+					perror("Can not create string variable.");
+			}
+			strncat(key_sym, key+6, strlen(key)-6);
 		} else {
-			if (snprintf(key_sym, MAXLINE, "ADK_PACKAGE_") < 0)
-				perror("Can not create string variable.");
+			if (snprintf(key_sym, MAXLINE, "ADK_TARGET_SYSTEM_%s", pkgvar) < 0)
+					perror("Can not create string variable.");
 		}
 			
-		strncat(key_sym, key+6, strlen(key)-6);
 		if (check_symbol(key_sym) != 0) {
 			free(key_sym);
 			return(NULL);
@@ -130,7 +135,8 @@ int main() {
 	FILE *pkg;
 	char buf[MAXLINE];
 	char path[MAXPATH];
-	char *string, *pkgvar, *pkgdeps, *tmp, *fpkg, *cpkg, *spkg, *key, *check;
+	char *string, *pkgvar, *pkgdeps, *tmp, *fpkg, *cpkg, *spkg, *key, *check, *dpkg;
+	char *stringtmp;
 	int i;
 	
 	/* read Makefile's for all packages */
@@ -160,6 +166,7 @@ int main() {
 				!(strncmp(pkgdirp->d_name, "libpthread", 10) == 0 && strlen(pkgdirp->d_name) == 10) &&
 				!(strncmp(pkgdirp->d_name, "uclibc++", 8) == 0) &&
 				!(strncmp(pkgdirp->d_name, "uclibc", 6) == 0) &&
+				!(strncmp(pkgdirp->d_name, "musl", 4) == 0) &&
 				!(strncmp(pkgdirp->d_name, "glibc", 5) == 0)) {
 				/* print result to stdout */
 				printf("package-$(ADK_COMPILE_%s) += %s\n", pkgvar, pkgdirp->d_name); 
@@ -187,7 +194,7 @@ int main() {
 
 					string = strstr(buf, "PKG_BUILDDEP:=");
 					if (string != NULL) {
-						tmp = parse_line(pkgdirp->d_name, pkgvar, string, 0, 0);
+						tmp = parse_line(pkgdirp->d_name, pkgvar, string, 0, 0, 0);
 						if (tmp != NULL) {
 							strncat(pkgdeps, tmp, strlen(tmp));
 						}
@@ -195,12 +202,27 @@ int main() {
 
 					string = strstr(buf, "PKG_BUILDDEP+=");
 					if (string != NULL) {
-						tmp = parse_line(pkgdirp->d_name, pkgvar, string, 0, 0);
+						tmp = parse_line(pkgdirp->d_name, pkgvar, string, 0, 0, 0);
 						if (tmp != NULL)
 							strncat(pkgdeps, tmp, strlen(tmp));
 					}
 
-					// WE need to find the subpackage name here
+					// We need to find the system name here
+					string = strstr(buf, "PKG_BUILDDEP_");
+					if (string != NULL) {
+						check = strstr(buf, ":=");
+						if (check != NULL) {
+							stringtmp = strdup(string);
+							string[strlen(string)-1] = '\0';
+							key = strtok(string, ":=");
+							dpkg = strdup(key+13);
+							tmp = parse_line(pkgdirp->d_name, dpkg, stringtmp, 1, 0, 1);
+							if (tmp != NULL)
+								strncat(pkgdeps, tmp, strlen(tmp));
+						}
+					}
+
+					// We need to find the subpackage name here
 					string = strstr(buf, "PKG_FLAVOURS_");
 					if (string != NULL) {
 						check = strstr(buf, ":=");
@@ -213,12 +235,12 @@ int main() {
 
 					string = strstr(buf, "PKGFB_");
 					if (string != NULL) {
-						tmp = parse_line(pkgdirp->d_name, fpkg, string, 1, 0);
+						tmp = parse_line(pkgdirp->d_name, fpkg, string, 1, 0, 0);
 						if (tmp != NULL)
 							strncat(pkgdeps, tmp, strlen(tmp));
 					}
 
-					// WE need to find the subpackage name here
+					// We need to find the subpackage name here
 					string = strstr(buf, "PKG_CHOICES_");
 					if (string != NULL) {
 						check = strstr(buf, ":=");
@@ -230,12 +252,12 @@ int main() {
 					}
 					string = strstr(buf, "PKGCB_");
 					if (string != NULL) {
-						tmp = parse_line(pkgdirp->d_name, cpkg, string, 1, 0);
+						tmp = parse_line(pkgdirp->d_name, cpkg, string, 1, 0, 0);
 						if (tmp != NULL)
 							strncat(pkgdeps, tmp, strlen(tmp));
 					}
 
-					// WE need to find the subpackage name here
+					// We need to find the subpackage name here
 					string = strstr(buf, "PKG_SUBPKGS_");
 					if (string != NULL) {
 						check = strstr(buf, ":=");
@@ -248,7 +270,7 @@ int main() {
 
 					string = strstr(buf, "PKGSB_");
 					if (string != NULL) {
-						tmp = parse_line(pkgdirp->d_name, spkg, string, 1, 1);
+						tmp = parse_line(pkgdirp->d_name, spkg, string, 1, 1, 0);
 						if (tmp != NULL) {
 							strncat(pkgdeps, tmp, strlen(tmp));
 						}

+ 66 - 3
tools/adk/pkgmaker.c

@@ -1,7 +1,7 @@
 /*
  * pkgmaker - create package meta-data for OpenADK buildsystem
  *
- * Copyright (C) 2010-2013 Waldemar Brodkorb <wbx@openadk.org>
+ * Copyright (C) 2010-2014 Waldemar Brodkorb <wbx@openadk.org>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -111,6 +111,53 @@ static int parse_var(char *buf, const char *varname, char *pvalue, char **result
 	return(1);
 }
 
+static int parse_var_with_system(char *buf, const char *varname, char *pvalue, char **result, char **sysname, int varlen) {
+
+	char *pkg_var, *check;
+	char *key, *value, *string;
+
+	if ((pkg_var = malloc(MAXLINE)) != NULL)
+		memset(pkg_var, 0, MAXLINE);
+	else {
+		perror("Can not allocate memory");
+		exit(EXIT_FAILURE);
+	}
+
+	check = strstr(buf, ":=");
+	if (check != NULL) {
+		string = strstr(buf, varname);
+		if (string != NULL) {
+			string[strlen(string)-1] = '\0';
+			key = strtok(string, ":=");
+			*sysname = strdup(key+varlen);
+			value = strtok(NULL, "=\t");
+			if (value != NULL) {
+				strncat(pkg_var, value, strlen(value));
+				*result = strdup(pkg_var);
+			}
+			free(pkg_var);
+			return(0);
+		}
+	} else {
+		string = strstr(buf, varname);
+		if (string != NULL) {
+			string[strlen(string)-1] = '\0';
+			key = strtok(string, "+=");
+			value = strtok(NULL, "=\t");
+			if (pvalue != NULL)
+				strncat(pkg_var, pvalue, strlen(pvalue));
+			strncat(pkg_var, " ", 1);
+			if (value != NULL)
+				strncat(pkg_var, value, strlen(value));
+			*result = strdup(pkg_var);
+			free(pkg_var);
+			return(0);
+		}
+	}
+	free(pkg_var);
+	return(1);
+}
+
 static int parse_var_with_pkg(char *buf, const char *varname, char *pvalue, char **result, char **pkgname, int varlen) {
 
 	char *pkg_var, *check;
@@ -268,9 +315,9 @@ int main() {
 	char dir[MAXPATH];
 	char variable[2*MAXVAR];
 	char *key, *value, *token, *cftoken, *sp, *hkey, *val, *pkg_fd;
-	char *pkg_name, *pkg_depends, *pkg_section, *pkg_descr, *pkg_url;
+	char *pkg_name, *pkg_depends, *pkg_depends_system, *pkg_section, *pkg_descr, *pkg_url;
 	char *pkg_cxx, *pkg_subpkgs, *pkg_cfline, *pkg_dflt, *pkg_multi;
-	char *pkg_need_cxx, *pkg_need_java, *pkgname, *pkg_debug;
+	char *pkg_need_cxx, *pkg_need_java, *pkgname, *sysname, *pkg_debug;
 	char *pkg_libc_depends, *pkg_host_depends, *pkg_system_depends, *pkg_arch_depends, *pkg_flavours, *pkg_flavours_string, *pkg_choices, *pseudo_name;
 	char *packages, *pkg_name_u, *pkgs, *pkg_opts, *pkg_libname;
 	char *saveptr, *p_ptr, *s_ptr, *pkg_helper;
@@ -282,6 +329,7 @@ int main() {
 	pkg_section = NULL;
 	pkg_url = NULL;
 	pkg_depends = NULL;
+	pkg_depends_system = NULL;
 	pkg_opts = NULL;
 	pkg_libname = NULL;
 	pkg_flavours = NULL;
@@ -299,6 +347,7 @@ int main() {
 	pkg_need_cxx = NULL;
 	pkg_need_java = NULL;
 	pkgname = NULL;
+	sysname = NULL;
 	pkg_helper = NULL;
 	pkg_debug = NULL;
 
@@ -463,6 +512,8 @@ int main() {
 						continue;
 					if ((parse_var(buf, "PKG_DEPENDS", pkg_depends, &pkg_depends)) == 0)
 						continue;
+					if ((parse_var_with_system(buf, "PKG_DEPENDS_", pkg_depends_system, &pkg_depends_system, &sysname, 12)) == 0)
+						continue;
 					if ((parse_var(buf, "PKG_LIBNAME", pkg_libname, &pkg_libname)) == 0) 
 						continue;
 					if ((parse_var(buf, "PKG_OPTS", pkg_opts, &pkg_opts)) == 0)
@@ -517,6 +568,8 @@ int main() {
 				fprintf(stderr, "Package description is %s\n", pkg_descr);
 			if (pkg_depends != NULL)
 				fprintf(stderr, "Package dependencies are %s\n", pkg_depends);
+			if (pkg_depends_system != NULL)
+				fprintf(stderr, "Package systemspecific dependencies are %s\n", pkg_depends_system);
 			if (pkg_subpkgs != NULL)
 				fprintf(stderr, "Package subpackages are %s\n", pkg_subpkgs);
 			if (pkg_flavours != NULL && pkgname != NULL)
@@ -782,6 +835,16 @@ int main() {
 					free(pkg_depends);
 					pkg_depends = NULL;
 				}
+				/* create system specific package dependency information */
+				if (pkg_depends_system != NULL) {
+					token = strtok(pkg_depends_system, " ");
+					while (token != NULL) {
+						fprintf(cfg, "\tselect ADK_PACKAGE_%s if ADK_TARGET_SYSTEM_%s\n", toupperstr(token), sysname);
+						token = strtok(NULL, " ");
+					}
+					free(pkg_depends_system);
+					pkg_depends_system = NULL;
+				}
 
 				if (pkg_need_cxx != NULL) {
 					fprintf(cfg, "\tdepends on ADK_TOOLCHAIN_GCC_CXX\n");