GNUstep on MS-Windows test
04/01/2009, 10:58 - Open Source
測試了一下 GNUstep 在 Windows 上的可行性,可以用,不過因為 DLL 等問題,要作到 portable 還很不方便。

選用 MinGW32 作為基礎,再加裝需要的程式上去。

Install GNUstep in MS-Windows with MinGW

This required a long time in Windows, so make a cup of tea or coffee or some beer as well.

Start: install MinGW binary from http://mingw.sf.net
install MinGW
install MSYS
install MSYSDTS
unarchive MSYSCORE
open MSYS shell

export CFLAGS="-I/usr/include -L/usr/lib"
export CXXFLAGS=$CFLAGS
export CPPFLAGS=$CFLAGS

Install required library
install ffcall
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-ipv6 --disable-nls --disable-debug --with-gnu-ld
make
make install

install libffi
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-ipv6 --disable-nls --disable-debug --with-gnu-ld
make
make install

install libiconv-1.9.2
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-ipv6 --disable-nls --disable-debug --with-gnu-ld --enable-static
make
make install


install zlib
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make
make install

install libxml2
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-ipv6 --disable-nls --disable-debug --with-gnu-ld --enable-static --with-zlib=/usr
make
make install

install libxslt
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-ipv6 --disable-nls --disable-debug --with-gnu-ld --enable-static
make
make install

install gettext-0.17
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-static --enable-ipv6 --disable-nls --disable-debug --with-gnu-ld --enable-cxx --enable-threads=win32 --with-libiconv-prefix=/usr
make

After show the gettext-tools has error
cd gettext-0.17
cd gettext-runtime
make install
This step is only install the gettext runtime library include libintl, and the gettext-tools has "can not found iconv.h" in "gnulib-lib/libxml/encoding.h", so...
cd gettext-tools
cp /usr/include/iconv.h .

make
cd ..
make

install jpeg-6b
./configure --prefix=/usr --enable-shared --enable-static
make
make install

install tiff
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-ipv6 --disable-nls --enable-static --disable-debug --with-gnu-ld --disable-jpeg
make
make install

install libpng-1.2.35
vi configure
search a line
/ac_cv_lib_z_zlibVersion=no
change no to yes
ac_cv_lib_z_zlibVersion=yes
./configure --prefix=/usr --enable-shared --enable-static

vi Makefile
change
LIBS = -lz
to
LIBS = -L/usr/lib -lz
change
CFLAGS = -g -O2
to
CFLAGS = -g -O2 -I/usr/include

make
make install

install sqlite
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-threads --enale-shared --enable-static --disable-debug --disable-nls --with-gnu-ld
make
make install

install wxWidgets
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-threads --enale-shared --enable-static --disable-debug --disable-nls --with-gnu-ld --enable-gui -enable-monolithic --enable-plugins --enable-objc_uniquifying --enable-compat26 --enable-intl --with-msw --enable-unicode --enable-offical_build
make
make install

install gdb-6.8
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-threads --enale-shared --enable-static --disable-debug --disable-nls --with-gnu-ld --enable-obj-gc
make
make install


Download GNUstep source from http://www.gnustep.org
install gnustep-make
./configure --prefix=/usr/GNUstep --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-ipv6 --disable-nls --disable-debug --with-gnu-ld

make
make install

vi /etc/profile
add under lines to file /etc/profile
export GNUSTEP_MAKEFILES=/usr/GNUstep/System/Library/Makefiles
export PATH=$PATH:/usr/GNUstep/System/Tools:/usr/GNUstep/Local/Tools:/usr/GNUstep/bin
export CFLAGS="-I/usr/include -I/usr/GNUstep/System/Library/Headers -I/usr/GNUstep/Local/Library/Headers -L/lib -L/usr/lib -L/usr/local/lib -L/usr/GNUstep/System/Library/Libraries -L/usr/GNUstep/Local/Library/Libraries"

source /etc/profile

chmod 755 /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
/usr/GNUstep/System/Library/Makefiles/GNUstep.sh

install gnustep-objc
./configure --prefix=/usr/GNUstep --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-static --enable-ipv6 --disable-nls --disable-debug --with-gnu-ld
make
make install

check /etc/GNUstep/GNUstep.conf

# This is the GNUstep configuration file.

# Any line starting with a '#' is a comment.
# Empty lines are ignored.
# Every other line in this file must be of the form
# XXX=YYY
# where there should be no spaces around the '=' (this is because we
# include this file in shell scripts and makefiles, and sh syntax
# requires no spaces around the '=').
#
# Standard sh quotes can be used in YYY but only at runtime; they can
# not be used while building.

# GNUstep can use up to 4 domains at the same time. They are System,
# Local, Network and User. You can install your programs / resources
# in any of these domains. This file mostly deals with configuring
# how the domains map to your filesystem.

