about summary refs log tree commit diff
path: root/pkgs/games/steam/build-wrapped.sh
blob: ddf974671a03825c3bc391b62ea45e8c73beff16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
source $stdenv/setup

outp=$out/lib/steam-runtime

buildDir() {
  paths="$1"
  pkgs="$2"

  for pkg in $pkgs; do
    echo "adding package $pkg"
    for path in $paths; do
      if [ -d $pkg/$path ]; then
        cd $pkg/$path
        for file in *; do
          found=""
          for i in $paths; do
            if [ -e "$outp/$i/$file" ]; then
              found=1
              break
            fi
          done
          if [ -z "$found" ]; then
            mkdir -p $outp/$path
            ln -s "$pkg/$path/$file" $outp/$path
            sovers=$(echo $file | perl -ne 'print if s/.*?\.so\.(.*)/\1/')
            if [ ! -z "$sovers" ]; then
              fname=''${file%.''${sovers}}
              for ver in ''${sovers//./ }; do
                found=""
                for i in $paths; do
                  if [ -e "$outp/$i/$fname" ]; then
                    found=1
                    break
                  fi
                done
                [ -n "$found" ] || ln -s "$pkg/$path/$file" "$outp/$path/$fname"
                fname="$fname.$ver"
              done
            fi
          fi
        done
      fi
    done
  done
}

eval "$installPhase"