ラベル FreeBSD の投稿を表示しています。 すべての投稿を表示
ラベル FreeBSD の投稿を表示しています。 すべての投稿を表示

2013年8月22日木曜日

Are you the kind of person who is always looking for latest versions and bleeding edge software for testing those new functions? If yes, you've come to the right place.

Here are step by step instructions in how to install FreeBSD 10 with latest clang, libobjc and GNUstep.

These instructions are for a laptop with Intel graphics and shell is the default csh.

You may have to alter some points to match your system.

FreeBSD

Download the latest release and install as normal.
Boot up and login as root. 

Download most recent ports

# portsnap fetch
# portsnap extract

Intel KMS

Add to /etc/make.conf for Intel KMS support
WITH_KMS=YES
WITH_NEW_XORG=YES

Portmaster

A convenient tool for installing ports.
# cd /usr/ports/ports-mgmt/portmaster
# make install

Nano

We don't wanna use vi....
# portmaster -G editors/nano

Subversion

# portmaster -G devel/subversion

Clang

Required for latest Obj-C features.
# portmaster -G lang/clang33

Sudo
# portmaster -G security/sudo

Edit settings so that we can use sudo 
# visudo
Uncomment the line “%wheel ALL=(ALL) NOPASSWD: ALL”


Add user to wheel group to allow sudo# pw usermod [youruser] -G wheel
 

Xorg

# portmaster x11/xorg (select drivers as needed)
# portmaster -G x11-wm/openbox (my choice of wm)
# portmaster -G x11-wm/xcompmgr (optional, needed for transparent windows)


# cd ~
# Xorg -configure
# cp xorg.conf.new /etc/X11/xorg.conf


Add to /etc/X11/xorg.conf
section ServerLayout to enable mouse and keyboard (without hald)
Option          "AutoAddDevices" "Off"


Add to /home/[youruser]/.xinitrc
exec xcompmgr &
exec openbox-session


Now X can be started with “startx” after login.



Autologin

If you want auto login and auto start X do this:
Add to /etc/gettytab
# WB: autologin console as user "brilliant"
A|Al|Autologin console:\
       :ht:np:sp#115200:al=
brilliant


Edit line in /etc/ttys
ttyv1   "/usr/libexec/getty Al"       xterm  on  secure


Add to ~/.cshrc
# WB: startx if it isn't already running
set XPID = `/usr/bin/pgrep X`
if ( { [ -n "$XPID" ] } ) then
 #echo "X is already running"
else
 startx
 logout
endif


GNUstep

Prerequisites

# portmaster -G security/gnutls
# portmaster -G devel/icu
# portmaster -G devel/libdispatch


Make clang33 our default compiler
Add to ~/.cshrc and then re-login
setenv CC clang33
setenv CXX clang++33
setenv CPP clang-cpp33


Get source from SVN



$ cd ~
$ mkdir Download
$ cd Download
$ svn co http://svn.gna.org/svn/gnustep/tools/make/trunk make
$ svn co http://svn.gna.org/svn/gnustep/libs/base/trunk base
$ svn co http://svn.gna.org/svn/gnustep/libs/back/trunk back
$ svn co http://svn.gna.org/svn/gnustep/libs/gui/trunk gui
$ svn co http://svn.gna.org/svn/gnustep/libs/libobjc2/trunk libobjc2


Configure & Install



gnustep-make
You may choose other layout and prefix if you like
$ ./configure --with-layout=gnustep --prefix=/usr/GNUstep --enable-objc-nonfragile-abi
$ gmake
$ sudo -E gmake install
$ source /usr/GNUstep/System/Library/Makefiles/GNUstep.csh


Add to ~/.cshrc
source /usr/GNUstep/System/Library/Makefiles/GNUstep.csh



libobjc2
$ gmake (cmake seems broken, use normal Makefile with gmake)
$ sudo -E gmake install
- Reinstall gnustep-make according to above so that it is configured to used the new libobjc2


gnustep-base
$ ./configure --disable-unicodeconstants --enable-fake-main
$ gmake
$ sudo -E gmake install


gnustep-gui
$ ./configure
$ gmake
$ sudo -E gmake install


gnustep-back
$ ./configure --enable-graphics=cairo --with-name=cairo
$ gmake
$ sudo -E gmake install


Set default backend to cairo
$ defaults write NSGlobalDomain GSBackend cairo

Play Time


Now everything should be set up so you can start compiling and running GNUstep applications.
If you have any problems, please let me know in the comments below.


Good Luck :)