# IMPORTANT: Don't delete lines from this file unless you want
# the values hardcoded in the packages to be used. If you want
# to suppress the network domain, set all its paths to be the same
# as the system domain. If you want to suppress the local domain,
# set all its paths to be the same as the network domain. If you
# want to suppress the user domain, set its paths to be the same
# as the local domain. You can not suppress the system domain.

# The paths should not include a '/' at the end.

# These GNUSTEP_*_ROOT variables are obsolete, and will be removed.
GNUSTEP_SYSTEM_ROOT=/usr/GNUstep/System
GNUSTEP_LOCAL_ROOT=/usr/GNUstep/Local
GNUSTEP_NETWORK_ROOT=/usr/GNUstep/Network

# The name of the user config file. This file can override
# some settings in this file. Usually used by users that want
# to install things into their GNUstep user domain and/or have
# many such domains.
GNUSTEP_USER_CONFIG_FILE=.GNUstep.conf

# The name of the user directory, if any. This is obsolete,
# and will be removed.
GNUSTEP_USER_DIR=GNUstep

# The name of the user directory where defaults (eg, preferences) are
# stored. If it does not start with a '/', it will be considered
# relative to the user home directory.
GNUSTEP_USER_DEFAULTS_DIR=GNUstep/Defaults


# This is where the gnustep-make Makefiles are installed.
# Traditionally, this is /usr/GNUstep/System/Library/Makefiles
#GNUSTEP_MAKEFILES=/usr/GNUstep/share/GNUstep/Makefiles
GNUSTEP_MAKEFILES=/usr/GNUstep/System/Library/Makefiles


# This is where the user home directories are. Only used to provide
# NSUserDirectory in gnustep-base. Never used anywhere else.
GNUSTEP_SYSTEM_USERS_DIR=/home
GNUSTEP_NETWORK_USERS_DIR=/home
GNUSTEP_LOCAL_USERS_DIR=/home


# This is where System GUI Applications get installed.
# Traditionally it is /usr/GNUstep/System/Applications.
#GNUSTEP_SYSTEM_APPS=/usr/GNUstep/lib/GNUstep/Applications
GNUSTEP_SYSTEM_APPS=/usr/GNUstep/System/Applications

# This is where System GUI Applications that only the
# Administrator can use get installed.
# Traditionally it is /usr/GNUstep/System/Applications/Admin.
#GNUSTEP_SYSTEM_ADMIN_APPS=/usr/GNUstep/lib/GNUstep/Applications
GNUSTEP_SYSTEM_ADMIN_APPS=/usr/GNUstep/System/Applications/Admin

# This is where System Web Applications (GSWeb, SOPE) get
# installed.
# Traditionally it is /usr/GNUstep/System/Library/WebApplications.
#GNUSTEP_SYSTEM_WEB_APPS=/usr/GNUstep/lib/GNUstep/WebApplications
GNUSTEP_SYSTEM_WEB_APPS=/usr/GNUstep/System/Library/WebApplications

# This is where System Command-Line Tools get installed.
# Traditionally it is /usr/GNUstep/System/Tools.
#GNUSTEP_SYSTEM_TOOLS=/usr/GNUstep/bin
GNUSTEP_SYsTEM_TOOLS=/usr/GNUstep/System/Tools

# This is where System Command-Line Tools that only the
# Administrator can use get installed. Important: this
# should not be in the PATH of normal users.
# Traditionally it is /usr/GNUstep/System/Tools/Admin.
#GNUSTEP_SYSTEM_ADMIN_TOOLS=/usr/GNUstep/sbin
GNUSTEP_SYSTEM_ADMIN_TOOLS=/usr/GNUstep/System/Tools/Admin

# This is where System resources get installed. This directory will
# contain a lot of executable code since *step traditionally likes to
# bundle executables and resources together.
# Traditionally it is /usr/GNUstep/System/Library.
#GNUSTEP_SYSTEM_LIBRARY=/usr/GNUstep/lib/GNUstep
GNUSTEP_SYSTEM_LIBRARY=/usr/GNUstep/System/Library

# This is where System headers get installed. They are the
# library .h headers.
# Traditionally it is /usr/GNUstep/System/Library/Headers.
#GNUSTEP_SYSTEM_HEADERS=/usr/GNUstep/include
GNUSTEP_SYSTEM_HEADERS=/usr/GNUstep/System/Library/Headers

# This is where System libraries get installed. By libraries we mean
# the shared/static object files that you can link into programs.
# Traditionally it is /usr/GNUstep/System/Library/Libraries.
#GNUSTEP_SYSTEM_LIBRARIES=/usr/GNUstep/lib
GNUSTEP_SYSTEM_LIBRARIES=/usr/GNUstep/System/Library/Libraries

