Skip to content

Commit 18b51c4

Browse files
committed
implement RFC98 (MapServer#4673) and RFC99 (MapServer#4704)
- implement complex scrit shaping via harfbuzz - refactor text rendering pipeline - remove support for GD renderer - remove support for deprecated annotation layers
1 parent 42733c2 commit 18b51c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+7816
-8375
lines changed

.travis.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,22 @@ env:
3838

3939
compiler:
4040
- gcc
41+
- clang
4142

4243
before_install:
44+
- mkdir tmp
45+
- cd tmp
46+
- wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.19.tar.bz2
47+
- tar xjf harfbuzz-0.9.19.tar.bz2
48+
- cd harfbuzz-0.9.19
49+
- ./configure --without-cairo --without-glib --without-icu
50+
- make -j3
51+
- sudo make install && sudo ldconfig
52+
- cd ../..
4353
- git submodule update --init --recursive
4454
- sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
4555
- sudo apt-get update -qq
46-
- sudo apt-get install -qq bison flex swig cmake librsvg2-dev colordiff postgis postgresql-9.1-postgis-2.0-scripts libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-noxpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev python-dev php5-dev libexempi-dev lcov lftp
56+
- sudo apt-get install -qq libfribidi-dev swig cmake librsvg2-dev colordiff postgis postgresql-9.1-postgis-2.0-scripts libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-noxpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev python-dev php5-dev libexempi-dev lcov lftp
4757
- sudo pip install git+git://github.com/tbonfort/cpp-coveralls.git@extensions
4858
- cd msautotest
4959
- ./create_postgis_test_data.sh

CMakeLists.txt

+52-41
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ endif (APPLE)
3333

3434

3535
macro (ms_link_libraries)
36-
target_link_libraries(mapserver ${ARGV})
36+
if(BUILD_DYNAMIC)
37+
target_link_libraries(mapserver ${ARGV})
38+
endif(BUILD_DYNAMIC)
3739
if(BUILD_STATIC)
3840
target_link_libraries(mapserver_static ${ARGV})
3941
endif(BUILD_STATIC)
@@ -59,9 +61,10 @@ macro( report_dependency_error component dependency)
5961
endmacro()
6062

6163
SET(CMAKE_REQUIRED_INCLUDES "math.h")
62-
if(CMAKE_COMPILER_IS_GNUCXX)
63-
SET(CMAKE_REQUIRED_LIBRARIES "m")
64-
endif(CMAKE_COMPILER_IS_GNUCXX)
64+
if(NOT(WIN32))
65+
SET(CMAKE_REQUIRED_LIBRARIES "m")
66+
endif(NOT(WIN32))
67+
6568
check_function_exists("strrstr" HAVE_STRRSTR)
6669
check_function_exists("strcasecmp" HAVE_STRCASECMP)
6770
check_function_exists("strcasestr" HAVE_STRCASESTR)
@@ -93,8 +96,8 @@ option(WITH_PROJ "Choose if reprojection support should be built in" ON)
9396
option(WITH_KML "Enable native KML output support (requires libxml2 support)" OFF)
9497
option(WITH_SOS "Enable SOS Server support (requires PROJ and libxml2 support)" OFF)
9598
option(WITH_WMS "Enable WMS Server support (requires proj support)" ON)
96-
option(WITH_GD "Choose if (old) GD support should be built in" OFF)
97-
option(WITH_FRIBIDI "Choose if FriBidi glyph shaping support should be built in (usefull for left-to-right languages)" ON)
99+
option(WITH_FRIBIDI "Choose if FriBidi glyph shaping support should be built in (usefull for left-to-right languages) (requires HARFBUZZ)" ON)
100+
option(WITH_HARFBUZZ "Choose if Harfbuzz complex text layout should be included (needed for e.g. arabic and hindi) (requires FRIBIDI)" ON)
98101
option(WITH_ICONV "Choose if Iconv Internationalization support should be built in" ON)
99102
option(WITH_CAIRO "Choose if CAIRO rendering support should be built in (required for SVG and PDF output)" ON)
100103
option(WITH_SVGCAIRO "Choose if SVG symbology support (via libsvgcairo) should be built in (requires cairo, libsvg, libsvg-cairo. Incompatible with librsvg)" OFF)
@@ -138,7 +141,7 @@ option(WITH_GENERIC_NINT "generic rounding" OFF)
138141
# PERLV_ld_DETECT?
139142

140143
# Add compiler flags for warnings
141-
if(CMAKE_COMPILER_IS_GNUCXX)
144+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
142145
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wdeclaration-after-statement")
143146
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
144147
endif()
@@ -148,8 +151,10 @@ SET(CMAKE_MACOSX_RPATH ON)
148151

149152
if(LINK_STATIC_LIBMAPSERVER)
150153
set(BUILD_STATIC 1)
154+
set(BUILD_DYNAMIC 0)
151155
set(MAPSERVER_LIBMAPSERVER mapserver_static)
152156
else(LINK_STATIC_LIBMAPSERVER)
157+
set(BUILD_DYNAMIC 1)
153158
set(MAPSERVER_LIBMAPSERVER mapserver)
154159
endif(LINK_STATIC_LIBMAPSERVER)
155160

@@ -166,7 +171,7 @@ renderers/agg/src/agg_line_aa_basics.cpp
166171
renderers/agg/src/clipper.cpp
167172
)
168173
include_directories(renderers/agg/include)
169-
174+
#add_definitions(-DHASH_DEBUG=1)
170175
if(WIN32)
171176
set(REGEX_SOURCES ${REGEX_DIR}/regex.c)
172177
include_directories(${REGEX_DIR})
@@ -179,7 +184,7 @@ else(WIN32)
179184
set(REGEX_SOURCES "")
180185
endif(WIN32)
181186

