Opened 10 years ago

Closed 10 years ago

#3424 closed enhancement (fixed)

Configure : conditionally output HAIKU_ADD_ALTERNATIVE_GCC_LIBS = 1

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

Description

Another build automation enhancement :

Similar to Changeset [29161], modify configure to conditionally output HAIKU_ADD_ALTERNATIVE_GCC_LIBS = 1 to a *BuildConfig file residing in HAIKU_OUTPUT_DIR

I'm willing to implement this. Please give me an idea of what would be acceptable.

Attachments (2)

configure.3424.diff (851 bytes) - added by mmadia 10 years ago.
created against hrev29571
configure.3424-rev2.diff (975 bytes) - added by mmadia 10 years ago.
revision 2, hopefully much cleaner

Download all attachments as: .zip

Change History (7)

comment:1 Changed 10 years ago by mmadia

This script shows one method for adding HAIKU_ADD_ALTERNATIVE_GCC_LIBS = 1 to HAIKU_OUTPUT_DIR/UserBuildConfig.

I've yet to attempt integrating this into the build system.

#!/bin/sh
# THESE VARIABLES exist for testing purposes.
HAIKU_OUTPUT_DIR='.'
infile="$HAIKU_OUTPUT_DIR/UserBuildConfig"
outfile="$HAIKU_OUTPUT_DIR/TempBuildConfig"

# check if HAIKU_OUTPUT_DIR/UserBuildConfig exists
# If yes, delete any lines containing HAIKU_ADD_ALTERNATIVE_GCC_LIBS
if [ -f "$infile" ] ; then
  grep -Ev HAIKU_ADD_ALTERNATIVE_GCC_LIBS "$infile" > "$outfile"
  mv -f "$outfile" "$infile"
fi
# Add line to HAIKU_OUTPUT_DIR/UserBuildConfig
echo "HAIKU_ADD_ALTERNATIVE_GCC_LIBS = 1 " >> "$infile"

Changed 10 years ago by mmadia

Attachment: configure.3424.diff added

created against hrev29571

comment:2 Changed 10 years ago by mmadia

The attached configure.3424.diff was tested with
../haiku/configure
../haiku/configure --alternative-gcc-output-dir ../gcc4
both commands were tested with and without a pre-existing HAIKU_OUTPUT_DIR/build/UserBuildConfig

note: configure was being run outside of haiku's source directory

comment:3 Changed 10 years ago by bonefish

Generally I'm not very fond of editing user files programmatically. In this case I think the better alternative is to set the variable in the generated BuildConfig. That would still allow it to be unset in the UserBuildConfig.

Changed 10 years ago by mmadia

Attachment: configure.3424-rev2.diff added

revision 2, hopefully much cleaner

comment:4 Changed 10 years ago by mmadia

configure.3424-rev2.diff creates a new variable , addAlternativeGCCLibs=0 and sets it =1 when --alternative-gcc-output-dir is detected.

This is added to ${outputDir}/build/BuildConfig: HAIKU_ADD_ALTERNATIVE_GCC_LIBS ?= "${addAlternativeGCCLibs}" ;

On a side note, is there any reason why ${alternativeGCCOutputDir} is not encapsulated in double quotes?

comment:5 in reply to:  4 Changed 10 years ago by bonefish

Resolution: fixed
Status: newclosed

Replying to mmadia:

configure.3424-rev2.diff creates a new variable , addAlternativeGCCLibs=0 and sets it =1 when --alternative-gcc-output-dir is detected.

This is added to ${outputDir}/build/BuildConfig: HAIKU_ADD_ALTERNATIVE_GCC_LIBS ?= "${addAlternativeGCCLibs}" ;

Applied in hrev29607, but adjusted a bit. Since HAIKU_ADD_ALTERNATIVE_GCC_LIBS is only tested for non-emptiness, setting it to 0 wouldn't work.

On a side note, is there any reason why ${alternativeGCCOutputDir} is not encapsulated in double quotes?

ATM path names with spaces aren't really supported anyway, so that doesn't really make a difference.

Note: See TracTickets for help on using tickets.