Bleeding edge

Are you the kind of person who is always looking for latest versions and bleeding edge software for testing those new functions? If yes, you've come to the right place.

Here are step by step instructions in how to install FreeBSD 10 with latest clang, libobjc and GNUstep.

These instructions are for a laptop with Intel graphics and shell is the default csh.

You may have to alter some points to match your system.

FreeBSD

Download the latest release and install as normal.
Boot up and login as root. 

Download most recent ports

# portsnap fetch
# portsnap extract

Intel KMS

Add to /etc/make.conf for Intel KMS support
WITH_KMS=YES
WITH_NEW_XORG=YES

Portmaster

A convenient tool for installing ports.
# cd /usr/ports/ports-mgmt/portmaster
# make install

Nano

We don't wanna use vi....
# portmaster -G editors/nano

Subversion

# portmaster -G devel/subversion

Clang

Required for latest Obj-C features.
# portmaster -G lang/clang33

Sudo
# portmaster -G security/sudo

Edit settings so that we can use sudo 
# visudo
Uncomment the line “%wheel ALL=(ALL) NOPASSWD: ALL”


Add user to wheel group to allow sudo# pw usermod [youruser] -G wheel
 

Xorg

# portmaster x11/xorg (select drivers as needed)
# portmaster -G x11-wm/openbox (my choice of wm)
# portmaster -G x11-wm/xcompmgr (optional, needed for transparent windows)


# cd ~
# Xorg -configure
# cp xorg.conf.new /etc/X11/xorg.conf


Add to /etc/X11/xorg.conf
section ServerLayout to enable mouse and keyboard (without hald)
Option          "AutoAddDevices" "Off"


Add to /home/[youruser]/.xinitrc
exec xcompmgr &
exec openbox-session


Now X can be started with “startx” after login.



Autologin

If you want auto login and auto start X do this:
Add to /etc/gettytab
# WB: autologin console as user "brilliant"
A|Al|Autologin console:\
       :ht:np:sp#115200:al=
brilliant


Edit line in /etc/ttys
ttyv1   "/usr/libexec/getty Al"       xterm  on  secure


Add to ~/.cshrc
# WB: startx if it isn't already running
set XPID = `/usr/bin/pgrep X`
if ( { [ -n "$XPID" ] } ) then
 #echo "X is already running"
else
 startx
 logout
endif


GNUstep

Prerequisites

# portmaster -G security/gnutls
# portmaster -G devel/icu
# portmaster -G devel/libdispatch


Make clang33 our default compiler
Add to ~/.cshrc and then re-login
setenv CC clang33
setenv CXX clang++33
setenv CPP clang-cpp33


Get source from SVN



$ cd ~
$ mkdir Download
$ cd Download
$ svn co http://svn.gna.org/svn/gnustep/tools/make/trunk make
$ svn co http://svn.gna.org/svn/gnustep/libs/base/trunk base
$ svn co http://svn.gna.org/svn/gnustep/libs/back/trunk back
$ svn co http://svn.gna.org/svn/gnustep/libs/gui/trunk gui
$ svn co http://svn.gna.org/svn/gnustep/libs/libobjc2/trunk libobjc2


Configure & Install



gnustep-make
You may choose other layout and prefix if you like
$ ./configure --with-layout=gnustep --prefix=/usr/GNUstep --enable-objc-nonfragile-abi
$ gmake
$ sudo -E gmake install
$ source /usr/GNUstep/System/Library/Makefiles/GNUstep.csh


Add to ~/.cshrc
source /usr/GNUstep/System/Library/Makefiles/GNUstep.csh



libobjc2
$ gmake (cmake seems broken, use normal Makefile with gmake)
$ sudo -E gmake install
- Reinstall gnustep-make according to above so that it is configured to used the new libobjc2


gnustep-base
$ ./configure --disable-unicodeconstants --enable-fake-main
$ gmake
$ sudo -E gmake install


gnustep-gui
$ ./configure
$ gmake
$ sudo -E gmake install


gnustep-back
$ ./configure --enable-graphics=cairo --with-name=cairo
$ gmake
$ sudo -E gmake install


Set default backend to cairo
$ defaults write NSGlobalDomain GSBackend cairo

Play Time


Now everything should be set up so you can start compiling and running GNUstep applications.
If you have any problems, please let me know in the comments below.


Good Luck :)


2012年12月4日火曜日

I'm back!


Some of you sharp people out there might have noticed. The title of the blog has changed. The first objective with this blog was to write about experiences from developing iOS apps using Objective-C. I have now broaden the content a bit to even include development in Objective-C on other platforms. For example by using the open source implementation of Cocoa, GNUstep, you can develop apps easily on Mac, Windows, Linux and *BSD in a platform independent environment.

First off, I want to show you how to get Obj-C 2.0 (@properties, new literals etc.) and GCD (Grand Central Dispatch) up and running on FreeBSD using GNUstep framework and some other libraries.

Let's say you've installed FreeBSD 9.x and have the system up and running. Here's my recipe for success:

- Install LLVM development package
# pkg install llvm-devel
Note: In FreeBSD 9.1 RC2/3 llvm-ld is missing so you have rebuild the kernel+world with "WITH_CLANG_EXTRAS=YES" in src.conf or use the gcc linker. Don't know if the missing llvm-files will come back for the final release or not...

- Install GNUstep and libobjc2 from tarballs
First install from ports to get all dependencies, then delete gnustep packages and install tarballs. Do this as root, not with sudo. GNUstep from ports does not support the new libobjc2 so we can't use it for development.
# pkg install gmake
# cd /usr/ports/devel/gnustep && make install clean
# [delete gnustep packages]

Download gnustep-make, -base, -gui and -backend from http://www.gnustep.org/resources/downloads.php.

Download latest libobjc2 from http://download.gna.org/gnustep/.

Start with installing gnustep-make
# [unpack gnustep-make and cd into directory]
# ./configure --with-layout=gnustep --prefix=/usr/local/GNUstep --enable-objc-nonfragile-abi CC=clang CXX=clang++
# gmake install CC=clang CXX=clang++
# . /usr/local/GNUstep/System/Library/Makefiles/GNUstep.sh (source the script, add this line to .bashrc or similar script)

libobjc2
# [unpack libobjc2 and cd into directory]
# gmake install CC=clang CXX=clang++

- Reinstall gnustep-make as above to configure it for new libobjc2

For gnustep-base, gnustep-gui, gnustep-back
# [unpack tarball and cd into directory]
# ./configure CC=clang CXX=clang++
# gmake install CC=clang CXX=clang++

GCD - Grand Central Dispatch
# cd /usr/ports/devel/libdispatch && make install clean
Include <dispatch/dispatch.h> to use.

And that's it. We will use two files to test our newly installed framework and libraries.
HelloWorld.m and the makefile GNUmakefile.

The sample code will test the new literals like @autorelease, @[ ... ], blocks and the dispatch library (launching blocks of code in different thread and with time delay).

HelloWorld.m start

#import <Foundation/Foundation.h>
#import <dispatch/dispatch.h>
#import <unistd.h>

int main (int argc, const char *argv[])
{

  @autoreleasepool {

    NSLog(@"Hello, World!");

    NSArray *a = @[ @"A", @"B", @"C" ];
    [a enumerateObjectsUsingBlock:^(NSString *s, NSUInteger index, BOOL *stop) {
      NSLog(@"String with index %d has value %@",(int)index, s);
    }];


    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 2.0 * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_global_queue(0,0), ^(void){
             NSLog(@"Hello from delayed dispatch!");
           });
 
    dispatch_async(dispatch_get_global_queue(0,0), ^{
             NSLog(@"Hello from dispatch!");
           });
  }
  sleep(3);
  return 0;
}


HelloWorld.m end


GNUmakefile start

ifeq ($(GNUSTEP_MAKEFILES),)
 GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
endif
ifeq ($(GNUSTEP_MAKEFILES),)
 $(error You need to set GNUSTEP_MAKEFILES before compiling!)
endif

include $(GNUSTEP_MAKEFILES)/common.make

ADDITIONAL_OBJC_LIBS += -ldispatch

#
# Application
#
VERSION = 0.1
PACKAGE_NAME = HelloWorld
APP_NAME = HelloWorld
HelloWorld_APPLICATION_ICON =

#
# Other sources
#
HelloWorld_OBJC_FILES += \
HelloWorld.m

#
# Makefiles
#
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/aggregate.make
include $(GNUSTEP_MAKEFILES)/application.make
-include GNUmakefile.postamble


GNUmakefile end

Put these two files in a folder and compile using

$ gmake

This will produce the bundle HelloWorld.app (which is basically just a folder)

Launch the app by typing
$ openapp ./HelloWorld

Have fun and good luck with Objective-C 2.0 and GNUstep :)




Cocoa on FreeBSD

I'm back!


