Skip to content

Commit

Permalink
[]: Success compile in linux. Need to tweak some parts.
Browse files Browse the repository at this point in the history
  • Loading branch information
gloob committed Oct 20, 2008
1 parent 1e1e970 commit 6f2d141
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 27 deletions.
2 changes: 1 addition & 1 deletion cmake/CMake/FindBISON.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ IF(BISON_EXECUTABLE)

ADD_CUSTOM_COMMAND(OUTPUT ${BISON_TARGET_outputs}
${BISON_TARGET_extraoutputs}
COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1}
COMMAND ${BISON_EXECUTABLE} "-p ${Name}" ${BISON_TARGET_cmdopt} ${ARGV1} -o ${ARGV2}
DEPENDS ${ARGV1}
COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
Expand Down
27 changes: 26 additions & 1 deletion cmake/CMake/FindICU.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# credit: dgregor: http://svn.boost.org/trac/boost/browser/sandbox/troy/boost_1_34_0/tools/build/CMake/FindICU.cmake?rev=4096
#
# Finds the International Components for Unicode (ICU) Library
#
# ICU_FOUND - True if ICU found.
# ICU_I18N_FOUND - True if ICU's internationalization library found.
# ICU_IO_FOUND - True if ICU's ostream output lib is found.
# ICU_INCLUDE_DIRS - Directory to include to get ICU headers
# Note: always include ICU headers as, e.g.,
# unicode/utypes.h
# ICU_LIBRARIES - Libraries to link against for the common ICU
# ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
# (note: in addition to ICU_LIBRARIES)

#
# ICU_IO_LIBRARIES - Libraries for ostream output
#
#
# Look for the header file.
find_path(
ICU_INCLUDE_DIR
Expand All @@ -35,17 +41,36 @@ if(ICU_INCLUDE_DIR AND ICU_LIBRARY)
NAMES icuin icui18n cygicuin cygicuin32
DOC "Libraries to link against for ICU internationalization")
mark_as_advanced(ICU_I18N_LIBRARY)

if (ICU_I18N_LIBRARY)
set(ICU_I18N_FOUND 1)
set(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY})
else (ICU_I18N_LIBRARY)
set(ICU_I18N_FOUND 0)
set(ICU_I18N_LIBRARIES)
endif (ICU_I18N_LIBRARY)

# Look for the ICU ostream library
find_library(
ICU_IO_LIBRARY
NAMES icuio
DOC "Libraries to link against for ICU ostream output")
mark_as_advanced(ICU_IO_LIBRARY)

if (ICU_IO_LIBRARY)
set(ICU_IO_FOUND 1)
set(ICU_IO_LIBRARIES ${ICU_IO_LIBRARY})
else (ICU_IO_LIBRARY)
set(ICU_IO_FOUND 0)
set(ICU_IO_LIBRARIES)
endif (ICU_IO_LIBRARY)

else(ICU_INCLUDE_DIR AND ICU_LIBRARY)
set(ICU_FOUND 0)
set(ICU_I18N_FOUND 0)
set(ICU_IO_FOUND 0)
set(ICU_LIBRARIES)
set(ICU_I18N_LIBRARIES)
set(ICU_IO_LIBRARIES)
set(ICU_INCLUDE_DIRS)
endif(ICU_INCLUDE_DIR AND ICU_LIBRARY)
26 changes: 14 additions & 12 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ LIST(APPEND CMAKE_MODULE_PATH ${PHP_SOURCE_DIR}/CMake)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Zend)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/TSRM)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/main)


# CMake Module includes
include(ConfigureFileIn)

Expand All @@ -43,7 +48,7 @@ if (ICU_FOUND AND ICU_I18N_FOUND)
# add_definitions(-DPHP_HAS_ICU=2)
message("Found ICU: ${ICU_INCLUDE_DIRS}")
include_directories(${ICU_INCLUDE_DIRS})
set(PHP_ZEND_LIBRARIES ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
set(PHP_ZEND_LIBRARIES ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES} ${ICU_IO_LIBRARIES})
else (ICU_FOUND AND ICU_I18N_FOUND)
message(FATAL_ERROR "Need to install ICU (http://icu-project.org) for compiling PHP.")
endif (ICU_FOUND AND ICU_I18N_FOUND)
Expand Down Expand Up @@ -105,21 +110,18 @@ if(UNIX)
add_definitions(-DPHP_ATOM_INC -fvisibility=hidden)
endif()

