Wednesday, September 11, 2019

Firebird 3 Embedded on MacOSX


I have finally managed to get around to preparing a mechanism for creating an embedded Firebird Framework on MacOSX (many thanks to the customer who sponsored the work). I will be committing the updated makefile embed.darwin shortly to B3_0_Release.
You can use the makefile to create a 32bit or 64 bit framework, depending on the build of Firebird you want.
Once you have a build of Firebird, you need to run make.platform.postfix, and then embed.darwin. The embeded framework is created in gen/Release/frameworks.

If you can't build Firebird from scratch you can download a copy of the embedded framework (currently Firebird 3.0.4) from IBPhoenix. (Approx 15mb)

32bit Embedded Framework
64bit Embedded Framework

Below is the embed.darwin makefile (updated 01-Oct-2019)

# Makefile script to generate an embedded Firebird Framework from a sucessful Firebird build
# To be run from the gen directory of a Firebird Release build
# Your application needs to be placed in the Resources/app directory.

    FBE=../gen/Release/frameworks/FirebirdEmbedded.framework
    BINLOC=../gen/Release/frameworks/FirebirdEmbedded.framework/Versions/A/Resources/bin
    LIBLOC=../gen/Release/frameworks/FirebirdEmbedded.framework/Versions/A
    INTLOC=../gen/Release/frameworks/FirebirdEmbedded.framework/Versions/A/Resources/intl
    PLULOC=../gen/Release/frameworks/FirebirdEmbedded.framework/Versions/A/Resources/plugins
    UTILOC=../gen/Release/frameworks/FirebirdEmbedded.framework/Versions/A/Libraries
    OLDPATH=/Library/Frameworks/Firebird.framework/Versions/A/Libraries

all:

    -$(RM) -rf $(FBE)
    mkdir -p $(FBE)/Versions/A/Resources
    mkdir -p $(FBE)/Versions/A/Resources/intl
    mkdir -p $(FBE)/Versions/A/Resources/plugins
    mkdir -p $(FBE)/Versions/A/Resources/bin
    mkdir -p $(FBE)/Versions/A/Resources/app
    mkdir -p $(FBE)/Versions/A/Headers
    mkdir -p $(FBE)/Versions/A/Libraries
    ln -s Versions/Current/Headers $(FBE)/Headers
    ln -s Versions/Current/Resources $(FBE)/Resources
    ln -s Versions/Current/Libraries $(FBE)/Libraries
    ln -s A $(FBE)/Versions/Current

    cp ../gen/Release/firebird/firebird.conf $(FBE)/Versions/A/Resources/firebird.conf
    cp ../gen/Release/firebird/plugins.conf $(FBE)/Versions/A/Resources/plugins.conf
    cp ../gen/Release/firebird/firebird.msg $(FBE)/Versions/A/Resources/firebird.msg
    cp ../gen/Release/firebird/lib/libfbclient.dylib $(FBE)/Versions/A/libfbclient.dylib
    cp ../gen/Release/firebird/plugins/libEngine12.dylib $(FBE)/Versions/A/Resources/plugins/libEngine12.dylib
    cp ../gen/Release/firebird/lib/libicudata.dylib $(FBE)/Versions/A/libicudata.dylib
    cp ../gen/Release/firebird/lib/libicui18n.dylib $(FBE)/Versions/A/libicui18n.dylib
    cp ../gen/Release/firebird/lib/libicuuc.dylib $(FBE)/Versions/A/libicuuc.dylib
    cp ../gen/Release/firebird/bin/gbak $(FBE)/Versions/A/Resources/bin/gbak
    cp ../gen/Release//firebird/bin/isql $(FBE)/Versions/A/Resources/bin/isql
    cp ../gen/Release/firebird/intl/fbintl.conf $(FBE)/Versions/A/Resources/intl/fbintl.conf
    cp ../gen/Release/firebird/intl/libfbintl.dylib $(FBE)/Versions/A/Resources/intl/libfbintl.dylib
    cp ../gen/Release/firebird/lib/libib_util.dylib $(FBE)/Versions/A/Libraries/libib_util.dylib


    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Firebird \
     @loader_path/../../libfbclient.dylib $(BINLOC)/isql
    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Firebird \
     @loader_path/../../libfbclient.dylib $(PLULOC)/libEngine12.dylib
    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicuuc.dylib \
    @loader_path/../../libicuuc.dylib $(BINLOC)/isql
    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicudata.dylib \
    @loader_path/../../libicudata.dylib $(BINLOC)/isql
    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicui18n.dylib \
    @loader_path/../../libicui18n.dylib $(BINLOC)/isql
   
    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Firebird \
    @loader_path/../../libfbclient.dylib $(BINLOC)/gbak
    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicuuc.dylib \
    @loader_path/../../libicuuc.dylib $(BINLOC)/gbak
    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicudata.dylib \
    @loader_path/../../libicudata.dylib $(BINLOC)/gbak
    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicui18n.dylib \
    @loader_path/../../libicui18n.dylib $(BINLOC)/gbak
   
    install_name_tool -change $(OLDPATH)/libicuuc.dylib @loader_path/libicuuc.dylib \
    $(LIBLOC)/libfbclient.dylib
    install_name_tool -change $(OLDPATH)/libicudata.dylib @loader_path/libicudata.dylib \
    $(LIBLOC)/libfbclient.dylib
    install_name_tool -change $(OLDPATH)/libicui18n.dylib @loader_path/libicui18n.dylib \
    $(LIBLOC)/libfbclient.dylib
    install_name_tool -change $(OLDPATH)/libicudata.dylib @loader_path/libicudata.dylib \
    $(LIBLOC)/libicuuc.dylib
    install_name_tool -change $(OLDPATH)/libicuuc.dylib @loader_path/libicuuc.dylib \
    $(LIBLOC)/libicui18n.dylib
    install_name_tool -change $(OLDPATH)/libicudata.dylib @loader_path/libicudata.dylib \
    $(LIBLOC)/libicui18n.dylib

    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Firebird \
    @loader_path/../../libfbclient.dylib $(INTLOC)/libfbintl.dylib

    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicuuc.dylib \
        @loader_path/../libicuuc.dylib $(INTLOC)/libfbintl.dylib
    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicudata.dylib \
        @loader_path/../libicudata.dylib $(INTLOC)/libfbintl.dylib
    install_name_tool -change /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicui18n.dylib \
        @loader_path/../libicui18n.dylib $(INTLOC)/libfbintl.dylib

    install_name_tool -id @rpath/libfbclient.dylib $(LIBLOC)/libfbclient.dylib
    install_name_tool -id @rpath/libicudata.dylib $(LIBLOC)/libicudata.dylib
    install_name_tool -id @rpath/libicui18n.dylib $(LIBLOC)/libicui18n.dylib
    install_name_tool -id @rpath/libicudata.dylib $(LIBLOC)/libicudata.dylib
    install_name_tool -id @rpath/libicuuc.dylib $(LIBLOC)/libicuuc.dylib
    install_name_tool -id @rpath/libicudata.dylib $(LIBLOC)/libicudata.dylib
    install_name_tool -id @rpath/libib_util.dylib $(UTILOC)/libib_util.dylib
    install_name_tool -id @rpath/libfbintl.dylib $(INTLOC)/libfbintl.dylib
    install_name_tool -id @rpath/libEngine12.dylib $(PLULOC)/libEngine12.dylib