summaryrefslogtreecommitdiff
path: root/install_dev
blob: 2c9ce4543b15702dc6cb1416f1c3ec88d424c203 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash

echo ' '
echo '  This script will install the >>Development<< files in the system'
echo '  from the build directories or from the unpacked download.'
echo '  It was tested only in Ubuntu.'
echo ' '
echo '  Must be run with "sudo" at the library folder, or install will fail:'
echo '     sudo ./install_dev'
echo ' '

EchoDownloadTip()
{
  echo '  The downloaded package must already be unpacked in the current directory.'
  echo '  Do NOT unpack different packages in the same directory.'
  echo '  For example:'
  echo '     mkdir iup'
  echo '     cd iup'
  echo '     tar -xpvzf ../iup-3.2_Linux26g4_lib.tar.gz'
  echo ' '
}

Pause()
{
  echo -n Press Enter to continue or Ctrl+C to abort...
  read contscr
  echo ' '
}

ComputeTecUname()
{
  TEC_SYSNAME=`uname -s`
  TEC_SYSVERSION=`uname -r|cut -f1 -d.`
  TEC_SYSMINOR=`uname -r|cut -f2 -d.`
  TEC_SYSARCH=`uname -m`
  
  TEC_UNAME=$TEC_SYSNAME$TEC_SYSVERSION$TEC_SYSMINOR

  # Linux 2.4 and GCC 3.x
  if [ $TEC_UNAME == Linux24 ]; then
    GCCVER=`gcc -dumpversion|cut -f1 -d.`
    if [ $GCCVER == 3 ]; then
      TEC_UNAME=$TEC_UNAME'g3'
    fi
  fi

  # Linux 2.6 and GCC 4.x
  if [ $TEC_UNAME == Linux26 ]; then
    GCCVER=`gcc -dumpversion|cut -f1 -d.`
    if [ $GCCVER == 4 ]; then
      TEC_UNAME=$TEC_UNAME'g4'
    fi
  fi

  # 64-bits Linux
  if [ $TEC_SYSARCH == x64 ]; then
    TEC_UNAME=$TEC_UNAME'_64'
  fi
}

Copy_Dev_Extra_CD()
{
  # Do NOT overwrite for FreeType
  cp -fn $1libfreetype.a /usr/lib
  
  cp -fv $1libpdflib.a /usr/lib
  cp -fv $1libftgl.a /usr/lib
}

Copy_Dev_To_System()
{
  mkdir -p /usr/include/$1
  cp -fv include/*.h /usr/include/$1
  cp -fv $2lib$1*.a /usr/lib
  
  if [ $1 == cd ]; then
    Copy_Dev_Extra_CD $2
  fi
}

Install_Dev()
{
  if [ -d lib/$TEC_UNAME ]; then
    echo '  Installing from build directory' lib/$TEC_UNAME
    echo ' '
    Pause
    Copy_Dev_To_System $1 lib/$TEC_UNAME/
  else
    echo '  The directory' lib/$TEC_UNAME 'was not found,'
    echo '  so installing from unpacked download.'
    echo ' '
    EchoDownloadTip
    Pause
    Copy_Dev_To_System $1
  fi
}

ComputeTecUname

Install_Dev cd