# HG changeset patch # User Sebastien Jodogne <s.jodogne@gmail.com> # Date 1503579691 -7200 # Node ID a71432534b58640dce8e4a18e8a34081e36046b4 # Parent b93b4039cee88d20022b6121611874ec9b37ceef validation script CheckAutoconfiguration.py diff -r b93b4039cee8 -r a71432534b58 Resources/CMake/PostgreSQLConfiguration.cmake --- a/Resources/CMake/PostgreSQLConfiguration.cmake Wed Aug 23 17:58:09 2017 +0200 +++ b/Resources/CMake/PostgreSQLConfiguration.cmake Thu Aug 24 15:01:31 2017 +0200 @@ -123,6 +123,9 @@ ) endif() + elseif(CROSS_COMPILING) + message(FATAL_ERROR "Cannot auto-generate the configuration file cross-compiling") + else() configure_file( ${CMAKE_SOURCE_DIR}/Resources/Platforms/pg_config_ext.h @@ -134,7 +137,7 @@ include(${CMAKE_SOURCE_DIR}/Resources/Platforms/func_accept_args.cmake) set(ACCEPT_TYPE_ARG3 ${ACCEPT_TYPE_ARG3}) - + check_type_size("long int" SIZE_LONG_INT) if (SIZE_LONG_INT EQUAL 8) set(HAVE_LONG_INT_64 1) @@ -148,7 +151,7 @@ file(READ ${CMAKE_SOURCE_DIR}/Resources/Platforms/c_flexmember.c SOURCE) check_c_source_compiles("${SOURCE}" c_flexmember) if (c_flexmember) - set(FLEXIBLE_ARRAY_MEMBER 1) + set(FLEXIBLE_ARRAY_MEMBER "/**/") endif() file(READ ${CMAKE_SOURCE_DIR}/Resources/Platforms/printf_archetype.c SOURCE) @@ -183,8 +186,7 @@ # Version of PostgreSQL, as a number math(EXPR PG_VERSION_NUM "${LIBPQ_MAJOR} * 10000 + ${LIBPQ_MINOR} * 100 + ${LIBPQ_REVISION}") - set(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1) # TODO - set(HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN 1) # TODO + #set(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 0) # TODO # Compute maximum alignment of any basic type. # We assume long's alignment is at least as strong as char, short, or int; diff -r b93b4039cee8 -r a71432534b58 Resources/Graveyard/CheckAutoconfiguration.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Graveyard/CheckAutoconfiguration.py Thu Aug 24 15:01:31 2017 +0200 @@ -0,0 +1,88 @@ +#!/usr/bin/python + +import os +import platform +import re +import sys + +if (len(sys.argv) > 3 or + (len(sys.argv) == 2 and + sys.argv[1] in [ '-h', '--help' ])): + print('Usage: %s <Platform> [Path to pg_config.h]' % sys.argv[0]) + print('') + print('Example: %s linux64 ~/Subversion/orthanc-postgresql/s/AUTOGENERATED/pg_config.h' % sys.argv[0]) + print('') + exit(-1) + + +if len(sys.argv) >= 2: + PLATFORM = sys.argv[1] +else: + ARCH = platform.architecture()[0] + if ARCH == '64bit': + ARCH = 64 + elif ARCH == '32bit': + ARCH = 32 + else: + raise Exception('Unknown architecture: %s' % ARCH) + + SYSTEM = platform.system() + if SYSTEM == 'Linux': + SYSTEM = 'linux' + elif SYSTEM == 'Darwin': + SYSTEM = 'darwin' + elif SYSTEM == 'Windows': + SYSTEM = 'windows' + else: + raise Exception('Unknown system: %s' % SYSTEM) + + PLATFORM = '%s%d' % (SYSTEM, ARCH) + +print('Testing platform: %s' % PLATFORM) + +REFERENCE = os.path.join(os.path.dirname(__file__), 'pg_config-%s.h' % PLATFORM) +print('Reference file: %s' % REFERENCE) + +if len(sys.argv) >= 3: + GENERATED = sys.argv[2] +else: + GENERATED = os.path.join(os.getcwd(), 'AUTOGENERATED', 'pg_config.h') + +print('Autogenerated file: %s\n' % GENERATED) + + +def GetDefinitions(path): + defs = {} + + r = re.compile(r'^#define ([a-zA-Z0-9_]+)\s+?($|.+)') + + with open(path, 'r') as f: + for l in f.readlines(): + l = l.strip() + + p = l.find('/*') + if p >= 0: + l = l[0:p] + + m = r.match(l) + if m != None: + defs[m.group(1)] = m.group(2) + #print(m.group(1), m.group(2)) + + return defs + + +reference = GetDefinitions(REFERENCE) +generated = GetDefinitions(GENERATED) + +for (key, value) in generated.items(): + if not key in reference: + print('Key not in reference: %s == %s' % (key, value)) + +print('') + +for (key, value) in generated.items(): + if key in reference and reference[key] != value: + print('Bad value for key %s: %s != %s' % (key, value, reference[key])) + +print('') diff -r b93b4039cee8 -r a71432534b58 Resources/Graveyard/NOTES.txt --- a/Resources/Graveyard/NOTES.txt Wed Aug 23 17:58:09 2017 +0200 +++ b/Resources/Graveyard/NOTES.txt Thu Aug 24 15:01:31 2017 +0200 @@ -6,7 +6,7 @@ # tar xvfz postgresql-9.6.1.tar.gz # cd postgresql-9.6.1 # ./configure -# cp src/include/pg_config.h ../../Resources/Platforms/pg_config-linux64.h +# cp src/include/pg_config.h ../../Resources/Graveyard/pg_config-linux64.h Linux 32 @@ -17,7 +17,7 @@ # tar xvfz postgresql-9.6.1.tar.gz # cd postgresql-9.6.1 # ./configure --host=i686-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" --without-readline --without-zlib -# cp src/include/pg_config.h ../../Resources/Platforms/pg_config-linux32.h +# cp src/include/pg_config.h ../../Resources/Graveyard/pg_config-linux32.h Windows 64 @@ -28,7 +28,7 @@ # tar xvfz postgresql-9.6.1.tar.gz # cd postgresql-9.6.1 # LDFLAGS=-lmsvcr90 ./configure --host=x86_64-w64-mingw32 --without-zlib -# cp src/include/pg_config.h ../../Resources/Platforms/pg_config-windows64.h +# cp src/include/pg_config.h ../../Resources/Graveyard/pg_config-windows64.h Windows 32 @@ -39,7 +39,7 @@ # tar xvfz postgresql-9.6.1.tar.gz # cd postgresql-9.6.1 # LDFLAGS=-lmsvcr90 ./configure --host=i686-w64-mingw32 --without-zlib -# cp src/include/pg_config.h ../../Resources/Platforms/pg_config-windows32.h +# cp src/include/pg_config.h ../../Resources/Graveyard/pg_config-windows32.h OS X @@ -50,4 +50,15 @@ # tar xvfz postgresql-9.6.1.tar.gz # cd postgresql-9.6.1 # ./configure -# cp src/include/pg_config.h ../../Resources/Platforms/pg_config-darwin64.h +# cp src/include/pg_config.h ../../Resources/Graveyard/pg_config-darwin64.h + + +FreeBSD 64 +---------- + +# cd /home/jodogne/Subversion/orthanc-postgresql/ThirdPartyDownloads +# rm -rf postgresql-9.6.1 +# tar xvfz postgresql-9.6.1.tar.gz +# cd postgresql-9.6.1 +# ./configure --without-readline +# cp src/include/pg_config.h ../../Resources/Graveyard/pg_config-freebsd64.h