[gimp/meson] Fix builds (#if -> #ifdef). Refactoring.
- From: Félix Piédallu <fpiedallu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/meson] Fix builds (#if -> #ifdef). Refactoring.
- Date: Thu, 15 Feb 2018 09:12:49 +0000 (UTC)
commit d08b4197542fad0d1ebab0e5b41ab3a25a52e576
Author: Félix Piédallu <felix piedallu me>
Date: Wed Feb 14 16:47:08 2018 +0100
Fix builds (#if -> #ifdef). Refactoring.
devel-docs/tools/meson.build | 4 +
libgimpwidgets/meson.build | 2 +-
meson.build | 788 ++++++++++++++-------------
plug-ins/script-fu/ftx/ftx.c | 2 +-
plug-ins/script-fu/script-fu-text-console.c | 2 +-
plug-ins/script-fu/tinyscheme/scheme.c | 2 +-
6 files changed, 403 insertions(+), 397 deletions(-)
---
diff --git a/devel-docs/tools/meson.build b/devel-docs/tools/meson.build
index 818b806..5e58c54 100644
--- a/devel-docs/tools/meson.build
+++ b/devel-docs/tools/meson.build
@@ -1,3 +1,5 @@
+if have_doc_shooter
+
doc_shooter_sources = [
'shadow.c',
'shooter.c',
@@ -24,3 +26,5 @@ doc_shooter = executable('doc-shooter',
],
install: false,
)
+
+endif
diff --git a/libgimpwidgets/meson.build b/libgimpwidgets/meson.build
index dea0001..59446db 100644
--- a/libgimpwidgets/meson.build
+++ b/libgimpwidgets/meson.build
@@ -158,7 +158,7 @@ libgimpwidgets_cflags = [
'-DMESON_BUILD',
]
-if gtk_mac_integration_ok
+if gtk2_macos.found()
libgimpwidgets_sources += [
'gimppickbutton-quartz.c',
]
diff --git a/meson.build b/meson.build
index 7d02297..ebb029a 100644
--- a/meson.build
+++ b/meson.build
@@ -12,19 +12,6 @@ project('gimp', ['c', 'cpp'], version: '2.9.9',
conf = configuration_data()
-pkgconfig = import('pkgconfig')
-i18n = import('i18n')
-gnome = import('gnome')
-pythonmod = import('python3')
-
-cc = meson.get_compiler('c')
-cxx = meson.get_compiler('cpp')
-prefix = get_option('prefix')
-buildtype = get_option('buildtype')
-
-profiling = get_option('profiling')
-ansi = get_option('ansi')
-
################################################################################
# Project info
@@ -32,13 +19,10 @@ prettyname = 'GIMP'
full_name = 'GNU Image Manipulation Program'
# Making releases on the stable branch:
-# micro_version += 1;
-# interface_age += 1;
-#
-# For a description of libtool version variables, see:
-# devel-docs/libtool-instructions.txt
+# micro_version += 1
+# interface_age += 1
-version = meson.project_version().split('.')
+version = meson.project_version().split('.')
major_version = version[0].to_int()
minor_version = version[1].to_int()
micro_version = version[2].to_int()
@@ -47,7 +31,7 @@ interface_age = 0
api_version = '@0@.0' .format(major_version)
app_version = '@0@.@1@'.format(major_version, minor_version)
user_version = '@0@.@1@'.format(major_version, minor_version)
-gimp_version = meson.project_version()
+gimp_version = '@0@.@1@.@2@'.format(major_version, minor_version, micro_version)
gimp_command = 'gimp-' + app_version
gimp_api_name = 'gimp-' + api_version
@@ -80,21 +64,30 @@ versionconfig.set('GIMP_MICRO_VERSION', micro_version)
versionconfig.set('GIMP_VERSION', gimp_version)
versionconfig.set('GIMP_API_VERSION', api_version)
+
+################################################################################
+# Get configuration and Meson modules
+
+pkgconfig = import('pkgconfig')
+i18n = import('i18n')
+gnome = import('gnome')
+pythonmod = import('python3')
+
+cc = meson.get_compiler('c')
+cxx = meson.get_compiler('cpp')
+prefix = get_option('prefix')
+buildtype = get_option('buildtype')
+
+
################################################################################
# Host system detection
-host_cpu = host_machine.cpu().to_lower()
+cpu = host_machine.cpu().to_lower()
-arch_x86_64 = (host_cpu == 'x86_64')
-arch_x86 = (
- (host_cpu.startswith('i') and host_cpu.endswith('86'))
- or arch_x86_64
-)
-arch_ppc64 = (host_cpu == 'ppc64' or host_cpu == 'powerpc64')
-arch_ppc = (
- (host_cpu == 'ppc' or host_cpu == 'powerpc')
- or arch_ppc64
-)
+arch_x86_64 = (cpu == 'x86_64')
+arch_x86 = (cpu.startswith('i') and cpu.endswith('86')) or arch_x86_64
+arch_ppc64 = (cpu == 'ppc64' or cpu == 'powerpc64')
+arch_ppc = (cpu == 'ppc' or cpu == 'powerpc') or arch_ppc64
if not (arch_x86 or arch_ppc)
error('Unknown host architecture')
@@ -105,15 +98,21 @@ conf.set10('ARCH_X86_64', arch_x86_64)
conf.set10('ARCH_PPC', arch_ppc)
conf.set10('ARCH_PPC64', arch_ppc64)
+
host_os = host_machine.system().to_lower()
message('Host os: ' + host_os)
-platform_win32= (
+platform_win32 = (
host_os.contains('mingw') or
host_os.contains('cygwin') or
host_os.contains('windows')
)
-platform_osx = host_os.contains('darwin')
+
+platform_osx = (
+ host_os.contains('machten') or
+ host_os.contains('rhapsody') or
+ host_os.contains('darwin')
+)
conf.set('PLATFORM_OSX', platform_osx)
@@ -139,8 +138,60 @@ if cc.version() == '7.2.0'
''')
endif
+
+
+################################################################################
+# Compiler CPU extensions for optimizations
+
+## TODOÂ only for release
+# Check for compiler CPU extensions
+cpuext_args = [
+ '-mfpmath=sse',
+ '-mmmx',
+ '-msse',
+ '-msse2',
+ '-msse4.1',
+]
+add_project_arguments(cc .get_supported_arguments(cpuext_args), language: 'c')
+add_project_arguments(cxx.get_supported_arguments(cpuext_args), language: 'cpp')
+
+conf.set10('USE_MMX', cc.has_argument('-mmmx'))
+conf.set10('USE_SSE', cc.has_argument('-msse'))
+conf.set10('COMPILE_SSE2_INTRINISICS', cc.has_argument('-msse2'))
+conf.set10('COMPILE_SSE4_1_INTRINISICS',cc.has_argument('-msse4.1'))
+
+
+have_altivec = false
+have_altivec_sysctl = false
+if arch_ppc
+ altivec_args = cc.get_supported_arguments([
+ '-faltivec',
+ '-maltivec',
+ '-mabi=altivec',
+ ])
+
+ if altivec_args != []
+ add_project_arguments (altivec_args, language: [ 'c', 'cpp'])
+ add_project_link_arguments(altivec_args, language: [ 'c', 'cpp'])
+
+ if host_os.contains('darwin')
+ have_altivec = true
+ have_altivec_sysctl = true
+ elif cc.compiles('''
+ int main() { asm ("vand %v0, %v0, %v0"); return 0; }
+ ''')
+ have_altivec = true
+ endif
+ endif
+endif
+conf.set('HAVE_ALTIVEC_SYSCTL', have_altivec_sysctl)
+conf.set('USE_ALTIVEC', have_altivec)
+
+
+
################################################################################
-# Dependencies
+# Mandatory Dependencies
+
math = cc.find_library('m')
atk = dependency('atk', version: '>=2.2.0')
@@ -185,13 +236,8 @@ lcms = dependency('lcms2', version: '>=2.8')
libmypaint_name = platform_win32 ? 'libmypaint' : 'libmypaint-1.3'
libmypaint = dependency(libmypaint_name, version: '>=1.3.0')
libmypaint_brushes= dependency('mypaint-brushes-1.0',required: false)
-pangocairo = dependency('pangocairo', version: '>=1.29.4')
-pangoft2 = dependency('pangoft2', version: '>=1.29.4')
-rsvg = dependency('librsvg-2.0', version: '>=2.40.6')
-
-# xgettext = dependency('xgettext', version: '>=0.19')
-
# Mypaint-brushes not available on MingW
+# TODO should be removed when MingW adds them
mypaint_brushes = libmypaint_brushes.found() ? [
libmypaint_brushes,
] : []
@@ -199,6 +245,11 @@ mypaint_args = libmypaint_brushes.found() ? [] : [
'-DMYPAINT_BRUSHES_DIR="/usr/share/mypaint-data/1.0/brushes"',
]
+pangocairo = dependency('pangocairo', version: '>=1.29.4')
+pangoft2 = dependency('pangoft2', version: '>=1.29.4')
+rsvg = dependency('librsvg-2.0', version: '>=2.40.6')
+
+
################################################################################
# Check for GLib Networking
@@ -256,8 +307,16 @@ if not pango_check
]))
endif
+################################################################################
+# Optional Dependencies
+
+libsocket = cc.find_library('socket', required: false)
+conf.set('HAVE_LIBSOCKET', libsocket.found())
+
+################################################################################
# Check for Dr. Mingw
+
drmingw = dependency('', required: false)
if platform_win32
exchndl_ld = cc.find_library('exchndl')
@@ -268,62 +327,10 @@ if platform_win32
endif
conf.set('HAVE_EXCHNDL', drmingw.found())
-# Check for finite or isfinite
-foreach fn : [ 'finite', 'isfinite']
- macro_name = 'HAVE_' + fn.to_upper()
- conf.set(macro_name, cc.has_function(fn, prefix: '#include <math.h>'))
-endforeach
-
-
-## TODOÂ only for release
-# Check for compiler CPU extensions
-cpuext_args = [
- '-mfpmath=sse',
- '-mmmx',
- '-msse',
- '-msse2',
- '-msse4.1',
-]
-add_project_arguments(cc .get_supported_arguments(cpuext_args), language: 'c')
-add_project_arguments(cxx.get_supported_arguments(cpuext_args), language: 'cpp')
-
-conf.set10('USE_MMX', cc.has_argument('-mmmx'))
-conf.set10('USE_SSE', cc.has_argument('-msse'))
-conf.set10('COMPILE_SSE2_INTRINISICS', cc.has_argument('-msse2'))
-conf.set10('COMPILE_SSE4_1_INTRINISICS',cc.has_argument('-msse4.1'))
-
-
-have_altivec = false
-have_altivec_sysctl = false
-if arch_ppc
- altivec_args = cc.get_supported_arguments([
- '-faltivec',
- '-maltivec',
- '-mabi=altivec',
- ])
-
- if altivec_args != []
- add_project_arguments (altivec_args, language: [ 'c', 'cpp'])
- add_project_link_arguments(altivec_args, language: [ 'c', 'cpp'])
- if host_os.contains('darwin')
- have_altivec = true
- have_altivec_sysctl = true
- elif cc.compiles('''
- int main() { asm ("vand %v0, %v0, %v0"); return 0; }
- ''')
- have_altivec = true
- endif
- endif
-endif
-conf.set('HAVE_ALTIVEC_SYSCTL', have_altivec_sysctl)
-conf.set('USE_ALTIVEC', have_altivec)
-
-
-
-conf.set10('ENABLE_MP', get_option('enable-multiproc'))
+################################################################################
+# Check for x11 support
-# Check if X11
x11_target = gtk2.get_pkgconfig_variable('target') == 'x11'
x11 = x11_target ? dependency('x11') : dependency('', required: false)
@@ -333,8 +340,6 @@ xext = x11_target ? dependency('xext') : dependency('', required: false)
xfixes= x11_target ? dependency('xfixes') : dependency('', required: false)
conf.set('HAVE_XFIXES', xfixes.found())
-enable_doc_shooter = x11_target
-
if x11_target
foreach header : [ 'X11/Xmu/WinUtil.h', 'X11/extensions/shape.h', ]
if not cc.has_header(header, dependencies: [ xext, xmu ])
@@ -352,7 +357,9 @@ conf.set('HAVE_X11_EXTENSIONS_SHAPE_H', cc.has_header('X11/extensions/shape.h'))
conf.set('HAVE_X11_XMU_WINUTIL_H', cc.has_header('X11/Xmu/WinUtil.h'))
-# Print support
+# Features requiring x11
+
+have_doc_shooter= x11_target
have_print = get_option('with-print')
have_screenshot = get_option('with-screenshot')
if have_print and not x11_target
@@ -363,147 +370,7 @@ if have_screenshot and not x11_target
endif
-# Headers
-conf.set ('HAVE_ALLOCA_H', cc.has_header('alloca.h'))
-conf.set ('HAVE_DLFCN_H', cc.has_header('dlfcn.h'))
-conf.set ('HAVE_EXECINFO_H', cc.has_header('execinfo.h'))
-conf.set ('HAVE_IEEEFP_H', cc.has_header('ieeefp.h'))
-conf.set ('HAVE_INTTYPES_H', cc.has_header('inttypes.h'))
-conf.set ('HAVE_LOCALE_H', cc.has_header('locale.h'))
-conf.set ('HAVE_MATH_H', cc.has_header('math.h'))
-conf.set ('HAVE_MEMORY_H', cc.has_header('memory.h'))
-conf.set ('HAVE_MMAN_H', cc.has_header('sys/mman.h'))
-conf.set ('HAVE_IPC_H', cc.has_header('sys/ipc.h'))
-conf.set ('HAVE_SHM_H', cc.has_header('sys/shm.h'))
-conf.set ('HAVE_STDINT_H', cc.has_header('stdint.h'))
-conf.set ('HAVE_STDLIB_H', cc.has_header('stdlib.h'))
-conf.set ('HAVE_STRING_H', cc.has_header('string.h'))
-conf.set ('HAVE_STRINGS_H', cc.has_header('strings.h'))
-conf.set ('HAVE_SYS_PARAM_H', cc.has_header('sys/param.h'))
-conf.set ('HAVE_SYS_SELECT_H', cc.has_header('sys/select.h'))
-conf.set ('HAVE_SYS_STAT_H', cc.has_header('sys/stat.h'))
-conf.set ('HAVE_SYS_TIME_H', cc.has_header('sys/time.h'))
-conf.set ('HAVE_SYS_TIMES_H', cc.has_header('sys/times.h'))
-conf.set ('HAVE_SYS_TYPES_H', cc.has_header('sys/types.h'))
-conf.set ('HAVE_SYS_WAIT_H', cc.has_header('sys/wait.h'))
-conf.set10('HAVE_UNISTD_H', cc.has_header('unistd.h'))
-
-# Functions
-
-conf.set('HAVE_ALLOCA', cc.has_function('alloca'))
-conf.set('HAVE_BACKTRACE', cc.has_function('backtrace'))
-conf.set('HAVE_DCGETTEXT', cc.has_function('dcgettext'))
-conf.set('HAVE_DIFFTIME', cc.has_function('difftime'))
-conf.set('HAVE_FINITE', cc.has_function('finite'))
-conf.set('HAVE_FSYNC', cc.has_function('fsync'))
-conf.set('HAVE_GETADDRINFO', cc.has_function('getaddrinfo'))
-conf.set('HAVE_GETNAMEINFO', cc.has_function('getnameinfo'))
-conf.set('HAVE_GETTEXT', cc.has_function('gettext'))
-conf.set('HAVE_MMAP', cc.has_function('mmap'))
-conf.set('HAVE_RINT', cc.has_function('rint'))
-conf.set('HAVE_VPRINTF', cc.has_function('vprintf'))
-conf.set('HAVE_BIND_TEXTDOMAIN_CODESET',
- cc.has_function('bind_textdomain_codeset')
-)
-
-# AC_HEADER_STDC
-# AC_HEADER_SYS_WAIT
-# AC_HEADER_TIME
-#
-# AC_CHECK_HEADERS(execinfo.h sys/param.h sys/time.h sys/times.h sys/wait.h
-# unistd.h)
-# AC_CHECK_FUNCS(backtrace, , AC_CHECK_LIB(execinfo, backtrace))
-#
-# AC_TYPE_PID_T
-# AC_FUNC_VPRINTF
-#
-# AC_FUNC_ALLOCA
-#
-# # check some more funcs
-# AC_CHECK_FUNCS(fsync)
-# AC_CHECK_FUNCS(difftime mmap)
-
-
-
-
-
-#undef HAVE_CFLOCALECOPYCURRENT
-#undef HAVE_CFPREFERENCESCOPYAPPVALUE
-#undef HAVE_DOPRNT
-#undef HAVE_DX_DINPUT
-#undef HAVE_LIBEXECINFO
-#undef HAVE_LIBNSL
-#undef HAVE_LIBPTHREAD
-#undef pid_t
-#undef size_t
-
-
-shmem_choice = get_option('shmem-type')
-if shmem_choice == 'auto'
- shmem_choice = 'sysv'
-
- # MacOS X has broken SysV shm
- if (
- host_os.contains('darwin') or
- host_os.contains('rhapsody') or
- host_os.contains('machten'))
- shmem_choice = 'posix'
- endif
- if platform_win32
- shmem_choice = 'win32'
- endif
-endif
-
-if shmem_choice == 'sysv'
- check_ip_rmid_deferred_release = cc.run('''
- #include <sys/types.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- int main() {
- int id = shmget(IPC_PRIVATE, 4, IPC_CREAT | 0600);
- if (id == -1)
- exit(2);
-
- char *shmaddr = shmat(id, 0, 0);
- shmctl(id, IPC_RMID, 0);
- if ((char*) shmat(id, 0, 0) == (char*) -1) {
- shmdt(shmaddr);
- exit(1);
- }
- shmdt(shmaddr);
- shmdt(shmaddr);
- exit(0);
- }
- ''').returncode() == 0
- conf.set('IPC_RMID_DEFERRED_RELEASE', check_ip_rmid_deferred_release)
- conf.set('USE_SYSV_SHM', true)
-elif shmem_choice == 'posix'
- conf.set('USE_POSIX_SHM', true)
-endif
-
-
-conf.set('NO_FD_SET',
- not platform_win32
- and not cc.compiles('''
- #include <sys/types.h>
- int main() { fd_set readMask, writeMask; return 0; }
- ''')
-)
-
-
-
-# GCC attributes
-conf.set('HAVE_FUNC_ATTRIBUTE_DESTRUCTOR',
- cc.compiles('''__attribute__ ((destructor)) void destructor_fn(void) { }''')
-)
-
-
-libsocket = cc.find_library('socket', required: false)
-conf.set('HAVE_LIBSOCKET', libsocket.found())
-
-
################################################################################
-# MIME types
# The list of MIME types that are supported by plug-ins
MIMEtypes = [
@@ -680,16 +547,12 @@ conf.set('HAVE_ALSA', alsa.found())
have_linuxinput = get_option('with-linux-input')
-if have_linuxinput
- if not cc.has_header('linux/input.h')
- error('linux/input.h header not found.')
- endif
+if have_linuxinput and not cc.has_header('linux/input.h')
+ error('linux/input.h header not found.')
endif
# DirectX DirectInput
-directx = dependency('', required: false)
directx_sdk_path = get_option('with-directx-sdk')
-
if directx_sdk_path != '' and platform_win32
if directx_sdk_path.contains(' ')
warning('''
@@ -709,6 +572,8 @@ if directx_sdk_path != '' and platform_win32
include_directories: join_paths(directx_sdk_path, 'Include'),
)
endif
+else
+ directx = dependency('', required: false)
endif
conf.set('HAVE_DX_DINPUT', directx.found())
@@ -721,7 +586,8 @@ endif
conf.set('HAVE_LIBGUDEV', gudev.found())
-# sendmail
+################################################################################
+# Email sending
email_message = false
sendmail_choice = get_option('with-sendmail')
@@ -754,7 +620,24 @@ else
email_message = '@0@ (@1@)'.format(true, xdg_email_path)
endif
-# perl
+
+################################################################################
+# ISO codes
+
+isocodes = dependency('iso-codes')
+isocodes_prefix = isocodes.get_pkgconfig_variable('prefix')
+isocodes_location = join_paths(
+ isocodes_prefix, get_option('datadir'), 'xml', 'iso-codes'
+)
+isocodes_localedir= join_paths(
+ isocodes_prefix, get_option('datadir'), 'locale'
+)
+conf.set('HAVE_ISO_CODES', isocodes.found())
+
+
+################################################################################
+# Program tools
+
perl = find_program('perl5', 'perl', 'perl5.005', 'perl5.004', 'perl')
@@ -778,27 +661,27 @@ have_scriptfu = get_option('with-script-fu')
# Check for GTK Mac Integration
-gtk_mac_integration_ok = false
if platform_osx and (gtk2.get_pkgconfig_variable('target') == 'xquartz')
- gtk2_macos = dependency('gtk-mac-integration-gtk2',
- version: '>=2.0.0',
+ gtk2_macos = dependency('gtk-mac-integration-gtk2', version: '>=2.0.0',
required: false
)
if not gtk2_macos.found()
- gtk2_macos = dependency('gtk-mac-integration',
- version: '>=2.0.0',
- required: false
- )
+ gtk2_macos = dependency('gtk-mac-integration', version: '>=2.0.0')
endif
- gtk_mac_integration_ok = gtk2_macos.found()
+else
+ gtk2_macos = dependency('', required: false)
endif
# Check for XML tools
-xmllint = find_program('xmllint', required: false)
-xsltproc= find_program('xsltproc',required: false)
-intltool_merge = find_program('intltool-merge')
-desktop_validate = find_program('desktop-file-validate')
-gdk_pixbuf_csource = find_program('gdk-pixbuf-csource')
+xmllint = find_program('xmllint', required: false)
+xsltproc = find_program('xsltproc',required: false)
+intltool_merge = find_program('intltool-merge')
+desktop_validate = find_program('desktop-file-validate')
+gdk_pixbuf_csource = find_program('gdk-pixbuf-csource')
+
+test_appdata = (
+ get_option('with-appdata-test') and find_program('appstream-util').found()
+)
# Check for vector icons
@@ -826,11 +709,6 @@ endif
conf.set('HAVE_XVFB_RUN', xvfb_run.found())
-test_appdata = (
- get_option('with-appdata-test') and find_program('appstream-util').found()
-)
-
-
if get_option('with-gtk-doc')
gtkdoc_scan = find_program('gtkdoc-scan', required : true)
else
@@ -953,29 +831,17 @@ conf.set('HAVE_GETTEXT', true)
# localedir = join_paths(get_option('prefix'), get_option('localedir'))
-################################################################################
-# ISO codes
-
-isocodes = dependency('iso-codes')
-isocodes_prefix = isocodes.get_pkgconfig_variable('prefix')
-isocodes_location = join_paths(
- isocodes_prefix, get_option('datadir'), 'xml', 'iso-codes'
-)
-isocodes_localedir= join_paths(
- isocodes_prefix, get_option('datadir'), 'locale'
-)
-conf.set('HAVE_ISO_CODES', isocodes.found())
################################################################################
# CFlags
-if profiling and cc.get_id() == 'gcc'
+if get_option('profiling') and cc.get_id() == 'gcc'
add_project_arguments ('-pg', language: [ 'c', 'cpp', ])
add_project_link_arguments('-pg', language: [ 'c', 'cpp', ])
endif
-if ansi
+if get_option('ansi')
add_project_arguments('-ansi', '-pedantic', language: 'c')
endif
@@ -1030,6 +896,134 @@ conf.set('HAVE__NL_MEASUREMENT_MEASUREMENT',
''')
)
+
+
+################################################################################
+# Miscelaneous configuration
+
+# Enable support for multiprocessing
+conf.set10('ENABLE_MP', get_option('enable-multiproc'))
+
+# Check for available functions
+foreach fn : [
+ 'alloca',
+ 'backtrace',
+ 'bind_textdomain_codeset',
+ 'dcgettext',
+ 'difftime',
+ 'finite',
+ 'finite',
+ 'fsync',
+ 'getaddrinfo',
+ 'getnameinfo',
+ 'gettext',
+ 'isfinite',
+ 'mmap',
+ 'rint',
+ 'vprintf',
+ ]
+ macro_name = 'HAVE_' + fn.to_upper().underscorify()
+ conf.set(macro_name, cc.has_function(fn))
+endforeach
+
+
+# Check for available headers
+foreach header : [
+ 'alloca.h',
+ 'dlfcn.h',
+ 'execinfo.h',
+ 'ieeefp.h',
+ 'inttypes.h',
+ 'locale.h',
+ 'math.h',
+ 'memory.h',
+ # 'sys/mman.h',
+ # 'sys/ipc.h',
+ # 'sys/shm.h',
+ 'stdint.h',
+ 'stdlib.h',
+ 'string.h',
+ 'strings.h',
+ 'sys/param.h',
+ 'sys/select.h',
+ 'sys/stat.h',
+ 'sys/time.h',
+ 'sys/times.h',
+ 'sys/types.h',
+ 'sys/wait.h',
+ 'unistd.h',
+ ]
+ macro_name = 'HAVE_' + header.to_upper().underscorify()
+ conf.set(macro_name, cc.has_header(header))
+endforeach
+
+conf.set('HAVE_MMAN_H', cc.has_header('sys/mman.h'))
+conf.set('HAVE_IPC_H', cc.has_header('sys/ipc.h'))
+conf.set('HAVE_SHM_H', cc.has_header('sys/shm.h'))
+
+
+################################################################################
+# Check for shared memory handling
+
+shmem_choice = get_option('shmem-type')
+if shmem_choice == 'auto'
+ shmem_choice = 'sysv'
+
+ # MacOS X has broken SysV shm
+ if platform_osx
+ shmem_choice = 'posix'
+ endif
+ if platform_win32
+ shmem_choice = 'win32'
+ endif
+endif
+
+if shmem_choice == 'sysv'
+ check_ip_rmid_deferred_release = cc.run('''
+ #include <sys/types.h>
+ #include <sys/ipc.h>
+ #include <sys/shm.h>
+ int main() {
+ int id = shmget(IPC_PRIVATE, 4, IPC_CREAT | 0600);
+ if (id == -1)
+ exit(2);
+
+ char *shmaddr = shmat(id, 0, 0);
+ shmctl(id, IPC_RMID, 0);
+ if ((char*) shmat(id, 0, 0) == (char*) -1) {
+ shmdt(shmaddr);
+ exit(1);
+ }
+ shmdt(shmaddr);
+ shmdt(shmaddr);
+ exit(0);
+ }
+ ''').returncode() == 0
+ conf.set('IPC_RMID_DEFERRED_RELEASE', check_ip_rmid_deferred_release)
+ conf.set('USE_SYSV_SHM', true)
+elif shmem_choice == 'posix'
+ conf.set('USE_POSIX_SHM', true)
+endif
+
+
+conf.set('NO_FD_SET',
+ not platform_win32
+ and not cc.compiles('''
+ #include <sys/types.h>
+ int main() { fd_set readMask, writeMask; return 0; }
+ ''')
+)
+
+
+
+# GCC attributes
+conf.set('HAVE_FUNC_ATTRIBUTE_DESTRUCTOR',
+ cc.compiles('''__attribute__ ((destructor)) void destructor_fn(void) { }''')
+)
+
+
+
+
################################################################################
# Set/regroup common CFlags for subdirs
@@ -1086,21 +1080,25 @@ config_defines = [
'-DHAVE_CONFIG_H',
]
+add_project_arguments(
+ config_defines,
+ language: [ 'c', 'cpp', ],
+)
if platform_osx
# libgimp_cflags += '-xobjective-c'
# libgimp_lflags += ['-framework', 'Cocoa']
endif
-add_project_arguments(
- config_defines,
- language: [ 'c', 'cpp', ],
-)
rootInclude = include_directories('.')
appInclude = include_directories('app')
+################################################################################
+# Generate files
+
+
gitversion_h1 = vcs_tag(
input : 'app/git-version.h.in',
output: 'git-version.h.in.1',
@@ -1123,67 +1121,17 @@ gitversion_h = vcs_tag(
fallback: '',
)
-################################################################################
-# Subdirs
-subdir('build/windows')
-
-# Tools (need libgimpbase now)
-subdir('libgimpbase')
-subdir('tools')
-
-# Translations
-subdir('po')
-subdir('po-libgimp')
-subdir('po-plug-ins')
-subdir('po-python')
-subdir('po-script-fu')
-subdir('po-tags')
-subdir('po-tips')
-# Data / Desktop / xml files
-subdir('cursors')
-subdir('data')
-subdir('desktop')
-subdir('etc')
-subdir('icons')
-subdir('m4macros')
-subdir('menus')
-subdir('themes')
-
-# Libraries (order here is important!)
-subdir('libgimpcolor')
-subdir('libgimpmath')
-subdir('libgimpconfig')
-subdir('libgimpmodule')
-subdir('libgimpthumb')
-subdir('libgimpwidgets')
-subdir('libgimp')
-
-# Executables, plugins
-subdir('modules')
-subdir('plug-ins')
-subdir('app')
-subdir('pdb')
-
-if platform_win32
- # subdir('build/windows/installer')
- # subdir('po-windows-installer')
-endif
-
-# Docs
-subdir('devel-docs')
-subdir('docs')
install_conf = configuration_data()
-
install_conf.set('GIMP_APP_VERSION', app_version)
install_conf.set('GIMP_PKGCONFIG_VERSION', gimp_version)
install_conf.set('GIMP_VERSION', gimp_version)
-
install_conf.set('ATK_REQUIRED_VERSION', atk .version())
install_conf.set('BABL_REQUIRED_VERSION', babl .version())
install_conf.set('CAIRO_PDF_REQUIRED_VERSION', cairopdf .version())
install_conf.set('CAIRO_REQUIRED_VERSION', cairo .version())
install_conf.set('FONTCONFIG_REQUIRED_VERSION', fontconfig .version())
+install_conf.set('FONTCONFIG_WIN32_RECOMMENDED_VERSION', fontconfig.version())
install_conf.set('FREETYPE2_REQUIRED_VERSION', freetype2 .version())
install_conf.set('GDK_PIXBUF_REQUIRED_VERSION', gdk_pixbuf .version())
install_conf.set('GEGL_REQUIRED_VERSION', gegl .version())
@@ -1204,8 +1152,6 @@ install_conf.set('RSVG_REQUIRED_VERSION', rsvg .version())
install_conf.set('WEBKIT_REQUIRED_VERSION', webkit .version())
install_conf.set('WEBP_REQUIRED_VERSION', webp .version())
install_conf.set('WMF_REQUIRED_VERSION', wmf .version())
-
-install_conf.set('FONTCONFIG_WIN32_RECOMMENDED_VERSION', fontconfig.version())
install_conf.set('XGETTEXT_RECOMMENDED_VERSION', '0.19')
configure_file(
@@ -1214,6 +1160,7 @@ configure_file(
configuration: install_conf
)
+
configure_file(
output: 'config.h',
configuration: conf
@@ -1248,6 +1195,7 @@ pkgconfig.generate(filebase: 'gimp-' + api_version,
'gimplocaledir=' +'${prefix}/'+ localedir,
],
)
+
pkgconfig.generate(filebase: 'gimpthumb-' + api_version,
name: 'GIMP Thumb',
description: 'GIMP Thumbnail Library',
@@ -1263,6 +1211,7 @@ pkgconfig.generate(filebase: 'gimpthumb-' + api_version,
gimp_api_name,
],
)
+
pkgconfig.generate(filebase: 'gimpui-' + api_version,
name: 'GIMP UI',
description: 'GIMP User Interface Library',
@@ -1283,49 +1232,7 @@ pkgconfig.generate(filebase: 'gimpui-' + api_version,
)
-# Print a summary of features enabled/disabled:
-
-message('''
-Extra Binaries:
- gimp-console: @0@'''.format(enable_console_bin) +'''
-
-Optional Features:
- Language selection: @0@'''.format(isocodes.found()) +'''
- Vector icons: @0@'''.format(have_vector_icons) +'''
- Dr. Mingw (Win32): @0@'''.format(drmingw.found()) +'''
-
-Optional Plug-Ins:
- Ascii Art: @0@'''.format(libaa.found()) +'''
- Ghostscript: @0@'''.format(ghostscript.found()) +'''
- Help Browser: @0@'''.format(webkit.found()) +'''
- JPEG 2000: @0@'''.format(jasper.found()) +'''
- MNG: @0@'''.format(libmng.found()) +'''
- OpenEXR: @0@'''.format(openexr.found()) +'''
- WebP: @0@'''.format(webp.found()) +'''
- PDF (export): @0@'''.format(cairopdf.found()) +'''
- Print: @0@'''.format(have_print) +'''
- Python 2: @0@'''.format(have_python) +'''
- Script-Fu: @0@'''.format(have_scriptfu) +'''
- TWAIN (Win32): @0@'''.format(platform_win32) +'''
- Webpage: @0@'''.format(webkit.found()) +'''
- WMF: @0@'''.format(wmf.found()) +'''
- X11 Mouse Cursor: @0@'''.format(xmc.found()) +'''
- XPM: @0@'''.format(libxpm.found()) +'''
- Email: @0@'''.format(email_message) +'''
-
-Optional Modules:
- ALSA (MIDI Input): @0@'''.format(alsa.found()) +'''
- Linux Input: @0@ (GUdev support: @0@)'''
- .format(have_linuxinput, gudev.found()) +'''
- DirectInput (Win32): @0@'''.format(directx.found()) +'''
-
-Tests:
- Use xvfb-run @0@'''.format(xvfb_run.found()) +'''
- Test appdata @0@'''.format(test_appdata) +'''
-'''
-)
-
-
+################################################################################
# Miscelaneous targets
if xsltproc.found()
@@ -1333,7 +1240,7 @@ if xsltproc.found()
input : [ 'authors.xsl', 'authors.xml', ],
output: 'AUTHORS',
command: [
- xsltproc.path(),
+ xsltproc,
'-o', '@OUTPUT@',
'@INPUT@',
],
@@ -1343,7 +1250,7 @@ if xsltproc.found()
input : [ 'authors4gimp-web.xsl', 'authors.xml', ],
output: 'authors.md',
command: [
- xsltproc.path(),
+ xsltproc,
'--stringparam', 'today', '`date --iso-8601=seconds`',
'-o', '@OUTPUT@',
'@INPUT@',
@@ -1357,7 +1264,7 @@ if xmllint.found()
input : [ 'authors.xml', ],
output: [ 'validate-authors', ],
command: [
- xmllint.path(),
+ xmllint,
'--noout',
'--valid', '@INPUT@',
],
@@ -1365,26 +1272,121 @@ if xmllint.found()
)
endif
-# TODO this python script is waiting for autotools directory/files structure
-# custom_target('check-defs',
-# input : [ ],
-# output: [ 'check-defs', ],
-# command: [
-# python2.path(),
-# join_paths(meson.source_root(), 'tools','defcheck.py'),
-# meson.source_root(),
-# ],
-# build_by_default: false,
-# )
-
+if python2.found()
+ # TODO this python script is waiting for autotools directory/files structure
+ custom_target('check-defs',
+ input : [ ],
+ output: [ 'check-defs', ],
+ command: [
+ python2,
+ join_paths(meson.source_root(), 'tools','defcheck.py'),
+ meson.source_root(),
+ ],
+ build_by_default: false,
+ )
+endif
custom_target('Changelog',
input : [ ],
output: [ 'Changelog', ],
command: [
- join_paths(meson.source_root(), 'tools','generate_changelog.sh'),
+ generate_changelog,
meson.source_root(),
'@OUTPUT@'
],
build_by_default: false,
)
+
+
+################################################################################
+# Subdirs
+
+# Tools
+subdir('libgimpbase')
+subdir('tools')
+
+# Translations
+subdir('po')
+subdir('po-libgimp')
+subdir('po-plug-ins')
+subdir('po-python')
+subdir('po-script-fu')
+subdir('po-tags')
+subdir('po-tips')
+# Data / Desktop / xml files
+subdir('cursors')
+subdir('data')
+subdir('desktop')
+subdir('etc')
+subdir('icons')
+subdir('m4macros')
+subdir('menus')
+subdir('themes')
+
+# Libraries (order here is important!)
+subdir('libgimpcolor')
+subdir('libgimpmath')
+subdir('libgimpconfig')
+subdir('libgimpmodule')
+subdir('libgimpthumb')
+subdir('libgimpwidgets')
+subdir('libgimp')
+
+# Executables, plugins
+subdir('modules')
+subdir('plug-ins')
+subdir('app')
+subdir('pdb')
+
+if platform_win32
+ subdir('build/windows')
+ # subdir('build/windows/installer')
+ # subdir('po-windows-installer')
+endif
+
+# Docs
+subdir('devel-docs')
+subdir('docs')
+
+
+
+################################################################################
+message('''
+Extra Binaries:
+ gimp-console: @0@'''.format(enable_console_bin) +'''
+
+Optional Features:
+ Language selection: @0@'''.format(isocodes.found()) +'''
+ Vector icons: @0@'''.format(have_vector_icons) +'''
+ Dr. Mingw (Win32): @0@'''.format(drmingw.found()) +'''
+
+Optional Plug-Ins:
+ Ascii Art: @0@'''.format(libaa.found()) +'''
+ Ghostscript: @0@'''.format(ghostscript.found()) +'''
+ Help Browser: @0@'''.format(webkit.found()) +'''
+ JPEG 2000: @0@'''.format(jasper.found()) +'''
+ MNG: @0@'''.format(libmng.found()) +'''
+ OpenEXR: @0@'''.format(openexr.found()) +'''
+ WebP: @0@'''.format(webp.found()) +'''
+ PDF (export): @0@'''.format(cairopdf.found()) +'''
+ Print: @0@'''.format(have_print) +'''
+ Python 2: @0@'''.format(have_python) +'''
+ Script-Fu: @0@'''.format(have_scriptfu) +'''
+ TWAIN (Win32): @0@'''.format(platform_win32) +'''
+ Webpage: @0@'''.format(webkit.found()) +'''
+ WMF: @0@'''.format(wmf.found()) +'''
+ X11 Mouse Cursor: @0@'''.format(xmc.found()) +'''
+ XPM: @0@'''.format(libxpm.found()) +'''
+ Email: @0@'''.format(email_message) +'''
+
+Optional Modules:
+ ALSA (MIDI Input): @0@'''.format(alsa.found()) +'''
+ Linux Input: @0@ (GUdev support: @0@)'''
+ .format(have_linuxinput, gudev.found()) +'''
+ DirectInput (Win32): @0@'''.format(directx.found()) +'''
+
+Tests:
+ Use xvfb-run @0@'''.format(xvfb_run.found()) +'''
+ Test appdata @0@'''.format(test_appdata) +'''
+'''
+)
diff --git a/plug-ins/script-fu/ftx/ftx.c b/plug-ins/script-fu/ftx/ftx.c
index 81386d8..7e7f7c6 100644
--- a/plug-ins/script-fu/ftx/ftx.c
+++ b/plug-ins/script-fu/ftx/ftx.c
@@ -9,7 +9,7 @@
#include "config.h"
#include <sys/stat.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
diff --git a/plug-ins/script-fu/script-fu-text-console.c b/plug-ins/script-fu/script-fu-text-console.c
index a1816dc..b8ad027 100644
--- a/plug-ins/script-fu/script-fu-text-console.c
+++ b/plug-ins/script-fu/script-fu-text-console.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <errno.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/tinyscheme/scheme.c
index 0efc19b..e6613d9 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.c
+++ b/plug-ins/script-fu/tinyscheme/scheme.c
@@ -25,7 +25,7 @@
#include "config.h"
#define _SCHEME_SOURCE
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef WIN32
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]