# Configure in main zone
#configure_file_in(php_config.h.cmake php_config.h DIRECTORY main)
# Configure in Zend zone
configure_file_in(zend_config.h.cmake zend_config.h DIRECTORY Zend)

add_subdirectory(ext)
message("extension list: ${EXTENSION_LIST}")

add_subdirectory(Zend)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Zend)

add_subdirectory(TSRM)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/TSRM)

add_subdirectory(main)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/main)

add_subdirectory(ext)
message("extension list: ${EXTENSION_LIST}")

# Configure in main zone
configure_file_in(php_config.h.cmake php_config.h DIRECTORY main)
# Configure in Zend zone
configure_file_in(zend_config.h.cmake zend_config.h DIRECTORY Zend)

add_subdirectory(sapi)
8 changes: 8 additions & 0 deletions cmake/ConfigureChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@ check_function_exists(strtoll HAVE_STRTOLL)
check_function_exists(strtoul HAVE_STRTOUL)
check_function_exists(strtoull HAVE_STRTOULL)

check_function_exists(link HAVE_LINK)
check_function_exists(localeconv HAVE_LOCALECONV)
check_function_exists(localtime_r HAVE_LOCALTIME_R)
check_function_exists(lockf HAVE_LOCKF)
check_function_exists(log1p HAVE_LOG1P)
check_function_exists(lrand48 HAVE_LRAND48)
check_function_exists(makedev HAVE_MAKEDEV)


# ZEND_FP_EXCEPT

Expand Down
19 changes: 12 additions & 7 deletions cmake/Zend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,23 @@ if(NOT EXISTS "zend_language_parser.c" OR NOT EXISTS "zend_language_parser.h" AN
endif(NOT EXISTS "zend_language_parser.c" OR NOT EXISTS "zend_language_parser.h" AND NOT BISON_FOUND)

if(BISON_FOUND)
BISON_TARGET(zend ${Zend_SOURCE_DIR}/zend_language_parser.y ${Zend_SOURCE_DIR}/zend_language_parser.c)
# bison -p zend -v -d zend_language_parser.y -o zend_language_parser.c
BISON_TARGET(zend ${Zend_SOURCE_DIR}/zend_language_parser.y ${Zend_SOURCE_DIR}/zend_language_parser.c COMPILE_FLAGS "-v")
endif(BISON_FOUND)

# INI parser/scanner rules
if (BISON_FOUND)
BISON_TARGET(ini_ ${Zend_SOURCE_DIR}/zend_ini_parser.y ${Zend_SOURCE_DIR}/zend_ini_parser.c)
endif (BISON_FOUND)
#if (BISON_FOUND)
# BISON_TARGET(ini_ ${Zend_SOURCE_DIR}/zend_ini_parser.y ${Zend_SOURCE_DIR}/zend_ini_parser.c)
#endif (BISON_FOUND)

find_file(ZEND_INI_SCANNER "zend_ini_scanner.c" PATHS ${Zend_SOURCE_DIR})
if(NOT ZEND_INI_SCANNER)
message("Regenerating zend_ini_scanner")
RE2C_TARGET(${Zend_SOURCE_DIR}/zend_ini_scanner.l ${Zend_SOURCE_DIR}/zend_ini_scanner.c "--case-inverted -cbdFt ${Zend_SOURCE_DIR}/zend_ini_scanner_defs.h")
endif(NOT ZEND_INI_SCANNER)

set(PHP_ZEND_LIBRARIES)
#set(PHP_ZEND_OBJECTS ${Zend_BINARY_DIR}/CMakeFiles/Zend.dir/zend_ini_parser.o ${Zend_BINARY_DIR}/CMakeFiles/Zend.dir/zend_default_classes.o PARENT_SCOPE)
set(PHP_ZEND_SOURCES ${Zend_SOURCE_DIR}/zend_ini_parser.c ${Zend_SOURCE_DIR}/zend_default_classes.c PARENT_SCOPE)

# Linux sources...

Expand Down Expand Up @@ -113,16 +115,19 @@ set(Zend_library_SRCS
zend_objects_API.c
zend_ts_hash.c
zend_stream.c
zend_default_classes.c
# zend_default_classes.c
zend_iterators.c
zend_interfaces.c
zend_exceptions.c
zend_strtod.c
zend_gc.c
zend_unicode.c
zend_strtol.c

zend_language_scanner.c
zend_ini_scanner.c
zend_language_parser.c
# zend_ini_parser.c
)

# Headers:
Expand Down Expand Up @@ -182,7 +187,7 @@ set(Zend_library_HDRS
)

# actual target:
add_library(Zend ${Zend_library_SRCS} ${Zend_library_HDRS} ${BISON_zend_OUTPUTS} ${BISON_ini__OUTPUTS})
add_library(Zend ${Zend_library_SRCS} ${Zend_library_HDRS} ${BISON_zend_OUTPUTS} ${BISON_ini_OUTPUTS})
set_target_properties(Zend PROPERTIES VERSION 0.0.0)

# add install target:
Expand Down
1 change: 1 addition & 0 deletions cmake/ext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
include(php/PHP_ARG_ENABLE)
include(php/PHP_NEW_EXTENSION)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${PHP_BINARY_DIR}/Zend)

