The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Herling CairoGraphics

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Herling CairoGraphics Posted: Oct 9, 2009 11:59 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Herling CairoGraphics
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Travis Griggs - Blog

Advertisement

This last week, I've been trying to get CairoGraphics libraries built on the breadth of platforms we support VisualWorks on. Doing so makes it easy for customers to use CairoGraphics with VisualWorks in their own projects, and if we manage to get ALL the platforms, it makes it so we can begin to improve our own IDE with its capabilities. It's unknown how many, if any, we'll get included for preview for the 7.7 release, but something is better than nothing. Windows and MacOSX seems a good probability at this point. X11 is proving more difficult.

Having built CairoGraphics libraries a couple of times, over the last year or so, with long pauses in between, I often find the documentation is not quite up to date, that I end up having to ask questions of their very helpful mailing list or irc channel. I'm not GNU build guru, so they're probably naive. Which led me to want to script the download and building of these libraries. So that it was reproducible. And precisely documented.

Bash is the script environment I'm most comfortable with. But I'm no wizard. Especially when it comes to doing higher level algorithmic things. I have to ask for help for those, and I end up missing Smalltalk anyway.

So I thought I'd take the rudimentary ScriptingSupport package that we include as preview in VisualWorks, and try that. At this point, it's still pretty young. It implements stuff to make command line execution easier, and adds the & binary sugar, which is a handy way of concatenating single objects onto collections (as opposed to , which concatenates multiple elements).

And then I just decided to have fun. I followed the following design principles, which seem to be at the heart of the design of most scripting languages.

  1. Typing sucks. It's no fun. So add lots of sugar to make things terse and conserve keyboard srokes.
  2. Use lots of infix characters.
  3. Make it up as you go. As you encounter new situations, add more stuff, don't try to come up with any sort of simple unifying theme. Just throw more stuff on.
  4. Typing sucks. The other kind. Support few basic types, and abuse them. Just mash them together. You should be deluded into thinking you have don't have to worry about types, except now and then again in surprising ways. Don't make me convert from one type to another.

The only non-traditional requirement I added, was that I don't want to build a new parser or anything. So it has to strictly speaking, still be Smalltalk.

It's still a work in progress; I'm not out to start a movement. I expect derision and flames. Its all a lark to me right now. I've named my little Domain Specific Scripting Language "Herl". Ken Treis actually suggested the name; thanks Ken. It's been replicated up to the Open Repository and has a package comment that looks like any scripting language reference manual.

For those who aren't that interested (all of you likely), a snapshot of the "script" I wrote with it, is probably enough.


rootDir := '$(HOME)/BuildCairo'.

rootDir rm.

rootDir mkdir.

rootDir cd.



"Download everything"

page := #(curl   -s 'http://www.cairographics.org/releases/' ) exec.

cairo := (((page -@ $>)  detect: [:each | 'LATEST-cairo-.*' ?= each]) -@ $<) _1.

