Skip to content

Instantly share code, notes, and snippets.

@Cynede
Created January 9, 2013 10:02
Show Gist options
  • Save Cynede/4492036 to your computer and use it in GitHub Desktop.
Save Cynede/4492036 to your computer and use it in GitHub Desktop.
F# FAKE is taking action in Gentoo ecosystem
>> Emerging (1 of 1) dev-dotnet/fchess-9999 from weirdo
>>> Unpacking source...
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 5 (delta 4), reused 5 (delta 4)
Unpacking objects: 100% (5/5), done.
From git://github.com/Cynede/FChess
d997552..70a4f9b master -> master
GIT update -->
repository: git://github.com/Cynede/FChess.git
updating from commit: d997552f687f3da0869b13f06759680063d94cec
to commit: 70a4f9bfbbb956405f45e0a49f501449270a493a
build.fsx | 2 +-
src/TeAIChess.fsproj | 19 ++++++-------------
2 files changed, 7 insertions(+), 14 deletions(-)
branch: master
storage directory: "/usr/portage/distfiles/egit-src/FChess.git"
checkout type: bare repository
Cloning into '/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999'...
done.
Branch branch-master set up to track remote branch master from origin.
Switched to a new branch 'branch-master'
>>> Unpacked to /var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999
>>> Source unpacked in /var/tmp/portage/dev-dotnet/fchess-9999/work
>>> Preparing source in /var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999 ...
configure source
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999 ...
fsharpi ./build.fsx
Building project with version: LocalBuild
Shortened DependencyGraph for Target Build:
<== Build
<== Clean
The resulting target order is:
- Clean
- Build
Starting Target: Build (==> Clean)
Starting Target: Clean
Cleans the last build
--- Cleaning stuff ---
Creating ./src/obj
Creating ./src/bin
Finished Target: Clean
--- Building the app ---
XBuild Engine Version 3.0.2.0
Mono, Version 3.0.2.0
Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2011.
Build started 01/09/2013 14:04:37.
__________________________________________________
Project "/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999/src/TeAIChess.fsproj" (default target(s)):
Target PrepareForBuild:
Configuration: Release Platform: x86
Created directory "bin/Release/"
Created directory "obj/x86/Release/"
Target GenerateSatelliteAssemblies:
No input files were specified for target GenerateSatelliteAssemblies, skipping.
Target CoreCompile:
Tool /usr/lib/pkgconfig/../../lib/mono//4.0/fsc.exe execution started with arguments: -o:obj/x86/Release/FChess.exe --debug:pdbonly --noframework --define:TRACE --doc:bin/Release/FChess.XML --optimize+ --platform:x86 -r:/usr/lib/mono/4.5/mscorlib.dll -r:/usr/lib/mono/4.5/System.dll -r:/usr/lib/mono/4.5/System.Numerics.dll -r:/usr/lib/mono/4.5/System.Core.dll --target:exe --warn:3 --warnaserror:76 --fullpaths --flaterrors --highentropyva- TeAIHelpers.fs TeAIModel.fs TeAI.fs TeAIConsole.fs
F# Compiler for F# 3.0 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License
Target _CopyDeployFilesToOutputDirectoryAlways:
Copying file from '/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999/src/App.config' to '/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999/src/bin/Release/App.config'
Target _CopyAppConfigFile:
Copying file from '/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999/src/App.config' to '/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999/src/bin/Release/FChess.exe.config'
Target DeployOutputFiles:
Copying file from '/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999/src/obj/x86/Release/FChess.exe.mdb' to '/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999/src/bin/Release/FChess.exe.mdb'
Copying file from '/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999/src/obj/x86/Release/FChess.exe' to '/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999/src/bin/Release/FChess.exe'
Done building project "/var/tmp/portage/dev-dotnet/fchess-9999/work/fchess-9999/src/TeAIChess.fsproj".
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:05.3239270
Finished Target: Build
---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target Duration
------ --------
Clean 00:00:00.0046081
Build 00:00:05.4534427
Total: 00:00:05.4743568
Status: Ok
---------------------------------------------------------------------
>>> Source compiled.
>>> Test phase [not enabled]: dev-dotnet/fchess-9999
>>> Install fchess-9999 into /var/tmp/portage/dev-dotnet/fchess-9999/image/ category dev-dotnet
>>> Completed installing fchess-9999 into /var/tmp/portage/dev-dotnet/fchess-9999/image/
>>> Installing (1 of 1) dev-dotnet/fchess-9999
* checking 1 files for package collisions
>>> Merging dev-dotnet/fchess-9999 to /
--- /usr/
--- /usr/bin/
>>> /usr/bin/FChess.exe
>>> Safely unmerging already-installed instance...
No package files given... Grabbing a set.
>>> Original instance of package unmerged safely.
>>> dev-dotnet/fchess-9999 merged.
>>> Auto-cleaning packages...
>>> No outdated packages were found on your system.
@Cynede
Copy link
Author

Cynede commented Jan 9, 2013

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=4

EGIT_REPO_URI="git://github.com/Cynede/FChess.git"

inherit git-2 fake

DESCRIPTION="FAKE - F# Make"
HOMEPAGE="https://github.com/Cynede/FChess"
SRC_URI=""

LICENSE="GPLv2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE=""

DEPEND="dev-lang/mono"
RDEPEND="${DEPEND}"

MAKEOPTS="-j1"

src_install() {
    dobin src/bin/Release/FChess.exe || die
}

@Cynede
Copy link
Author

Cynede commented Jan 9, 2013

# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: fake.eclass
# @MAINTAINER: [email protected]
# @BLURB: Common functionality for fake apps
# @DESCRIPTION: Common functionality needed by fake build system.

inherit mono

NO_FAKE_DEPEND=( "dev-lang/fsharp" "dev-dotnet/fake" )

DEPEND="${NO_FAKE_DEPEND}"

# @FUNCTION: fake_src_unpack
# @DESCRIPTION:  Runs default()
fake_src_unpack() {
    if [[ "${PV%.9999}" != "${PV}" ||  "${PV}" == "9999" ]]
    then
        default
        git_src_unpack
    else
        default
    fi
}

# @FUNCTION: fake_src_configure
# @DESCRIPTION: Runs nothing
fake_src_configure() {
    echo "configure source"
}

# @FUNCTION: fake_src_compile
# @DESCRIPTION: Runs fake.
fake_src_compile() {
    #/usr/bin/fake
    cd "${S}"
    fake || die "fake failed"
}

# @FUNCTION: fake_src_install
# @DESCRIPTION: installs common doc files, if DOCS is
# set, installs those. Gets rid of .la files.
fake_src_install () {
    mono_multilib_comply
    local   commondoc=( AUTHORS ChangeLog README TODO )
    for docfile in "${commondoc[@]}"
    do
        [[ -e "${docfile}" ]] && dodoc "${docfile}"
    done
    if [[ "${DOCS[@]}" ]]
    then
        dodoc "${DOCS[@]}" || die "dodoc DOCS failed"
    fi
    find "${D}" -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed"
}

EXPORT_FUNCTIONS src_configure src_compile src_install

@Cynede
Copy link
Author

Cynede commented Jan 9, 2013

#I @"/usr/lib/mono/4.0/"
#r @"FakeLib.dll"

open System
open System.IO

module cprintf =
    let cprintf c fmt = 
        Printf.kprintf 
            (fun s -> 
                let old = System.Console.ForegroundColor 
                try 
                  System.Console.ForegroundColor <- c
                  System.Console.Write s
                finally
                  System.Console.ForegroundColor <- old) 
            fmt
    let cprintfn c fmt = 
        cprintf c fmt
        printfn ""

open Fake

open Fake

let CcolorMap = function
    | ImportantMessage _ -> ConsoleColor.Blue
    | ErrorMessage _     -> ConsoleColor.Red
    | LogMessage _       -> ConsoleColor.DarkGray
    | TraceMessage _     -> ConsoleColor.DarkBlue
    | FinishedMessage    -> ConsoleColor.Black
    | _                  -> ConsoleColor.DarkGray

let CConsoleTraceListener = ConsoleTraceListener(buildServer <> CCNet,CcolorMap)
listeners.[0] <- CConsoleTraceListener

open cprintf

let shell cmd args =
    let proc = new System.Diagnostics.ProcessStartInfo(cmd)
    proc.RedirectStandardOutput <- true
    proc.UseShellExecute <- false
    proc.Arguments <- args
    let p = System.Diagnostics.Process.Start(proc)
    let tool_output = p.StandardOutput.ReadToEnd()
    p.WaitForExit()
    tool_output
let shellx a b = cprintf ConsoleColor.DarkGray <| "%s" <| shell a b
let shellxf a b = cprintf ConsoleColor.DarkGreen <| "%s\n" <| shell a b

// *** Define Targets ***
Description "Cleans the last build"
Target "Clean" (fun () -> 
    trace " --- Cleaning stuff --- "
    CleanDirs ["src/obj"; "src/bin"]
    )

Target "Build" (fun () -> 
    trace " --- Building the app --- "
    try
        shellxf "xbuild" "src/TeAIChess.fsproj \"/p:Configuration=Release\""
    with | _ as exc ->
        trace (" --- Failed to build: " + exc.Message)
    )

Target "Run" (fun () ->
    trace " --- Running FChess --- "
    shellxf "mono" "src/bin/Debug/TeAICHess.exe"
    )

// *** Define Dependencies ***
"Clean"
  ==> "Build"
  ==> "Run"

// *** Start Build ***
RunParameterTargetOrDefault "target" "Build"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment