Merge branch 'master' of git://repo.or.cz/buildroot
[buildroot.git] / package / lzma / lzma.mk
blob855d587dd634e37aa1158c0fc1a1b144044682b7
1 #############################################################
3 # lzma
5 #############################################################
6 LZMA_VERSION:=4.32.4
7 LZMA_SOURCE:=lzma-$(LZMA_VERSION).tar.gz
8 LZMA_CAT:=$(ZCAT)
9 LZMA_SITE:=http://tukaani.org/lzma/
10 LZMA_HOST_DIR:=$(TOOL_BUILD_DIR)/lzma-$(LZMA_VERSION)
11 LZMA_TARGET_DIR:=$(BUILD_DIR)/lzma-$(LZMA_VERSION)
12 LZMA_CFLAGS:=$(TARGET_CFLAGS)
13 ifeq ($(BR2_LARGEFILE),y)
14 LZMA_CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
15 endif
16 LZMA_TARGET_BINARY:=bin/lzma
18 # lzma binary for use on the host
19 LZMA=$(TOOL_BUILD_DIR)/bin/lzma
20 HOST_LZMA_BINARY=$(shell $(CONFIG_SHELL) package/lzma/lzmacheck.sh)
21 HOST_LZMA_IF_ANY=$(shell $(CONFIG_SHELL) toolchain/dependencies/check-host-lzma.sh)
24 $(DL_DIR)/$(LZMA_SOURCE):
25 $(WGET) -P $(DL_DIR) $(LZMA_SITE)/$(LZMA_SOURCE)
27 ######################################################################
29 # lzma host
31 ######################################################################
33 $(LZMA_HOST_DIR)/.unpacked: $(DL_DIR)/$(LZMA_SOURCE)
34 $(LZMA_CAT) $(DL_DIR)/$(LZMA_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
35 toolchain/patch-kernel.sh $(LZMA_HOST_DIR) package/lzma/ lzma\*.patch
36 touch $@
38 $(LZMA_HOST_DIR)/.configured: $(LZMA_HOST_DIR)/.unpacked
39 (cd $(LZMA_HOST_DIR); rm -f config.cache;\
40 CC="$(HOSTCC)" \
41 CXX="$(HOSTCXX)" \
42 ./configure \
43 --prefix=/ \
45 touch $@
47 $(LZMA_HOST_DIR)/src/lzma/lzma: $(LZMA_HOST_DIR)/.configured
48 $(MAKE) -C $(LZMA_HOST_DIR) all
49 touch -c $@
51 $(STAGING_DIR)/bin/lzma: $(LZMA_HOST_DIR)/src/lzma/lzma
52 $(MAKE) DESTDIR=$(STAGING_DIR) -C $(LZMA_HOST_DIR) install
53 $(SED) "s,^libdir=.*,libdir=\'$(STAGING_DIR)/lib\',g" \
54 $(STAGING_DIR)/lib/liblzmadec.la
56 .PHONY: lzma-host use-lzma-host-binary
57 use-lzma-host-binary:
58 if [ ! -f "$(TOOL_BUILD_DIR)/bin/lzma" ]; then \
59 [ -d $(TOOL_BUILD_DIR)/bin ] || mkdir -p $(TOOL_BUILD_DIR)/bin; \
60 ln -sf "$(HOST_LZMA_IF_ANY)" "$(TOOL_BUILD_DIR)/bin/lzma"; \
63 build-lzma-host-binary: $(LZMA_HOST_DIR)/src/lzma/lzma
64 -rm -f $(TOOL_BUILD_DIR)/bin/lzma
65 $(INSTALL) -D -m 0755 $(LZMA_HOST_DIR)/src/lzma/lzma $(TOOL_BUILD_DIR)/bin/lzma
67 host-lzma: $(HOST_LZMA_BINARY)
69 lzma-host: $(STAGING_DIR)/bin/lzma
71 lzma-host-clean:
72 rm -f $(STAGING_DIR)/bin/lzma
73 -$(MAKE) -C $(LZMA_HOST_DIR) clean
74 lzma-host-dirclean:
75 rm -rf $(LZMA_HOST_DIR)
77 lzma-host-install: /usr/local/bin/lzma
79 ######################################################################
81 # lzma target
83 ######################################################################
85 $(LZMA_TARGET_DIR)/.unpacked: $(DL_DIR)/$(LZMA_SOURCE)
86 $(LZMA_CAT) $(DL_DIR)/$(LZMA_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
87 toolchain/patch-kernel.sh $(LZMA_TARGET_DIR) package/lzma/ lzma\*.patch
88 touch $@
90 $(LZMA_TARGET_DIR)/.configured: $(LZMA_TARGET_DIR)/.unpacked
91 (cd $(LZMA_TARGET_DIR); rm -f config.cache;\
92 $(TARGET_CONFIGURE_OPTS) \
93 $(TARGET_CONFIGURE_ARGS) \
94 CFLAGS="$(TARGET_CFLAGS) $(LZMA_CFLAGS)" \
95 ac_cv_func_malloc_0_nonnull=yes \
96 ./configure \
97 --target=$(GNU_TARGET_NAME) \
98 --host=$(GNU_TARGET_NAME) \
99 --build=$(GNU_HOST_NAME) \
100 --prefix=/usr \
101 --exec-prefix=$(TARGET_DIR)/usr/bin \
102 --libdir=$(TARGET_DIR)/lib \
103 --includedir=$(TARGET_DIR)/include \
104 --disable-debug \
105 $(DISABLE_NLS) \
106 $(DISABLE_LARGEFILE) \
108 touch $@
110 $(LZMA_TARGET_DIR)/src/lzma/lzma: $(LZMA_TARGET_DIR)/.configured
111 $(MAKE) -C $(LZMA_TARGET_DIR) all
112 touch -c $@
114 $(TARGET_DIR)/$(LZMA_TARGET_BINARY): $(LZMA_TARGET_DIR)/src/lzma/lzma
115 $(INSTALL) -D -m 0755 $(LZMA_TARGET_DIR)/src/lzma/lzma $@
116 -$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $@
117 touch -c $@
119 #lzma-headers: $(TARGET_DIR)/$(LZMA_TARGET_BINARY)
121 lzma-target: uclibc $(TARGET_DIR)/$(LZMA_TARGET_BINARY)
123 lzma-source: $(DL_DIR)/$(LZMA_SOURCE)
125 lzma-clean:
126 -$(MAKE) -C $(LZMA_TARGET_DIR) clean
127 rm -f $(TARGET_DIR)/usr/bin/lzma
129 lzma-dirclean:
130 rm -rf $(LZMA_DIR)
132 #############################################################
134 # Toplevel Makefile options
136 #############################################################
137 ifeq ($(BR2_PACKAGE_LZMA_HOST),y)
138 TARGETS+=lzma-host
139 HOST_SOURCE+=lzma-source
140 endif
142 ifeq ($(BR2_PACKAGE_LZMA_TARGET),y)
143 TARGETS+=lzma-target
144 endif
146 #ifeq ($(BR2_PACKAGE_LZMA_TARGET_HEADERS),y)
147 #TARGETS+=lzma-headers
148 #endif