From ff81d306d49e6ce4237bdee4c2d1dfd8e9b92e74 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 8 Apr 2009 10:07:17 +0000 Subject: [PATCH] * Moved the optional package dependency definitions into the new build/jam/OptionalPackageDependencies and include it earlier (before the Jamfiles). * Introduced build/jam/OptionalBuildFeatures which is supposed to do the setup for optional build features that need it. * Renamed USE_SSL to HAIKU_BUILD_FEATURE_SSL and made it more intelligent. The OpenSSL optional package is downloaded and unzipped automatically when enabled. Switching between enabled/disabled HAIKU_BUILD_FEATURE_SSL is handled gracefully -- the concerned components are built in separate subdirectories. Adding the OpenSSL optional package to the image also enables HAIKU_BUILD_FEATURE_SSL. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30021 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- Jamfile | 5 ++ Jamrules | 2 + build/jam/OptionalBuildFeatures | 47 +++++++++++++++++++ build/jam/OptionalPackageDependencies | 9 ++++ build/jam/OptionalPackages | 18 +------ build/jam/ReleaseBuildProfiles | 1 - build/jam/UserBuildConfig.ReadMe | 5 ++ .../inbound_protocols/imap/Jamfile | 39 +++++++-------- .../inbound_protocols/pop3/Jamfile | 39 +++++++-------- .../outbound_protocols/smtp/Jamfile | 38 ++++++++------- src/bin/network/wget/Jamfile | 36 ++++++++------ src/preferences/mail/Jamfile | 47 +++++++++---------- 12 files changed, 175 insertions(+), 111 deletions(-) create mode 100644 build/jam/OptionalBuildFeatures create mode 100644 build/jam/OptionalPackageDependencies diff --git a/Jamfile b/Jamfile index b51ff8b6b5..9643fd6d4f 100644 --- a/Jamfile +++ b/Jamfile @@ -132,6 +132,11 @@ Depends ScreenSaverKit : Haiku ; +# Evaluate optional package dependencies and prepare the optional build +# features before parsing the Jamfile tree. +include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackageDependencies ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalBuildFeatures ] ; + # Optionally we allow not to include the "src" subdirectory. if $(HAIKU_DONT_INCLUDE_SRC) { # Don't include "src", but at least include the stuff needed for the diff --git a/Jamrules b/Jamrules index 74f87028f4..35e74573fe 100644 --- a/Jamrules +++ b/Jamrules @@ -8,6 +8,8 @@ HAIKU_BUILD_RULES_DIR = [ FDirName $(HAIKU_BUILD_DIR) jam ] ; HAIKU_OBJECT_DIR = [ FDirName $(HAIKU_OUTPUT_DIR) objects ] ; HAIKU_COMMON_PLATFORM_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_DIR) common ] ; HAIKU_DOWNLOAD_DIR = [ FDirName $(HAIKU_OUTPUT_DIR) download ] ; +HAIKU_OPTIONAL_BUILD_PACKAGES_DIR = [ FDirName $(HAIKU_OUTPUT_DIR) + build_packages ] ; # Cache files for header scanning and jamfile caching HCACHEFILE = header_cache ; diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures new file mode 100644 index 0000000000..ab38a0e959 --- /dev/null +++ b/build/jam/OptionalBuildFeatures @@ -0,0 +1,47 @@ +# This file contains setup for features that can optionally be used for the +# build. For features that require downloading a zip file from somewhere it is +# likely the same file use for an optional package. + + +# SSL + +# Automatically enable the SSL feature, when the optional OpenSSL optional +# package is enabled. +if [ IsOptionalHaikuImagePackageAdded OpenSSL ] { + HAIKU_BUILD_FEATURE_SSL = 1 ; +} + +local baseURL = http://haiku-files.org/files/optional-packages ; +HAIKU_OPENSSL_PACKAGE = openssl-0.9.8j-gcc2-2009-01-28 ; +HAIKU_OPENSSL_URL = $(baseURL)/$(HAIKU_OPENSSL_PACKAGE).zip ; + +if $(HAIKU_BUILD_FEATURE_SSL) { + if $(TARGET_ARCH) != x86 { + Echo "SSL build feature not available for $(TARGET_ARCH)" ; + } else { + # Download the zip archive. + local zipFile = [ DownloadOptionalPackage $(HAIKU_OPENSSL_PACKAGE) + : $(HAIKU_OPENSSL_URL) ] ; + + # zip file and output directory + HAIKU_OPENSSL_ZIP_FILE = $(zipFile) ; + HAIKU_OPENSSL_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) + $(HAIKU_OPENSSL_PACKAGE) ] ; + + # unzip headers and libraries + HAIKU_OPENSSL_HEADERS_DEPENDENCY = [ UnzipArchive $(HAIKU_OPENSSL_DIR) + : common/include/ : $(zipFile) + ] ; + + HAIKU_OPENSSL_LIBS = [ UnzipArchive $(HAIKU_OPENSSL_DIR) + : + common/lib/libcrypto.so + common/lib/libssl.so + : $(zipFile) + ] ; + + HAIKU_OPENSSL_ENABLED = 1 ; + HAIKU_OPENSSL_HEADERS + = [ FDirName $(HAIKU_OPENSSL_DIR) common include ] ; + } +} diff --git a/build/jam/OptionalPackageDependencies b/build/jam/OptionalPackageDependencies new file mode 100644 index 0000000000..55486e57e8 --- /dev/null +++ b/build/jam/OptionalPackageDependencies @@ -0,0 +1,9 @@ +# package dependencies + +OptionalPackageDependencies APR-util : APR ; +OptionalPackageDependencies BeHappy : BeBook NetSurf ; +OptionalPackageDependencies Development : Perl ; +OptionalPackageDependencies LibLayout : Development ; +OptionalPackageDependencies NetSurf : OpenSSL ; +OptionalPackageDependencies OpenSSH : OpenSSL ; +OptionalPackageDependencies Subversion : OpenSSL ; diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index b13228daf6..cbca0e4ab4 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -43,16 +43,6 @@ if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) && $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) { # Yasm -# package dependencies -OptionalPackageDependencies APR-util : APR ; -OptionalPackageDependencies BeHappy : BeBook NetSurf ; -OptionalPackageDependencies Development : Perl ; -OptionalPackageDependencies LibLayout : Development ; -OptionalPackageDependencies NetSurf : OpenSSL ; -OptionalPackageDependencies OpenSSH : OpenSSL ; -OptionalPackageDependencies Subversion : OpenSSL ; - - # APR if [ IsOptionalHaikuImagePackageAdded APR ] { if $(TARGET_ARCH) != x86 { @@ -446,16 +436,14 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSL ] { if $(TARGET_ARCH) != x86 { Echo "No optional package OpenSSL available for $(TARGET_ARCH)" ; } else { - local baseURL = http://haiku-files.org/files/optional-packages ; - InstallOptionalHaikuImagePackage openssl-0.9.8j-gcc2-2009-01-28 - : $(baseURL)/openssl-0.9.8j-gcc2-2009-01-28.zip + InstallOptionalHaikuImagePackage $(HAIKU_OPENSSL_PACKAGE) + : $(HAIKU_OPENSSL_URL) : ; } } - # P7zip if [ IsOptionalHaikuImagePackageAdded P7zip ] { if $(TARGET_ARCH) != x86 { @@ -481,8 +469,6 @@ if [ IsOptionalHaikuImagePackageAdded P7zip ] { } - - # Pe text editor if [ IsOptionalHaikuImagePackageAdded Pe ] { if $(TARGET_ARCH) != x86 { diff --git a/build/jam/ReleaseBuildProfiles b/build/jam/ReleaseBuildProfiles index cd114364e8..061e8d0da9 100644 --- a/build/jam/ReleaseBuildProfiles +++ b/build/jam/ReleaseBuildProfiles @@ -9,7 +9,6 @@ switch $(HAIKU_BUILD_PROFILE) { AddGroupToHaikuImage party : 101 : user sshd ; HAIKU_IMAGE_HOST_NAME = shredder ; HAIKU_IMAGE_SIZE = 400 ; - USE_SSL = 1 ; AddOptionalHaikuImagePackages BePDF Firefox Pe Vision VLC WonderBrush ; AddOptionalHaikuImagePackages CVS Development Subversion OpenSSH Yasm ; diff --git a/build/jam/UserBuildConfig.ReadMe b/build/jam/UserBuildConfig.ReadMe index 4723fb9608..915f3973c3 100644 --- a/build/jam/UserBuildConfig.ReadMe +++ b/build/jam/UserBuildConfig.ReadMe @@ -49,6 +49,11 @@ AppendToConfigVar DEFINES : HAIKU_TOP src kits : RUN_WITHOUT_REGISTRAR # has no effect on executables or other shared objects. DEBUG on haiku-nat.o = 1 ; +# Enables the SSL build feature. Several targets will be compiled with SSL +# support. Adding the OpenSSL optional package will automatically enable this +# feature. +HAIKU_BUILD_FEATURE_SSL = 1 ; + # Haiku Image Related Modifications diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile b/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile index c7496c8fe9..7e8a33e04f 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile @@ -11,29 +11,30 @@ UsePrivateHeaders mail ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; -local sslDir ; - -if $(USE_SSL) { - SubDirC++Flags -DUSE_SSL ; - if ! $(SSL_DIR) { - sslDir = [ FDirName $(HAIKU_OUTPUT_DIR) cross-ssl common ] ; - } else { - sslDir = $(SSL_DIR) ; - } - SubDirSysHdrs [ FDirName $(sslDir) include ] ; -} - -Addon IMAP : +local sources = imap_client.cpp imap_config.cpp - NestedString.cpp ; + NestedString.cpp +; -LinkAgainst IMAP : be libmail.so $(TARGET_NETWORK_LIBS) ; - -if $(USE_SSL) { - LinkAgainst IMAP : $(sslDir)/lib/libssl.so $(sslDir)/lib/libcrypto.so ; +# use OpenSSL, if enabled +if $(HAIKU_OPENSSL_ENABLED) { + SubDirC++Flags -DUSE_SSL ; + SubDirSysHdrs $(HAIKU_OPENSSL_HEADERS) ; + Includes [ FGristFiles $(sources) ] : $(HAIKU_OPENSSL_HEADERS_DEPENDENCY) ; + # Dependency needed to trigger downloading/unzipping the package before + # compiling the files. + SetupFeatureObjectsDir ssl ; +} else { + SetupFeatureObjectsDir no-ssl ; } +Addon IMAP + : $(sources) + : be libmail.so $(TARGET_NETWORK_LIBS) $(HAIKU_OPENSSL_LIBS) +; + Package haiku-maildaemon-cvs : IMAP : - boot home config add-ons mail_daemon inbound_protocols ; + boot home config add-ons mail_daemon inbound_protocols +; diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/Jamfile b/src/add-ons/mail_daemon/inbound_protocols/pop3/Jamfile index f839aac19d..cd939269b1 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/Jamfile +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/Jamfile @@ -11,30 +11,31 @@ UsePrivateHeaders mail ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; -local sslDir ; - -if $(USE_SSL) { - SubDirC++Flags -DUSE_SSL ; - if ! $(SSL_DIR) { - sslDir = [ FDirName $(HAIKU_OUTPUT_DIR) cross-ssl common ] ; - } else { - sslDir = $(SSL_DIR) ; - } - SubDirSysHdrs [ FDirName $(sslDir) include ] ; -} - -Addon POP3 : +local sources = MessageIO.cpp pop3.cpp SimpleMailProtocol.cpp - md5c.c ; + md5c.c +; -LinkAgainst POP3 : be libmail.so $(TARGET_NETWORK_LIBS) ; - -if $(USE_SSL) { - LinkAgainst POP3 : $(sslDir)/lib/libssl.so $(sslDir)/lib/libcrypto.so ; +# use OpenSSL, if enabled +if $(HAIKU_OPENSSL_ENABLED) { + SubDirC++Flags -DUSE_SSL ; + SubDirSysHdrs $(HAIKU_OPENSSL_HEADERS) ; + Includes [ FGristFiles $(sources) ] : $(HAIKU_OPENSSL_HEADERS_DEPENDENCY) ; + # Dependency needed to trigger downloading/unzipping the package before + # compiling the files. + SetupFeatureObjectsDir ssl ; +} else { + SetupFeatureObjectsDir no-ssl ; } +Addon POP3 + : $(sources) + : be libmail.so $(TARGET_NETWORK_LIBS) $(HAIKU_OPENSSL_LIBS) +; + Package haiku-maildaemon-cvs : POP3 : - boot home config add-ons mail_daemon inbound_protocols ; + boot home config add-ons mail_daemon inbound_protocols +; diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/Jamfile b/src/add-ons/mail_daemon/outbound_protocols/smtp/Jamfile index d0dde25845..9bd3035105 100644 --- a/src/add-ons/mail_daemon/outbound_protocols/smtp/Jamfile +++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/Jamfile @@ -11,26 +11,30 @@ UsePrivateHeaders mail ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; -if $(USE_SSL) { - SubDirC++Flags -DUSE_SSL ; - if ! $(SSL_DIR) { - sslDir = [ FDirName $(HAIKU_OUTPUT_DIR) cross-ssl common ] ; - } else { - sslDir = $(SSL_DIR) ; - } - SubDirSysHdrs [ FDirName $(sslDir) include ] ; -} - -Addon SMTP : +local sources = smtp.cpp - md5c.c ; + md5c.c +; -LinkAgainst SMTP : be libmail.so $(TARGET_NETWORK_LIBS) $(TARGET_LIBSTDC++) ; - -if $(USE_SSL) { - LinkAgainst SMTP : $(sslDir)/lib/libssl.so $(sslDir)/lib/libcrypto.so ; +# use OpenSSL, if enabled +if $(HAIKU_OPENSSL_ENABLED) { + SubDirC++Flags -DUSE_SSL ; + SubDirSysHdrs $(HAIKU_OPENSSL_HEADERS) ; + Includes [ FGristFiles $(sources) ] : $(HAIKU_OPENSSL_HEADERS_DEPENDENCY) ; + # Dependency needed to trigger downloading/unzipping the package before + # compiling the files. + SetupFeatureObjectsDir ssl ; +} else { + SetupFeatureObjectsDir no-ssl ; } +Addon SMTP + : $(sources) + : be libmail.so $(TARGET_NETWORK_LIBS) $(TARGET_LIBSTDC++) + $(HAIKU_OPENSSL_LIBS) +; + Package haiku-maildaemon-cvs : SMTP : - boot home config add-ons mail_daemon outbound_protocols ; + boot home config add-ons mail_daemon outbound_protocols +; diff --git a/src/bin/network/wget/Jamfile b/src/bin/network/wget/Jamfile index 7a9333bbc6..93fad65692 100644 --- a/src/bin/network/wget/Jamfile +++ b/src/bin/network/wget/Jamfile @@ -1,27 +1,33 @@ SubDir HAIKU_TOP src bin network wget ; UseHeaders [ FDirName $(SUBDIR) src ] : true ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) src ] ; local defines = [ FDefines HAVE_CONFIG_H=1 ] ; SubDirCcFlags $(defines) ; SubDirC++Flags $(defines) ; -local SSL_FILES ; -local SSL_LIBS ; -if $(USE_SSL) { +# use OpenSSL, if enabled +local sslSources ; + +if $(HAIKU_OPENSSL_ENABLED) { SubDirCcFlags -DHAVE_LIBSSL ; - if ! $(SSL_DIR) { - sslDir = [ FDirName $(HAIKU_OUTPUT_DIR) cross-ssl common ] ; - } else { - sslDir = $(SSL_DIR) ; - } - SubDirSysHdrs [ FDirName $(sslDir) include ] ; - SSL_FILES = openssl.c ; - SSL_LIBS = $(sslDir)/lib/libssl.so $(sslDir)/lib/libcrypto.so ; -} + SubDirSysHdrs $(HAIKU_OPENSSL_HEADERS) ; + sslSources = openssl.c ; + Includes [ FGristFiles $(sslSources) ] + : $(HAIKU_OPENSSL_HEADERS_DEPENDENCY) ; + # Dependency needed to trigger downloading/unzipping the package before + # compiling the files. + SetupFeatureObjectsDir ssl ; +} else { + SetupFeatureObjectsDir no-ssl ; +} + + +SEARCH_SOURCE += [ FDirName $(SUBDIR) src ] ; + # needs to be invoked after SetupFeatureObjectsDir + BinCommand wget : cmpt.c @@ -55,6 +61,6 @@ BinCommand wget : utils.c version.c xmalloc.c - $(SSL_FILES) - : $(TARGET_NETWORK_LIBS) $(SSL_LIBS) + $(sslSources) + : $(TARGET_NETWORK_LIBS) $(HAIKU_OPENSSL_LIBS) ; diff --git a/src/preferences/mail/Jamfile b/src/preferences/mail/Jamfile index 8b25a438df..a3b96ff837 100644 --- a/src/preferences/mail/Jamfile +++ b/src/preferences/mail/Jamfile @@ -15,25 +15,12 @@ SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; UsePrivateHeaders shared ; # TODO(bga): E-mail preferences does not really need to link against the -# OpenSSL libraries. Remove this after problems with the runtile loader are +# OpenSSL libraries. Remove this after problems with the runtime loader are # sorted up. Details here: # # http://www.freelists.org/post/haiku-development/Runtime-loader-problem -local sslDir ; - -if $(USE_SSL) { - SubDirC++Flags -DUSE_SSL ; - if ! $(SSL_DIR) { - sslDir = [ FDirName $(HAIKU_OUTPUT_DIR) cross-ssl common ] ; - } else { - sslDir = $(SSL_DIR) ; - } - SubDirSysHdrs [ FDirName $(sslDir) include ] ; -} - - -Preference E-mail : +local sources = Account.cpp AutoConfig.cpp AutoConfigWindow.cpp @@ -42,18 +29,30 @@ Preference E-mail : ConfigViews.cpp ConfigWindow.cpp DNSQuery.cpp - main.cpp - : be libmail.so $(HAIKU_NETWORK_LIBS) $(TARGET_NETAPI_LIB) - : e-mail.rdef - ; + main.cpp +; -if $(USE_SSL) { - LinkAgainst E-mail : $(sslDir)/lib/libssl.so $(sslDir)/lib/libcrypto.so ; +if $(HAIKU_OPENSSL_ENABLED) { + SubDirC++Flags -DUSE_SSL ; + SubDirSysHdrs $(HAIKU_OPENSSL_HEADERS) ; + Includes [ FGristFiles $(sources) ] : $(HAIKU_OPENSSL_HEADERS_DEPENDENCY) ; + # Dependency needed to trigger downloading/unzipping the package before + # compiling the files. + SetupFeatureObjectsDir ssl ; +} else { + SetupFeatureObjectsDir no-ssl ; } +Preference E-mail + : $(sources) + : be libmail.so $(HAIKU_NETWORK_LIBS) $(TARGET_NETAPI_LIB) + $(HAIKU_OPENSSL_LIBS) + : e-mail.rdef +; + Package haiku-maildaemon-cvs : - E-mail : - boot beos preferences ; + E-mail : + boot beos preferences +; SubInclude HAIKU_TOP src preferences mail ProviderInfo ; -