182-
set(mapserver_SOURCES
187+
set(mapserver_SOURCES fontcache.c
183188
cgiutil.c mapgeos.c maporaclespatial.c mapsearch.c mapwms.c classobject.c
184189
mapgml.c mapoutput.c mapwmslayer.c layerobject.c mapgraticule.c mapows.c
185190
mapservutil.c mapxbase.c maphash.c mapowscommon.c mapshape.c mapxml.c mapbits.c
@@ -192,17 +197,20 @@ mapprojhack.c maptree.c mapdebug.c maplexer.c mapquantization.c mapunion.c
192197
mapdraw.c maplibxml2.c mapquery.c maputil.c strptime.c mapdrawgdal.c
193198
mapraster.c mapuvraster.c mapdummyrenderer.c mapobject.c maprasterquery.c
194199
mapwcs.c maperror.c mapogcfilter.c mapregex.c mapwcs11.c mapfile.c
195-
mapogcfiltercommon.c maprendering.c mapwcs20.c mapgd.c mapogcsld.c
200+
mapogcfiltercommon.c maprendering.c mapwcs20.c mapogcsld.c
196201
mapresample.c mapwfs.c mapgdal.c mapogcsos.c mapscale.c mapwfs11.c
197202
mapgeomtransform.c mapogroutput.c mapsde.c mapwfslayer.c mapagg.cpp mapkml.cpp
198-
mapgeomutil.cpp mapkmlrenderer.cpp
203+
mapgeomutil.cpp mapkmlrenderer.cpp fontcache.c textlayout.c
199204
mapogr.cpp mapcontour.c mapsmoothing.c ${REGEX_SOURCES})
200205

201-
add_library(mapserver SHARED ${mapserver_SOURCES} ${agg_SOURCES})
202-
set_target_properties( mapserver PROPERTIES
203-
VERSION ${MapServer_VERSION_STRING}
204-
SOVERSION 1
206+
if(BUILD_DYNAMIC)
207+
add_library(mapserver SHARED ${mapserver_SOURCES} ${agg_SOURCES})
208+
set_target_properties( mapserver PROPERTIES
209+
VERSION ${MapServer_VERSION_STRING}
210+
SOVERSION 1
205211
)
212+
endif(BUILD_DYNAMIC)
213+
206214
if(BUILD_STATIC)
207215
add_library(mapserver_static STATIC ${mapserver_SOURCES} ${agg_SOURCES})
208216
set_target_properties( mapserver_static PROPERTIES
@@ -240,6 +248,10 @@ add_executable(shptreetst shptreetst.c)
240248
target_link_libraries(shptreetst ${MAPSERVER_LIBMAPSERVER})
241249

242250

251+
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
252+
set(USE_EXTENDED_DEBUG 1)
253+
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
254+
243255
find_package(PNG)
244256
if(PNG_FOUND)
245257
include_directories(${PNG_INCLUDE_DIR})
@@ -285,30 +297,6 @@ if(WITH_WMS)
285297
endif(USE_PROJ)
286298
endif(WITH_WMS)
287299

288-
289-
if(WITH_GD)
290-
find_package(GD)
291-
if(NOT GD_FOUND)
292-
report_optional_not_found(GD)
293-
else(NOT GD_FOUND)
294-
include_directories(${GD_INCLUDE_DIR})
295-
ms_link_libraries( ${GD_LIBRARY})
296-
set (USE_GD 1)
297-
if(GD_SUPPORTS_PNG)
298-
set(USE_GD_PNG 1)
299-
endif(GD_SUPPORTS_PNG)
300-
if(GD_SUPPORTS_GIF)
301-
set(USE_GD_GIF 1)
302-
endif(GD_SUPPORTS_GIF)
303-
if(GD_SUPPORTS_JPEG)
304-
set(USE_GD_JPEG 1)
305-
endif(GD_SUPPORTS_JPEG)
306-
if(GD_SUPPORTS_FREETYPE)
307-
set(USE_GD_FREETYPE 1)
308-
endif(GD_SUPPORTS_FREETYPE)
309-
endif(NOT GD_FOUND)
310-
endif (WITH_GD)
311-
312300
if(WITH_FRIBIDI)
313301
find_package(FriBiDi)
314302
if(NOT FRIBIDI_FOUND)
@@ -323,6 +311,25 @@ if(WITH_FRIBIDI)
323311
endif(NOT FRIBIDI_FOUND)
324312
endif (WITH_FRIBIDI)
325313

314+
if(WITH_HARFBUZZ)
315+
find_package(HarfBuzz)
316+
if(NOT HARFBUZZ_FOUND)
317+
report_optional_not_found(HARFBUZZ)
318+
else(NOT HARFBUZZ_FOUND)
319+
include_directories(${HARFBUZZ_INCLUDE_DIR})
320+
ms_link_libraries( ${HARFBUZZ_LIBRARY})
321+
set (USE_HARFBUZZ 1)
322+
endif(NOT HARFBUZZ_FOUND)
323+
endif (WITH_HARFBUZZ)
324+
325+
if( USE_HARFBUZZ AND NOT(USE_FRIBIDI) )
326+
report_dependency_error(HARFBUZZ FRIBIDI)
327+
endif( USE_HARFBUZZ AND NOT(USE_FRIBIDI) )
328+
if( USE_FRIBIDI AND NOT(USE_HARFBUZZ) )
329+
report_dependency_error(FRIBIDI HARFBUZZ)
330+
endif( USE_FRIBIDI AND NOT(USE_HARFBUZZ) )
331+
332+
326333
if(WITH_ICONV)
327334
find_package(ICONV)
328335
if(ICONV_FOUND)
@@ -719,6 +726,8 @@ if(WITH_EXEMPI)
719726
endif(LIBEXEMPI_FOUND)
720727
endif(WITH_EXEMPI)
721728

729+
ms_link_libraries(harfbuzz)
730+
722731
if(WITH_PYTHON)
723732
add_subdirectory("mapscript/python")
724733
set(USE_PYTHON_MAPSCRIPT 1)
@@ -798,7 +807,6 @@ message(STATUS " * freetype: ${FREETYPE_LIBRARY}")
798807
message(STATUS " * Optional components")
799808
status_optional_component("GDAL" "${USE_GDAL}" "${GDAL_LIBRARY}")
800809
status_optional_component("OGR" "${USE_OGR}" "${GDAL_LIBRARY}")
801-
status_optional_component("GD" "${USE_GD}" "${GD_LIBRARY}")
802810
status_optional_component("GIF" "${USE_GIF}" "${GIF_LIBRARY}")
803811
status_optional_component("MYSQL" "${USE_MYSQL}" "${MYSQL_LIBRARY}")
804812
status_optional_component("FRIBIDI" "${USE_FRIBIDI}" "${FRIBIDI_LIBRARY}")
@@ -885,8 +893,11 @@ if(USE_SDE92)
885893
INSTALL(TARGETS msplugin_sde92 DESTINATION lib)
886894
endif(USE_SDE92)
887895

888-
INSTALL(TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv mapserver RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
896+
INSTALL(TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
889897
if(BUILD_STATIC)
890898
INSTALL(TARGETS mapserver_static DESTINATION lib)
891899
endif(BUILD_STATIC)
900+
if(BUILD_DYNAMIC)
901+
INSTALL(TARGETS mapserver DESTINATION lib)
902+
endif(BUILD_DYNAMIC)
892903

INSTALL.CMAKE

+3
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ default (in which case the cmake step will fail if the dependency cannot be foun
119119
of these can be enabled or disabled by passing "-DWITH_XXX=0" or "-DWITH_XXX=1" to the
120120
"cmake .." invocation in order to override a default selection.
121121

122+
This Readme file may be out of sync with the actual CMakeLists files shipped.
123+
Refer to the CMakeLists.txt file for up-to-date options.
124+
122125
- option(WITH_PROJ "Choose if reprojection support should be built in" ON)
123126
- option(WITH_KML "Enable native KML output support (requires libxml2 support)" OFF)
124127
- option(WITH_SOS "Enable SOS Server support (requires PROJ and libxml2 support)" OFF)

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ BUILDPATH=../../build
66
FLEX=flex
77
YACC=yacc
88
CMAKEFLAGS=-DCMAKE_C_FLAGS="--coverage" -DCMAKE_CXX_FLAGS="--coverage" \
9-
-DCMAKE_SHARED_LINKER_FLAGS="-lgcov" -DWITH_GD=1 -DWITH_CLIENT_WMS=1 \
9+
-DCMAKE_SHARED_LINKER_FLAGS="-lgcov" -DWITH_CLIENT_WMS=1 \
1010
-DWITH_CLIENT_WFS=1 -DWITH_KML=1 -DWITH_SOS=1 -DWITH_PHP=1 \
11-
-DWITH_PYTHON=1 -DWITH_JAVA=1 -DWITH_THREAD_SAFETY=1 -DWITH_FRIBIDI=0 -DWITH_FCGI=0 -DWITH_EXEMPI=1 \
12-
-DCMAKE_BUILD_TYPE=Release -DWITH_RSVG=1 -DWITH_CURL=1
11+
-DWITH_PYTHON=1 -DWITH_JAVA=1 -DWITH_THREAD_SAFETY=1 -DWITH_FRIBIDI=1 -DWITH_FCGI=0 -DWITH_EXEMPI=1 \
12+
-DCMAKE_BUILD_TYPE=Release -DWITH_RSVG=1 -DWITH_CURL=1 -DWITH_HARFBUZZ=1
1313
all: cmakebuild
1414

1515
cmakebuild: lexer parser

cmake/FindHarfBuzz.cmake

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Original Licence:
2+
# Copyright (c) 2012, Intel Corporation
3+
#
4+
# Redistribution and use in source and binary forms, with or without
5+
# modification, are permitted provided that the following conditions are met:
6+
#
7+
# * Redistributions of source code must retain the above copyright notice, this
8+
# list of conditions and the following disclaimer.
9+
# * Redistributions in binary form must reproduce the above copyright notice,
10+
# this list of conditions and the following disclaimer in the documentation
11+
# and/or other materials provided with the distribution.
12+
# * Neither the name of Intel Corporation nor the names of its contributors may
13+
# be used to endorse or promote products derived from this software without
14+
# specific prior written permission.
15+
#
16+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
# POSSIBILITY OF SUCH DAMAGE.
27+
#
28+
# Try to find Harfbuzz include and library directories.
29+
#
30+
# After successful discovery, this will set for inclusion where needed:
31+
# HARFBUZZ_INCLUDE_DIR - containg the HarfBuzz headers
32+
# HARFBUZZ_LIBRARY - containg the HarfBuzz library
33+
34+
include(FindPkgConfig)
35+
36+
pkg_check_modules(PC_HARFBUZZ harfbuzz>=0.9.18)
37+
38+
find_path(HARFBUZZ_INCLUDE_DIR NAMES hb.h
39+
HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR}
40+
)
41+
42+
find_library(HARFBUZZ_LIBRARY NAMES harfbuzz
43+
HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR}
44+
)
45+
46+
set(HARFBUZZ_INCLUDE_DIRS ${HARFBUZZ_INCLUDE_DIR})
47+
set(HARFBUZZ_LIBRARIES ${HARFBUZZ_LIBRARY})
48+
include(FindPackageHandleStandardArgs)
49+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HarfBuzz DEFAULT_MSG HARFBUZZ_INCLUDE_DIR HARFBUZZ_LIBRARY)
50+
mark_as_advanced(HARFBUZZ_LIBRARY HARFBUZZ_INCLUDE_DIR)

0 commit comments

Comments
 (0)