summaryrefslogtreecommitdiffstats
path: root/make/newt.mk
blob: 56fba9ea056a0c41d0588d107857a4dca9a8c1cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#############################################################
#
# newt
#
#############################################################
NEWT_SOURCE=newt_0.50.17.orig.tar.gz
NEWT_SITE=http://ftp.debian.org/debian/pool/main/n/newt
NEWT_DIR=$(BUILD_DIR)/newt-0.50.17
NEWT_PATCH=$(SOURCE_DIR)/newt.patch
ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true)
NEWT_CFLAGS="-Os -g -fPIC -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64"
else
NEWT_CFLAGS="-Os -g -fPIC"
endif

$(DL_DIR)/$(NEWT_SOURCE):
	$(WGET) -P $(DL_DIR) $(NEWT_SITE)/$(NEWT_SOURCE)

$(NEWT_DIR)/.source: $(DL_DIR)/$(NEWT_SOURCE) $(NEWT_PATCH)
	zcat $(DL_DIR)/$(NEWT_SOURCE) | tar -C $(BUILD_DIR) -xvf -
	cat $(NEWT_PATCH) | patch -p1 -d $(NEWT_DIR)
	(cd $(NEWT_DIR); autoconf);
	touch $(NEWT_DIR)/.source;

$(NEWT_DIR)/.configured: $(NEWT_DIR)/.source
	(cd $(NEWT_DIR); rm -rf config.cache; \
		PATH=$(STAGING_DIR)/bin:$$PATH CC=$(TARGET_CC1) \
		./configure \
		--target=$(GNU_TARGET_NAME) \
		--prefix=/usr \
		--exec-prefix=/usr \
		--bindir=/usr/bin \
		--sbindir=/usr/sbin \
		--libexecdir=/usr/lib \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--localstatedir=/var \
		--mandir=/usr/man \
		--infodir=/usr/info \
		--disable-nls \
	);
	touch $(NEWT_DIR)/.configured;

$(NEWT_DIR)/libnewt.so.0.50.17: $(NEWT_DIR)/.configured
	$(MAKE) CFLAGS=$(NEWT_CFLAGS) CC=$(TARGET_CC1) -C  $(NEWT_DIR)
	touch -c $(NEWT_DIR)/libnewt.so.0.50.17

$(STAGING_DIR)/lib/libnewt.so.0.50.17: $(NEWT_DIR)/libnewt.so.0.50.17
	cp -a $(NEWT_DIR)/libnewt.a $(STAGING_DIR)/lib;
	cp -a $(NEWT_DIR)/newt.h $(STAGING_DIR)/include;
	cp -a $(NEWT_DIR)/libnewt.so* $(STAGING_DIR)/lib;
	(cd $(STAGING_DIR)/lib; ln -fs libnewt.so.0.50.17 libnewt.so);
	(cd $(STAGING_DIR)/lib; ln -fs libnewt.so.0.50.17 libnewt.so.0.50);
	touch -c $(STAGING_DIR)/lib/libnewt.so.0.50.17

$(TARGET_DIR)/lib/libnewt.so.0.50.17: $(STAGING_DIR)/lib/libnewt.so.0.50.17
	cp -a $(STAGING_DIR)/lib/libnewt.so* $(TARGET_DIR)/lib;
	-$(STRIP) --strip-unneeded $(TARGET_DIR)/lib/libnewt.so*
	touch -c $(TARGET_DIR)/lib/libnewt.so.0.50.17

newt: uclibc slang $(TARGET_DIR)/lib/libnewt.so.0.50.17

newt-clean:
	rm -f $(TARGET_DIR)/lib/libnewt.so*
	-$(MAKE) -C $(NEWT_DIR) clean

newt-dirclean: slang-dirclean
	rm -rf $(NEWT_DIR)