forked from abhra0897/gowin-easy-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_launcher
executable file
·91 lines (71 loc) · 4.04 KB
/
main_launcher
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
# !/bin/bash
#~~~~~~~~~~~~~~~~ GoWin SDK All-in-One Launcher ~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~ Written By: Avra Mitra ~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~ Updated: Feb 24, 2020 ~~~~~~~~~~~~~~~~~~~~#
# ---------------------------------------------------------------------------
# This script is a launcher to automate the process of configuring and running different applications
# in order to make eveything work perfectly. It does following things:
# 1) Set IDE and license server executables' directories
# 2) Set the license directories. If your license is in other location, change them
# 3) Terminate existing license server process/daemon, and synplify
# 4) Run Synopsis Synplify Pro License server with the proper synplify license file
# 5) Export environment variable which will be used by synplify pro
# 6) Delete log files from previous run to keep things clean
# 7) Set GoWin IDE's license by editing gwlicense.ini with proper license file path
# 8) Run the GoWin IDE.
# ---------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------- YOU MAY CHANGE THE BELOW SECTION -------------------------
#-------------------------------------------------------------------------------
# store current working directory as our base directory
INIT_DIR=$(pwd);
# store synopsis synplify license server directory
LIC_SERVER_DIR=$INIT_DIR/GowinLicenseServerForLinux/SCLPortableVersion/linux64/bin;
# store gowin IDE directory
IDE_DIR=$INIT_DIR/IDE/bin;
# I stored synplify pro license in the same directory as license server. You may change it
SYNPLIFY_LIC_DIR=$LIC_SERVER_DIR;
# This variable stores Synplify pro's license file's name. Change it if your license file has a different name
SYNPLIFY_LIC_FILE_NAME=gowin_Synplifypro.lic;
# And the gowin IDE license is stored in thr IDE directory. It also can be changed
IDE_LIC_DIR=$IDE_DIR;
# This variable stores GoWin IDE's license file's name. Change it if your license file has a different name
IDE_LIC_FILE_NAME=gowin.lic;
#-------------------------------------------------------------------------------
#----------------------- DON'T CHANGE ANYTHING BELOW ---------------------------
#-------------------------------------------------------------------------------
# at first check if any other lmgrd instance is running: ps-ax | grep lmgrd
# if found, terminate with: kill -15 <PID>
killall -SIGTERM lmgrd;
# do same with synplify process
killall -SIGTERM synplify;
# Add host name in synplify pro's license file (at line 43)
# If used with diff version lic file, the line number may be required to be changed
# Find the line number of "SERVER <hostname> 94C691A91EB6 27020" line in the license file
# Put the number in place of 43 in the if statement
line_cnt=1
while IFS= read -r line
do
if((line_cnt==43)); then
echo 'SERVER '$HOSTNAME' 94C691A91EB6 27020'
else
echo "$line"
fi
((line_cnt++))
done<$SYNPLIFY_LIC_DIR/$SYNPLIFY_LIC_FILE_NAME>$SYNPLIFY_LIC_DIR/new_$SYNPLIFY_LIC_FILE_NAME
cp $SYNPLIFY_LIC_DIR/$SYNPLIFY_LIC_FILE_NAME $SYNPLIFY_LIC_DIR/old_$SYNPLIFY_LIC_FILE_NAME
mv $SYNPLIFY_LIC_DIR/new_$SYNPLIFY_LIC_FILE_NAME $SYNPLIFY_LIC_DIR/$SYNPLIFY_LIC_FILE_NAME
# start license server with proper synopsis synplify pro license file.
# host ID and host name in the license file must match with your machine.
# if doesn't match, change machine's mac.
$LIC_SERVER_DIR/lmgrd -l $INIT_DIR/LicenseServer.log -c $SYNPLIFY_LIC_DIR/$SYNPLIFY_LIC_FILE_NAME
#-------------------------------------------------------------------------------
# Add LM_LICENSE_FILE environment variable. For some reason, adding it to ~/.bashrc doesn't seem to work
export LM_LICENSE_FILE=27020@localhost;
#delete the stupid stdout.log.bak files from previous run
rm $INIT_DIR/stdout.log*;
#Set the IDE license. It's different from Synplify Pro license
echo [license] > $IDE_DIR/gwlicense.ini;
echo lic=\"$IDE_LIC_DIR/$IDE_LIC_FILE_NAME\" >> $IDE_DIR/gwlicense.ini;
# Now run the main IDE
$IDE_DIR/gw_ide &