summaryrefslogtreecommitdiffstats
blob: e3dafd1c53304f932d0200bef1d2b13aeef5d8f8 (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
108
109
110
111
112
113
114
115
116
Import(["env", "conf_env"])

if env.get("JRTPLIB_BUNDLED", False) :

################################################################################
# Common
################################################################################

	cppdefines = ["RTP_SUPPORT_RTCPUNKNOWN",
		("JRTPLIB_EXPORT", ""),
		("JRTPLIB_IMPORTEXPORT", "JRTPLIB_EXPORT"),
		"RTP_SOCKLENTYPE_UINT",
		"RTP_SUPPORT_IPV4MULTICAST",
		"RTP_SUPPORT_SDESPRIV",
		"RTP_SUPPORT_PROBATION",
		"RTP_SUPPORT_GETLOGINR",
		"RTP_SUPPORT_IPV6",
		"RTP_SUPPORT_IPV6MULTICAST",
		"RTP_SUPPORT_IFADDRS",
		"RTP_SUPPORT_SENDAPP",
	]

	if env["PLATFORM"] != "win32" :
		cppdefines += ["RTPCONFIG_UNIX_H", ]
	if env["PLATFORM"] != "win32" :
		cppflags = [("-include", "sys/types.h"), ("-include", "stdint.h")]


################################################################################
# Module flags
################################################################################

	if env["SCONS_STAGE"] == "flags" :
		env["JRTPLIB_FLAGS"] = {
				"CPPPATH": [Dir("src/")],
				"LIBPATH": [Dir(".")],
				"LIBS": ["Swiften_JRTPLIB"],
				"INTERNAL_CPPDEFINES": ["STATICLIB"],
				"CPPDEFINES": cppdefines,
				"CPPFLAGS": cppflags,
			}
		#if env["PLATFORM"] == "win32" :
		#	env["LIBIDN_FLAGS"]["CPPPATH"] += [Dir("stubs/win32")]
		#	if env["MSVC_VERSION"][:3] == "9.0" :
		#		env["LIBIDN_FLAGS"]["CPPPATH"] += [Dir("stubs/win32/VC2008")]

################################################################################
# Build
################################################################################

	if env["SCONS_STAGE"] == "build" :
		myenv = env.Clone()
		myenv.Append(CPPPATH = ["src"])
		# Remove warn flags
		myenv.Replace(CXXFLAGS = [flag for flag in env["CCFLAGS"] if flag not in ["-W", "-Wall"]])

		#myenv.Append(CCFLAGS = ["-DNDEBUG", "-DSTATICLIB"])
		
		#if myenv["PLATFORM"] != "win32":
		#	myenv.Append(CCFLAGS = ["-DMINIUPNPC_SET_SOCKET_TIMEOUT"])
		
		#if myenv["PLATFORM"] == "darwin":
		#	myenv.Append(CCFLAGS = ["-DMACOSX", "-D_DARWIN_C_SOURCE"])
		
		#if myenv["PLATFORM"] == "win32":
		#	myenv.Append(CCFLAGS = ["-DWIN32"])

		src_files = [
				"src/rtpsession.cpp",
				"src/rtpexternaltransmitter.cpp",
				"src/rtppacket.cpp",
				"src/rtpsourcedata.cpp",
				"src/rtpsessionparams.cpp",
				"src/rtpexternaltransmitter.cpp",
				"src/rtpipv4address.cpp",
				"src/rtcpapppacket.cpp",
				"src/rtcpbyepacket.cpp",
				"src/rtcpcompoundpacketbuilder.cpp",
				"src/rtcpcompoundpacket.cpp",
				"src/rtcppacketbuilder.cpp",
				"src/rtcppacket.cpp",
				"src/rtcprrpacket.cpp",
				"src/rtcpscheduler.cpp",
				"src/rtcpsdesinfo.cpp",
				"src/rtcpsdespacket.cpp",
				"src/rtcpsrpacket.cpp",
				"src/rtpbyteaddress.cpp",
				"src/rtpcollisionlist.cpp",
				"src/rtpdebug.cpp",
				"src/rtperrors.cpp",
				"src/rtpexternaltransmitter.cpp",
				"src/rtpinternalsourcedata.cpp",
				"src/rtpipv4address.cpp",
				"src/rtpipv6address.cpp",
				"src/rtplibraryversion.cpp",
				"src/rtppacketbuilder.cpp",
				"src/rtppacket.cpp",
				"src/rtppollthread.cpp",
				"src/rtprandom.cpp",
				"src/rtprandomrand48.cpp",
				"src/rtprandomrands.cpp",
				"src/rtprandomurandom.cpp",
				"src/rtpsession.cpp",
				"src/rtpsessionparams.cpp",
				"src/rtpsessionsources.cpp",
				"src/rtpsourcedata.cpp",
				"src/rtpsources.cpp",
				"src/rtptimeutilities.cpp",
				"src/rtpudpv4transmitter.cpp",
				"src/rtpudpv6transmitter.cpp",
			]	
		
		#if myenv["PLATFORM"] == "win32":
		#	src_files += ["src/libnatpmp/wingettimeofday.c"]
		
		myenv.StaticLibrary("Swiften_JRTPLIB", src_files)