aboutsummaryrefslogtreecommitdiffstats
path: root/package/socat/socat.mk
blob: d45b306603533c0cdd36d83699802d0064d2abe9 (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
106
107
#############################################################
#
# socat
#
#############################################################

#SOCAT_MAJOR_VERSION=1.4
#SOCAT_MINOR_VERSION=.0.3
SOCAT_MAJOR_VERSION=2.0.0-b2
SOCAT_MINOR_VERSION=

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

SOCAT_SOURCE=socat-$(SOCAT_MAJOR_VERSION)$(SOCAT_MINOR_VERSION).tar.bz2
SOCAT_CAT:=$(BZCAT)
SOCAT_SITE=http://www.dest-unreach.org/socat/download/
#SOCAT_DIR=$(BUILD_DIR)/${shell basename $(SOCAT_SOURCE) .tar.bz2}
SOCAT_DIR=$(BUILD_DIR)/socat-$(SOCAT_MAJOR_VERSION)
#SOCAT_WORKDIR=$(BUILD_DIR)/socat_workdir
SOCAT_WORKDIR=$(SOCAT_DIR)

# SOCAT Configure opts taken from Config/config.Linux-2.6.24.h
CRDLY_SHIFT := $(strip $(subst ",,$(BR2_PACKAGE_SOCAT_PREDEF_CRDLY_SHIFT)))
#"))
TABDLY_SHIFT := $(strip $(subst ",,$(BR2_PACKAGE_SOCAT_PREDEF_TABDLY_SHIFT)))
#"))
CSIZE_SHIFT := $(strip $(subst ",,$(BR2_PACKAGE_SOCAT_PREDEF_CSIZE_SHIFT)))
#"))

SOCAT_CONFIGURE_OPTS :=
ifneq ($(CRDLY_SHIFT),)
SOCAT_CONFIGURE_OPTS += sc_cv_sys_crdly_shift=$(CRDLY_SHIFT)
endif
ifneq ($(TABDLY_SHIFT),)
SOCAT_CONFIGURE_OPTS += sc_cv_sys_tabdly_shift=$(TABDLY_SHIFT)
endif
ifneq ($(CRDLY_SHIFT),)
SOCAT_CONFIGURE_OPTS += sc_cv_sys_csize_shift=$(CSIZE_SHIFT)
endif

$(DL_DIR)/$(SOCAT_SOURCE):
	$(call DOWNLOAD,$(SOCAT_SITE),$(SOCAT_SOURCE))

$(SOCAT_DIR)/.unpacked: $(DL_DIR)/$(SOCAT_SOURCE)
	$(SOCAT_CAT) $(DL_DIR)/$(SOCAT_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	toolchain/patch-kernel.sh $(SOCAT_DIR) package/socat/ socat-$(SOCAT_MAJOR_VERSION)\*.patch
	touch $(SOCAT_DIR)/.unpacked

$(SOCAT_WORKDIR)/Makefile: $(SOCAT_DIR)/.unpacked
	rm -f $(SOCAT_WORKDIR)/Makefile
	mkdir -p $(SOCAT_WORKDIR)
	(cd $(SOCAT_WORKDIR); rm -rf config.cache; \
		$(TARGET_CONFIGURE_OPTS) \
		$(TARGET_CONFIGURE_ARGS) \
		$(SOCAT_CONFIGURE_OPTS) \
		$(SOCAT_DIR)/configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/usr \
		--exec-prefix=/usr \
		--bindir=/usr/bin \
		--sbindir=/usr/sbin \
		--libdir=/lib \
		--libexecdir=/usr/lib \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--localstatedir=/var \
		--mandir=/usr/man \
		--infodir=/usr/info \
		--disable-termios \
		$(DISABLE_NLS); \
	$(SED) 's/#define HAVE_TERMIOS_ISPEED 1/#undef HAVE_TERMIOS_ISPEED/g' config.h; \
	)

#	cp $(SOCAT_WORKDIR)/Config/config.Linux-2-6*.h $(SOCAT_WORKDIR)/config.h ; \


$(SOCAT_WORKDIR)/socat: $(SOCAT_WORKDIR)/Makefile
	rm -f $@
	$(MAKE) -C $(SOCAT_WORKDIR)

$(TARGET_DIR)/usr/bin/socat: $(SOCAT_WORKDIR)/socat
	mkdir -p $(TARGET_DIR)/usr/man/man1
	$(MAKE) -C $(SOCAT_WORKDIR) install prefix=$(TARGET_DIR)/usr DESTDIR=$(TARGET_DIR)
	touch $@

socat: uclibc $(TARGET_DIR)/usr/bin/socat

socat-source: $(DL_DIR)/$(SOCAT_SOURCE)

socat-clean:
	-$(MAKE) -C $(SOCAT_WORKDIR) clean
	rm -f $(TARGET_DIR)/usr/bin/{socat,filan,procan}

socat-dirclean:
	rm -rf $(SOCAT_DIR) $(SOCAT_WORKDIR)

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(BR2_PACKAGE_SOCAT),y)
TARGETS+=socat
endif