Commit fb0a0a1
build on mac os x
Changed files (7)
modifiedREADMEmodifiedbirdfont_installmodifiedconfiguremodifiedscripts/build.pyaddedscripts/mac_build.pydeletedscripts/win_build.pymodifieduninstall
Diff
@@ -2,8 +2,7 @@ Birdfont - Font Editor ---------------------- -Birdfont is a font editor that creates outline vector graphics and exports -fonts in SVG, EOT and TTF format. +Birdfont is a font editor which can create vector graphics and export SVG, EOT and TTF fonts. Author: Johan Mattsson and others see AUTHORS for full attribution. License: GNU GPL v3 @@ -46,13 +45,13 @@ Building Mac binaries Compile all dependencies using MacPorts and run: -./scripts/macports_configure.py -./scripts/macports_build.py -./scripts/macports_install.py +python ./configure --prefix=/opt/birdfont +python ./scripts/mac_build.py +sudo python ./birdfont_install --------------------- -Precompiled Packages --------------------- +-------- +Packages +-------- Windows binaries are avalilable at http://birdfont.org @@ -5,6 +5,7 @@ import glob from optparse import OptionParser from scripts import config from scripts import version+from scripts.run import run def install (file, dir): f = dest + prefix + dir + '/'@@ -14,8 +15,8 @@ def install (file, dir): else: f += file print ("install: " + f)- subprocess.check_output ('install -d ' + dest + prefix + dir, shell=True)- subprocess.check_output ('install ' + file + ' ' + dest + prefix + dir + '/', shell=True)+ run ('install -d ' + dest + prefix + dir)+ run ('install ' + file + ' ' + dest + prefix + dir + '/') installed.write (f + "\n") if not os.path.exists ("build/configured"):@@ -59,9 +60,16 @@ install ('resources/linux/birdfont.png', '/share/icons/hicolor/48x48/apps') install ('build/bin/birdfont', '/bin') install ('build/bin/birdfont-export', '/bin')-install ('build/bin/libbirdfont.so.' + version.SO_VERSION, '/lib')-install ('build/bin/libbirdfont.so', '/lib') +#library+if os.path.isfile ('build/bin/libbirdfont.so.' + version.SO_VERSION):+ install ('build/bin/libbirdfont.so.' + version.SO_VERSION, '/lib')+ install ('build/bin/libbirdfont.so', '/lib')+else:+ install ('build/bin/libbirdfont.' + version.SO_VERSION + '.dylib', '/lib')+ install ('build/bin/libbirdfont.dylib', '/lib')++#manpages if not bsd_manpages: install ('build/birdfont.1.gz', '/share/man/man1') install ('build/birdfont-export.1.gz', '/share/man/man1')@@ -69,7 +77,6 @@ else: install ('resources/linux/birdfont.1', '/man/man1') install ('resources/linux/birdfont-export.1', '/man/man1') - # translations for lang_dir in glob.glob('build/locale/*'): lc = lang_dir.replace ('build/locale/', "")@@ -7,6 +7,7 @@ from optparse import OptionParser from scripts import version from scripts import configfile import re+from scripts.run import run VERSION = version.VERSION @@ -53,6 +54,7 @@ def configure (): libs = [ 'cairo', 'gdk-pixbuf-2.0', + 'gee-1.0', 'gio-2.0', 'glib-2.0', 'gtk+-2.0',@@ -64,8 +66,8 @@ def configure (): for lib in libs: test_library_version (lib) - v = subprocess.check_output ('mkdir -p build', shell=True)- v = subprocess.check_output ('touch build/configured', shell=True)+ run ('mkdir -p build')+ run ('touch build/configured') print (""); print (OKGREEN + "Done" + ENDC);@@ -75,8 +75,13 @@ def libbirdfont(prefix, cc, cflags, ldflags, valac, valaflags, library): if os.path.exists("build/bin/libbirdfont.so"): run ("cd build/bin && unlink libbirdfont.so") - run ("""cd build/bin && ln -s """ + library + " libbirdfont.so")-+ # create link to the versioned library+ if library.find ('.so') > -1:+ run ("""cd build/bin && ln -s """ + library + " libbirdfont.so")+ elif library.find ('.dylib') > -1:+ run ("""cd build/bin && ln -s """ + library + " libbirdfont.dylib")+ + def birdfont_export(prefix, cc, cflags, ldflags, valac, valaflags, library): # birdfont-export run("mkdir -p build/birdfont-export")@@ -110,7 +115,7 @@ def birdfont_export(prefix, cc, cflags, ldflags, valac, valaflags, library): run(cc + " " + ldflags + " \ build/birdfont-export/*.o \- -L build/bin/ -l birdfont \+ -Lbuild/bin/ -lbirdfont \ $(pkg-config --libs gee-1.0) \ $(pkg-config --libs libxml-2.0) \ $(pkg-config --libs gio-2.0) \@@ -158,7 +163,7 @@ def birdfont_gtk(prefix, cc, cflags, ldflags, valac, valaflags, library): run(cc + " " + ldflags + """ \ build/birdfont/*.o \- -L build/bin/ -l birdfont \+ -Lbuild/bin/ -lbirdfont \ $(pkg-config --libs gee-1.0) \ $(pkg-config --libs libxml-2.0) \ $(pkg-config --libs gio-2.0) \new file mode 100644@@ -0,0 +1,60 @@+#!/usr/bin/python+"""+Copyright (C) 2013 Johan Mattsson++This library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation; either version 3 of the +License, or (at your option) any later version.++This library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details.+"""++import build+from translations import compile_translations+import configfile+from run import run+import version+from optparse import OptionParser++parser = OptionParser()+parser.add_option("-p", "--prefix", dest="prefix", help="install prefix", metavar="PREFIX")+parser.add_option("-d", "--dest", dest="dest", help="install to this directory", metavar="DEST")+parser.add_option("-c", "--cc", dest="cc", help="select the C compiler", metavar="CC")+parser.add_option("-f", "--cflags", dest="cflags", help="set compiler flags", metavar="CFLAGS")+parser.add_option("-l", "--ldflags", dest="ldflags", help="set linker flags", metavar="LDFLAGS")+parser.add_option("-v", "--valac", dest="valac", help="select vala compiler", metavar="VALAC")++(options, args) = parser.parse_args()++if not options.prefix:+ options.prefix = "/opt/local"+if not options.cc:+ options.cc = "gcc"+if not options.cflags:+ options.cflags = ""+if not options.ldflags:+ options.ldflags = ""+if not options.valac:+ options.valac = "valac"++prefix = options.prefix+valac = options.valac+valaflags = ""+cc = options.cc+cflags = options.cflags+ldflags = options.ldflags+library_cflags = options.cflags+library_ldflags= options.ldflags+library = "libbirdfont." + version.SO_VERSION + ".dylib"++configfile.write_config (prefix)+compile_translations()+build.libbirdfont(prefix, cc, cflags, library_ldflags, valac, valaflags, library)+build.birdfont_export(prefix, cc, cflags, ldflags, valac, valaflags, library)+build.birdfont_gtk(prefix, cc, cflags, ldflags, valac, valaflags, library)++print ("Done")deleted file mode 100755@@ -1,418 +0,0 @@-#!/usr/bin/python-"""-Copyright (C) 2012 2013 Johan Mattsson--This program is free software: you can redistribute it and/or modify-it under the terms of the GNU General Public License as published by-the Free Software Foundation, either version 3 of the License, or-(at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program. If not, see <http://www.gnu.org/licenses/>.-"""--import os-import shutil-import subprocess-import sys--import configfile-import version-from run import run-from translations import compile_translations--VERSION = version.VERSION--WIN32_LIBS = [- 'glib-2.0',- 'libxml-2.0',- 'gio-2.0',- 'libsoup-2.4',- 'gtk+-2.0',- 'webkit-1.0'-]--WIN32_DLLS = [ - "libcairo-2.dll",- "libgdk-win32-2.0-0.dll",- "libgdk_pixbuf-2.0-0.dll",- "libgio-2.0-0.dll",- "libglib-2.0-0.dll",- "libgobject-2.0-0.dll",- "libgthread-2.0-0.dll",- "libgtk-win32-2.0-0.dll",- "libxml2-2.dll",- "libfontconfig-1.dll",- "libfreetype-6.dll",- "libpixman-1-0.dll",- "libpng15-15.dll",- "zlib1.dll",- "libpixman-1-0.dll",- "libpng15-15.dll",- "libintl-8.dll",- "libgmodule-2.0-0.dll",- "libffi-5.dll",- "libgobject-2.0-0.dll",- "libjasper-1.dll",- "libjpeg-8.dll",- "libtiff-5.dll",- "libgdk_pixbuf-2.0-0.dll",- "libpango-1.0-0.dll",- "libpangocairo-1.0-0.dll",- "libgdk-win32-2.0-0.dll",- "libgmodule-2.0-0.dll",- "libexpat-1.dll",- "libpangoft2-1.0-0.dll",- "libpangowin32-1.0-0.dll",- "libpangocairo-1.0-0.dll",- "libgdk-win32-2.0-0.dll",- "libpangoft2-1.0-0.dll",- "libpangowin32-1.0-0.dll",- "libpangocairo-1.0-0.dll",- "libatk-1.0-0.dll",- "libsoup-2.4-1.dll",- "libsqlite3-0.dll",- "libxslt-1.dll",- "libgcc_s_sjlj-1.dll",- "libstdc++-6.dll",- "libjavascriptcoregtk-1.0-0.dll",- "libenchant-1.dll",- "libgailutil-18.dll",- "libwebkitgtk-1.0-0.dll",- "pthreadGC2.dll"-]- -def configure():- print("")- print("Crosscompile for windows")- - run('./configure')- - run('i686-w64-mingw32-gcc --version')- run('i686-w64-mingw32-pkg-config --version') - run('windres --version') - run('wine --version')- run('ls ' + os.getenv("HOME") + "/.wine/drive_c/Program/NSIS/makensis.exe")- - for pkg in WIN32_LIBS:- run('i686-w64-mingw32-pkg-config --cflags --libs '+ pkg)--def build():- run("mkdir -p ./build/supplement")- run("mkdir -p ./build/win32")- run("mkdir -p ./build/win32/libbirdfont")- run("mkdir -p ./build/win32/birdfont")- run("mkdir -p ./build/win32/birdfont-export")-- run("windres ./resources/win32/icon.rc -O coff -o ./build/icon.res")-- # generate c code- run("cp ./libbirdfont/OpenFontFormat/*.c ./build/win32/libbirdfont/")- run("""valac -C \- ./libbirdfont/*.vala \- ./libbirdfont/OpenFontFormat/*.vala \- --basedir ./build/win32/libbirdfont/ \- --library libbirdfont \- -H ./build/win32/libbirdfont/birdfont.h \- --pkg libxml-2.0 \- --pkg gio-2.0 \- --pkg cairo \- --pkg libsoup-2.4 \- --pkg gdk-pixbuf-2.0 \- --pkg webkit-1.0""")-- run("""valac -C --basedir ./build/win32/birdfont \- ./birdfont/* \- --vapidir=./ \- --pkg libxml-2.0 \- --pkg gio-2.0 \- --pkg cairo \- --pkg libsoup-2.4 \- --pkg gdk-pixbuf-2.0 \- --pkg webkit-1.0 \- --pkg gtk+-2.0 \- --pkg libbirdfont""")- - run("""valac -C --basedir ./build/win32/birdfont-export/ \- ./birdfont-export/* \- --vapidir=./ \- --pkg libxml-2.0 \- --pkg gio-2.0 \- --pkg cairo \- --pkg libsoup-2.4 \- --pkg gdk-pixbuf-2.0 \- --pkg webkit-1.0 \- --pkg gtk+-2.0 \- --pkg libbirdfont""")-- # compile c code- run("""i686-w64-mingw32-gcc \- -c ./build/win32/libbirdfont/birdfont.h \- ./build/win32/birdfont/Main.c \- ./build/win32/birdfont/GtkWindow.c \- ./build/win32/birdfont-export/BirdfontExport.c \- ./build/win32/libbirdfont/*.c ./ \- -D 'GETTEXT_PACKAGE="birdfont"' \- -I ./build/win32/libbirdfont/ \- -mthreads \- $(i686-w64-mingw32-pkg-config --cflags --libs glib-2.0) \- $(i686-w64-mingw32-pkg-config --cflags --libs libxml-2.0) \- $(i686-w64-mingw32-pkg-config --cflags --libs gio-2.0) \- $(i686-w64-mingw32-pkg-config --cflags --libs libsoup-2.4) \- $(i686-w64-mingw32-pkg-config --cflags --libs gtk+-2.0) \- $(i686-w64-mingw32-pkg-config --cflags --libs webkit-1.0)""");- - # move object files to their folders- run("""mv BirdfontExport.o ./build/win32/birdfont-export """)- run("""mv Main.o ./build/win32/birdfont """)- run("""mv GtkWindow.o ./build/win32/birdfont """)- run("""mv *.o ./build/win32/libbirdfont/ """)-- # link binaries- run("""i686-w64-mingw32-gcc \- -shared \- ./build/win32/libbirdfont/*.o \- ./build/icon.res \- -Wl,-subsystem,windows \- -mthreads \- -L/usr/i686-w64-mingw32/sys-root/mingw/lib \- -static -B static -lintl.dll -B static -l glib-2.0.dll -B static -l xml2.dll \- -B static -lgio-2.0.dll -B static -l soup-2.4.dll \- -B static -l webkitgtk-1.0.dll -B static -lgtk-win32-2.0.dll -B static -lgdk-win32-2.0.dll -B static -latk-1.0.dll -B static -lgio-2.0.dll -B static -lpangowin32-1.0.dll -B static -lpangocairo-1.0.dll -B static -lgdk_pixbuf-2.0.dll -B static -lpango-1.0.dll -B static -lcairo.dll -B static -lgobject-2.0.dll -B static -lgmodule-2.0.dll -B static -lgthread-2.0.dll -B static -lglib-2.0.dll \- -l freetype.dll\- -static -o libbirdfont.dll""")- - run("""i686-w64-mingw32-ar rcs ./build/libbirdfont.dll.a ./build/win32/libbirdfont/*.o""")-- run("""i686-w64-mingw32-gcc \- ./build/win32/birdfont/Main.o \- ./build/win32/birdfont/GtkWindow.o \- ./build/icon.res \- -Wl,-subsystem,windows \- -mthreads \- -L./build/ \- -L/usr/i686-w64-mingw32/sys-root/mingw/lib \- -static -B -static -l birdfont.dll \- -static -B static -lintl.dll -B static -l glib-2.0.dll -B static -l xml2.dll \- -B static -l gio-2.0.dll -B static -l soup-2.4.dll \- -B static -l webkitgtk-1.0.dll -B static -l gtk-win32-2.0.dll -B static -l gdk-win32-2.0.dll -B static -l atk-1.0.dll -B static -l gio-2.0.dll -B static -l pangowin32-1.0.dll -B static -l pangocairo-1.0.dll -B static -l gdk_pixbuf-2.0.dll -B static -l pango-1.0.dll -B static -l cairo.dll -B static -l gobject-2.0.dll -B static -l gmodule-2.0.dll -B static -l gthread-2.0.dll -B static -l glib-2.0.dll \- -l freetype.dll \- -static -o birdfont.exe""")-- run("""i686-w64-mingw32-gcc \- ./build/win32/birdfont/Main.o \- ./build/win32/birdfont/GtkWindow.o \- ./build/icon.res \- -mthreads \- -L./build/ \- -L/usr/i686-w64-mingw32/sys-root/mingw/lib \- -static -B -static -l birdfont.dll \- -static -B static -lintl.dll -B static -l glib-2.0.dll -B static -l xml2.dll \- -B static -l gio-2.0.dll -B static -l soup-2.4.dll \- -B static -l webkitgtk-1.0.dll -B static -l gtk-win32-2.0.dll -B static -l gdk-win32-2.0.dll -B static -l atk-1.0.dll -B static -l gio-2.0.dll -B static -l pangowin32-1.0.dll -B static -l pangocairo-1.0.dll -B static -l gdk_pixbuf-2.0.dll -B static -l pango-1.0.dll -B static -l cairo.dll -B static -l gobject-2.0.dll -B static -l gmodule-2.0.dll -B static -l gthread-2.0.dll -B static -l glib-2.0.dll \- -l freetype.dll \- -static -o birdfont_terminal.exe""")-- run("""i686-w64-mingw32-gcc \- ./build/win32/birdfont-export/BirdfontExport.o \- ./build/icon.res \- -Wl,-subsystem,windows \- -mthreads \- -L./build/ \- -L/usr/local/lib -lfreetype -lz \- -L/usr/i686-w64-mingw32/sys-root/mingw/lib \- -static -B -static -l birdfont.dll \- -static -B static -lintl.dll -B static -l glib-2.0.dll -B static -l xml2.dll \- -B static -l gio-2.0.dll -B static -l soup-2.4.dll \- -B static -l webkitgtk-1.0.dll -B static -l gtk-win32-2.0.dll -B static -l gdk-win32-2.0.dll -B static -l atk-1.0.dll -B static -l gio-2.0.dll -B static -l pangowin32-1.0.dll -B static -l pangocairo-1.0.dll -B static -l gdk_pixbuf-2.0.dll -B static -l pango-1.0.dll -B static -l cairo.dll -B static -l gobject-2.0.dll -B static -l gmodule-2.0.dll -B static -l gthread-2.0.dll -B static -l glib-2.0.dll \- -l freetype.dll \- -static -o birdfont-export.exe""")-- run("mv birdfont-export.exe ./build/supplement/")- run("mv birdfont.exe ./build/supplement/")- run("mv birdfont_terminal.exe ./build/supplement/")- run("mv libbirdfont.dll ./build/supplement/")-- compile_translations ()-- copy_runtime_dependencies ()- generate_nsi()- - os.chdir('../../')- run(os.getenv("HOME") + "/.wine/drive_c/Program/NSIS/makensis.exe ./build/supplement/birdfont_installer.nsi")- -def generate_nsi():- print ('generating build/supplement/birdfont_installer.nsi')-- run('mkdir -p ./build/supplement')-- f = open('./build/supplement/birdfont_installer.nsi', 'w+')- f.write("""; windows installation script generated by by build script--Name "Birdfont"-""")-- f.write("OutFile \"..\\")- f.write("birdfont-")- f.write(VERSION)- f.write(".exe\"")- - f.write("""-InstallDir $PROGRAMFILES\Birdfont-InstallDirRegKey HKLM "Software\NSIS_Birdfont" "Install_Dir"--Icon "birdfont.ico"--; Request application privileges for Windows Vista-RequestExecutionLevel admin--;----------------------------------Page components-Page directory-Page instfiles--UninstPage uninstConfirm-UninstPage instfiles--;----------------------------------Section "Birdfont (required)"-- SectionIn RO-""");-- os.chdir('./build/supplement')- write_files ('.', f)-- f.write("""-- SetOutPath $INSTDIR-- ; Write the installation path into the registry- WriteRegStr HKLM SOFTWARE\NSIS_Birdfont "Install_Dir" "$INSTDIR"- - ; Write the uninstall keys for Windows- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Birdfont" "DisplayName" "NSIS Birdfont"- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Birdfont" "UninstallString" '"$INSTDIR\uninstall.exe"'- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Birdfont" "NoModify" 1- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Birdfont" "NoRepair" 1- WriteUninstaller "uninstall.exe"- -SectionEnd--Section "Start Menu Shortcuts"-- CreateDirectory "$SMPROGRAMS\Birdfont"- CreateShortCut "$SMPROGRAMS\Birdfont\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0- CreateShortCut "$SMPROGRAMS\Birdfont\Birdfont.lnk" "$INSTDIR\\birdfont.exe" ""- - CreateShortCut "$DESKTOP\Birdfont.lnk" "$INSTDIR\\birdfont.exe" ""- -SectionEnd--;----------------------------------; Uninstaller--Section "Uninstall"- - ; Remove registry keys- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Birdfont"- DeleteRegKey HKLM SOFTWARE\NSIS_Birdfont--""")-- remove_files ('.', f)-- f.write("""-- Delete $INSTDIR\uninstall.exe- RMDir "$INSTDIR\Birdfont"- - Delete "$SMPROGRAMS\Birdfont\*.*"- RMDir "$SMPROGRAMS\Birdfont"-- Delete "$DESKTOP\Birdfont.lnk"--SectionEnd-""")--def write_files (dir, f):- filenames = os.walk(dir)-- f.write(" SetOutPath $INSTDIR\n")- - for path in (os.path.join(dir, f) for f in os.listdir(dir)):- if not os.path.isdir(path):- f.write(" File \"")- f.write(path.replace ('./', '').replace ('/', '\\'))- f.write("\"\n")- - for dirname, dirnames, filenames in os.walk(dir):- for subdirname in dirnames:- ndir = os.path.join(dirname, subdirname)- wdir = ndir.replace ('./', '').replace ('/', '\\')- - f.write("\n")- f.write(" SetOutPath $INSTDIR\\")- f.write(wdir)- f.write("\n")- - dirList = os.listdir(ndir)- for fname in dirList:- fp = os.path.join(ndir, fname) - if not os.path.isdir(fp):- f.write(" File ")- f.write(wdir)- f.write("\\")- f.write(fname)- f.write("\n")--def remove_files (dir, f):- for path in (os.path.join(dir, f) for f in os.listdir(dir)):- if os.path.isdir(path):- remove_files (path, f)- else:- f.write(" Delete \"$INSTDIR\\")- f.write(path.replace ('./', '').replace ('/', '\\'))- f.write("\"\n")- - if dir == '.':- f.write(" RMDir \"$INSTDIR\"\n") - else:- f.write(" RMDir \"$INSTDIR\\")- f.write(dir.replace ('./', '').replace ('/', '\\'))- f.write("\"\n")- -def copy_runtime_dependencies ():-- MINGW = "/usr/i686-w64-mingw32/sys-root/mingw"- MINGW_BIN = MINGW + "/bin"-- run("cp /usr/share/unicode/NamesList.txt ./build/supplement/")-- run("cp ./README ./build/supplement/")- run("cp ./NEWS ./build/supplement/")- - run("cp -ra ./layout/ ./build/supplement/")- run("cp -ra ./icons/ ./build/supplement/")- run("cp -ra ./build/locale ./build/supplement/")- - run("cp ./resources/win32/birdfont.ico ./build/supplement/")- run("cp -r " + MINGW + "/etc ./build/supplement/")-- run("cp " + MINGW_BIN + "/gspawn-win32-helper.exe ./build/supplement/")- run("cp " + MINGW_BIN + "/gspawn-win32-helper-console.exe ./build/supplement/")-- # DLL-hell- for dll in WIN32_DLLS:- run("cp " + MINGW_BIN + "/" + dll + " ./build/supplement/")--configfile.write_config ("")-build () @@ -1,6 +1,7 @@ #!/usr/bin/python import os import subprocess+from scripts.run import run if not os.path.exists ("build/configured"): print ("Project is not configured")@@ -13,6 +14,6 @@ if not os.path.exists ("build/installed"): f = open('build/installed') for file in iter(f): print ('Removing ' + file.replace ('\n', ''))- subprocess.check_output ('rm ' + file, shell=True)+ run ('rm ' + file) f.close()