[fpc-pascal] Help to create a Makefile to build a shared library on Linux

Pierre Y. pierre at levosgien.net
Fri Jul 30 15:49:52 CEST 2010


Hi,

Can you help me creating a Makefile to replace this ugly "build.sh" script ?

# cat build.sh
#!/usr/bin/env bash

PROJECT=nepudf
UIB_ROOT=../uib/source
MACHINE_TYPE=`uname -m`

if [ ${MACHINE_TYPE} == 'x86_64' ]; then
  # 64-bit stuff here
  FB_ROOT=/usr/lib64/firebird/2.1
  fpc -B -dFB21 -fPIC -Xs -Fi${UIB_ROOT} -Fu${UIB_ROOT}
-Fl${FB_ROOT}/lib ${PROJECT}.dpr
else
  # 32-bit stuff here
  FB_ROOT=/usr/lib/firebird/2.1
  fpc -B -dFB21 -Xs -Fi${UIB_ROOT} -Fu${UIB_ROOT} -Fl${FB_ROOT}/lib
${PROJECT}.dpr
fi

if [ `id -u` = 0 ]
then
  install --mode 555 --owner root --group root --strip
lib${PROJECT}.so ${FB_ROOT}/UDF/${PROJECT}.so
  install --mode 444 --owner root --group root ${PROJECT}.sql ${FB_ROOT}/UDF/

  echo Since you are root, ${PROJECT}.so and ${PROJECT}.sql have been
installed into ${FB_ROOT}/UDF
fi

The idea is quite simple : the sources for this firebird user defined
functions library is hosted on my subversion repository, it only
requires firebird to be installed and the uib components, in an ideal
world I would just have to install firebird, fpc, checkout UIB from
svn, checkout my poject from svn so that the directory tree look like
that :

~/src
~/src/nepudf
~/src/uib

Then :

~/src/nepudf $ fpcmake... && make && sudo make install

I found non Makefile.fpc example to build a shared library.

Many thanks for your help, regards,

-- 
Pierre Yager



More information about the fpc-pascal mailing list