summary refs log tree commit diff
path: root/pkgs/build-support/dotnetbuildhelpers/patch-fsharp-targets.sh
blob: 3f81cc73e80125ad02c23e9b48264b8fa879b8e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

# Some project files look for F# targets in $(FSharpTargetsPath)
# so it's a good idea to add something like this to your ~/.bash_profile:

# export FSharpTargetsPath=$(dirname $(which fsharpc))/../lib/mono/4.0/Microsoft.FSharp.Targets

# In build scripts, you would add somehting like this:

# export FSharpTargetsPath="${fsharp}/lib/mono/4.0/Microsoft.FSharp.Targets"

# However, some project files look for F# targets in the main Mono directory. When that happens
# patch the project files using this script so they will look in $(FSharpTargetsPath) instead.

echo "Patching F# targets in fsproj files..."

find -iname \*.fsproj -print -exec \
  sed --in-place=.bak \
    -e 's,<FSharpTargetsPath>\([^<]*\)</FSharpTargetsPath>,<FSharpTargetsPath Condition="Exists('\'\\1\'')">\1</FSharpTargetsPath>,'g \
    {} \;