All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v3] leveldb: new package
Date: Wed, 24 Dec 2014 14:31:05 +0100	[thread overview]
Message-ID: <20141224133105.GA3880@free.fr> (raw)
In-Reply-To: <1419418559-23870-1-git-send-email-ste@junkomatic.net>

Steve, All,

On 2014-12-24 10:55 +0000, Steve James spake thusly:
> Adds new package: leveldb
> 
>   LevelDB is a fast key-value storage library written at Google that
>   provides an ordered mapping from string keys to string values.
> 
> Signed-off-by: Steve James <ste@junkomatic.net>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
[--SNIP--]
> diff --git a/package/leveldb/leveldb.mk b/package/leveldb/leveldb.mk
> new file mode 100644
> index 0000000..0a4a079
> --- /dev/null
> +++ b/package/leveldb/leveldb.mk
> @@ -0,0 +1,59 @@
> +################################################################################
> +#
> +# leveldb
> +#
> +################################################################################
> +
> +LEVELDB_VERSION = 803d69203a62faf50f1b77897310a3a1fcae712b
> +LEVELDB_SITE = $(call github,google,leveldb,$(LEVELDB_VERSION))
> +LEVELDB_LICENSE = BSD-3c
> +LEVELDB_LICENSE_FILES = LICENSE
> +LEVELDB_INSTALL_STAGING = YES
> +LEVELDB_DEPENDENCIES = snappy
> +
> +# The leveldb build has some basic autoconf-like behaviour which assumes the
> +# target is the host. We hard-wire it to the right outcome for Buildroot
> +# irrespective of the host.
> +LEVELDB_MAKE_ARGS = TARGET_OS=Linux
> +
> +# Default leveldb compiler flags
> +LEVELDB_CFLAGS = -DNDEBUG -I. -I./include -std=c++0x -pthread -DOS_LINUX -DLEVELDB_PLATFORM_POSIX
> +
> +TARGET_CFLAGS += $(LEVELDB_CFLAGS)
> +TARGET_CXXFLAGS += $(LEVELDB_CFLAGS)
> +TARGET_MAKE_ARGS += $(LEVELDB_MAKE_ARGS)

As you have already noticed, this is wrong: variables in Makefiles have
a global scope, so what you are doign here is simply overwriting those
variables for all packages.

What you want to do instead is:

> +define LEVELDB_BUILD_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) $(TARGET_MAKE_ARGS)
> +endef

    define LEVELDB_BUILD_CMDS
        $(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
            CFLAGS="$(TARGET_CFLAGS) $(LEVELDB_CFLAGS)" \
            CXXFLAGS="$(TARGET_CXXFLAGS) $(LEVELDB_CFLAGS)" \
            TARGET_OS=Linux
    endef

(and get rid of no longer needed variables, of course.)

Regards,
Yann E. MORIN.

> +ifeq ($(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
> +define LEVELDB_INSTALL_STAGING_CMDS_STATIC
> +	$(INSTALL) -D -m 0644 $(@D)/libleveldb.a $(STAGING_DIR)/usr/lib
> +endef
> +endif
> +
> +ifeq ($(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
> +define LEVELDB_INSTALL_STAGING_CMDS_SHARED
> +	$(INSTALL) -D -m 0755 $(@D)/libleveldb.so.1.18 $(STAGING_DIR)/usr/lib
> +	$(HOSTLN) -sf libleveldb.so.1.18 $(STAGING_DIR)/usr/lib/libleveldb.so.1
> +	$(HOSTLN) -sf libleveldb.so.1.18 $(STAGING_DIR)/usr/lib/libleveldb.so
> +endef
> +endif
> +
> +define LEVELDB_INSTALL_STAGING_CMDS
> +	$(LEVELDB_INSTALL_STAGING_CMDS_STATIC)
> +	$(LEVELDB_INSTALL_STAGING_CMDS_SHARED)
> +	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/leveldb
> +	$(INSTALL) -D -m 0644 $(@D)/include/leveldb/*.h $(STAGING_DIR)/usr/include/leveldb
> +endef
> +
> +ifeq ($(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
> +define LEVELDB_INSTALL_TARGET_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/libleveldb.so.1.18 $(TARGET_DIR)/usr/lib
> +	$(HOSTLN) -sf libleveldb.so.1.18 $(TARGET_DIR)/usr/lib/libleveldb.so.1
> +	$(HOSTLN) -sf libleveldb.so.1.18 $(TARGET_DIR)/usr/lib/libleveldb.so
> +endef
> +endif
> +
> +$(eval $(generic-package))
> -- 
> 1.7.10.4
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

      parent reply	other threads:[~2014-12-24 13:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1419418559-23870-1-git-send-email-ste@junkomatic.net>
2014-12-24 12:25 ` [Buildroot] [PATCH v3] leveldb: new package Steve James
2014-12-24 13:31 ` Yann E. MORIN [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141224133105.GA3880@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.