diff mbox

[02/14] libenca: new package

Message ID 1389549208-19078-3-git-send-email-maxime.hadjinlian@gmail.com
State Superseded
Headers show

Commit Message

Maxime Hadjinlian Jan. 12, 2014, 5:53 p.m. UTC
Extremely Naive Charset Analyser.

This package was originally found at : https://github.com/huceke/buildroot-rbp
By gimli <ebsi4711@gmail.com>

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---
 package/Config.in                                  |  1 +
 package/libenca/Config.in                          |  6 ++++
 package/libenca/libenca-1.9-dont-build-tools.patch | 33 ++++++++++++++++++++++
 package/libenca/libenca-1.9-fix-clean.patch        | 22 +++++++++++++++
 package/libenca/libenca-1.9-fix-prefix.patch       | 19 +++++++++++++
 package/libenca/libenca.mk                         | 26 +++++++++++++++++
 6 files changed, 107 insertions(+)
 create mode 100644 package/libenca/Config.in
 create mode 100644 package/libenca/libenca-1.9-dont-build-tools.patch
 create mode 100644 package/libenca/libenca-1.9-fix-clean.patch
 create mode 100644 package/libenca/libenca-1.9-fix-prefix.patch
 create mode 100644 package/libenca/libenca.mk

Comments

Thomas Petazzoni Jan. 13, 2014, 8:20 a.m. UTC | #1
Dear Maxime Hadjinlian,

On Sun, 12 Jan 2014 18:53:16 +0100, Maxime Hadjinlian wrote:
> Extremely Naive Charset Analyser.
> 
> This package was originally found at : https://github.com/huceke/buildroot-rbp
> By gimli <ebsi4711@gmail.com>
> 
> Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
> ---
>  package/Config.in                                  |  1 +
>  package/libenca/Config.in                          |  6 ++++
>  package/libenca/libenca-1.9-dont-build-tools.patch | 33 ++++++++++++++++++++++
>  package/libenca/libenca-1.9-fix-clean.patch        | 22 +++++++++++++++
>  package/libenca/libenca-1.9-fix-prefix.patch       | 19 +++++++++++++

We don't want the version number of package in the patch file names,
but we do want sequence numbers. So:

	libenca-000-<something>.patch
	libenca-001-<something>.patch

> diff --git a/package/libenca/libenca-1.9-dont-build-tools.patch b/package/libenca/libenca-1.9-dont-build-tools.patch
> new file mode 100644
> index 0000000..43b3420
> --- /dev/null
> +++ b/package/libenca/libenca-1.9-dont-build-tools.patch
> @@ -0,0 +1,33 @@
> +diff -ruN libenca-1.9.orig/Makefile.in libenca-1.9/Makefile.in
> +--- libenca-1.9.orig/Makefile.in	2011-07-23 20:02:58.304328321 -0400
> ++++ libenca-1.9/Makefile.in	2011-07-23 20:03:34.246328297 -0400
> +@@ -78,7 +78,7 @@


> diff --git a/package/libenca/libenca-1.9-fix-clean.patch b/package/libenca/libenca-1.9-fix-clean.patch
> new file mode 100644
> index 0000000..9c206ad
> --- /dev/null
> +++ b/package/libenca/libenca-1.9-fix-clean.patch
> @@ -0,0 +1,22 @@
> +--- libenca-1.9.orig/src/Makefile.in	2011-07-23 20:19:28.744327998 -0400
> ++++ libenca-1.9/src/Makefile.in	2011-07-23 20:22:47.894327936 -0400

> diff --git a/package/libenca/libenca-1.9-fix-prefix.patch b/package/libenca/libenca-1.9-fix-prefix.patch
> new file mode 100644
> index 0000000..6fd195b
> --- /dev/null
> +++ b/package/libenca/libenca-1.9-fix-prefix.patch
> @@ -0,0 +1,19 @@
> +--- libenca-1.9.orig/configure
> ++++ libenca-1.9/configure

We generally prefer to patch the Makefile.am and the configure.{in,ac}
script, and set <foo>_AUTORECONF = YES.

> +#############################################################
> +#
> +# libenca
> +#
> +#############################################################

80 # signs are needed now.