(#(curl -s) & ('http://www.cairographics.org/releases/' , cairo) , #(-o 'cairo.tgz')) exec.

pixman := (((page -@ $>)  detect: [:each | 'LATEST-pixman-.*' ?= each]) -@ $<) _1.

(#(curl -s) & ('http://www.cairographics.org/releases/' , pixman) , #(-o 'pixman.tgz')) exec.

page := #(curl  -s 'http://pkgconfig.freedesktop.org/releases/' ) exec.

pkgconfig := ((((page -@ $>)  select: [:each | each =? 'pkg-config-.*' ]) sortBy: [:each | (each -@ $.) _2 asNumber]) last -@ $<) _1.

(#(curl -s) & ('http://pkgconfig.freedesktop.org/releases/' , pkgconfig) , #(-o 'pkgconfig.tgz')) exec.

#(curl -s 'ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.40.tar.gz' -o 'libpng.tgz') exec.



"Untar and rename all 4"

#(tar -xzf 'pkgconfig.tgz') exec.

'pkgconfig.tgz' rm.

(rootDir ls: 'pkg.*') _1  mv: 'pkgconfig'.

#(tar -xzf 'libpng.tgz') exec.	

'libpng.tgz' rm.

(rootDir ls: 'libpng.*') _1 mv:  'libpng'.

#(tar -xzf 'pixman.tgz') exec.	

'pixman.tgz' rm.

(rootDir ls: 'pixman.*') _1 mv: 'pixman'.

#(tar -xzf 'cairo.tgz') exec.	

'cairo.tgz' rm.

(rootDir ls: 'cairo.*') _1 mv: 'cairo'.



"Build, install pkg-config"

(rootDir / 'pkgconfig' ) cd.

(rootDir / 'pkgconfig' / 'configure' & ('--prefix=' , (rootDir / '') forExec)) exec.

#(make) exec.

#(make install) exec.



"Environment variables for our pkg-config"

'PKG_CONFIG' setenv: rootDir / 'bin' / 'pkg-config'.

'PKG_CONFIG_PATH' setenv: rootDir / 'lib' / 'pkgconfig'.



"Setup environment variables for fat binary compilation"

'MACOSX_DEPLOYMENT_TARGET' setenv: '10.4'.

'LDFLAGS' setenv: '-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk'.

'CFLAGS' setenv: '-Os -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk'.



"Build, install libpng"

(rootDir / 'libpng') cd.

(rootDir / 'libpng' / 'configure' & ('--prefix=' , (rootDir / '') forExec) & '--disable-dependency-tracking') exec.

#(make) exec.

#(make install) exec.



"Build, install pixman"

(rootDir / 'pixman') cd.

(rootDir / 'pixman' / 'configure' & ('--prefix=' , (rootDir / '') forExec) & '--disable-dependency-tracking' ) exec.

#(make) exec.

#(make install) exec.



"Build, install cairo"

(rootDir / 'cairo') cd.

(rootDir / 'cairo' / 'configure' & ('--prefix=' , (rootDir / '') forExec) & '--disable-xlib' & '--disable-dependency-tracking') exec.

#(make) exec.

#(make install) exec.



"Move dylibs to platform staging directories"

(rootDir / 'Frameworks') mkdir.

rootDir / 'lib' / 'libpng12.0.dylib' cp: rootDir / 'Frameworks'.

rootDir / 'lib' / 'libpixman-1.0.dylib' cp: rootDir / 'Frameworks'.

rootDir / 'lib' / 'libcairo.2.dylib' cp: rootDir / 'Frameworks'.



"Make them all relocatable"

(rootDir / 'Frameworks') cd.

#(install_name_tool -id '@executable_path/../Frameworks/libpng12.0.dylib' 'libpng12.0.dylib') exec.

#(install_name_tool -id '@executable_path/../Frameworks/libpixman-1.0.dylib' 'libpixman-1.0.dylib') exec.

#(install_name_tool -id '@executable_path/../Frameworks/libcairo.2.dylib' 'libcairo.2.dylib') exec.

(#(install_name_tool -change) & (rootDir / 'lib' / 'libpixman-1.0.dylib') , #('@executable_path/../Frameworks/libpixman-1.0.dylib' 'libcairo.2.dylib')) exec.

(#(install_name_tool -change) & (rootDir / 'lib' / 'libpng12.0.dylib') , #('@executable_path/../Frameworks/libpng12.0.dylib' 'libcairo.2.dylib')) exec.



"Clear build variables"

'MACOSX_DEPLOYMENT_TARGET' unsetenv.

'LDFLAGS' unsetenv.

'CFLAGS' unsetenv.


Feel like Herl-ing now?

Read: Herling CairoGraphics

Topic: Gruple: A Tuplespace for Groovy Previous Topic   Next Topic Topic: Seaside 3.0 Alpha 5

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use