Some of you sharp people out there might have noticed. The title of the blog has changed. The first objective with this blog was to write about experiences from developing iOS apps using Objective-C. I have now broaden the content a bit to even include development in Objective-C on other platforms. For example by using the open source implementation of Cocoa, GNUstep, you can develop apps easily on Mac, Windows, Linux and *BSD in a platform independent environment.

First off, I want to show you how to get Obj-C 2.0 (@properties, new literals etc.) and GCD (Grand Central Dispatch) up and running on FreeBSD using GNUstep framework and some other libraries.

Let's say you've installed FreeBSD 9.x and have the system up and running. Here's my recipe for success:

- Install LLVM development package
# pkg install llvm-devel
Note: In FreeBSD 9.1 RC2/3 llvm-ld is missing so you have rebuild the kernel+world with "WITH_CLANG_EXTRAS=YES" in src.conf or use the gcc linker. Don't know if the missing llvm-files will come back for the final release or not...

- Install GNUstep and libobjc2 from tarballs
First install from ports to get all dependencies, then delete gnustep packages and install tarballs. Do this as root, not with sudo. GNUstep from ports does not support the new libobjc2 so we can't use it for development.
# pkg install gmake
# cd /usr/ports/devel/gnustep && make install clean
# [delete gnustep packages]

Download gnustep-make, -base, -gui and -backend from http://www.gnustep.org/resources/downloads.php.

Download latest libobjc2 from http://download.gna.org/gnustep/.

Start with installing gnustep-make
# [unpack gnustep-make and cd into directory]
# ./configure --with-layout=gnustep --prefix=/usr/local/GNUstep --enable-objc-nonfragile-abi CC=clang CXX=clang++
# gmake install CC=clang CXX=clang++
# . /usr/local/GNUstep/System/Library/Makefiles/GNUstep.sh (source the script, add this line to .bashrc or similar script)

libobjc2
# [unpack libobjc2 and cd into directory]
# gmake install CC=clang CXX=clang++

- Reinstall gnustep-make as above to configure it for new libobjc2

For gnustep-base, gnustep-gui, gnustep-back
# [unpack tarball and cd into directory]
# ./configure CC=clang CXX=clang++
# gmake install CC=clang CXX=clang++

GCD - Grand Central Dispatch
# cd /usr/ports/devel/libdispatch && make install clean
Include <dispatch/dispatch.h> to use.

And that's it. We will use two files to test our newly installed framework and libraries.
HelloWorld.m and the makefile GNUmakefile.

The sample code will test the new literals like @autorelease, @[ ... ], blocks and the dispatch library (launching blocks of code in different thread and with time delay).

HelloWorld.m start

#import <Foundation/Foundation.h>
#import <dispatch/dispatch.h>
#import <unistd.h>

int main (int argc, const char *argv[])
{

  @autoreleasepool {

    NSLog(@"Hello, World!");

    NSArray *a = @[ @"A", @"B", @"C" ];
    [a enumerateObjectsUsingBlock:^(NSString *s, NSUInteger index, BOOL *stop) {
      NSLog(@"String with index %d has value %@",(int)index, s);
    }];


    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 2.0 * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_global_queue(0,0), ^(void){
             NSLog(@"Hello from delayed dispatch!");
           });
 
    dispatch_async(dispatch_get_global_queue(0,0), ^{
             NSLog(@"Hello from dispatch!");
           });
  }
  sleep(3);
  return 0;
}


HelloWorld.m end


GNUmakefile start

ifeq ($(GNUSTEP_MAKEFILES),)
 GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
endif
ifeq ($(GNUSTEP_MAKEFILES),)
 $(error You need to set GNUSTEP_MAKEFILES before compiling!)
endif

include $(GNUSTEP_MAKEFILES)/common.make

ADDITIONAL_OBJC_LIBS += -ldispatch

#
# Application
#
VERSION = 0.1
PACKAGE_NAME = HelloWorld
APP_NAME = HelloWorld
HelloWorld_APPLICATION_ICON =

#
# Other sources
#
HelloWorld_OBJC_FILES += \
HelloWorld.m

#
# Makefiles
#
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/aggregate.make
include $(GNUSTEP_MAKEFILES)/application.make
-include GNUmakefile.postamble


GNUmakefile end

Put these two files in a folder and compile using

$ gmake

This will produce the bundle HelloWorld.app (which is basically just a folder)

Launch the app by typing
$ openapp ./HelloWorld

Have fun and good luck with Objective-C 2.0 and GNUstep :)




Related Posts Plugin for WordPress, Blogger...