On Sat, Apr 11, 2009 at 4:57 AM, David McPaul <dlmcpaul@xxxxxxxxx> wrote: >> Because of that last argument, I'd actually be in favor of keeping yasm in >> our buildtools, but then it needs to be enabled during cross compilation! > > How can I go about doing that? The patch i'm working on is here: Index: build/jam/OptionalPackageDependencies =================================================================== --- build/jam/OptionalPackageDependencies (revision 30117) +++ build/jam/OptionalPackageDependencies (working copy) -2,7 +2,7 @@ OptionalPackageDependencies APR-util : APR ; OptionalPackageDependencies BeHappy : BeBook NetSurf ; -OptionalPackageDependencies Development : Perl ; +OptionalPackageDependencies Development : Perl Yasm ; OptionalPackageDependencies LibLayout : Development ; OptionalPackageDependencies NetSurf : OpenSSL ; OptionalPackageDependencies OpenSSH : OpenSSL ; Index: build/jam/MainBuildRules =================================================================== --- build/jam/MainBuildRules (revision 30117) +++ build/jam/MainBuildRules (working copy) -175,9 +175,9 @@ actions AssembleNasm { if test $(ASFLAGS) ; then - yasm -d $(ASFLAGS) -f elf32 -o $(1) $(2); + $(HAIKU_YASM) -d $(ASFLAGS) -f elf32 -o $(1) $(2); else - yasm -f elf32 -o $(1) $(2); + $(HAIKU_YASM) -f elf32 -o $(1) $(2); fi } Index: build/scripts/build_cross_tools =================================================================== --- build/scripts/build_cross_tools (revision 30117) +++ build/scripts/build_cross_tools (working copy) -50,6 +50,7 @@ # create the object and installation directories for the cross compilation tools installDir=$haikuOutputDir/cross-tools objDir=$haikuOutputDir/cross-tools-build +yasmObjDir=$objDir/yasm binutilsObjDir=$objDir/binutils gccObjDir=$objDir/gcc tmpIncludeDir=$objDir/sysincludes -57,10 +58,17 @@ rm -rf $installDir $objDir -mkdir -p $installDir $objDir $binutilsObjDir $gccObjDir $tmpIncludeDir \ - $tmpLibDir || exit 1 +mkdir -p $installDir $objDir $yasmObjDir $binutilsObjDir $gccObjDir \ + $tmpIncludeDir $tmpLibDir || exit 1 mkdir -p $installDir/lib/gcc-lib/i586-pc-haiku/$haikuRequiredLegacyGCCVersion +# build yasm +cd $yasmObjDir +$buildToolsDir/../yasm/configure --prefix=$installDir \ + --program-prefix=i586-pc-haiku-|| exit 1 +make || exit 1 +make install || exit 1 + # build binutils cd $binutilsObjDir CFLAGS="-O2" CXXFLAGS="-O2" $buildToolsDir/binutils/configure \ Index: build/scripts/build_cross_tools_gcc4 =================================================================== --- build/scripts/build_cross_tools_gcc4 (revision 30117) +++ build/scripts/build_cross_tools_gcc4 (working copy) -57,6 +57,8 @@ cd $haikuOutputDir haikuOutputDir=$(pwd) +yasmSourceDir=$buildToolsDir/yasm + binutilsSourceDir=$buildToolsDir/binutils gccSourceDir=$buildToolsDir/gcc -73,6 +75,7 @@ # create the object and installation directories for the cross compilation tools installDir=$haikuOutputDir/cross-tools objDir=$haikuOutputDir/cross-tools-build +yasmObjDir=$objDir/yasm binutilsObjDir=$objDir/binutils gccObjDir=$objDir/gcc tmpIncludeDir=$objDir/sysincludes -80,10 +83,16 @@ rm -rf $installDir $objDir -mkdir -p $installDir $objDir $binutilsObjDir $gccObjDir $tmpIncludeDir \ - $tmpLibDir || exit 1 +mkdir -p $installDir $objDir $yasmObjDir $binutilsObjDir $gccObjDir \ + $tmpIncludeDir $tmpLibDir || exit 1 mkdir -p $installDir/lib/gcc/$haikuMachine/$gccVersion +# build yasm +cd $yasmObjDir +$yasmSourceDir/configure --prefix=$installDir \ + --program-prefix=$haikuMachine- +$MAKE || exit 1 +$MAKE install || exit 1 # build binutils cd $binutilsObjDir Index: configure =================================================================== --- configure (revision 30117) +++ configure (working copy) -75,6 +75,7 @@ HAIKU_LD The linker. Defaults to "ld". HAIKU_OBJCOPY The objcopy to be used. Defaults to "objcopy". HAIKU_RANLIB The static library indexer. Defaults to "ranlib". + HAIKU_YASM The yasm assembler. Defaults to "yasm". HAIKU_CPPFLAGS The preprocessor flags. Defaults to "". HAIKU_CCFLAGS The C flags. Defaults to "". HAIKU_CXXFLAGS The C++ flags. Defaults to "". -279,6 +280,7 @@ set_default_value HAIKU_LD ld set_default_value HAIKU_OBJCOPY objcopy set_default_value HAIKU_RANLIB ranlib +set_default_value HAIKU_YASM yasm set_default_value HAIKU_CPPFLAGS "" set_default_value HAIKU_CCFLAGS "" set_default_value HAIKU_CXXFLAGS "" -403,6 +405,7 @@ get_build_tool_path LD ld get_build_tool_path OBJCOPY objcopy get_build_tool_path RANLIB ranlib + get_build_tool_path YASM yasm fi # prepare gcc settings -457,6 +460,7 @@ HAIKU_LD ?= ${HAIKU_LD} ; HAIKU_OBJCOPY ?= ${HAIKU_OBJCOPY} ; HAIKU_RANLIB ?= ${HAIKU_RANLIB} ; +HAIKU_YASM ?= $(HAIKU_YASM) ; HAIKU_CPPFLAGS ?= ${HAIKU_CPPFLAGS} ; HAIKU_CCFLAGS ?= ${HAIKU_CCFLAGS} ; HAIKU_CXXFLAGS ?= ${HAIKU_CXXFLAGS} ; So, a quick rundown from the top: First, I added Yasm as a dependency of the Development optional package - since Yasm is required for building Haiku now, it should be included by default is Development is... that's sort of what that package was designed for :) Next, I replaced the jam rule's invocation of yasm with a variable from BuildConfig - $(HAIKU_YASM) The changes to build_cross_tools and build_cross_tools_gcc4 were sort of hacked in, and do work, but I had to add the --program-prefix=i586-pc-haiku- which shouldn't really be needed/wanted. I did this because of my struggles with the BuildConfig, which I'll get to shortly. The resulting yasm created by the build_cross_tools does work for building ape_reader, as I confirmed, but I didn't try libavc yet. Also, the _gcc4 script hasn't really been tested, i just modified it the same way in hopes that it was right. Additionally, it shouldn't bother building yasm unless the target is x86 The changes I made to "configure" are to add HAIKU_YASM to the BuildConfig - this is where I'm having problems, as this logic needs to handle the various scenarios where you're either building the cross-tools, specifying a cross-tools prefix, or building on a Haiku host where the cross-tools aren't needed. If someone can help with this part, and not require that yasm be i586-pc-haiku-yasm then I think it'll be closer to what we're looking for right? - Urias