> +
> +LIBENCA_VERSION = 1.9
> +LIBENCA_SITE = http://dl.cihar.com/enca
> +LIBENCA_SOURCE = enca-$(LIBENCA_VERSION).tar.bz2
> +LIBENCA_INSTALL_STAGING = YES
> +LIBENCA_LICENSE = GPLv2
> +LIBENCA_LICENSE_FILES = COPYING
> +
> +LIBENCA_CONF_ENV += ac_cv_file__dev_random=yes
> +LIBENCA_CONF_ENV += ac_cv_file__dev_urandom=yes
> +LIBENCA_CONF_ENV += ac_cv_file__dev_arandom=no
> +LIBENCA_CONF_ENV += ac_cv_file__dev_srandom=no
> +LIBENCA_CONF_ENV += yeti_cv_func_scanf_modif_size_t=yes

Use (i.e on one line) :

LIBENCA_CONF_ENV = \
	bleh=yes \
	foo=bar \
	bar=bleh

> +define LIBENCA_MAKE_HOST_TOOL
> +cd $(@D)/tools && $(HOSTCC) -o make_hash make_hash.c

Instead with one tab.

Thomas
Yann E. MORIN Jan. 14, 2014, 10:14 p.m. UTC | #2
Maxime, All,

At long last, my comments below... ;-)

Since I'm basing my review not on this patch, but on the one you have in
your repo, there might be some discrepancies...

On 2014-01-12 18:53 +0100, Maxime Hadjinlian spake thusly:
> Extremely Naive Charset Analyser.

Muarf! :-)

> This package was originally found at : https://github.com/huceke/buildroot-rbp
> By gimli <ebsi4711@gmail.com>

Maybe it would be nice to at least Cc gimli, out of courtesy?

> Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
  Cc: gimli

[--SNIP--]
> diff --git a/package/libenca/libenca-1.9-dont-build-tools.patch b/package/libenca/libenca-1.9-dont-build-tools.patch
> new file mode 100644
> index 0000000..43b3420
> --- /dev/null
> +++ b/package/libenca/libenca-1.9-dont-build-tools.patch

Your repo now has a commit log + SoB-line, but it does not explain why
you want to avoid buildign the tools. Please expand on this in the
patch' commit log (what you said on IRC is OK, I guess).

Also, your patch touches Makefile.in. You should modify Makefile.am to
remove the tools, and set LIBENCA_AUTORECONF=yes.

Or better yet: prepare a patch for upstream that adds the possibility to
enable/disable the tools:
    ./configure --enable-tools
    ./configure --disable-tools

That way, we can get rid of the patch altogether (and _AUTORECONF) when
upstream releases a new version and we bump to it.

> diff --git a/package/libenca/libenca-1.9-fix-clean.patch b/package/libenca/libenca-1.9-fix-clean.patch
> new file mode 100644
> index 0000000..9c206ad
> --- /dev/null
> +++ b/package/libenca/libenca-1.9-fix-clean.patch

This patch in your repo is still missing a commit log + SoB-line.

Also, it looks like it is an install fix, not a clean fix (name of the
patch).

Again, you're touching Makefile.in. You should modify Makefile.am and
set AUTORECONF=yes.

> diff --git a/package/libenca/libenca-1.9-fix-prefix.patch b/package/libenca/libenca-1.9-fix-prefix.patch
> new file mode 100644
> index 0000000..6fd195b

It seems you dropped that one from your repo.

> index 0000000..e9dba18
> --- /dev/null
> +++ b/package/libenca/libenca.mk
> @@ -0,0 +1,26 @@
> +#############################################################
> +#
> +# libenca
> +#
> +#############################################################

Here I'm pasting the content of your repo:

> +LIBENCA_VERSION = 1.15
> +LIBENCA_SITE = $(call github,nijel,enca,$(LIBENCA_VERSION))
> +LIBENCA_INSTALL_STAGING = YES
> +LIBENCA_LICENSE = GPLv2
> +LIBENCA_LICENSE_FILES = COPYING
> +
> +LIBENCA_CONF_OPT += --prefix=$(TARGET_DIR)/usr

Why do you need to fake the prefix? Doesn't DESTDIR work as expected?

> +LIBENCA_CONF_ENV += ac_cv_file__dev_random=yes \
> ac_cv_file__dev_urandom=yes \
> ac_cv_file__dev_arandom=no \
> ac_cv_file__dev_srandom=no

