Opened 11 years ago

Closed 11 years ago

#3423 closed enhancement (fixed)

Automate creation of cross-ssl dir

Reported by: mmadia Owned by: bonefish
Priority: normal Milestone: R1
Component: Build System Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All


Another feature to improve build automation...

Currently, any application that makes use of OpenSSL will fail to compile unless the user expands the optional package openssl to $HAIKU_OUTPUT_DIR/cross-ssl

The build system supports downloading the archive and expanding the archive to the build destination.

Could a rule SetupSSLDir be created to automate this process? Then any jamfile that makes use of the variable sslDir could be updated to call this rule.

I'm willing to implement this, just tell me how you would like it done.

Attachments (2)

SetupCrossSSLDir.patch (2.4 KB ) - added by mmadia 11 years ago.
Initial Patch -- very rough (578 bytes ) - added by mmadia 11 years ago.
temporary measure to assist people.

Download all attachments as: .zip

Change History (8)

comment:1 by mmadia, 11 years ago

How's this look so far?

*UserBuildConfig and ReleaseBuildProfiles

instead of :
	USE_SSL = 1 ; 
do :
	SetupCrossSSLDir ;

haiku/build/jam/MiscRules :

( or a similar *Rules file )

rule SetupCrossSSLDir
	if $(TARGET_ARCH) != x86 {
		Echo "No optional package OpenSSL available for $(TARGET_ARCH)" ;
	} else { 
# check if cross-ssl dir exists
# if not, check if file archive exists
# 	if not, download file,  extract file
		SSL_DIR = blah
		USE_SSL = 1 ;

A side effect of this, all packages that test "if $USE_SSL = 1", would be able to expect SSL_DIR to be valid.


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 ] ;


if $(USE_SSL) {
	SubDirSysHdrs [ FDirName $(SSL_DIR) include ] ;

comment:2 by mmadia, 11 years ago

I haven't had time to work on this more, due to hardware issues. Though, here's an idea of how to implement the commented sections

## Untested Code for ImageRules
if [ IsOptionalBuildSoftwareAdded OpenSSL ] {
        if $(TARGET_ARCH) != x86 {
		Echo "No optional package OpenSSL available for $(TARGET_ARCH)" ;
	} else {
		local baseURL = ;
		InstallOptionalBuildSoftware openssl-0.9.8j-gcc2-2009-01-28
			: $(baseURL)/

rule InstallOptionalBuildSoftware package : url : dirTokens
	# download zip file
	local zipFile = $(package:G=download).zip ;
	MakeLocate $(zipFile) : $(HAIKU_DOWNLOAD_DIR) ;
	DownloadFile $(zipFile) : $(url) ;

	# unzip to container 
	UnzipArchiveToContainer $(HAIKU_OUTPUT_DIR) : $(dirTokens) : $(zipFile) ;

by mmadia, 11 years ago

Attachment: SetupCrossSSLDir.patch added

Initial Patch -- very rough

comment:3 by mmadia, 11 years ago

jam -q @alpha-raw .... don't know how to make generated/cross-ssl/lib/ don't know how to make generated/cross-ssl/lib/ .... ...found 71932 target(s)... ...updating 8236 target(s)... ...can't find 2 target(s)... ...can't make 6 target(s)...

Am I going about this wrong? Do I need to figure out how to inform jam how to make those shared objects?

For some reason, I thought that having SetupCrossSSLDir in build/jam/ReleaseBuildProfiles would be sufficient.

comment:4 by bonefish, 11 years ago

  • Probably unintentionally you've inserted a second AddOptionalHaikuImagePackages rule, which will override the first one.
  • UnzipArchiveToContainer does unzip the given archive to an installation container (HaikuImage, NetBootArchive, BootFloppy,...), not to a directory. The unzipping happens in the build_haiku_image script, which is too late for your purpose. Unless I'm much mistaken there is no rule to unzip a file yet. The closest rule is UnarchiveObjects in FileRules, which extracts object files from a static library. An unzip rule could work similarly.
  • Rather than adding every optional build dependency, I would create a new file similar to OptionalPackages (say OptionalBuildPackages) which would execute the download and unzip rules for each enabled package and set some global variables that can be used in the Jamfiles. Like HAIKU_OPTIONAL_{LIBSSL,LIBCRYPTO,SSL_HEADERS} for OpenSSL.

by mmadia, 11 years ago

Attachment: added

temporary measure to assist people.

comment:5 by mmadia, 11 years ago

I still haven't taken enough time to learn how to do this. The bits about HAIKU_OPTIONAL_{LIBSSL, LIBCRYPTO, SSL_HEADERS} are still beyond me.

For the meantime, here's a rinky dink shell script to help people. I don't intend for it to be committed, but felt it useful enough to be added to the ticket. The script needs to be run from the users HAIKU_OUTPUT_DIR.

comment:6 by bonefish, 11 years ago

Resolution: fixed
Status: newclosed

Implemented a solution in hrev30021.

Note: See TracTickets for help on using tickets.