Skip Menu |

This queue is for tickets about the Text-Markdown-Discount CPAN distribution.

Report information
The Basics
Id: 98100
Status: new
Priority: 0/
Queue: Text-Markdown-Discount

People
Owner: Nobody in particular
Requestors: fraserbn [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] Android support
Howdy! The three attached patches get the module to build, test & install cleanly on Android: $ perl -MText::Markdown::Discount -E 'say "$^O: $Text::Markdown::Discount::VERSION"' android: 0.11
Subject: 0001-Android-support-for-discount-configure.inc.patch
From d31eb27f691e098a9c96055040228b181a12664b Mon Sep 17 00:00:00 2001 From: Brian Fraser <fraserbn@gmail.com> Date: Sun, 17 Aug 2014 02:48:41 +0200 Subject: [PATCH 1/3] Android support for discount/configure.inc CPPFLAGS and CCFLAGS need to be set, since all Android builds will have a --sysroot option that msut be respected to get anything to compile. TMPDIR must be set because of a bug in Android's sh: http://stackoverflow.com/questions/15283220/android-shell-eof Android's tr is actually a symlink to busybox, which was likely causing configure.inc to throw it's hands in the air and quit. I couldn't figure out how to fix that, so instead I made Makefile.PL pass the path to tr, which gets configure working. --- Makefile.PL | 18 ++++++++++++++++-- discount/configure.inc | 6 ++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 855c161..5f040f4 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -55,13 +55,27 @@ xml.o xmlpage.o )); +sub MY::postamble { + my $os_extras = ""; + my $ccflags = ""; + if ( $^O eq 'android' ) { + require Config; + require IPC::Cmd; + my $tr_binary = IPC::Cmd::can_run("tr"); + my $tr = $tr_binary ? "AC_TR='$tr_binary'" : ""; + my $tmpdir = File::Spec->tmpdir; -sub MY::postamble { + $ccflags = $Config::Config{ccflags}; + $os_extras = join " ", + "TMPDIR='$tmpdir'", + "CPPFLAGS='$Config::Config{cppflags}'", + $tr; + } return sprintf(' $(MYEXTLIB): %s -', qq{( cd $extdir; CC='cc -fPIC' sh configure.sh; make )\n}); +', qq{( cd $extdir; $os_extras CC='cc $ccflags -fPIC' sh configure.sh; make )\n}); } WriteMakefile( diff --git a/discount/configure.inc b/discount/configure.inc index 7b4ac48..8b2f243 100755 --- a/discount/configure.inc +++ b/discount/configure.inc @@ -1548,9 +1548,11 @@ AC_CONFIG() { AC_QUIET() { eval $* 5>/dev/null } - -AC_TR=`acLookFor tr` +if [ "X$AC_TR" == X ]; then + AC_TR=`acLookFor tr`; +fi + if [ "$AC_TR" ]; then # try posix-style tr ABC=`echo abc | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` -- 1.7.12.4 (Apple Git-37)
Subject: 0002-Support-for-Android-in-Makefile.in.patch
From 492e09f5b43b3e90e1b33a1021c13ad35a3601ec Mon Sep 17 00:00:00 2001 From: Brian Fraser <fraserbn@gmail.com> Date: Sun, 17 Aug 2014 02:52:32 +0200 Subject: [PATCH 2/3] Support for Android in Makefile.in More strange behavior -- for some reason, make wasn't chdir'ing to discount/, which made the invocation to ./librarian.sh break. This patch invokes the script using a full path, which works around the issue. --- discount/Makefile.in | 8 +++++--- discount/configure.inc | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/discount/Makefile.in b/discount/Makefile.in index 3bda63d..279dc08 100644 --- a/discount/Makefile.in +++ b/discount/Makefile.in @@ -9,6 +9,8 @@ MANDIR=@mandir@ LIBDIR=@libdir@ INCDIR=@prefix@/include +INSTALL_BASEDIR=@INSTALL_BASEDIR@ + PGMS=markdown SAMPLE_PGMS=mkd2html makepage @THEME@SAMPLE_PGMS+= theme @@ -25,7 +27,7 @@ all: $(PGMS) $(SAMPLE_PGMS) $(TESTFRAMEWORK) install: $(PGMS) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) @INSTALL_PROGRAM@ $(PGMS) $(DESTDIR)$(BINDIR) - ./librarian.sh install libmarkdown VERSION $(DESTDIR)$(LIBDIR) + sh $(INSTALL_BASEDIR)/librarian.sh install libmarkdown VERSION $(DESTDIR)$(LIBDIR) @INSTALL_DATA@ mkdio.h $(DESTDIR)$(INCDIR) install.everything: install install.samples install.man @@ -95,7 +97,7 @@ main.o: main.c mkdio.h config.h $(CC) $(CFLAGS) -I. -c main.c $(MKDLIB): $(OBJS) - ./librarian.sh make $(MKDLIB) VERSION $(OBJS) + sh $(INSTALL_BASEDIR)/librarian.sh make $(MKDLIB) VERSION $(OBJS) verify: echo tools/checkbits.sh @./echo -n "headers ... "; tools/checkbits.sh && echo "GOOD" @@ -112,7 +114,7 @@ echo: tools/echo.c config.h clean: rm -f $(PGMS) $(TESTFRAMEWORK) $(SAMPLE_PGMS) *.o - rm -f $(MKDLIB) `./librarian.sh files $(MKDLIB) VERSION` + rm -f $(MKDLIB) `sh $(INSTALL_BASEDIR)/librarian.sh files $(MKDLIB) VERSION` distclean spotless: clean rm -f @GENERATED_FILES@ @CONFIGURE_FILES@ diff --git a/discount/configure.inc b/discount/configure.inc index 8b2f243..9d1133a 100755 --- a/discount/configure.inc +++ b/discount/configure.inc @@ -1422,6 +1422,7 @@ AC_PROG_INSTALL () { fi __config_files="$__config_files config.md" + AC_SUB 'INSTALL_BASEDIR' "$__cwd" AC_SUB 'INSTALL_DIR' "$__cwd/config.md" echo "#! /bin/sh" > $__cwd/config.md echo "# script generated" `date` "by configure.sh" >> $__cwd/config.md -- 1.7.12.4 (Apple Git-37)
Subject: 0003-Android-doesn-t-have-pw_gecos-in-struct-pw.patch
From ac7cad58519647554d15c60fe4da92b1abf94437 Mon Sep 17 00:00:00 2001 From: Brian Fraser <fraserbn@gmail.com> Date: Sun, 17 Aug 2014 02:54:44 +0200 Subject: [PATCH 3/3] Android doesn't have pw_gecos in struct pw --- discount/theme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discount/theme.c b/discount/theme.c index 7000bc6..015e0ae 100644 --- a/discount/theme.c +++ b/discount/theme.c @@ -342,7 +342,7 @@ fauthor(MMIOT *doc, FILE *output, int flags, int whence) { char *h = mkd_doc_author(doc); -#if HAVE_PWD_H +#if HAVE_PWD_H && !defined(__ANDROID__) if ( (h == 0) && me ) h = me->pw_gecos; #endif -- 1.7.12.4 (Apple Git-37)