Check indentation on those three lines: they appear to be right-shifted.
Myabe your tabls are too small in your editor? We're using 8-space wide
tabs.

> +define LIBENCA_MAKE_HOST_TOOL
> +     cd $(@D)/tools && sed -e 's/^#define \([A-Z0-9_]*\) \(.*\)/@\1@ \2/' -e 's/"//g' -e 's/NULL$$//' -e 's/ /\//' -e 's/^\(.*\)$$/s\/\1\//' ../iconvenc.h >encodings.sed

Please split this long line before each -e:
    cd $(@D)/tools && sed -e 's/^#define \([A-Z0-9_]*\) \(.*\)/@\1@ \2/' \
                          -e 's/"//g' -e 's/NULL$$//' -e 's/ /\//' \
                          -e 's/^\(.*\)$$/s\/\1\//' ../iconvenc.h \
                          >encodings.sed

> +     cd $(@D)/tools && $(HOSTCC) -o make_hash make_hash.c
> +     cd $(@D)/tools && sed -f encodings.sed ./encodings.dat | ./make_hash >encodings.h
> +endef
> +
> +LIBENCA_POST_CONFIGURE_HOOKS += LIBENCA_MAKE_HOST_TOOL

Should it be a POST_CONFIGURE, or a _PRE_BUILD hook? But we don't have a
_PRE_BUILD HOOK, so let it be a _POST_CONFIGURE.

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index c47f1ad..b1a805b 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -757,6 +757,7 @@  menu "Text and terminal handling"
 source "package/enchant/Config.in"
 source "package/icu/Config.in"
 source "package/libedit/Config.in"
+source "package/libenca/Config.in"
 source "package/libfribidi/Config.in"
 source "package/libiconv/Config.in"
 source "package/linenoise/Config.in"
