linux wrapper 路径,如何适用于Linux的Wrapper Xilinx脚本

由于xilinx基于Linux并且使用Cygwin作为Windows版本,而且我更习惯Linux,我决定安装Linux版本。

我期待一切都能开箱即用,但当我看到没有创建启动器时,我很失望,只是运行可执行文件不起作用。

谷歌搜索和询问后,我设法制作了这个脚本(也附在这篇文章中):

#!/ bin / sh的

XLXDIR ='/ opt / Xilinx / 11.1'#改变你拥有的任何东西

SETtiNGS ='settings32.sh'#在64位版本上更改为settings64.sh

xilinx_help(){

echo“这个程序在Xilinx环境下运行命令。”

回声“用法:”

echo“xilinx []”

回声“例子:”

回声“xilinx ise”

echo“xilinx xps”

echo“Xilinx安装在$ XLXDIR上”

}

如果[$#-lt 1]

然后

xilinx_help#如果没有给出参数,显示帮助并退出

退出0

科幻

用于“$ XLXDIR”/ * /“$ SETTINGS”中的脚本

echo“Running \`$ script'...”>& 2

“$ script”#运行所有设置脚本以导出env变量

DONE

#此脚本会覆盖$ XLXDIR / settings32.sh上的脚本,

#这不是很优雅,有bashisms

#(`pushd',`popd'和`source'而不是`cd',`cd  - '和`。')

#与其他shell不兼容。

Xilinx环境中的“$ @”#run命令

将此文件保存为/ usr / local / bin / xilinx并使用chmod + x / usr / local / bin / xilinx授予其权限(您需要拥有所有权限的root权限,因此请使用sudo)

现在,如果您想运行任何Xilinx程序,您只需打开命令行并运行,例如,xilinx ise

在/opt/Xilinx/11.1/settings32.sh上有一个与此相同的脚本:它在所有/opt/Xilinx/11.1/子文件夹上加载所有settings32.sh,因此您可以像任何其他命令一样运行ise或xps

问题是它只适用于bash shell,因此它不适用于其他shell,如Debian的破折号;

还有,我没觉得它很优雅。

你可能想要改变的事情:

XLXDIR:我的Xilinx安装路径是/opt/Xilinx/11.1/,还有ISE /,EDK /等文件夹。

如果您使用的是其他版本或具有不同的安装路径,请编辑XLXDIR = ...行。

设置:如果您使用的是64位版本(请参阅http://forums.xilinx.com/t5/Inst ... 4-bit-Ubuntu-10-04/

td-p / 69690),您可以将settings32.sh更改为settings64.sh。

#!/ bin / sh:如果出于某种原因,在不同版本上,您会收到大量“未找到命令”错误消息,可能Xilinx设置脚本无法与您的shell一起使用,您必须指定

bash将第一行更改为#!/ bin / bash

for循环:如果您更喜欢使用Xilinx自己的/opt/Xilinx/11.1/settings32.sh脚本而不是我编写的for循环,请替换脚本末尾附近的那5行代码...

(包括在内)与此行:

“$ XLXDIR”/ “$ SETTINGS”

(注意“。”与行的其余部分分开;它与bash的source命令相同)。

此外,您必须将#!/ bin / sh更改为#!/ bin / bash,如第3点所示。

我认为如果你改变所需的东西,这个脚本应适用于任何Linux版本的任何Xilinx版本/套件,但我想会有例外。

欢迎提出建议。

xilinx 1 KB

以上来自于谷歌翻译以下为原文

Since Xilinx is based on Linux and uses Cygwin for the Windows version, and I'm more used to Linux, I decided to install the Linux version. I was expecting everything to work out of the box, but I was disappointed when I saw that no launcher was created, and that just running the executables wouldn't work.

After googling and asking, I managed to make this script (also attached to this post):

#!/bin/shXLXDIR='/opt/Xilinx/11.1'  # change to whatever you haveSETTINGS='settings32.sh'  # change to settings64.sh on 64-bit versionsxilinx_help () {echo "This program runs a command under a Xilinx environment."echo "Usage:"echo "  xilinx []"echo "Examples:"echo "  xilinx ise"echo "  xilinx xps"echo "Xilinx is instalLED on $XLXDIR"}IF [ $# -lt 1 ]thenxilinx_help  # if no argument is given, display help and exitexit 0fifor script in "$XLXDIR"/*/"$SETTINGS"doecho "Running \`$script'..." >&2. "$script"  # run all settings scripts to export env variablesdone# This script overrides the one on $XLXDIR/settings32.sh,# which isn't very elegant and has bashisms# (`pushd', `popd' and `source' instead of `cd', `cd -' and `.')# that aren't compatible with other shells."$@"  # run command on Xilinx envSave this file as /usr/local/bin/xilinx and give it permissions with chmod +x /usr/local/bin/xilinx (you'll need to have root permissions for all this, so use sudo)

Now, if you want to run any Xilinx program, you just have to open a command line and run, for example, xilinx ise

There's a script on /opt/Xilinx/11.1/settings32.sh that does the same as this: it loads all settings32.sh on all /opt/Xilinx/11.1/ subfolders, so you can then run ise or xps as any other command. The problem is that it only works with the bash shell, so it won't work on other shells such as Debian's dash; also, I didn't find it very elegant.

THINGS YOU MIGHT WANT TO CHANGE:XLXDIR: My Xilinx install path is /opt/Xilinx/11.1/, and there's where ISE/, EDK/, etc folders are. If you are using another version or have a different install path, edit the XLXDIR=... line.

SETTINGS: If you're using the 64-bit version (see http://forums.xilinx.com/t5/Inst ... tu-10-04/td-p/69690), you may change settings32.sh to settings64.sh.

#!/bin/sh: If, for some reason, on a different version, you get a lot of "Command not found" error messages, maybe the Xilinx settings scripts don't work with your shell and you must specify the usage of bash changing this first line to #!/bin/bash

for loop: If you prefer to use Xilinx's own /opt/Xilinx/11.1/settings32.sh script instead of the for loop I've written, replace those 5 lines near the end of the script between for script in... and done (both included) with this line:. "$XLXDIR"/"$SETTINGS"(notice that the "." is separated from the rest of the line; it does the same as bash's source command). Also, you will have to change #!/bin/sh to #!/bin/bash as shown on point 3.I think this script should work for any Xilinx version/suite on any Linux version if you change the needed stuff, but I suppose there will be exceptions. Suggestions are welcome.

jishu_1686141_1_1.html            xilinx ‏1 KB

699ba7046c51816a17b33a7caa85f179.png

0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值