set(EXTENSION_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
6 changes: 5 additions & 1 deletion cmake/ext/date/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ set(EXT_DATE_SOURCES
php_date.c
)

set(EXT_DATE_HEADERS
lib/timelib.h
)

#add_library(EXT_DATE [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL]
add_library(EXT_DATE ${EXT_DATE_SOURCES})
add_library(EXT_DATE ${EXT_DATE_SOURCES} ${EXT_DATE_HEADERS})

#PHP_NEW_EXTENSION(date ${DATE_EXTENSION_SOURCES} {PHP_EXTENSION_SHARED})
1 change: 1 addition & 0 deletions cmake/ext/standard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ file(GLOB EXT_STANDARD_HEADERS *.h)

#add_library(EXT_DATE [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL]
add_library(EXT_STANDARD ${EXT_STANDARD_SOURCES} ${EXT_STANDARD_HEADERS})
target_link_libraries(EXT_STANDARD "resolv")
10 changes: 7 additions & 3 deletions cmake/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${PHP_SOURCE_DIR}/Zend)
include_directories(${PHP_BINARY_DIR}/Zend)
include_directories(${PHP_SOURCE_DIR}/TSRM)
include_directories(${PHP_SOURCE_DIR}/ext/date/lib)
include_directories(${PHP_BINARY_DIR}/ext/date/lib)

set(PHP_main_LIBRARIES)

configure_file(internal_functions.c.in ${CMAKE_CURRENT_SOURCE_DIR}/internal_functions.c)

# ########## main library ##########
# Sources:
set(main_library_SRCS
# internal_functions_cli.c
internal_functions.c
internal_functions_cli.c
# internal_functions_nw.c
# internal_functions_win32.c
main.c
Expand Down Expand Up @@ -56,6 +58,7 @@ set(main_library_SRCS
streams/xp_socket.c
streams/mmap.c
streams/glob_wrapper.c
streams/unicode_filter.c
)


Expand Down Expand Up @@ -89,9 +92,10 @@ set(main_library_HDRS
snprintf.h
spprintf.h
win95nt.h

streams/php_stream_filter_api.h
)

configure_file(internal_functions.c.in ${CMAKE_SOURCE_DIR}/internal_functions.c)

# actual target:
add_library(main ${main_library_SRCS} ${main_library_HDRS})
Expand Down
4 changes: 2 additions & 2 deletions cmake/sapi/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
message("PHP_EXTENSION_SOURCE_LIST: ${PHP_EXTENSIONS_SOURCE_LIST}")
message("SAPI EXTENSION LIST: ${EXTENSION_LIST}")

add_executable(php php_cli.c php_cli_readline.c)
target_link_libraries(php Zend main TSRM ${EXTENSION_LIST})
add_executable(php php_cli.c php_cli_readline.c ${PHP_ZEND_SOURCES})
target_link_libraries(php Zend main TSRM ${EXTENSION_LIST} ${PHP_ZEND_LIBRARIES} ${PHP_ZEND_OBJECTS})

0 comments on commit 6f2d141

Please sign in to comment.