~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to erts/etc/win32/nsis/dll_version_helper.sh

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
3
3
# %CopyrightBegin%
4
4
5
 
# Copyright Ericsson AB 2007-2010. All Rights Reserved.
 
5
# Copyright Ericsson AB 2007-2011. All Rights Reserved.
6
6
7
7
# The contents of this file are subject to the Erlang Public License,
8
8
# Version 1.1, (the "License"); you may not use this file except in
26
26
# exit 0
27
27
 
28
28
cat > hello.c <<EOF
 
29
#include <windows.h>
29
30
#include <stdio.h>
30
31
 
31
32
int main(void)
35
36
}
36
37
 
37
38
EOF
38
 
cl /MD hello.c > /dev/null 2>&1
 
39
cl -MD hello.c  > /dev/null 2>&1
39
40
if [ '!' -f hello.exe.manifest ]; then
40
 
    echo "This compiler does not generate manifest files - OK if using mingw" >&2
41
 
    exit 0
 
41
    # Gah - VC 2010 changes the way it handles DLL's and manifests... Again...
 
42
    # need another way of getting the version
 
43
    DLLNAME=`dumpbin.exe -imports hello.exe | egrep MSVCR.*dll`
 
44
    DLLNAME=`echo $DLLNAME`
 
45
    cat > helper.c <<EOF
 
46
#include <windows.h>
 
47
#include <stdio.h>
 
48
 
 
49
#define REQ_MODULE "$DLLNAME"
 
50
 
 
51
int main(void)
 
52
{
 
53
  DWORD dummy;
 
54
  DWORD versize;
 
55
  int i,n;
 
56
  unsigned char *versinfo;
 
57
  char buff[100];
 
58
 
 
59
  char *vs_verinfo;
 
60
  unsigned int vs_ver_size;
 
61
  
 
62
  WORD *translate;
 
63
  unsigned int tr_size;
 
64
  
 
65
  if (!(versize = GetFileVersionInfoSize(REQ_MODULE,&dummy))) {
 
66
    fprintf(stderr,"No version info size in %s!\n",REQ_MODULE);
 
67
    exit(1);
 
68
  }
 
69
  versinfo=malloc(versize);
 
70
  if (!GetFileVersionInfo(REQ_MODULE,dummy,versize,versinfo)) {
 
71
    fprintf(stderr,"No version info in %s!\n",REQ_MODULE);
 
72
    exit(2);
 
73
  }
 
74
  if (!VerQueryValue(versinfo,"\\\\VarFileInfo\\\\Translation",&translate,&tr_size)) {
 
75
    fprintf(stderr,"No translation info in %s!\n",REQ_MODULE);
 
76
    exit(3);
 
77
  }
 
78
  n = tr_size/(2*sizeof(*translate));
 
79
  for(i=0; i < n; ++i) {
 
80
    sprintf(buff,"\\\\StringFileInfo\\\\%04x%04x\\\\FileVersion",
 
81
            translate[i*2],translate[i*2+1]);
 
82
    if (VerQueryValue(versinfo,buff,&vs_verinfo,&vs_ver_size)) {
 
83
      printf("%s\n",(char *) vs_verinfo);
 
84
      return 0;
 
85
    }
 
86
  } 
 
87
  fprintf(stderr,"Failed to find file version of %s\n",REQ_MODULE);
 
88
  return 0;
 
89
}
 
90
EOF
 
91
    cl -MD helper.c version.lib > /dev/null 2>&1
 
92
    if [ '!' -f helper.exe ]; then
 
93
        echo "Failed to build helper program." >&2
 
94
        exit 1
 
95
    fi
 
96
    NAME=$DLLNAME
 
97
    VERSION=`./helper`
 
98
else
 
99
    VERSION=`grep '<assemblyIdentity' hello.exe.manifest | sed 's,.*version=.\([0-9\.]*\).*,\1,g' | grep -v '<'`
 
100
    NAME=`grep '<assemblyIdentity' hello.exe.manifest | sed 's,.*name=.[A-Za-z\.]*\([0-9]*\).*,msvcr\1.dll,g' | grep -v '<'`
42
101
fi
43
 
VERSION=`grep '<assemblyIdentity' hello.exe.manifest | sed 's,.*version=.\([0-9\.]*\).*,\1,g' | grep -v '<'`
44
 
NAME=`grep '<assemblyIdentity' hello.exe.manifest | sed 's,.*name=.[A-Za-z\.]*\([0-9]*\).*,msvcr\1.dll,g' | grep -v '<'`
45
 
rm -f hello.c hello.obj hello.exe hello.exe.manifest
 
102
#rm -f hello.c hello.obj hello.exe hello.exe.manifest helper.c helper.obj helper.exe helper.exe.manifest
46
103
if [ "$1" = "-n" ]; then
47
104
    ASKEDFOR=$NAME
48
105
else