pass ARCH down to uClibc
[buildroot.git] / package / lzma / lzma.mk
blob76a44a921e0e16342c6c085e1361ce0d84101caf
1 #############################################################
3 # lzma
5 #############################################################
6 LZMA_VERSION_STRING:=$(subst ",,$(BR2_PACKAGE_LZMA_VERSION))
7 #")
8 ifneq ($(BR2_PACKAGE_LZMA_VERSION_git),)
9 LZMA_SITE:=git://ctrl.tukaani.org/lzma-utils.git
10 LZMA_SOURCE:=lzma-utils.tar.gz
11 LZMA_CAT:=$(ZCAT)
12 LZMA_SRCDIR:=$(TOOL_BUILD_DIR)/lzma-utils
13 LZMA_HOST_DIR:=$(TOOL_BUILD_DIR)/lzma-utils-host
14 LZMA_TARGET_DIR:=$(BUILD_DIR)/lzma-utils
15 LZMA_CONFIGURE_ARGS:=--enable-small
16 else
17 LZMA_VERSION:=4.32.4
18 LZMA_SOURCE:=lzma-$(LZMA_VERSION).tar.gz
19 LZMA_CAT:=$(ZCAT)
20 LZMA_SITE:=http://tukaani.org/lzma/
21 LZMA_SRCDIR:=$(TOOL_BUILD_DIR)/lzma-$(LZMA_VERSION)
22 LZMA_HOST_DIR:=$(TOOL_BUILD_DIR)/lzma-$(LZMA_VERSION)-host
23 LZMA_TARGET_DIR:=$(BUILD_DIR)/lzma-$(LZMA_VERSION)
24 endif
26 LZMA_CFLAGS:=$(TARGET_CFLAGS)
27 ifeq ($(BR2_LARGEFILE),y)
28 LZMA_CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
29 endif
30 LZMA_TARGET_BINARY:=bin/lzma
32 # lzma binary for use on the host
33 LZMA=$(TOOL_BUILD_DIR)/bin/lzma
34 HOST_LZMA_BINARY=$(shell $(CONFIG_SHELL) package/lzma/lzmacheck.sh)
35 HOST_LZMA_IF_ANY=$(shell $(CONFIG_SHELL) toolchain/dependencies/check-host-lzma.sh)
38 $(DL_DIR)/$(LZMA_SOURCE):
39 ifeq ($(BR2_PACKAGE_LZMA_VERSION_git),)
40 $(WGET) -P $(DL_DIR) $(LZMA_SITE)/$(LZMA_SOURCE)
41 else
42 test -d $(DL_DIR)/lzma-utils/.git || \
43 $(GIT) clone $(LZMA_SITE) $(DL_DIR)/lzma-utils
44 #(cd $(DL_DIR)/lzma-utils && ./autogen.sh)
45 (cd $(DL_DIR) && tar -czf $@ lzma-utils)
46 endif
48 ######################################################################
50 # lzma host
52 ######################################################################
54 $(LZMA_SRCDIR)/.unpacked: $(DL_DIR)/$(LZMA_SOURCE)
55 $(LZMA_CAT) $(DL_DIR)/$(LZMA_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
56 toolchain/patch-kernel.sh $(LZMA_SRCDIR) package/lzma/ lzma\*.patch
57 ifeq ($(BR2_USE_UPDATES),y)
58 (test -d $(LZMA_SRCDIR)/.git && cd $(@D) && $(GIT) pull && ./autogen.sh)
59 endif
60 $(CONFIG_UPDATE) $(@D)
61 touch $@
63 $(LZMA_HOST_DIR)/.configured: $(LZMA_SRCDIR)/.unpacked
64 mkdir -p $(@D)
65 (cd $(LZMA_HOST_DIR); rm -f config.cache;\
66 CC="$(HOSTCC)" \
67 CXX="$(HOSTCXX)" \
68 $(LZMA_SRCDIR)/configure \
69 --prefix=/ \
71 touch $@
73 $(LZMA_HOST_DIR)/src/lzma/lzma: $(LZMA_HOST_DIR)/.configured
74 $(MAKE) -C $(LZMA_HOST_DIR) all
75 touch -c $@
77 $(STAGING_DIR)/bin/lzma: $(LZMA_HOST_DIR)/src/lzma/lzma
78 $(MAKE) DESTDIR=$(STAGING_DIR) -C $(LZMA_HOST_DIR) install
79 $(SED) "s,^libdir=.*,libdir=\'$(STAGING_DIR)/lib\',g" \
80 $(STAGING_DIR)/lib/liblzmadec.la
82 .PHONY: host-lzma use-lzma-host-binary build-lzma-host-binary
83 use-lzma-host-binary:
84 $(Q)if [ ! -f "$(TOOL_BUILD_DIR)/bin/lzma" ]; then \
85 [ -d $(TOOL_BUILD_DIR)/bin ] || mkdir -p $(TOOL_BUILD_DIR)/bin; \
86 ln -sf "$(HOST_LZMA_IF_ANY)" "$(TOOL_BUILD_DIR)/bin/lzma"; \
89 build-lzma-host-binary: $(LZMA_HOST_DIR)/src/lzma/lzma
90 -rm -f $(TOOL_BUILD_DIR)/bin/lzma
91 $(INSTALL) -D -m 0755 $(LZMA_HOST_DIR)/src/lzma/lzma $(TOOL_BUILD_DIR)/bin/lzma
93 host-lzma: $(HOST_LZMA_BINARY)
95 lzma-host: $(STAGING_DIR)/bin/lzma
97 lzma-host-clean:
98 rm -f $(STAGING_DIR)/bin/lzma
99 -$(MAKE) -C $(LZMA_HOST_DIR) clean
100 lzma-host-dirclean:
101 rm -rf $(LZMA_HOST_DIR)
103 lzma-host-install: /usr/local/bin/lzma
105 ######################################################################
107 # lzma target
109 ######################################################################
111 #$(LZMA_TARGET_DIR)/.unpacked: $(DL_DIR)/$(LZMA_SOURCE)
112 # $(LZMA_CAT) $(DL_DIR)/$(LZMA_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
113 # toolchain/patch-kernel.sh $(LZMA_TARGET_DIR) package/lzma/ lzma\*.patch
114 # touch $@
116 $(LZMA_TARGET_DIR)/.configured: THIS_SRCDIR=$(LZMA_SRCDIR)
117 $(LZMA_TARGET_DIR)/.configured: $(LZMA_SRCDIR)/.unpacked
118 mkdir -p $(@D)
119 (cd $(LZMA_TARGET_DIR); rm -f config.cache;\
120 $(TARGET_CONFIGURE_OPTS) \
121 $(TARGET_CONFIGURE_ARGS) \
122 CFLAGS="$(TARGET_CFLAGS) $(LZMA_CFLAGS)" \
123 ac_cv_func_malloc_0_nonnull=yes \
124 $(LZMA_SRCDIR)/configure \
125 --target=$(GNU_TARGET_NAME) \
126 --host=$(GNU_TARGET_NAME) \
127 --build=$(GNU_HOST_NAME) \
128 --prefix=/usr \
129 --exec-prefix=$(TARGET_DIR)/usr/bin \
130 --libdir=$(TARGET_DIR)/lib \
131 --includedir=$(TARGET_DIR)/include \
132 --disable-debug \
133 $(DISABLE_NLS) \
134 $(DISABLE_LARGEFILE) \
135 $(LZMA_CONFIGURE_ARGS) \
137 touch $@
139 $(LZMA_TARGET_DIR)/src/lzma/lzma: $(LZMA_TARGET_DIR)/.configured
140 $(MAKE) -C $(LZMA_TARGET_DIR) all
141 touch -c $@
143 $(TARGET_DIR)/$(LZMA_TARGET_BINARY): $(LZMA_TARGET_DIR)/src/lzma/lzma
144 $(INSTALL) -D -m 0755 $(LZMA_TARGET_DIR)/src/lzma/lzma $@
145 -$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $@
146 touch -c $@
148 #lzma-headers: $(TARGET_DIR)/$(LZMA_TARGET_BINARY)
150 lzma-target: $(TARGET_DIR)/$(LZMA_TARGET_BINARY)
152 lzma-source: $(DL_DIR)/$(LZMA_SOURCE)
154 lzma-clean:
155 -$(MAKE) -C $(LZMA_TARGET_DIR) clean
156 rm -f $(TARGET_DIR)/usr/bin/lzma
158 lzma-dirclean:
159 rm -rf $(LZMA_DIR)
161 #############################################################
163 # Toplevel Makefile options
165 #############################################################
166 ifeq ($(BR2_PACKAGE_LZMA_HOST),y)
167 TARGETS+=lzma-host
168 HOST_SOURCE+=lzma-source
169 endif
171 ifeq ($(BR2_PACKAGE_LZMA_TARGET),y)
172 TARGETS+=lzma-target
173 endif
175 #ifeq ($(BR2_PACKAGE_LZMA_TARGET_HEADERS),y)
176 #TARGETS+=lzma-headers
177 #endif