From ed2897f7028f0c50a149b9b226d6c70b9fc57c53 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Tue, 11 Jan 2011 20:52:57 +0000 Subject: [PATCH] build: Mostly reverted 2427 following code review by Andreas. --- README | 104 ++--------------------------- buildForMac => contrib/buildForMac | 51 ++++++++++---- msvc64/buildall.bat | 2 +- 3 files changed, 43 insertions(+), 114 deletions(-) rename buildForMac => contrib/buildForMac (59%) diff --git a/README b/README index c6e51685..a0312cb6 100644 --- a/README +++ b/README @@ -21,11 +21,11 @@ You can build the libraries in the following ways: 1 Linux, Mac, Cygwin, Msys (autoconf tools) - general notes follow - - see notes below concerning Cygwin/MSYS and MacOSX + - FAQ concerning Cygwin/MSYS and MacOSX http://dev.exiv2.org/projects/exiv2/wiki/FAQ 2 Microsoft Visual C++ - - see msvc/README-MSVC.txt (32bit build VC7.1/2003 and up) - - see msvc64/ReadMe.txt (32bit and 64 bit build VC8/2005 and up) + - see msvc/README-MSVC.txt (32bit build VC7.1/2003 and up) + - see msvc64/ReadMe.txt (32bit and 64 bit build VC8/2005 and up) 3 CMake (experimental support for cmake on all platforms) - see README-CMAKE for more information @@ -41,13 +41,7 @@ utility: If you downloaded the source code from the subversion repository, you won't have a configure script. Run 'make config' to generate it and see -the section "Hacking" below. You may need to run autoconf in the config directory: - - $ cd exiv2/config - $ autoconf - $ mv configure .. - $ cd .. - $ ./configure etc....... +the section "Hacking" below. The default install locations are /usr/local/lib for the library, /usr/local/bin for the exiv2 utility and /usr/local/include/exiv2 for the @@ -186,93 +180,3 @@ On UNIX-like systems, run the configure script with the options --enable-commercial --disable-nls --disable-lensdata -To build Exiv2 with MSVC 7.1 or later on Windows, use the solution file -msvc\exiv2.sln. See msvc\README-MSVC.txt for details. - - -Cygwin/MSYS -=========== - -You can build on Cygwin using autoconf. The process is similar to Linux. This will generate a 32bit shared library (DLL) version of exiv2.exe and its libraries. - -Please observe the following additional steps: - -1) You may need to run dos2unix on all the files in the config directory. - This is only necessary if your exiv2 directory is SVN:2426 or earlier (2011-01-10) - cd exiv2/config - dos2unix * - cd .. - -2) You may make need to generate the configure script. - cd exiv2/config - autoconf - mv configure .. - -3) You should disable compiler visibility: - cd exiv2 - ./configure --disable-visibility - -4) If you wish to build the sample programs, here are the steps: - cd exiv2 - make - .... build time about 7 minutes (on a 2.2MHz Duo Core Intel Processor) - make install - export "PKG_CONFIG_PATH=${PWD}/config" - make samples - .... build time about 4 minutes - -5) Cygwin builds have dependancies on other cygwin dlls. - You can use depends32.exe (in the msvc64 tree) to determine the dependancies. - - 540 /c/gnu/exiv2/src/.libs> ../../msvc64/tools/bin/depends32.exe -q exiv2.exe - cygz.dll - cygintl-8.dll - cygiconv-2.dll - cygexpat-1.dll - cygstdc++-6.dll - CRYPTBASE.dll - SspiCli.dll - RPCRT4.dll - KERNEL32.dll - ntdll.dll - KERNELBASE.dll - ADVAPI32.DLL - cygwin1.dll - cyggcc_s-1.dll - cygexiv2-10.dll - exiv2.exe - - It's possible to run cygwin builds on "vanilla" windows machines (cygwin not installed) - provided you ensure that all the dependant cyg*.dll files are available - on the path or in the same directory as exiv2.exe. - (cryptbase.dll ... advapi32.dll are standard Windows dlls and should not be redistributed). - -MacOSX -====== - -By default the Mac will perform a "native" build of exiv2. On Leopard this is a 32 bit intel/ppc build. On Snow Leopard, this is a 64 bit intel build (x64). These correspond to arch={i386 | ppc | x86_64} The libraries are linked against the run-time libraries of the build machine. - -However there are three additional things you may wish to respect. - -1 Building and linking xmpsdk - - There is an additional complication that xmpsdk is very strong willed. You will have to pass OBJCFLAGS (and OBJCXXFLAGS) to the build environment for xmpsdk. - - arch=i386 - ./configure CFLAGS="$arch" CXXFLAGS="$arch" CPPFLAGS="$arch" LDFLAGS="$arch -L${PWD}/xmpsdk/src" OBJCFLAGS="$arch" OBJCXXFLAGS="$arch" - env CFLAGS="$arch" CXXFLAGS="$arch" CPPFLAGS="$arch" LDFLAGS="$arch" OBJCFLAGS="$arch" OBJCXXFLAGS="$arch" make - -2 Using the appropriate run-time libraries. - You should set the environment string TARGET to modify the - TARGET="MACOSX_DEPLOYMENT_TARGET=10.4" (or 5 or 6) - -3 Building "universal" binaries (library/executables which contain code for more than one architecture). - If you wish to build a "universal" library, you should build each of the architectures independantly and combine them with the lipo utility. - - lipo -arch i386 lib.i386 -arch x86_64 lib.x86_64 -arch ppc lib.ppc -create -output exiv2.20.dylib - -The bash script buildForMac embodies all three of these concepts and builds a universal exiv2 on Snow Leopard and Leopard. - - -That's all Folks! -================= diff --git a/buildForMac b/contrib/buildForMac similarity index 59% rename from buildForMac rename to contrib/buildForMac index 18b42b70..6fe26a0c 100755 --- a/buildForMac +++ b/contrib/buildForMac @@ -1,12 +1,31 @@ #!/bin/bash +## +# buildForMac +# example: contrib/buildForMac --disable-shared + +# b=`basename "${PWD}"` + +if [ ! -d contrib ]; then + echo "you are in the wrong directory - please run $0 in the main directory (which includes contrib and src)" + exit 1 +fi + +TARGET="MACOSX_DEPLOYMENT_TARGET=10.4" + lib=libexiv2.10.dylib app=exiv2 -TARGET="MACOSX_DEPLOYMENT_TARGET=10.4" - LIB=./src/.libs/$lib APP=./src/.libs/$app +for option in "$@" ; do + if [ "$option" == --disable-shared ]; then + lib=libexiv2.a + LIB=./src/.libs/$lib + APP=./src/$app + fi +done + props() { ls -alt $* lipo -info $* @@ -16,33 +35,39 @@ props() { build() { make clean - ./configure CFLAGS="$arch" CXXFLAGS="$arch" CPPFLAGS="$arch" LDFLAGS="$arch -L${PWD}/xmpsdk/src" OBJCFLAGS="$arch" OBJCXXFLAGS="$arch" $TARGET + ./configure CFLAGS="$arch" CXXFLAGS="$arch" CPPFLAGS="$arch" LDFLAGS="$arch -L${PWD}/xmpsdk/src" OBJCFLAGS="$arch" OBJCXXFLAGS="$arch" $TARGET "$@" env CFLAGS="$arch" CXXFLAGS="$arch" CPPFLAGS="$arch" LDFLAGS="$arch -L${PWD}/xmpsdk/src" OBJCFLAGS="$arch" OBJCXXFLAGS="$arch" $TARGET make $TARGET props $APP props $LIB } for arch in '-arch i386' '-arch x86_64' '-arch ppc'; do - if [ "$arch" = "-arch i386" ]; then - build + if [ "$arch" == "-arch i386" ]; then + build "$@" rm -rf app.i386 lib.i386 cp $APP app.i386 cp $LIB lib.i386 - elif [ "$arch" = "-arch x86_64" ]; then - build + elif [ "$arch" == "-arch x86_64" ]; then + build "$@" rm -rf app.x86_64 lib.x86_64 cp $APP app.x86_64 cp $LIB lib.x86_64 - elif [ "$arch" = "-arch ppc" ]; then - build + elif [ "$arch" == "-arch ppc" ]; then + build "$@" rm -rf app.ppc lib.ppc cp $APP app.ppc cp $LIB lib.ppc fi done -env $TARGET lipo -arch i386 lib.i386 -arch x86_64 lib.x86_64 -arch ppc lib.ppc -create -output $lib -env $TARGET lipo -arch i386 app.i386 -arch x86_64 app.x86_64 -arch ppc app.ppc -create -output $app +LIB=./src/.libs/$lib +APP=./src/.libs/$app -props $lib -props $app +env $TARGET lipo -arch i386 lib.i386 -arch x86_64 lib.x86_64 -arch ppc lib.ppc -create -output $LIB +env $TARGET lipo -arch i386 app.i386 -arch x86_64 app.x86_64 -arch ppc app.ppc -create -output $APP + +props $LIB +props $APP + +# That's all Folks! +## diff --git a/msvc64/buildall.bat b/msvc64/buildall.bat index 57ccdb3e..a16d65d5 100644 --- a/msvc64/buildall.bat +++ b/msvc64/buildall.bat @@ -1,4 +1,4 @@ -@echo of +@echo off rem ## rem buildall - wee script for building from the command line