一、下載MiniGUI
到官方網站:http://www.minigui.com/index.php?id=minigui-open-source-version&L=1
下載MiniGUI軟件包,目前可免費下載的有二個版本,MiniGUI-STR V1.6.2和MiniGUI v1.3.3。MiniGUI v1.6是針對嵌入式開發的一個精簡版本;MiniGUI v1.3.3是很穩定的版本了。我使用MiniGUI v1.3.3。打開官方網站後,注冊一個用戶,要下載的源碼包:
MiniGUI圖形庫:
libminigui-1.3.3.tar.gz
MiniGUI資源包,包含字體,圖標等:
minigui-res-1.3.3.tar.gz
MiniGUI示例程序:
mg-samples-1.3.0.tar.gz
一個綜合的例程:
mde-1.3.0.tar.gz
在PC上運行這些例程,還需要一個工具:qvfb,在MiniGUI網站上有下載。
下載後,解壓:
[root@localhost minigui]# tar zxvf libminigui-1.3.3.tar.gz
[root@localhost minigui]# tar zxvf minigui-res-1.3.3.tar.gz
[root@localhost minigui]# tar zxvf mg-samples-1.3.0.tar.gz
[root@localhost minigui]# tar zxvf mde-1.3.0.tar.gz
[root@localhost minigui]# tar zxvf qvfb-1.0.tar.gz
二、編譯及安裝
1、libminigui
[root@localhost minigui]# cd libminigui-1.3.3
[root@localhost libminigui-1.3.3]# make menuconfig
在make menuconfig中,有各種配置,可參考官方的《MiniGUI 用戶手冊》。
我只對以下配置修改:
System wide options --->
Build MiniGUI-Lite //選上,Lite版本
[ ] Stand-Alone
[ ] Use incore (built-in) resource
Unit of timer is 10ms
Cursor support
User can move window with mouse
Mouse button can do double click
[ ] Build with debugging messages
[ ] Trace messages of MiniGUI
[ ] Include symbol name of messages
Font options --->
Raw bitmap font
[ ] Var bitmap font //不選擇,否則編譯,demo時,出錯。
Incore font sansserif
Incore font courier
Incore font symbol
Incore font vgas
Qt Prerendered Font
TrueType font
Adobe Type1 font
在PC中,運行,只對這二點修改。
如果配置沒有問題,就可以執行:
[root@localhost minigui]#make
[root@localhost minigui]#make install
注意:當make和make install沒有出錯後,不要以為一切OK了。一定要記得把“/usr/local/lib”添加到/etc/ld.so.conf文件中,運行ldconfig,否則,一會運行demo時,提示找不到圖形庫。類似,如:
[root@localhost src]# ./helloworld
./helloworld: error while loading shared libraries: libminigui-1.3.so.3: cannot open shared object file: No such file or directory
2、MiniGUI
[root@localhost minigui]#cd minigui-res-1.3.x
[root@localhost minigui]#make install
默認安裝在:/usr/local/lib/minigui/res/目錄,安裝這個一般很順利,沒有什麼問題。
3、編譯例程mg-samples-1.3.0和mde-1.3.0
如果libminigui-1.3.3編譯,配置正確的話,這二個例程就是執行:
#./configure
#make
#make install
編譯出問題,一般都是libminigui安裝時,有問題。
4、安裝、配置qvfb
[root@localhost minigui]# cd qvfb-1.0
[root@localhost minigui]# ./configure
出錯:
checking for X... configure: error: Can't find X includes. Please check your installation and add the correct paths!
這個配置錯誤和minigui沒有關系,只是PC上的linux系統沒有安裝X windows,qt等圖形庫相關,我重新安裝qt和相關軟件包,這個問題就可以解決了。
[root@localhost minigui]#make
[root@localhost minigui]#make install
配置qvfb為minigui的圖形引摯,修改:vim /usr/local/etc/MiniGUI.cfg
# GAL engine和# IAL engine,如下:
25 [system]
26 # GAL engine
27 #gal_engine=fbcon
28 gal_engine=qvfb
29
30 # IAL engine
31 #ial_engine=console
32 ial_engine=qvfb
33
34 mdev=/dev/mouse
35 mtype=IMPS2
36
37 [fbcon]
38 defaultmode=1024x768-16bpp
39
40 [qvfb]
41 defaultmode=640x480-16bpp
42 display=0
接關運行qvfb,啟動虛擬幀緩沖區:
[root@localhost libminigui-1.3.3]# qvfb &
將彈出窗口:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onxxxxx="if(!this.resized) {return true;} else {window.open('/uploadfile/200810/20081025032519370.jpg');}" onxxxx="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}">
如果MiniGUI配置為MiniGUI-Lite版本的話,還要進mde-1.3.0/mginit目錄,執行:./mginit,如果不執行,則有如下錯誤:
[root@localhost src]# ./helloworld
AttachSharedResource: No such file or directory
Error in step 7: Can not attach shared resource!
InitGUI failure when using /usr/local/etc/MiniGUI.cfg as cfg file.
執行mginit,接著出現如下錯誤:
[root@localhost mde-1.3.0]# mginit/mginit
Can not create task bar.
這個錯誤我找了很久,得不到解決,看了《用戶手冊》,執行:
ldd mginit 命令後,得以解決。成功加載例程後,顯示如:
這個綜合的demo有許多軟件,其顯示效果如下: