1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # This file is part of OpenOffice.org.
11 # OpenOffice.org is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU Lesser General Public License version 3
13 # only, as published by the Free Software Foundation.
15 # OpenOffice.org is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU Lesser General Public License version 3 for more details
19 # (a copy is included in the LICENSE file that accompanied this code).
21 # You should have received a copy of the GNU Lesser General Public License
22 # version 3 along with OpenOffice.org. If not, see
23 # <http://www.openoffice.org/license.html>
24 # for a copy of the LGPLv3 License.
26 #*************************************************************************
31 .INCLUDE
: $(PRJ
)$/version.mk
34 ENABLE_EXCEPTIONS
=TRUE
35 VISIBILITY_HIDDEN
= TRUE
37 EXTENSIONNAME
:=mysql-connector-ooo
39 EXTERNAL_WARNINGS_NOT_ERRORS
= TRUE
41 # --- Settings -----------------------------------------------------
43 .INCLUDE
: settings.mk
45 #-------------------------------------------------------------------
47 #---- extension version
48 EXTENSION_VERSION_BASE
=$(MYSQLC_VERSION_MAJOR
).
$(MYSQLC_VERSION_MINOR
).
$(MYSQLC_VERSION_MICRO
)
49 EXTENSION_VERSION
=$(EXTENSION_VERSION_BASE
)
51 #---- extension title package name
52 EXTENSION_ZIPNAME
:=$(EXTENSIONNAME
)
54 #-------------------------------------------------------------------
56 # The headers delivered from C/C++ have a habit of putting a ";" after the closing bracked of a namespace, which
57 # yields a warning with Solaris' compiler. Until this is fixed in C/C++, silence this warning
58 .IF
"$(OS)" == "SOLARIS"
59 CFLAGSWARNCXX
+=,wemptydecl
60 CFLAGSWARNCXX
:=$(CFLAGSWARNCXX
:s
/ ,/,/)
63 #-------------------------------------------------------------------
64 .IF
"$(ENABLE_MYSQLC)" != "YES"
66 @echo
"Mysql native driver extension build disabled."
69 # use the static version
71 MYSQL_LIBDIR
=$(LIBMYSQL_PATH
)$/lib
72 MYSQL_INCDIR
=$(LIBMYSQL_PATH
)$/include
74 .IF
"$(SYSTEM_MYSQL)" != "YES"
75 MYSQL_LIBDIR
=$(LIBMYSQL_PATH
)$/lib
76 MYSQL_INCDIR
=$(LIBMYSQL_PATH
)$/include
80 .IF
"$(SYSTEM_MYSQL)" == "YES"
81 CFLAGS
+=-DSYSTEM_MYSQL
84 .IF
"$(SYSTEM_MYSQL_CPPCONN)" == "YES"
85 CFLAGS
+=-DSYSTEM_MYSQL_CPPCONN
88 CDEFS
+=-DCPPDBC_EXPORTS
-DCPPCONN_LIB_BUILD
89 .IF
"$(SYSTEM_MYSQL_CPPCONN)" != "YES"
90 CDEFS
+= -DCPPCONN_LIB
=\"$(DLLPRE
)mysqlcppconn
$(DLLPOST
)\"
93 # --------------- MySQL settings ------------------
95 MYSQL_INC
=-I
$(SOLARINCDIR
)$/mysqlcppconn
-I
$(SOLARINCDIR
)$/mysqlcppconn
/cppconn
-I
$(MYSQL_INCDIR
)
96 MYSQL_LIB
=$(MYSQL_LIBDIR
)$/libmysql.lib
97 MYSQL_LIBFILE
=$(MYSQL_LIBDIR
)$/libmysql.dll
98 MYSQL_CPPCONNFILE
=$(SOLARBINDIR
)$/$(DLLPRE
)mysqlcppconn
$(DLLPOST
)
100 .IF
"$(SYSTEM_MYSQL)" != "YES"
101 MYSQL_INC
+=-I
$(MYSQL_INCDIR
)
102 .IF
"$(OS)"=="MACOSX"
103 MYSQL_LIBFILE
=$(MYSQL_LIBDIR
)$/$(DLLPRE
)mysql
.16$(DLLPOST
)
105 MYSQL_LIBFILE
=$(MYSQL_LIBDIR
)$/$(DLLPRE
)mysql
$(DLLPOST
).16
108 # checkdll will complain if we do not point it to the libmysql lib
109 EXTRALIBPATHS
=-L
$(MYSQL_LIBDIR
)
112 .IF
"$(SYSTEM_MYSQL_CPPCONN)" != "YES"
113 .IF
"$(OS)"=="MACOSX" ||
"$(OS)" == "SOLARIS"
116 MYSQL_LIB
+=-rdynamic
-lz
-lcrypt
-lnsl
-lm
118 MYSQL_CPPCONNFILE
=$(SOLARLIBDIR
)$/$(DLLPRE
)mysqlcppconn
$(DLLPOST
)
120 MYSQL_CPPCONN_LIB
+=-lmysqlcppconn
124 .IF
"$(SYSTEM_MYSQL_CPPCONN)" != "YES"
125 MYSQL_INC
+=-I
$(SOLARINCDIR
)$/mysqlcppconn
-I
$(SOLARINCDIR
)$/mysqlcppconn
/cppconn
128 CFLAGS
+=-I..
$/..
$/inc
$(MYSQL_INC
) \
129 -DMYSQLC_VERSION_MAJOR
=$(MYSQLC_VERSION_MAJOR
) \
130 -DMYSQLC_VERSION_MINOR
=$(MYSQLC_VERSION_MINOR
) \
131 -DMYSQLC_VERSION_MICRO
=$(MYSQLC_VERSION_MICRO
) \
134 # provide the name of the MySQL client lib to the C++ code
135 .IF
"$(SYSTEM_MYSQL)" != "YES"
136 CDEFS
+= -DMYSQL_LIB
=\"$(MYSQL_LIBFILE
:f
)\"
139 #--------------------------------------------------
142 SHL1TARGET
=$(TARGET
).uno
143 LIB1TARGET
=$(SLB
)$/$(SHL1TARGET
).lib
145 $(SLO
)$/mysqlc_driver.obj \
146 $(SLO
)$/mysqlc_services.obj \
147 $(SLO
)$/mysqlc_connection.obj \
148 $(SLO
)$/mysqlc_resultset.obj \
149 $(SLO
)$/mysqlc_resultsetmetadata.obj \
150 $(SLO
)$/mysqlc_statement.obj \
151 $(SLO
)$/mysqlc_preparedstatement.obj \
152 $(SLO
)$/mysqlc_databasemetadata.obj \
153 $(SLO
)$/mysqlc_types.obj \
154 $(SLO
)$/mysqlc_general.obj \
155 $(SLO
)$/mysqlc_propertyids.obj
159 $(MYSQL_CPPCONN_LIB
) \
165 SHL1LIBS
= $(LIB1TARGET
)
166 SHL1DEF
= $(MISC
)$/$(SHL1TARGET
).def
168 DEF1NAME
= $(SHL1TARGET
)
169 DEF1EXPORTFILE
= exports.dxp
171 # create Extension -----------------------------
173 # DESCRIPTION_SRC is the source file which is copied into the extension
174 # It is defaulted to "description.xml", but we want to pre-process it, so we use an intermediate
176 DESCRIPTION_SRC
= $(MISC
)$/description.xml
179 registry
$/data
$/org
$/openoffice
$/Office
$/DataAccess
$/Drivers.xcu
181 COMPONENT_MERGED_XCU
= \
182 $(foreach,i
,$(COMPONENT_XCU
) $(EXTENSIONDIR
)$/$i)
184 COMPONENT_LIBRARY
= \
185 $(EXTENSIONDIR
)$/$(SHL1TARGET
)$(DLLPOST
)
187 COMPONENT_MYSQL_LIBFILE
= \
188 $(EXTENSIONDIR
)$/$(MYSQL_LIBFILE
:f
)
190 COMPONENT_MYSQL_CPPCONN_FILE
=\
191 $(EXTENSIONDIR
)$/$(MYSQL_CPPCONNFILE
:f
)
193 COMPONENT_LIBRARIES
=\
197 $(EXTENSIONDIR
)$/images
$/extension_32.png
199 # ........ component description ........
200 # one file for each WITH_LANG token
201 COMPONENT_DESCRIPTIONS
=$/$(foreach,lang
,$(alllangiso
) description-
$(lang
).txt
)
202 COMPONENT_DESCRIPTIONS_PACKDEP
= \
203 $(foreach,i
,$(COMPONENT_DESCRIPTIONS
) $(EXTENSIONDIR
)$/$i)
205 # ........ dependencies for packaging the extension ........
206 EXTENSION_PACKDEPS
=makefile.mk
$(COMPONENT_IMAGES
) $(COMPONENT_DESCRIPTIONS_PACKDEP
) $(COMPONENT_MERGED_XCU
)
208 .IF
"$(SYSTEM_MYSQL)" != "YES"
209 EXTENSION_PACKDEPS
+=$(COMPONENT_MYSQL_LIBFILE
)
212 .IF
"$(SYSTEM_MYSQL_CPPCONN)" != "YES"
213 EXTENSION_PACKDEPS
+=$(COMPONENT_MYSQL_CPPCONN_FILE
)
216 # --- Targets ------------------------------------------------------
217 .INCLUDE
: extension_pre.mk
219 .INCLUDE
: extension_post.mk
221 $(COMPONENT_IMAGES
) : $(SRC_ROOT
)/$(RSCDEFIMG
)$/desktop
$/res
$/$$(@
:f
)
222 @@
-$(MKDIRHIER
) $(@
:d
)
226 # the following is a hack for now - need to find out the generic mechanism later
228 $(EXTENSIONDIR
)$/registry
$/data
$/org
$/openoffice
$/Office
$/DataAccess
$/Drivers.xcu
: .
$/registry
$/data
$/org
$/openoffice
$/Office
$/DataAccess
$/Drivers.xcu
229 @@
-$(MKDIRHIER
) $(EXTENSIONDIR
)$/registry
$/data
$/org
$/openoffice
$/Office
$/DataAccess
230 @
$(COPY
) $< $(EXTENSIONDIR
)$/registry
$/data
$/org
$/openoffice
$/Office
$/DataAccess
$/Drivers.xcu
> $(NULLDEV
)
232 $(COMPONENT_DESCRIPTIONS_PACKDEP
) : $(DESCRIPTION
)
234 $(DESCRIPTION_SRC
): description.xml
236 .IF
"$(WITH_LANG)" != ""
237 $(XRMEX
) -p
$(PRJNAME
) -i
$< -o
$@
-m
$(mktmp
$(foreach,lang
,$(subst,en-US
, $(WITH_LANG_LIST
)) $(SRCDIR
)/translations
/source
/$(lang
)/$(PRJNAME
)$/$(PATH_IN_MODULE
).po
)) -l
all
238 $(SED
) "s/#VERSION#/$(EXTENSION_VERSION)/" < $@
> $@.new
240 @
$(COPY
) $(@
:d
)/description-
*.txt
$(EXTENSIONDIR
)
242 $(SED
) "s/#VERSION#/$(EXTENSION_VERSION)/" < $< > $@
244 @
$(COPY
) description-en-US.txt
$(EXTENSIONDIR
)
246 .IF
"$(SYSTEM_MYSQL)" != "YES"
247 # --- the MySQL client lib needs to be copied
248 $(COMPONENT_MYSQL_LIBFILE
): $(MYSQL_LIBFILE
)
249 @@
-$(MKDIRHIER
) $(@
:d
)
250 @
$(COPY
) $< $@
> $(NULLDEV
)
251 .IF
"$(OS)" == "MACOSX"
252 $(XCRUN
) install_name_tool
-id @__________________________________________________OOO
/$(MYSQL_LIBFILE
:f
) $@
256 .IF
"$(SYSTEM_MYSQL_CPPCONN)" != "YES"
257 # --- the MySQL cppconn lib needs to be copied
258 $(COMPONENT_MYSQL_CPPCONN_FILE
): $(MYSQL_CPPCONNFILE
)
259 @@
-$(MKDIRHIER
) $(@
:d
)
260 @
$(COPY
) $< $@
> $(NULLDEV
)
261 .IF
"$(OS)" == "MACOSX"
262 $(XCRUN
) install_name_tool
-change
$(MYSQL_LIBFILE
:f
) @loader_path
/$(MYSQL_LIBFILE
:f
) $@
266 .IF
"$(OS)" == "MACOSX"
267 $(EXTENSION_TARGET
): adjust_libmysql_path
269 adjust_libmysql_path
: $(EXTENSIONDIR
)$/$(SHL1TARGET
)$(DLLPOST
)
270 $(XCRUN
) install_name_tool
-change
$(MYSQL_LIBFILE
:f
) @loader_path
/$(MYSQL_LIBFILE
:f
) $(EXTENSIONDIR
)$/$(SHL1TARGET
)$(DLLPOST
)