diff --git a/package/libenca/Config.in b/package/libenca/Config.in
new file mode 100644
index 0000000..5e951ed
--- /dev/null
+++ b/package/libenca/Config.in
@@ -0,0 +1,6 @@ 
+config BR2_PACKAGE_LIBENCA
+	bool "libenca"
+	help
+	  Extremely Naive Charset Analyser
+
+	  http://cihar.com/software/enca/
diff --git a/package/libenca/libenca-1.9-dont-build-tools.patch b/package/libenca/libenca-1.9-dont-build-tools.patch
new file mode 100644
index 0000000..43b3420
--- /dev/null
+++ b/package/libenca/libenca-1.9-dont-build-tools.patch
@@ -0,0 +1,33 @@ 
+diff -ruN libenca-1.9.orig/Makefile.in libenca-1.9/Makefile.in
+--- libenca-1.9.orig/Makefile.in	2011-07-23 20:02:58.304328321 -0400
++++ libenca-1.9/Makefile.in	2011-07-23 20:03:34.246328297 -0400
+@@ -78,7 +78,7 @@
+ DATA = $(pkgconfig_DATA)
+ ETAGS = etags
+ CTAGS = ctags
+-DIST_SUBDIRS = tools script lib src devel-docs test data
++DIST_SUBDIRS = script lib src devel-docs test data
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ distdir = $(PACKAGE)-$(VERSION)
+ top_distdir = $(distdir)
+@@ -207,10 +207,10 @@
+ sharedstatedir = @sharedstatedir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
+-@MAINTAINER_MODE_FALSE@SUBDIRS = tools script lib src devel-docs test
++@MAINTAINER_MODE_FALSE@SUBDIRS = script lib src devel-docs test
+
+ # @(#) $Id: Makefile.am,v 1.35 2005/11/24 10:21:32 yeti Exp $
+-@MAINTAINER_MODE_TRUE@SUBDIRS = tools data script lib src devel-docs test
++@MAINTAINER_MODE_TRUE@SUBDIRS = data script lib src devel-docs test
+ man_MANS = man/enca.1
+ DISTCHECK_CONFIGURE_FLAGS = --enable-maintainer-mode
+ M4TESTS = \
+@@ -223,7 +223,6 @@
+   m4/long-text.l2 \
+   m4/recode-bugs.m4 \
+   m4/scanf.m4 \
+-  m4/tools.m4 \
+   m4/typevar.m4
+
+ EXTRA_DIST = \
diff --git a/package/libenca/libenca-1.9-fix-clean.patch b/package/libenca/libenca-1.9-fix-clean.patch
new file mode 100644
index 0000000..9c206ad
--- /dev/null
+++ b/package/libenca/libenca-1.9-fix-clean.patch
@@ -0,0 +1,22 @@ 
+--- libenca-1.9.orig/src/Makefile.in	2011-07-23 20:19:28.744327998 -0400
++++ libenca-1.9/src/Makefile.in	2011-07-23 20:22:47.894327936 -0400
+@@ -694,7 +694,7 @@
+	cd $(DESTDIR)$(bindir); \
+	inst1=`echo enca | sed '$(transform)'`; \
+	inst2=`echo enconv | sed '$(transform)'`; \
+-	$(LN_S) $$inst1$(EXEEXT) $$inst2$(EXEEXT)
++	$(LN_S) -f $$inst1$(EXEEXT) $$inst2$(EXEEXT)
+
+ uninstall-hook:
+	inst=`echo enconv | sed '$(transform)'`; \
+--- libenca-1.9.orig/Makefile.in	2011-07-23 20:19:28.746327999 -0400
++++ libenca-1.9/Makefile.in	2011-07-23 20:36:48.742327668 -0400
+@@ -768,7 +768,7 @@
+	cd $(DESTDIR)$(man1dir); \
+	inst1=`echo enca | sed '$(transform)'`.1; \
+	inst2=`echo enconv | sed '$(transform)'`.1; \
+-	$(LN_S) $$inst1 $$inst2
++	$(LN_S) -f $$inst1 $$inst2
+
+ uninstall-hook:
+	inst=`echo enconv | sed '$(transform)'`.1; \
diff --git a/package/libenca/libenca-1.9-fix-prefix.patch b/package/libenca/libenca-1.9-fix-prefix.patch
new file mode 100644
index 0000000..6fd195b
--- /dev/null
+++ b/package/libenca/libenca-1.9-fix-prefix.patch
@@ -0,0 +1,19 @@ 
+--- libenca-1.9.orig/configure
++++ libenca-1.9/configure
+
+@@ -20808,15 +20808,6 @@ _ACEOF
+ fi
+
+
+-if test "$prefix" = "NONE"; then
+-  LDFLAGS="$LDFLAGS -L$ac_default_prefix/lib"
+-  CPPFLAGS="$CPPFLAGS -I$ac_default_prefix/include"
+-else
+-  LDFLAGS="$LDFLAGS -L$prefix/lib"
+-  CPPFLAGS="$CPPFLAGS -I$prefix/include"
+-fi
+-
+-
+ case "$target" in
+ NONE) yeti_libm_target="$host" ;;
+ *) yeti_libm_target="$target" ;;
diff --git a/package/libenca/libenca.mk b/package/libenca/libenca.mk
new file mode 100644
index 0000000..e9dba18
--- /dev/null
+++ b/package/libenca/libenca.mk
@@ -0,0 +1,26 @@ 
+#############################################################
+#
+# libenca
+#
+#############################################################
+
+LIBENCA_VERSION = 1.9
+LIBENCA_SITE = http://dl.cihar.com/enca
+LIBENCA_SOURCE = enca-$(LIBENCA_VERSION).tar.bz2
+LIBENCA_INSTALL_STAGING = YES
+LIBENCA_LICENSE = GPLv2
+LIBENCA_LICENSE_FILES = COPYING
+
+LIBENCA_CONF_ENV += ac_cv_file__dev_random=yes
+LIBENCA_CONF_ENV += ac_cv_file__dev_urandom=yes
+LIBENCA_CONF_ENV += ac_cv_file__dev_arandom=no
+LIBENCA_CONF_ENV += ac_cv_file__dev_srandom=no
+LIBENCA_CONF_ENV += yeti_cv_func_scanf_modif_size_t=yes
+
+define LIBENCA_MAKE_HOST_TOOL
+cd $(@D)/tools && $(HOSTCC) -o make_hash make_hash.c
+endef
+
+LIBENCA_POST_CONFIGURE_HOOKS += LIBENCA_MAKE_HOST_TOOL
+
+$(eval $(autotools-package))