# This is where System documentation get installed. This is known
# not to contain any executable, so we keep it separate.
# Traditionally it is /usr/GNUstep/System/Library/Documentation.
#GNUSTEP_SYSTEM_DOC=/usr/GNUstep/share/GNUstep/Documentation
GNUSTEP_SYSTEM_DOC=/usr/GNUstep/System/Library/Documentation

# This is where System man pages get installed.
# Traditionally it is /usr/GNUstep/System/Library/Documentation/man.
#GNUSTEP_SYSTEM_DOC_MAN=/usr/GNUstep/share/man
GNUSTEP_SYSTEM_DOC_MAN=/usr/GNUstep/System/Library/Documentation

# This is where System info pages get installed.
# Traditionally it is /usr/GNUstep/System/Library/Documentation/info.
#GNUSTEP_SYSTEM_DOC_INFO=/usr/GNUstep/share/info
GNUSTEP_SYSTEM_DOC_INFO=/usr/GNUstep/System/Library/Documentation/info


GNUSTEP_NETWORK_APPS=/usr/GNUstep/Network/Applications
GNUSTEP_NETWORK_ADMIN_APPS=/usr/GNUstep/Network/Applications
GNUSTEP_NETWORK_WEB_APPS=/usr/GNUstep/Network/WebApplications
GNUSTEP_NETWORK_TOOLS=/usr/GNUstep/Network/Tools
GNUSTEP_NETWORK_ADMIN_TOOLS=/usr/GNUstep/Network/Admin
GNUSTEP_NETWORK_LIBRARY=/usr/GNUstep/Network/Library
GNUSTEP_NETWORK_HEADERS=/usr/GNUstep/Network/Library/Headers
GNUSTEP_NETWORK_LIBRARIES=/usr/GNUstep/Network/Library/Libraries
GNUSTEP_NETWORK_DOC=/usr/GNUstep/Network/Documentation
GNUSTEP_NETWORK_DOC_MAN=/usr/GNUstep/Nework/Documentation/man
GNUSTEP_NETWORK_DOC_INFO=/usr/GNUstep/Network/Documentation/info

GNUSTEP_LOCAL_APPS=/usr/GNUstep/Local/Applications
GNUSTEP_LOCAL_ADMIN_APPS=/usr/GNUstep/Local/Applications/Admin
GNUSTEP_LOCAL_WEB_APPS=/usr/GNUstep/Local/Applications/WebApplications
GNUSTEP_LOCAL_TOOLS=/usr/GNUstep/Local/Tools
GNUSTEP_LOCAL_ADMIN_TOOLS=/usr/GNUstep/Tools/Admin
GNUSTEP_LOCAL_LIBRARY=/usr/GNUstep/Local/Library
GNUSTEP_LOCAL_HEADERS=/usr/GNUstep/Local/Library/Headers
GNUSTEP_LOCAL_LIBRARIES=/usr/GNUstep/Local/Library/Libraries
GNUSTEP_LOCAL_DOC=/usr/GNUstep/Local/Documentation
GNUSTEP_LOCAL_DOC_MAN=/usr/GNUstep/Local/Documentations/man
GNUSTEP_LOCAL_DOC_INFO=/usr/GNUstep/Local/Documentations/info

# Important: settings in the User should normally be relative paths,
# and will be interpreted as relative to the user's directory. This
# allows each user to have their own domain to install things. You
# can set them to be absolute, mostly if you want to disable them
# by setting them equal to the ones in the Network domain.
GNUSTEP_USER_DIR_APPS=GNUstep/Applications
GNUSTEP_USER_DIR_ADMIN_APPS=GNUstep/Applications/Admin
GNUSTEP_USER_DIR_WEB_APPS=GNUstep/WebApplications
GNUSTEP_USER_DIR_TOOLS=GNUstep/Tools
GNUSTEP_USER_DIR_ADMIN_TOOLS=GNUstep/Tools/Admin
GNUSTEP_USER_DIR_LIBRARY=GNUstep/Library
GNUSTEP_USER_DIR_HEADERS=GNUstep/Library/Headers
GNUSTEP_USER_DIR_LIBRARIES=GNUstep/Library/Libraries
GNUSTEP_USER_DIR_DOC=GNUstep/Library/Documentation
GNUSTEP_USER_DIR_DOC_MAN=GNUstep/Library/Documentation/man
GNUSTEP_USER_DIR_DOC_INFO=GNUstep/Library/Documentation/info


cd /usr/GNUstep/System/Library/Libraries
ln -s /usr/lib/libxml2.a .
ln -s /usr/lib/libxml2.la .
ln -s /usr/lib/libxml2.dll.a .

ln -s /usr/lib/libxslt.a .
ln -s /usr/lib/libxslt.la .

ln -s /usr/lib/libiconv.a .
ln -s /usr/lib/libiconv.la .
ln -s /usr/lib/libiconv.dll.a .

