prepare.py: add option --enable-non-free-codecs and...

prepare.py: add option --enable-non-free-codecs and --enable-gpl-third-parties, remove HAVE_* options from Xcode project since there are now automatically stubbed by the SDK
parent 9c2a949f
......@@ -1427,28 +1427,14 @@ static BOOL libStarted = FALSE;
connectivity = none;
ms_init(); // Need to initialize mediastreamer2 before loading the plugins
// Load plugins if available in the linphone SDK - otherwise these calls will do nothing
libmsilbc_init();
#if defined(HAVE_SILK)
libmssilk_init();
#endif
#ifdef HAVE_AMR
libmsamr_init(); // load amr plugin if present from the liblinphone sdk
#endif
#ifdef HAVE_X264
libmsx264_init(); // load x264 plugin if present from the liblinphone sdk
#endif
#ifdef HAVE_OPENH264
libmsopenh264_init(); // load openh264 plugin if present from the liblinphone sdk
#endif
#if HAVE_G729
libmsbcg729_init(); // load g729 plugin
#endif
#ifdef HAVE_WEBRTC
libmsamr_init();
libmsx264_init();
libmsopenh264_init();
libmsbcg729_init();
libmswebrtc_init();
#endif
// Set audio assets
const char *lRing =
......
......@@ -99,15 +99,14 @@
- (bool)onUpdate {
bool video_enabled = false;
#ifdef VIDEO_ENABLED
LinphoneCall *currentCall = linphone_core_get_current_call([LinphoneManager getLc]);
if (linphone_core_video_enabled([LinphoneManager getLc]) && currentCall &&
!linphone_call_media_in_progress(currentCall) &&
linphone_call_get_state(currentCall) == LinphoneCallStreamsRunning) {
video_enabled = TRUE;
LinphoneCore *lc = [LinphoneManager getLc];
LinphoneCall *currentCall = linphone_core_get_current_call(lc);
if (linphone_core_video_supported(lc)) {
if (linphone_core_video_enabled(lc) && currentCall && !linphone_call_media_in_progress(currentCall) &&
linphone_call_get_state(currentCall) == LinphoneCallStreamsRunning) {
video_enabled = TRUE;
}
}
#endif // VIDEO_ENABLED
[self setEnabled:video_enabled];
if (last_update_state != video_enabled)
......
......@@ -526,49 +526,48 @@ static UICompositeViewDescription *compositeDescription = nil;
}
+ (IASKSpecifier *)filterSpecifier:(IASKSpecifier *)specifier {
#ifndef HAVE_SSL
if ([[specifier key] isEqualToString:@"transport_preference"]) {
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]];
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"TLS"];
[dict setObject:titles forKey:@"Titles"];
NSMutableArray *values = [NSMutableArray arrayWithArray:[dict objectForKey:@"Values"]];
[values removeObject:@"tls"];
[dict setObject:values forKey:@"Values"];
return [[IASKSpecifier alloc] initWithSpecifier:dict];
}
#else
if ([[specifier key] isEqualToString:@"media_encryption_preference"]) {
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]];
if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionZRTP)) {
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"ZRTP"];
[dict setObject:titles forKey:@"Titles"];
NSMutableArray *values = [NSMutableArray arrayWithArray:[dict objectForKey:@"Values"]];
[values removeObject:@"ZRTP"];
[dict setObject:values forKey:@"Values"];
}
if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionSRTP)) {
if (linphone_core_sip_transport_supported([LinphoneManager getLc], LinphoneTransportTls)) {
if ([[specifier key] isEqualToString:@"transport_preference"]) {
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]];
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"SRTP"];
[titles removeObject:@"TLS"];
[dict setObject:titles forKey:@"Titles"];
NSMutableArray *values = [NSMutableArray arrayWithArray:[dict objectForKey:@"Values"]];
[values removeObject:@"SRTP"];
[values removeObject:@"tls"];
[dict setObject:values forKey:@"Values"];
return [[IASKSpecifier alloc] initWithSpecifier:dict];
}
if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionDTLS)) {
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"DTLS"];
[dict setObject:titles forKey:@"Titles"];
NSMutableArray *values = [NSMutableArray arrayWithArray:[dict objectForKey:@"Values"]];
[values removeObject:@"DTLS"];
[dict setObject:values forKey:@"Values"];
} else {
if ([[specifier key] isEqualToString:@"media_encryption_preference"]) {
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]];
if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionZRTP)) {
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"ZRTP"];
[dict setObject:titles forKey:@"Titles"];
NSMutableArray *values = [NSMutableArray arrayWithArray:[dict objectForKey:@"Values"]];
[values removeObject:@"ZRTP"];
[dict setObject:values forKey:@"Values"];
}
if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionSRTP)) {
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"SRTP"];
[dict setObject:titles forKey:@"Titles"];
NSMutableArray *values = [NSMutableArray arrayWithArray:[dict objectForKey:@"Values"]];
[values removeObject:@"SRTP"];
[dict setObject:values forKey:@"Values"];
}
if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionDTLS)) {
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"DTLS"];
[dict setObject:titles forKey:@"Titles"];
NSMutableArray *values = [NSMutableArray arrayWithArray:[dict objectForKey:@"Values"]];
[values removeObject:@"DTLS"];
[dict setObject:values forKey:@"Values"];
}
return [[IASKSpecifier alloc] initWithSpecifier:dict];
}
return [[IASKSpecifier alloc] initWithSpecifier:dict];
}
#endif // HAVE_SSL
// Add "build from source" if MPEG4 or H264 disabled
if ([[specifier key] isEqualToString:@"h264_preference"] && ![LinphoneManager isCodecSupported:"h264"]) {
return [SettingsViewController disableCodecSpecifier:specifier];
......@@ -584,9 +583,9 @@ static UICompositeViewDescription *compositeDescription = nil;
LinphoneManager *lm = [LinphoneManager instance];
NSMutableSet *hiddenKeys = [NSMutableSet set];
#ifndef HAVE_SSL
[hiddenKeys addObject:@"media_encryption_preference"];
#endif
if (!linphone_core_sip_transport_supported([LinphoneManager getLc], LinphoneTransportTls)) {
[hiddenKeys addObject:@"media_encryption_preference"];
}
#ifndef DEBUG
[hiddenKeys addObject:@"release_button"];
......@@ -630,9 +629,9 @@ static UICompositeViewDescription *compositeDescription = nil;
[hiddenKeys addObject:@"enable_first_login_view_preference"];
#ifndef VIDEO_ENABLED
[hiddenKeys addObject:@"enable_video_preference"];
#endif // VIDEO_ENABLED
if (!linphone_core_video_supported([LinphoneManager getLc])) {
[hiddenKeys addObject:@"enable_video_preference"];
}
if (!linphone_core_video_enabled([LinphoneManager getLc])) {
[hiddenKeys addObject:@"video_menu"];
......
......@@ -36,11 +36,12 @@ This SDK can be generated in 2 flavors:
* NO GPL third parties means that Linphone will only use non GPL code except for `liblinphone`, `mediastreamer2`, `oRTP` and `belle-sip`. If you choose this flavor, your final application is **still subject to GPL except if you have a [commercial license for the mentioned libraries](http://www.belledonne-communications.com/products.html)**.
To generate the liblinphone multi arch SDK without GPL third parties, invoke:
./prepare.py -DENABLE_GPL_THIRD_PARTIES=OFF [other options] && make
./prepare.py --disable-gpl-third-parties=no [other options] && make
## Customizing features
You can choose to enable/disable features such as custom audio/video codecs, media encryption, etc. To get a list of all features, the simplest way is to invoke `prepare.py` with `--list-features`:
You can enable all non-free codecs using `--enable-non-free-codecs`.
You can also choose to enable/disable features one by one (custom audio/video codecs, media encryption, etc.). To get a list of all features, the simplest way is to invoke `prepare.py` with `--list-features`:
./prepare.py --list-features
......@@ -72,8 +73,8 @@ After the SDK is built, just open the Linphone Xcode project with Xcode, and pre
## Note regarding third party components subject to license
The liblinphone SDK is compiled with third parties code that are subject to patent license, specially: AMR, SILK G729 and H264 codecs.
Linphone controls the embedding of these codecs thanks to the preprocessor macros HAVE_SILK, HAVE_AMR, HAVE_G729 HAVE_OPENH264 positioned in Xcode project.
Before embedding these 4 codecs in the final application, **make sure to have the right to do so**.
Linphone controls the embedding of these codecs by generating dummy libraries when there are not available. You can enable them using `prepare.py`
script (see `--enable-non-free-codecs` option). Before embedding these 4 codecs in the final application, **make sure to have the right to do so**.
# Testing the application
......
......@@ -80,8 +80,6 @@
2264B6D211200342002C2C53 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2264B6D111200342002C2C53 /* SystemConfiguration.framework */; };
226CDAE014E2D0B800513B67 /* libmsbcg729.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226CDADE14E2D0B800513B67 /* libmsbcg729.a */; };
226EF06C15FA256B005865C7 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 226EF06B15FA256B005865C7 /* MobileCoreServices.framework */; };
226F2ED61344B0EF00F6EF27 /* libopencore-amrwb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226F2ED31344B0EF00F6EF27 /* libopencore-amrwb.a */; };
226F2ED71344B0EF00F6EF27 /* libopencore-amrnb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226F2ED41344B0EF00F6EF27 /* libopencore-amrnb.a */; };
226F2ED81344B0EF00F6EF27 /* libmsamr.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226F2ED51344B0EF00F6EF27 /* libmsamr.a */; };
2274401A106F31BD006EC466 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22744019106F31BD006EC466 /* CoreAudio.framework */; };
2274402F106F335E006EC466 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2274402E106F335E006EC466 /* AudioToolbox.framework */; };
......@@ -175,6 +173,9 @@
63C5107E1B8DF3DF008A415A /* libmediastreamer_base.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22405EE916006F0700B92522 /* libmediastreamer_base.a */; };
63C5107F1B8DF3DF008A415A /* libmediastreamer_voip.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22405EEA16006F0700B92522 /* libmediastreamer_voip.a */; };
63C510801B8DF3DF008A415A /* libortp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 220FAD2C10765B400068D98F /* libortp.a */; };
63C5109E1B8F2603008A415A /* libopencore-amrnb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226F2ED41344B0EF00F6EF27 /* libopencore-amrnb.a */; };
63C5109F1B8F2603008A415A /* libopencore-amrwb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226F2ED31344B0EF00F6EF27 /* libopencore-amrwb.a */; };
63C510A01B8F48DB008A415A /* libmswebrtc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 63EA4C941B50189D00922857 /* libmswebrtc.a */; };
63CD4B4F1A5AAC8C00B84282 /* DTAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CD4B4E1A5AAC8C00B84282 /* DTAlertView.m */; };
63D2680F1B174A5E00A2CC11 /* numpad_one_voicemail_default.png in Resources */ = {isa = PBXBuildFile; fileRef = 63D2680D1B174A5E00A2CC11 /* numpad_one_voicemail_default.png */; };
63D268101B174A5E00A2CC11 /* numpad_one_voicemail_over.png in Resources */ = {isa = PBXBuildFile; fileRef = 63D2680E1B174A5E00A2CC11 /* numpad_one_voicemail_over.png */; };
......@@ -1889,6 +1890,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
63C510A01B8F48DB008A415A /* libmswebrtc.a in Frameworks */,
63C5109E1B8F2603008A415A /* libopencore-amrnb.a in Frameworks */,
63C5109F1B8F2603008A415A /* libopencore-amrwb.a in Frameworks */,
63D7216D1B73975900D70E65 /* libmsx264.a in Frameworks */,
63D7215D1B7394D200D70E65 /* libtunnel.a in Frameworks */,
63D7216C1B73973D00D70E65 /* libx264.a in Frameworks */,
......@@ -1938,8 +1942,6 @@
223148E61178A09900637D6A /* libmsilbc.a in Frameworks */,
226183B0147259670037138E /* libmssilk.a in Frameworks */,
22A10F3B11F8960300373793 /* libortp.a in Frameworks */,
226F2ED71344B0EF00F6EF27 /* libopencore-amrnb.a in Frameworks */,
226F2ED61344B0EF00F6EF27 /* libopencore-amrwb.a in Frameworks */,
226CDAE014E2D0B800513B67 /* libmsbcg729.a in Frameworks */,
220FAD3810765B400068D98F /* libspeex.a in Frameworks */,
220FAD3910765B400068D98F /* libspeexdsp.a in Frameworks */,
......@@ -4612,10 +4614,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = linphone_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
VIDEO_ENABLED,
HAVE_OPENH264,
HAVE_SILK,
HAVE_SSL,
DEBUG,
USE_APN_DEV,
);
......@@ -4702,12 +4700,6 @@
GCC_OPTIMIZATION_LEVEL = s;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = linphone_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
VIDEO_ENABLED,
HAVE_SILK,
HAVE_SSL,
HAVE_OPENH264,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
......@@ -4790,12 +4782,7 @@
GCC_OPTIMIZATION_LEVEL = s;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = linphone_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
VIDEO_ENABLED,
HAVE_SILK,
HAVE_SSL,
USE_APN_DEV,
);
GCC_PREPROCESSOR_DEFINITIONS = USE_APN_DEV;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
......@@ -4879,11 +4866,6 @@
GCC_OPTIMIZATION_LEVEL = s;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = linphone_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
VIDEO_ENABLED,
HAVE_SILK,
HAVE_SSL,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
......
......@@ -112,7 +112,7 @@ class PlatformListAction(argparse.Action):
def gpl_disclaimer(platforms):
cmakecache = 'WORK/ios-{arch}/cmake/CMakeCache.txt'.format(arch=platforms[0])
gpl_third_parties_enabled = ("ENABLE_GPL_THIRD_PARTIES:BOOL=ON" in open(cmakecache).read())
gpl_third_parties_enabled = "ENABLE_GPL_THIRD_PARTIES:BOOL=YES" in open(cmakecache).read() or "ENABLE_GPL_THIRD_PARTIES:BOOL=ON" in open(cmakecache).read()
if gpl_third_parties_enabled:
warning("\n***************************************************************************"
......@@ -138,14 +138,14 @@ def gpl_disclaimer(platforms):
def extract_libs_list():
l = []
# name = libspeexdsp.a; path = "liblinphone-sdk/apple-darwin/lib/libspeexdsp.a"; sourceTree = "<group>"; };
regex = re.compile("name = (lib(\S+)\.a); path = \"liblinphone-sdk/apple-darwin/")
regex = re.compile("name = (\")*(lib(\S+))\.a(\")*; path = \"liblinphone-sdk/apple-darwin/")
f = open('linphone.xcodeproj/project.pbxproj', 'r')
lines = f.readlines()
f.close()
for line in lines:
m = regex.search(line)
if m is not None:
l += [m.group(1)]
l += [m.group(2)]
return list(set(l))
......@@ -154,7 +154,6 @@ missing_dependencies = {}
def check_is_installed(binary, prog=None, warn=True):
if not find_executable(binary):
if warn:
missing_dependencies[binary] = prog
# error("Could not find {}. Please install {}.".format(binary, prog))
......@@ -383,6 +382,13 @@ clean: $(addprefix clean-,$(packages))
veryclean: $(addprefix veryclean-,$(packages))
generate-dummy-%:
\t@echo "[{archs}] Generating dummy $* static library." ; \\
\tprintf "void $*_init() {{}}" | tr '-' '_' > .dummy.c ; \\
\tfor arch in {archs}; do clang -c .dummy.c -arch $$arch -o .dummy-$$arch.a; done ; \\
\tlipo -create -output .dummy.a .dummy-*.a ; \\
\trm .dummy-*.a .dummy.c
lipo:
\tarchives=`find liblinphone-sdk/{first_arch}-apple-darwin.ios -name *.a` && \\
\tmkdir -p liblinphone-sdk/apple-darwin && \\
......@@ -398,18 +404,18 @@ lipo:
\t\tall_archs="{first_arch}"; \\
\t\tmkdir -p `dirname $$destpath`; \\
\t\t{multiarch} \\
\t\techo "[$$all_archs] Mixing `basename $$archive` in $$destpath"; \\
\t\techo "[{archs}] Mixing `basename $$archive` in $$destpath"; \\
\t\tlipo -create $$all_paths -output $$destpath; \\
\tdone && \\
\tfor lib in {libs_list} ; do \\
\t\tif [ $${{lib:0:5}} = "libms" ] ; then \\
\t\t\tlibrary_path=liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/$$lib ; \\
\t\t\tlibrary_path=liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/$${{lib}}.a ; \\
\t\telse \\
\t\t\tlibrary_path=liblinphone-sdk/apple-darwin/lib/$$lib ; \\
\t\t\tlibrary_path=liblinphone-sdk/apple-darwin/lib/$${{lib}}.a ; \\
\t\tfi ; \\
\t\tif ! test -f $$library_path ; then \\
\t\t\techo "[$$all_archs] Generating dummy $$lib static library." ; \\
\t\t\tcp -f submodules/binaries/libdummy.a $$library_path ; \\
\t\t\t$(MAKE) generate-dummy-$$lib ; \\
\t\t\tmv .dummy.a $$library_path ; \\
\t\tfi \\
\tdone
......@@ -492,7 +498,11 @@ def main(argv=None):
argparser.add_argument(
'-f', '--force', help="Force preparation, even if working directory already exist.", action='store_true')
argparser.add_argument(
'-G' '--generator', help="CMake build system generator (default: Unix Makefiles).", default='Unix Makefiles', choices=['Unix Makefiles', 'Ninja'])
'--disable-gpl-third-parties', help="Disable GPL third parties such as FFMpeg, x264.", action='store_false')
argparser.add_argument(
'--enable-non-free-codecs', help="Enable non-free codecs such as OpenH264, MPEG4, etc.. Final application must comply with their respective license (see README.md).", action='store_true')
argparser.add_argument(
'-G' '--generator', help="CMake build system generator (default: Unix Makefiles).", default='Unix Makefiles', choices=['Unix Makefiles', 'Ninja'], dest='generator')
argparser.add_argument(
'-L', '--list-cmake-variables', help="List non-advanced CMake cache variables.", action='store_true', dest='list_cmake_variables')
argparser.add_argument(
......@@ -504,26 +514,27 @@ def main(argv=None):
args, additional_args = argparser.parse_known_args()
if check_tools() != 0:
return 1
if args.debug_verbose:
additional_args += ["-DENABLE_DEBUG_LOGS=ON"]
additional_args += ["-G", args.G__generator]
if args.G__generator == 'Ninja':
additional_args += ["-G", args.generator]
if args.generator == 'Ninja':
if not check_is_installed("ninja", "it"):
return 1
generator = 'ninja -C'
else:
generator = '$(MAKE) -C'
if check_tools() != 0:
return 1
additional_args += ["-DENABLE_DEBUG_LOGS={}".format("YES" if args.debug_verbose else "NO")]
additional_args += ["-DENABLE_NON_FREE_CODECS={}".format("YES" if args.enable_non_free_codecs else "NO")]
additional_args += ["-DENABLE_GPL_THIRD_PARTIES={}".format("NO" if args.disable_gpl_third_parties else "YES")]
if args.tunnel or os.path.isdir("submodules/tunnel"):
if not os.path.isdir("submodules/tunnel"):
info("Tunnel wanted but not found yet, trying to clone it...")
if check_is_installed("git", "it", True):
Popen("git clone gitosis@git.linphone.org:tunnel.git submodules/tunnel".split(" ")).wait()
else:
p = Popen("git clone gitosis@git.linphone.org:tunnel.git submodules/tunnel".split(" "))
p.wait()
if p.retcode != 0:
error("Could not clone tunnel. Please see http://www.belledonne-communications.com/voiptunnel.html")
return 1
warning("Tunnel enabled, disabling GPL third parties.")
......
cmake-builder @ 955f8749
Subproject commit 3401c7cea3667101395d7ff41bbf98d152b4603a
Subproject commit 955f8749357d7caa195699f12efe2a04823f0e2d
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment