Welcome to mirror list, hosted at ThFree Co, Russian Federation.

generateversionscript.sh « native « eng - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 83e249067d0aae14bb3f5e15a621b69459ed7e11 (plain)
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
#!/usr/bin/env bash

saved=("$@")
while test $# -gt 0; do
  case "$1" in
    --help|-h)
      printf "Usage:\ngenerateversionscript.sh <filename> <prefix>\n"
      exit 1;;
    esac
    shift
done
set -- "${saved[@]}"

prefix="$2"

printf "V1.0 {\n    global:\n"

while read -r line; do
  # Skip empty lines and comment lines starting with semicolon
  if [[ "$line" =~ ^\;.*$|^[[:space:]]*$ ]]; then
    continue
  fi

  # Remove the CR character in case the sources are mapped from
  # a Windows share and contain CRLF line endings
  line="${line//$'\r'/}"

  # Only prefix the entries that start with "#"
  if [[ "$line" =~ ^#.*$ ]]; then
    printf "        %s%s;\n" "$prefix" "${line//#/}"
  else
    printf "        %s;\n" "$line"
  fi
done < "$1"

printf "    local: *;\n};\n"