summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2014-01-13 16:17:44 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2014-01-13 16:17:44 +0100
commitdf6e1dfc6d23ae8b46f7da64e07e5a1e06460d12 (patch)
tree5a39899727de49e22fbd2554222f9174234482df /tools
parent7bd70b733a54b6d1d26fd0f570328c95cc4858ef (diff)
enable xbmc for ibmx40+musl, add system specific dependency for pkgmaker/depmaker, port eudev and rework systemd package (not ready)
Diffstat (limited to 'tools')
-rw-r--r--tools/adk/depmaker.c56
-rw-r--r--tools/adk/pkgmaker.c69
2 files changed, 105 insertions, 20 deletions
diff --git a/tools/adk/depmaker.c b/tools/adk/depmaker.c
index a2291e4b0..a80a0b02f 100644
--- a/tools/adk/depmaker.c
+++ b/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));
}
diff --git a/tools/adk/pkgmaker.c b/tools/adk/pkgmaker.c
index d00e7302f..3609691b6 100644
--- a/tools/adk/pkgmaker.c
+++ b/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");