summaryrefslogtreecommitdiffstats
path: root/package/speex/speex.mk
blob: 36aa6250475f30542db1ec0b2329d577296dace9 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#############################################################
#
# speex
#
#############################################################

SPEEX_VERSION=1.2beta2

# Don't alter below this line unless you (think) you know
# what you are doing! Danger, Danger!

SPEEX_SOURCE=speex-$(SPEEX_VERSION).tar.gz
SPEEX_CAT:=$(ZCAT)
SPEEX_SITE=http://downloads.us.xiph.org/releases/speex
SPEEX_DIR=$(BUILD_DIR)/speex-$(SPEEX_VERSION)

ifeq ($(BR2_PACKAGE_SPEEX_ARM5E),y)
SPEEX_FOR_ARM5E:=--enable-arm5e-asm
endif

$(DL_DIR)/$(SPEEX_SOURCE):
	$(WGET) -P $(DL_DIR) $(SPEEX_SITE)/$(SPEEX_SOURCE)

$(SPEEX_DIR)/.unpacked: $(DL_DIR)/$(SPEEX_SOURCE)
	$(SPEEX_CAT) $(DL_DIR)/$(SPEEX_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	$(CONFIG_UPDATE) $(SPEEX_DIR)
	touch $(SPEEX_DIR)/.unpacked

$(SPEEX_DIR)/Makefile: $(SPEEX_DIR)/.unpacked
	rm -f $(SPEEX_DIR)/Makefile
	mkdir -p $(SPEEX_DIR)
	(cd $(SPEEX_DIR); rm -rf config.cache; \
		$(TARGET_CONFIGURE_OPTS) \
		$(TARGET_CONFIGURE_ARGS) \
		$(SPEEX_DIR)/configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/usr \
		--includedir=/usr/include \
		--enable-shared \
		--enable-fixed-point \
		$(SPEEX_FOR_ARM5E) \
		$(DISABLE_NLS); \
	)
	$(SED) "s,^OGG_CFLAGS.*,OGG_CFLAGS= -I$(STAGING_DIR)/usr/include,g" $(SPEEX_DIR)/Makefile
	$(SED) "s,^OGG_LIBS.*,OGG_LIBS= -L$(STAGING_DIR)/usr/lib -logg,g" $(SPEEX_DIR)/Makefile
	$(SED) "s,^OGG_CFLAGS.*,OGG_CFLAGS= -I$(STAGING_DIR)/usr/include,g" $(SPEEX_DIR)/libspeex/Makefile
	$(SED) "s,^OGG_LIBS.*,OGG_LIBS= -L$(STAGING_DIR)/usr/lib -logg,g" $(SPEEX_DIR)/libspeex/Makefile
	$(SED) "s,-I/usr/include,,g" $(SPEEX_DIR)/libspeex/Makefile
	$(SED) "s,^OGG_CFLAGS.*,OGG_CFLAGS= -I$(STAGING_DIR)/usr/include,g" $(SPEEX_DIR)/src/Makefile
	$(SED) "s,^OGG_LIBS.*,OGG_LIBS= -L$(STAGING_DIR)/usr/lib -logg,g" $(SPEEX_DIR)/src/Makefile
	$(SED) "s,-I/usr/include,,g" $(SPEEX_DIR)/src/Makefile
	$(SED) "s,^OGG_CFLAGS.*,OGG_CFLAGS= -I$(STAGING_DIR)/usr/include,g" $(SPEEX_DIR)/include/Makefile
	$(SED) "s,^OGG_LIBS.*,OGG_LIBS= -L$(STAGING_DIR)/usr/lib -logg,g" $(SPEEX_DIR)/include/Makefile
	$(SED) "s,-I/usr/include,,g" $(SPEEX_DIR)/include/Makefile
	$(SED) "s,^OGG_CFLAGS.*,OGG_CFLAGS= -I$(STAGING_DIR)/usr/include,g" $(SPEEX_DIR)/include/speex/Makefile
	$(SED) "s,^OGG_LIBS.*,OGG_LIBS= -L$(STAGING_DIR)/usr/lib -logg,g" $(SPEEX_DIR)/include/speex/Makefile
	$(SED) "s,-I/usr/include,,g" $(SPEEX_DIR)/include/speex/Makefile
	$(SED) "s,^OGG_CFLAGS.*,OGG_CFLAGS= -I$(STAGING_DIR)/usr/include,g" $(SPEEX_DIR)/doc/Makefile
	$(SED) "s,^OGG_LIBS.*,OGG_LIBS= -L$(STAGING_DIR)/usr/lib -logg,g" $(SPEEX_DIR)/doc/Makefile
	$(SED) "s,-I/usr/include,,g" $(SPEEX_DIR)/doc/Makefile



$(SPEEX_DIR)/speex: $(SPEEX_DIR)/Makefile
	rm -f $@
	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(SPEEX_DIR)

$(SPEEX_DIR)/.installed: $(SPEEX_DIR)/speex
	$(MAKE) DESTDIR=$(STAGING_DIR) -C $(SPEEX_DIR) install
	$(SED) "s,^libdir=.*,libdir=\'$(STAGING_DIR)/usr/lib\',g" $(STAGING_DIR)/usr/lib/libspeex.la
	touch $@

$(TARGET_DIR)/usr/bin/speexdec: $(SPEEX_DIR)/.installed
	cp -dpf $(STAGING_DIR)/usr/bin/speexdec $(TARGET_DIR)/usr/bin/speexdec

$(TARGET_DIR)/usr/bin/speexenc: $(TARGET_DIR)/usr/bin/speexdec
	cp -dpf $(STAGING_DIR)/usr/bin/speexenc $(TARGET_DIR)/usr/bin/speexenc

$(TARGET_DIR)/usr/lib/libspeex.so: $(TARGET_DIR)/usr/bin/speexenc
	cp -dpf $(STAGING_DIR)/usr/lib/libspeex.so* $(TARGET_DIR)/usr/lib

speex-bins:	

speex: uclibc libogg $(TARGET_DIR)/usr/lib/libspeex.so

speex-source: $(DL_DIR)/$(SPEEX_SOURCE)

speex-clean:
	@if [ -d $(SPEEX_DIR)/Makefile ]; then \
		$(MAKE) -C $(SPEEX_DIR) clean; \
	fi

speex-dirclean:
	rm -rf $(SPEEX_DIR)

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_SPEEX)),y)
TARGETS+=speex
endif