From 0eb32a8e2e000218959606af4a54a55fc4598eea Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 28 Sep 2014 10:21:53 +0200 Subject: fix perl cross-compile and some modules on Darwin host --- package/adk-helper/src/ptgen.c | 232 ----------------------------------- package/alsa-lib/Makefile | 4 +- package/logitechmediaserver/Makefile | 2 +- package/mpdbox/Makefile | 6 +- package/p5-audio-scan/Makefile | 2 + package/p5-dbd-sqlite/Makefile | 4 +- package/p5-dbi/Makefile | 9 ++ package/perl/Makefile | 17 ++- 8 files changed, 31 insertions(+), 245 deletions(-) delete mode 100644 package/adk-helper/src/ptgen.c (limited to 'package') diff --git a/package/adk-helper/src/ptgen.c b/package/adk-helper/src/ptgen.c deleted file mode 100644 index f91aac84f..000000000 --- a/package/adk-helper/src/ptgen.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * ptgen - partition table generator - * Copyright (C) 2006 by Felix Fietkau - * - * uses parts of afdisk - * Copyright (C) 2002 by David Roetzel - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#if __BYTE_ORDER == __BIG_ENDIAN -#define cpu_to_le16(x) ((((x) & 0xff) << 8) | ((x) >> 8)) -#elif __BYTE_ORDER == __LITTLE_ENDIAN -#define cpu_to_le16(x) (x) -#else -#error unknown endianness! -#endif - -/* Partition table entry */ -struct pte { - unsigned char active; - unsigned char chs_start[3]; - unsigned char type; - unsigned char chs_end[3]; - unsigned int start; - unsigned int length; -}; - -struct partinfo { - unsigned long size; - int type; -}; - -int verbose = 0; -int active = 1; -int heads = -1; -int sectors = -1; -int kb_align = 0; -struct partinfo parts[4]; -char *filename = NULL; - - -/* - * parse the size argument, which is either - * a simple number (K assumed) or - * K, M or G - * - * returns the size in KByte - */ -static long to_kbytes(const char *string) { - int exp = 0; - long result; - char *end; - - result = strtoul(string, &end, 0); - switch (tolower(*end)) { - case 'k' : - case '\0' : exp = 0; break; - case 'm' : exp = 1; break; - case 'g' : exp = 2; break; - default: return 0; - } - - if (*end) - end++; - - if (*end) { - fprintf(stderr, "garbage after end of number\n"); - return 0; - } - - /* result: number + 1024^(exp) */ - return result * ((2 << ((10 * exp) - 1)) ?: 1); -} - -/* convert the sector number into a CHS value for the partition table */ -static void to_chs(long sect, unsigned char chs[3]) { - int c,h,s; - - s = (sect % sectors) + 1; - sect = sect / sectors; - h = sect % heads; - sect = sect / heads; - c = sect; - - chs[0] = h; - chs[1] = s | ((c >> 2) & 0xC0); - chs[2] = c & 0xFF; - - return; -} - -/* round the sector number up to the next cylinder */ -static inline unsigned long round_to_cyl(long sect) { - int cyl_size = heads * sectors; - - return sect + cyl_size - (sect % cyl_size); -} - -/* round the sector number up to the kb_align boundary */ -static inline unsigned long round_to_kb(long sect) { - return ((sect - 1) / kb_align + 1) * kb_align; -} - -/* check the partition sizes and write the partition table */ -static int gen_ptable(int nr) -{ - struct pte pte[4]; - unsigned long sect = 0; - int i, fd, ret = -1, start, len; - - memset(pte, 0, sizeof(struct pte) * 4); - for (i = 0; i < nr; i++) { - if (!parts[i].size) { - fprintf(stderr, "Invalid size in partition %d!\n", i); - return -1; - } - pte[i].active = ((i + 1) == active) ? 0x80 : 0; - pte[i].type = parts[i].type; - start = sect + sectors; - if (kb_align != 0) - start = round_to_kb(start); - pte[i].start = cpu_to_le16(start); - sect = start + parts[i].size * 2; - if (kb_align == 0) - sect = round_to_cyl(sect); - pte[i].length = cpu_to_le16(len = sect - start); - to_chs(start, pte[i].chs_start); - to_chs(start + len - 1, pte[i].chs_end); - if (verbose) - fprintf(stderr, "Partition %d: start=%ld, end=%ld, size=%ld\n", i, (long) start * 512, ((long) start + (long) len) * 512, (long) len * 512); - } - - if ((fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644)) < 0) { - fprintf(stderr, "Can't open output file '%s'\n",filename); - return -1; - } - - lseek(fd, 446, SEEK_SET); - if (write(fd, pte, sizeof(struct pte) * 4) != sizeof(struct pte) * 4) { - fprintf(stderr, "write failed.\n"); - goto fail; - } - lseek(fd, 510, SEEK_SET); - if (write(fd, "\x55\xaa", 2) != 2) { - fprintf(stderr, "write failed.\n"); - goto fail; - } - - ret = 0; -fail: - close(fd); - return ret; -} - -static void usage(char *prog) -{ - fprintf(stderr, "Usage: %s [-v] -h -s -o [-a 0..4] [-l ] [[-t ] -p ...] \n", prog); - exit(1); -} - -int main (int argc, char **argv) -{ - char type = 0x83; - int ch; - int part = 0; - - while ((ch = getopt(argc, argv, "h:s:p:a:t:o:vl:")) != -1) { - switch (ch) { - case 'o': - filename = optarg; - break; - case 'v': - verbose++; - break; - case 'h': - heads = (int) strtoul(optarg, NULL, 0); - break; - case 's': - sectors = (int) strtoul(optarg, NULL, 0); - break; - case 'p': - if (part > 3) { - fprintf(stderr, "Too many partitions\n"); - exit(1); - } - parts[part].size = to_kbytes(optarg); - parts[part++].type = type; - break; - case 't': - type = (char) strtoul(optarg, NULL, 16); - break; - case 'a': - active = (int) strtoul(optarg, NULL, 0); - if ((active < 0) || (active > 4)) - active = 0; - break; - case 'l': - kb_align = (int) strtoul(optarg, NULL, 0) * 2; - break; - case '?': - default: - usage(argv[0]); - } - } - argc -= optind; - if (argc || (heads <= 0) || (sectors <= 0) || !filename) - usage(argv[0]); - - return gen_ptable(part); -} diff --git a/package/alsa-lib/Makefile b/package/alsa-lib/Makefile index 6461e02f4..dd5e9a3b2 100644 --- a/package/alsa-lib/Makefile +++ b/package/alsa-lib/Makefile @@ -5,7 +5,7 @@ include ${ADK_TOPDIR}/rules.mk PKG_NAME:= alsa-lib PKG_VERSION:= 1.0.28 -PKG_RELEASE:= 3 +PKG_RELEASE:= 4 PKG_MD5SUM:= c9e21b88a2b3e6e12ea7ba0f3b271fc3 PKG_DESCR:= sound library PKG_SECTION:= libs/audio @@ -34,7 +34,7 @@ CONFIGURE_ARGS+= --disable-python alsa-lib-install: ${INSTALL_DIR} ${IDIR_ALSA_LIB}/usr/lib ${IDIR_ALSA_LIB}/usr/share/alsa ${CP} ${WRKINST}/usr/lib/libasound.so* ${IDIR_ALSA_LIB}/usr/lib - ${CP} ${WRKINST}/usr/share/alsa/* ${IDIR_ALSA_LIB}/usr/share/alsa + ${CP} ${WRKINST}/usr/share/alsa/alsa.conf ${IDIR_ALSA_LIB}/usr/share/alsa include ${ADK_TOPDIR}/mk/host-bottom.mk include ${ADK_TOPDIR}/mk/pkg-bottom.mk diff --git a/package/logitechmediaserver/Makefile b/package/logitechmediaserver/Makefile index 6d118f4e0..daafeefb0 100644 --- a/package/logitechmediaserver/Makefile +++ b/package/logitechmediaserver/Makefile @@ -11,7 +11,7 @@ PKG_DESCR:= popular media server PKG_SECTION:= mm/audio PKG_DEPENDS:= perl p5-xml-parser p5-dbi p5-ev p5-html-parser PKG_DEPENDS+= p5-json-xs p5-digest-sha1 p5-yaml-xs p5-sub-name -PKG_DEPENDS+= p5-xml-parser-expat p5-time-hires p5-common-sense +PKG_DEPENDS+= p5-xml-parser-expat p5-common-sense PKG_DEPENDS+= p5-types-serialiser p5-audio-scan p5-image-scale PKG_DEPENDS+= p5-dbd-sqlite p5-tie-refhash PKG_BUILDDEP:= perl diff --git a/package/mpdbox/Makefile b/package/mpdbox/Makefile index b431a0b72..b0f2c2605 100644 --- a/package/mpdbox/Makefile +++ b/package/mpdbox/Makefile @@ -4,16 +4,14 @@ include $(ADK_TOPDIR)/rules.mk PKG_NAME:= mpdbox -PKG_VERSION:= 1.0 -PKG_RELEASE:= 2 +PKG_VERSION:= 1.0.1 +PKG_RELEASE:= 1 PKG_MD5SUM:= ac0dc1cc7141c1eca66d8ddd98574e0b PKG_DESCR:= mpd web interface PKG_SECTION:= mm/audio PKG_URL:= http://www.openadk.org/cgi-bin/gitweb.cgi?p=mpdbox.git;a=summary PKG_SITES:= http://www.openadk.org/distfiles/ -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz - include $(ADK_TOPDIR)/mk/package.mk $(eval $(call PKG_template,MPDBOX,mpdbox,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/p5-audio-scan/Makefile b/package/p5-audio-scan/Makefile index 346dd5681..e08f27718 100644 --- a/package/p5-audio-scan/Makefile +++ b/package/p5-audio-scan/Makefile @@ -20,6 +20,8 @@ include $(ADK_TOPDIR)/mk/package.mk $(eval $(call PKG_template,P5_AUDIO_SCAN,p5-audio-scan,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS+= -fPIC + include $(ADK_TOPDIR)/mk/perl.mk CONFIG_STYLE:= perl diff --git a/package/p5-dbd-sqlite/Makefile b/package/p5-dbd-sqlite/Makefile index 1be5008c6..abcd09a83 100644 --- a/package/p5-dbd-sqlite/Makefile +++ b/package/p5-dbd-sqlite/Makefile @@ -9,8 +9,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 86cfaf477cb9ddc39508f74f4268fc79 PKG_DESCR:= self-contained rdbms in a dbi driver PKG_SECTION:= dev/perl -PKG_DEPENDS:= perl -PKG_BUILDDEP:= perl +PKG_DEPENDS:= perl p5-dbi +PKG_BUILDDEP:= perl p5-dbi-host PKG_SITES:= http://cpan.metacpan.org/authors/id/I/IS/ISHIGAKI/ DISTFILES:= DBD-SQLite-${PKG_VERSION}.tar.gz diff --git a/package/p5-dbi/Makefile b/package/p5-dbi/Makefile index 6380059dd..1c85cf8be 100644 --- a/package/p5-dbi/Makefile +++ b/package/p5-dbi/Makefile @@ -16,18 +16,27 @@ PKG_SITES:= http://cpan.metacpan.org/authors/id/T/TI/TIMB/ DISTFILES:= DBI-${PKG_VERSION}.tar.gz WRKDIST= ${WRKDIR}/DBI-${PKG_VERSION} +include $(ADK_TOPDIR)/mk/host.mk include $(ADK_TOPDIR)/mk/package.mk +$(eval $(call HOST_template,P5_DBI,p5-dbi,$(PKG_VERSION)-${PKG_RELEASE})) $(eval $(call PKG_template,P5_DBI,p5-dbi,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS+= -fPIC + include $(ADK_TOPDIR)/mk/perl.mk +HOST_STYLE:= perl CONFIG_STYLE:= perl XAKE_FLAGS+= $(PERL_ENV) +hostpost-install: + (cd $(WRKBUILD) && PATH='$(HOST_PATH)' $(HOST_PERL_ENV) make install) + p5-dbi-install: $(INSTALL_DIR) $(IDIR_P5_DBI)$(PERL_SITEDIR) $(CP) $(WRKINST)$(PERL_SITEDIR)/* \ $(IDIR_P5_DBI)$(PERL_SITEDIR) +include ${ADK_TOPDIR}/mk/host-bottom.mk include ${ADK_TOPDIR}/mk/pkg-bottom.mk diff --git a/package/perl/Makefile b/package/perl/Makefile index b866cb05c..11fa4678e 100644 --- a/package/perl/Makefile +++ b/package/perl/Makefile @@ -34,8 +34,9 @@ host-configure: $(SED) "s#@@STAGING_HOST_DIR@@/perl-host#./perl#" ${WRKBUILD}/Makefile.SH $(SED) "s#@@LIB@@#-Ilib#" ${WRKBUILD}/Makefile.SH # darwin workaround + $(CP) ${WRKBUILD}/hints/darwin.sh ${WRKBUILD}/hints/darwin.sh.bak $(SED) "s#^usedl.*##" ${WRKBUILD}/hints/darwin.sh - (cd ${WRKBUILD}; ${BASH} ./Configure -des -Duseperlio -Uusedl -Uusethreads -Uuseshrplib -Dprefix=${STAGING_HOST_DIR}/usr) + (cd ${WRKBUILD}; ${BASH} ./Configure -des -Uusedl -Uusethreads -Duseperlio -Uuseshrplib -Dprefix=${STAGING_HOST_DIR}/usr) host-build: cd ${WRKBUILD} && env CC_FOR_BUILD="gcc" ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ @@ -44,8 +45,16 @@ host-build: perl-hostinstall: cd ${WRKBUILD} && env CC_FOR_BUILD="gcc" ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ ${HOST_MAKE_FLAGS} ${HOST_INSTALL_TARGET} $(MAKE_TRACE) - mv ${STAGING_HOST_DIR}/usr/bin/perl ${STAGING_HOST_DIR}/usr/bin/perl-host + mv ${STAGING_HOST_DIR}/usr/bin/perl ${STAGING_HOST_DIR}/usr/bin/perl-static cp ${WRKBUILD}/miniperl ${STAGING_HOST_DIR}/usr/bin + # now build perl a second time for perl modules (dynamic) + $(CP) ${WRKBUILD}/hints/darwin.sh.bak ${WRKBUILD}/hints/darwin.sh + (cd ${WRKBUILD}; rm config.sh; ${BASH} ./Configure -des -Uuseshrplib -Dprefix=${STAGING_HOST_DIR}/usr) + cd ${WRKBUILD} && env CC_FOR_BUILD="gcc" ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ + ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET} $(MAKE_TRACE) + cd ${WRKBUILD} && env CC_FOR_BUILD="gcc" ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ + ${HOST_MAKE_FLAGS} ${HOST_INSTALL_TARGET} $(MAKE_TRACE) + mv ${STAGING_HOST_DIR}/usr/bin/perl ${STAGING_HOST_DIR}/usr/bin/perl-host do-configure: sed \ @@ -71,7 +80,7 @@ do-build: (cd ${WRKBUILD}; $(MAKE)) do-install: - (cd ${WRKBUILD}; $(STAGING_HOST_DIR)/usr/bin/perl-host installperl --destdir=${WRKINST}) + (cd ${WRKBUILD}; $(STAGING_HOST_DIR)/usr/bin/perl-static installperl --destdir=${WRKINST}) perl-install: ${INSTALL_DIR} ${IDIR_PERL}/usr/bin @@ -79,7 +88,7 @@ perl-install: ${CP} ${WRKINST}/usr/lib/perl5/${PKG_VERSION}/* \ ${IDIR_PERL}/usr/lib/perl5/${PKG_VERSION} ${INSTALL_BIN} ${WRKINST}/usr/bin/perl ${IDIR_PERL}/usr/bin/ - touch $(STAGING_TARGET_DIR)/usr/lib/perl5/$(PKG_VERSION)/$(ADK_TARGET_CPU_ARCH)-linux/CORE/patchlevel-debian.h + touch $(IDIR_PERL)/usr/lib/perl5/$(PKG_VERSION)/$(ADK_TARGET_CPU_ARCH)-linux/CORE/patchlevel-debian.h include ${ADK_TOPDIR}/mk/host-bottom.mk include ${ADK_TOPDIR}/mk/pkg-bottom.mk -- cgit v1.2.3