ln -s /usr/lib/libcallback.a .
ln -s /usr/lib/libcallback.la .

ln -s /usr/lib/libavcall.a .
ln -s /usr/lib/libavcall.la .

link others library in /usr/lib to /usr/GNUstep/System/Library/Libraries

install gnustep-base
./configure --prefix=/usr/GNUstep --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-ipv6 --enable-nls --enable-static --disable-debug --with-gnu-ld --enable-pass-arguments --enable-ffcall --disable-ffi --disable-xml

install gnustep-gui
./configure --prefix=/usr/GNUstep --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-ipv6 --enable-nls --enable-static --disable-debug --with-gnu-ld --with-jpeg-library=/usr/lib --with-jpeg-include=/usr/include
make
make install

install gnustep-back
./configure --prefix=/usr/GNUstep --sysconfdir=/etc --localstatedir=/var --enable-threads --enable-shared --enable-ipv6 --enable-nls --enable-static --disable-debug --with-gnu-ld --enable-graphics=winlib --enable-server=win32
make
make install

install Performance
make
make install

Install DevelopmentTool

install gorm
make
make install

install ProjectCenter
make
make install

install GWorkspace
./configure --prefix=/usr/GNUstep --enable-shared --enable-static
make
make install


寫了個簡單的程式 test1.m 測試一下。

#import <Foundation/Foundation.h>

int main(int argc, char *argv[])
{
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];

register unsigned int j,k;

NSString *s=[[NSString alloc] init];
NSNumber *i=[[NSNumber alloc] init];
NSMutableArray *table=[[NSMutableArray alloc] init];

s=[NSString stringWithString:@"This is a book!"];
i=[NSNumber numberWithInt:10];

NSLog(@"argc=%d",argc);
for(j=0;j<argc;j++){
[table addObject:[NSString stringWithCString:argv[j]]];
NSLog(@"argv[%d]=%@",j,[NSString stringWithCString:argv[j]]);
}

NSLog(@"i=%d s=%s",i,s);
#ifndef DARWIN
NSLog(@"i=%d s=%s",[i intValue],[s cString]);
#else
NSLog(@"i=%d s=%@",[i intValue],s);
#endif

if((k=[[NSString stringWithCString:argv[1]] intValue])<=0)
k=5;

NSLog(@"k=%d",k);

for(j=0;j<k;j++){
i=[NSNumber numberWithInt:j];
NSLog(@"j=%d i=%@",j,i);
}

[s retain];
[i retain];
[table retain];

[pool release];
return 0;
}


這個 Makefile 可以在有裝 XCode 的 OS X 或 Linux 裝 GNUstep 及 MS-Windows 裝 MinGW 下使用。

#
CC=gcc
#
OS_VERSION=$(shell uname -s)
CFLAGS=-I/usr/include -L/usr/lib
#
ifeq ($(OS_VERSION),Darwin)
export CFLAGS+=-DDARWIN -framework Foundation
else
GNUSTEP_DIR=/usr/GNUstep
GNUSTEP_SYSTEM_DIR=$(GNUSTEP_DIR)/System
GNUSTEP_LOCAL_DIR=$(GNUSTEP_DIR)/Local
#
export CFLAGS+=-I$(GNUSTEP_SYSTEM_DIR)/Library/Headers
export CFLAGS+=-I$(GNUSTEP_LOCAL_DIR)/Library/Headers
export CFLAGS+=-L$(GNUSTEP_SYSTEM_DIR)/Library/Libraries
export CFLAGS+=-L$(GNUSTEP_LOCAL_DIR)/Library/Libraries

ifeq ($(OS_VERSION),MINGW32_NT-5.1)
export CFLAGS+=-L/mingw/lib
export LIBS+=$(GNUSTEP_SYSTEM_DIR)/Library/Libraries/libobjc.dll.a
export LIBS+=$(GNUSTEP_LOCAL_DIR)/Library/Libraries/libgnustep-base.dll.a
export LDFLAGS+="-Wl,--enable-auto-import"
else
export CFLAGS+=-lgnustep-base -lobjc
endif

export CFLAGS+=-fconstant-string-class=NSConstantString
# For GCC-4.0 and upper only
# export CFLAGS+=-fobjc-call-cxx-cdtors
export CFLAGS+=-static-libgcc
endif

export CFLAGS+=-lstdc++

all:
$(CC) $(LDFLAGS) $(CFLAGS) test1.m $(LIBS) -o test1

clean:
rm -fr *.o *.exe
rm -fr test1



不過看來離我要的東西,還很遠。
對了 GNUstep 的 Gorm.app 就等於 XCode 的 Interface Builder 及 ProjectCenter.app 就是 XCode。

發表回應 發表回應 ( 575預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 3 / 67 )


<<開始 <前一頁 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 下一頁> 最後>>