diff options
author | Bryan O'Sullivan <bos@lindenlab.com> | 2008-06-02 21:14:31 +0000 |
---|---|---|
committer | Bryan O'Sullivan <bos@lindenlab.com> | 2008-06-02 21:14:31 +0000 |
commit | 9db949eec327df4173fde3de934a87bedb0db13c (patch) | |
tree | aeffa0f0e68b1d2ceb74d460cbbd22652c9cd159 | |
parent | 419e13d0acaabf5e1e02e9b64a07648bce822b2f (diff) |
svn merge -r88066:88786 svn+ssh://svn.lindenlab.com/svn/linden/branches/cmake-9-merge
dataserver-is-deprecated
for-fucks-sake-whats-with-these-commit-markers
268 files changed, 15811 insertions, 1184 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt index 2799cd80e4..2a37015b01 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -117,6 +117,7 @@ Farallon Greyskin Feep Larsson VWR-447 VWR-1314 + VWR-4444 Fremont Cunningham VWR-1147 Gudmund Shepherd @@ -194,6 +195,7 @@ Michelle2 Zenovka VWR-2652 VWR-2834 VWR-3749 + VWR-4506 Mm Alder VWR-3777 VWR-4794 diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt new file mode 100644 index 0000000000..e09c7110c5 --- /dev/null +++ b/indra/CMakeLists.txt @@ -0,0 +1,65 @@ +# -*- cmake -*- + +project(SecondLife) + +# The FindPkgConfig module was released with 2.4.7. +cmake_minimum_required(VERSION 2.4.7 FATAL_ERROR) + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + +include(Variables) + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING + "Build type. One of: Debug Release RelWithDebInfo" FORCE) +endif (NOT CMAKE_BUILD_TYPE) + +add_subdirectory(cmake) + +add_subdirectory(${LIBS_OPEN_PREFIX}llaudio) +add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter) +add_subdirectory(${LIBS_OPEN_PREFIX}llcommon) +add_subdirectory(${LIBS_OPEN_PREFIX}llimage) +add_subdirectory(${LIBS_OPEN_PREFIX}llimagej2coj) +add_subdirectory(${LIBS_OPEN_PREFIX}llinventory) +add_subdirectory(${LIBS_OPEN_PREFIX}llmath) +add_subdirectory(${LIBS_OPEN_PREFIX}llmedia) +add_subdirectory(${LIBS_OPEN_PREFIX}llmessage) +add_subdirectory(${LIBS_OPEN_PREFIX}llprimitive) +add_subdirectory(${LIBS_OPEN_PREFIX}llrender) +add_subdirectory(${LIBS_OPEN_PREFIX}llvfs) +add_subdirectory(${LIBS_OPEN_PREFIX}llwindow) +add_subdirectory(${LIBS_OPEN_PREFIX}llxml) + +if (EXISTS ${LIBS_CLOSED_DIR}llkdu AND NOT STANDALONE) + add_subdirectory(${LIBS_CLOSED_PREFIX}llkdu) +endif (EXISTS ${LIBS_CLOSED_DIR}llkdu AND NOT STANDALONE) + +add_subdirectory(${LIBS_OPEN_PREFIX}lscript) + +if (WINDOWS) + add_subdirectory(copy_win_scripts) +endif (WINDOWS) + +if (VIEWER) + add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger) + add_subdirectory(${LIBS_OPEN_PREFIX}llui) + + if (LINUX) + add_subdirectory(${VIEWER_PREFIX}linux_crash_logger) + elseif (DARWIN) + add_subdirectory(${VIEWER_PREFIX}mac_crash_logger) + add_subdirectory(${VIEWER_PREFIX}mac_updater) + elseif (WINDOWS) + add_subdirectory(${VIEWER_PREFIX}win_crash_logger) + add_subdirectory(${VIEWER_PREFIX}win_updater) + elseif (SOLARIS) + add_subdirectory(solaris_crash_logger) + endif (LINUX) + + add_subdirectory(${VIEWER_PREFIX}newview) +endif (VIEWER) + +if (SERVER) + include(${SERVER_PREFIX}Server.cmake) +endif (SERVER) diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake new file mode 100644 index 0000000000..58f06075a8 --- /dev/null +++ b/indra/cmake/00-Common.cmake @@ -0,0 +1,199 @@ +# -*- cmake -*- +# +# Compilation options shared by all Second Life components. + +include(Variables) + + +# Portable compilation flags. + +set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1") +set(CMAKE_CXX_FLAGS_RELEASE + "-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -DLL_SEND_CRASH_REPORTS=1 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO + "-DLL_RELEASE=1 -DLL_SEND_CRASH_REPORTS=0 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1") + + +# Don't bother with a MinSizeRel build. + +set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;Debug" CACHE STRING + "Supported build types." FORCE) + + +# Platform-specific compilation flags. + +if (WINDOWS) + # Don't build DLLs. + set(BUILD_SHARED_LIBS OFF) + + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MTd" + CACHE STRING "C++ compiler debug options" FORCE) + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MT" + CACHE STRING "C++ compiler release-with-debug options" FORCE) + set(CMAKE_CXX_FLAGS_RELEASE + "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /MT" + CACHE STRING "C++ compiler release options" FORCE) + + add_definitions( + /DLL_WINDOWS=1 + /DUNICODE + /D_UNICODE + /GS + /TP + /W3 + /c + /Zc:forScope + /nologo + ) + + if(MSVC80 OR MSVC90) + add_definitions( + /Zc:wchar_t- + ) + endif (MSVC80 OR MSVC90) + + # Are we using the crummy Visual Studio KDU build workaround? + if (NOT VS_DISABLE_FATAL_WARNINGS) + add_definitions(/WX) + endif (NOT VS_DISABLE_FATAL_WARNINGS) +endif (WINDOWS) + + +if (LINUX) + set(CMAKE_SKIP_RPATH TRUE) + + # Here's a giant hack for Fedora 8, where we can't use + # _FORTIFY_SOURCE if we're using a compiler older than gcc 4.1. + + find_program(GXX g++) + mark_as_advanced(GXX) + + if (GXX) + execute_process( + COMMAND ${GXX} --version + COMMAND sed "s/^[gc+ ]*//" + COMMAND head -1 + OUTPUT_VARIABLE GXX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + else (GXX) + set(GXX_VERSION x) + endif (GXX) + + # The quoting hack here is necessary in case we're using distcc or + # ccache as our compiler. CMake doesn't pass the command line + # through the shell by default, so we end up trying to run "distcc" + # " g++" - notice the leading space. Ugh. + + execute_process( + COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version" + COMMAND sed "s/^[gc+ ]*//" + COMMAND head -1 + OUTPUT_VARIABLE CXX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if (${GXX_VERSION} STREQUAL ${CXX_VERSION}) + add_definitions(-D_FORTIFY_SOURCE=2) + else (${GXX_VERSION} STREQUAL ${CXX_VERSION}) + if (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat") + add_definitions(-D_FORTIFY_SOURCE=2) + endif (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat") + endif (${GXX_VERSION} STREQUAL ${CXX_VERSION}) + + # GCC 4.3 introduces a pile of obnoxious new warnings, which we + # treat as errors due to -Werror. Quiet the most offensive and + # widespread of them. + + if (${GXX_VERSION} MATCHES "4.3") + add_definitions(-Wno-deprecated -Wno-parentheses) + endif (${GXX_VERSION} MATCHES "4.3") + + # End of hacks. + + add_definitions( + -DLL_LINUX=1 + -D_REENTRANT + -fexceptions + -fno-math-errno + -fno-strict-aliasing + -fsigned-char + -g + -pthread + ) + + if (SERVER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-60") + if (EXISTS /etc/debian_version) + FILE(READ /etc/debian_version DEBIAN_VERSION) + else (EXISTS /etc/debian_version) + set(DEBIAN_VERSION "") + endif (EXISTS /etc/debian_version) + + if (NOT DEBIAN_VERSION STREQUAL "3.1") + add_definitions(-DCTYPE_WORKAROUND) + endif (NOT DEBIAN_VERSION STREQUAL "3.1") + + if (EXISTS /usr/lib/mysql4/mysql) + link_directories(/usr/lib/mysql4/mysql) + endif (EXISTS /usr/lib/mysql4/mysql) + + add_definitions( + -msse2 + -mfpmath=sse + ) + endif (SERVER) + + if (VIEWER) + add_definitions(-DAPPID=secondlife) + endif (VIEWER) + + set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}") + set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}") +endif (LINUX) + + +if (DARWIN) + add_definitions(-DLL_DARWIN=1) + set(CMAKE_LD_FLAGS "-headerpad_max_install_names") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlong-branch") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-branch") +endif (DARWIN) + + +if (LINUX OR DARWIN) + set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs") + + if (NOT GCC_DISABLE_FATAL_WARNINGS) + set(GCC_WARNINGS "${GCC_WARNINGS} -Werror") + endif (NOT GCC_DISABLE_FATAL_WARNINGS) + + set(GCC_CXX_WARNINGS "${GCC_WARNINGS} -Wno-reorder") + + set(CMAKE_C_FLAGS "${GCC_WARNINGS} ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${GCC_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}") +endif (LINUX OR DARWIN) + + +if (STANDALONE) + add_definitions(-DLL_STANDALONE=1) + + if (LINUX AND ${ARCH} STREQUAL "i686") + add_definitions(-march=pentiumpro) + endif (LINUX AND ${ARCH} STREQUAL "i686") + +else (STANDALONE) + set(${ARCH}_linux_INCLUDES + ELFIO + atk-1.0 + glib-2.0 + gstreamer-0.10 + gtk-2.0 + llfreetype2 + pango-1.0 + ) +endif (STANDALONE) + +if(SERVER) + include_directories(${LIBS_PREBUILT_DIR}/include/havok) +endif(SERVER) diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake new file mode 100644 index 0000000000..c495b7f7c6 --- /dev/null +++ b/indra/cmake/APR.cmake @@ -0,0 +1,53 @@ +# -*- cmake -*- + +include(BerkeleyDB) +include(Linking) + +set(APR_FIND_QUIETLY ON) +set(APR_FIND_REQUIRED ON) + +set(APRUTIL_FIND_QUIETLY ON) +set(APRUTIL_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindAPR) +else (STANDALONE) + if (WINDOWS) + set(WINLIBS_PREBUILT_DEBUG_DIR + ${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug + ) + set(WINLIBS_PREBUILT_RELEASE_DIR + ${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release + ) + set(APR_LIBRARIES + debug ${WINLIBS_PREBUILT_DEBUG_DIR}/apr-1 + optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/apr-1 + ) + set(APRUTIL_LIBRARIES + debug ${WINLIBS_PREBUILT_DEBUG_DIR}/aprutil-1 + optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/aprutil-1 + ) + set(APRICONV_LIBRARIES + debug ${WINLIBS_PREBUILT_DEBUG_DIR}/apriconv-1 + optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/apriconv-1 + ) + elseif (DARWIN) + set(APR_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/apr-1 + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/apr-1 + ) + set(APRUTIL_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/aprutil-1 + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/aprutil-1 + ) + set(APRICONV_LIBRARIES apriconv-1) + else (WINDOWS) + set(APR_LIBRARIES apr-1) + set(APRUTIL_LIBRARIES aprutil-1) + endif (WINDOWS) + set(APR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/apr-1) + + if (LINUX AND VIEWER) + list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES}) + endif (LINUX AND VIEWER) +endif (STANDALONE) diff --git a/indra/cmake/Audio.cmake b/indra/cmake/Audio.cmake new file mode 100644 index 0000000000..895881141a --- /dev/null +++ b/indra/cmake/Audio.cmake @@ -0,0 +1,32 @@ +# -*- cmake -*- + +if (STANDALONE) + include(FindPkgConfig) + pkg_check_modules(OGG REQUIRED ogg) + pkg_check_modules(VORBIS REQUIRED vorbis) + pkg_check_modules(VORBISENC REQUIRED vorbisenc) + pkg_check_modules(VORBISFILE REQUIRED vorbisfile) +else (STANDALONE) + set(VORBIS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) + set(VORBISENC_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS}) + set(VORBISFILE_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS}) + + if (WINDOWS) + set(OGG_LIBRARIES ogg_static_mt) + set(VORBIS_LIBRARIES vorbis_static_mt) + set(VORBISENC_LIBRARIES vorbisenc_static_mt) + set(VORBISFILE_LIBRARIES vorbisfile_static_mt) + else (WINDOWS) + set(OGG_LIBRARIES ogg) + set(VORBIS_LIBRARIES vorbis) + set(VORBISENC_LIBRARIES vorbisenc) + set(VORBISFILE_LIBRARIES vorbisfile) + endif (WINDOWS) +endif (STANDALONE) + +link_directories( + ${VORBIS_LIBRARY_DIRS} + ${VORBISENC_LIBRARY_DIRS} + ${VORBISFILE_LIBRARY_DIRS} + ${OGG_LIBRARY_DIRS} + ) diff --git a/indra/cmake/BerkeleyDB.cmake b/indra/cmake/BerkeleyDB.cmake new file mode 100644 index 0000000000..d98e79179d --- /dev/null +++ b/indra/cmake/BerkeleyDB.cmake @@ -0,0 +1,11 @@ +# -*- cmake -*- + +set(DB_FIND_QUIETLY ON) +set(DB_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindBerkeleyDB) +else (STANDALONE) + set(DB_LIBRARIES db-4.2) + set(DB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake new file mode 100644 index 0000000000..40f23eb8ca --- /dev/null +++ b/indra/cmake/Boost.cmake @@ -0,0 +1,56 @@ +# -*- cmake -*- + +set(Boost_FIND_QUIETLY ON) +set(Boost_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindBoost) + + set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt) + set(BOOST_REGEX_LIBRARY boost_regex-mt) + set(BOOST_SIGNALS_LIBRARY boost_signals-mt) +else (STANDALONE) + set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) + + if (WINDOWS) + set(BOOST_VERSION 1_34_1) + if (MSVC71) + set(BOOST_PROGRAM_OPTIONS_LIBRARY + optimized libboost_program_options-vc71-mt-s-${BOOST_VERSION} + debug libboost_program_options-vc71-mt-sgd-${BOOST_VERSION}) + set(BOOST_REGEX_LIBRARY + optimized libboost_regex-vc71-mt-s-${BOOST_VERSION} + debug libboost_regex-vc71-mt-sgd-${BOOST_VERSION}) + set(BOOST_SIGNALS_LIBRARY + optimized libboost_signals-vc71-mt-s-${BOOST_VERSION} + debug libboost_signals-vc71-mt-sgd-${BOOST_VERSION}) + else (MSVC71) + set(BOOST_PROGRAM_OPTIONS_LIBRARY + optimized libboost_program_options-vc80-mt-s-${BOOST_VERSION} + debug libboost_program_options-vc80-mt-sgd-${BOOST_VERSION}) + set(BOOST_REGEX_LIBRARY + optimized libboost_regex-vc80-mt-s-${BOOST_VERSION} + debug libboost_regex-vc80-mt-sgd-${BOOST_VERSION}) + set(BOOST_SIGNALS_LIBRARY + optimized libboost_signals-vc80-mt-s-${BOOST_VERSION} + debug libboost_signals-vc80-mt-sgd-${BOOST_VERSION}) + endif (MSVC71) + elseif (DARWIN) + set(BOOST_PROGRAM_OPTIONS_LIBRARY + optimized boost_program_options-mt + debug boost_program_options-mt-d + ) + set(BOOST_REGEX_LIBRARY + optimized boost_regex-mt + debug boost_regex-mt-d + ) + set(BOOST_SIGNALS_LIBRARY + optimized boost_signals-mt + debug boost_signals-mt-d + ) + elseif (LINUX) + set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt) + set(BOOST_REGEX_LIBRARY boost_regex-mt) + set(BOOST_SIGNALS_LIBRARY boost_signals-mt) + endif (WINDOWS) +endif (STANDALONE) diff --git a/indra/cmake/BuildVersion.cmake b/indra/cmake/BuildVersion.cmake new file mode 100644 index 0000000000..60a519c9af --- /dev/null +++ b/indra/cmake/BuildVersion.cmake @@ -0,0 +1,18 @@ +# -*- cmake -*- + +include(Python) + +macro (build_version _target) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/build_version.py + llversion${_target}.h ${LLCOMMON_INCLUDE_DIRS} + OUTPUT_VARIABLE ${_target}_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if (${_target}_VERSION) + message(STATUS "Version of ${_target} is ${${_target}_VERSION}") + else (${_target}_VERSION) + message(SEND_ERROR "Could not determine ${_target} version") + endif (${_target}_VERSION) +endmacro (build_version) diff --git a/indra/cmake/CARes.cmake b/indra/cmake/CARes.cmake new file mode 100644 index 0000000000..4dfcf588c6 --- /dev/null +++ b/indra/cmake/CARes.cmake @@ -0,0 +1,21 @@ +# -*- cmake -*- +include(Linking) + +set(CARES_FIND_QUIETLY ON) +set(CARES_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindCARes) +else (STANDALONE) + if (WINDOWS) + set(CARES_LIBRARIES areslib) + elseif (DARWIN) + set(CARES_LIBRARIES + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/cares + debug ${ARCH_PREBUILT_DIRS_DEBUG}/cares + ) + else (WINDOWS) + set(CARES_LIBRARIES cares) + endif (WINDOWS) + set(CARES_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/ares) +endif (STANDALONE) diff --git a/indra/cmake/CMakeCopyIfDifferent.cmake b/indra/cmake/CMakeCopyIfDifferent.cmake new file mode 100644 index 0000000000..abbd1d0653 --- /dev/null +++ b/indra/cmake/CMakeCopyIfDifferent.cmake @@ -0,0 +1,41 @@ +# -*- cmake -*- +# Taken from http://www.cmake.org/Wiki/CMakeCopyIfDifferent +# Generates a rule to copy each source file from source directory to destination directory. +# +# Typical use - +# +# SET(SRC_FILES head1.h head2.h head3.h) +# COPY_IF_DIFFERENT( /from_dir /to_dir IncludeTargets ${SRC_FILES}) +# ADD_TARGET(CopyIncludes ALL DEPENDS ${IncludeTargets}) + +MACRO(COPY_IF_DIFFERENT FROM_DIR TO_DIR TARGETS) +# Macro to implement copy_if_different for a list of files +# Arguments - +# FROM_DIR - this is the source directory +# TO_DIR - this is the destination directory +# TARGETS - A variable to receive a list of targets +# FILES - names of the files to copy +# TODO: add globing. +SET(AddTargets "") +FOREACH(SRC ${ARGN}) + GET_FILENAME_COMPONENT(SRCFILE ${SRC} NAME) + IF("${FROM_DIR}" STREQUAL "") + SET(FROM ${SRC}) + ELSE("${FROM_DIR}" STREQUAL "") + SET(FROM ${FROM_DIR}/${SRC}) + ENDIF("${FROM_DIR}" STREQUAL "") + IF("${TO_DIR}" STREQUAL "") + SET(TO ${SRCFILE}) + ELSE("${TO_DIR}" STREQUAL "") + SET(TO ${TO_DIR}/${SRCFILE}) + ENDIF("${TO_DIR}" STREQUAL "") + ADD_CUSTOM_COMMAND( + OUTPUT "${TO}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FROM} ${TO} + DEPENDS ${FROM} + COMMENT "Copying ${SRCFILE} ${TO_DIR}" + ) + SET(AddTargets ${AddTargets} ${TARGET}) +ENDFOREACH(SRC ${ARGN}) +SET(${TARGETS} ${AddTargets}) +ENDMACRO(COPY_IF_DIFFERENT FROM_DIR TO_DIR TARGETS) diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt new file mode 100644 index 0000000000..9cc34ea159 --- /dev/null +++ b/indra/cmake/CMakeLists.txt @@ -0,0 +1,95 @@ +# -*- cmake -*- + +include(00-Common) + +project(cmake) + +set(cmake_SOURCE_FILES + CMakeLists.txt + + 00-Common.cmake + APR.cmake + Audio.cmake + BerkeleyDB.cmake + Boost.cmake + BuildVersion.cmake + CARes.cmake + CURL.cmake + CMakeCopyIfDifferent.cmake + DirectX.cmake + ELFIO.cmake + EXPAT.cmake + FindAPR.cmake + FindBerkeleyDB.cmake + FindCARes.cmake + FindELFIO.cmake + FindGooglePerfTools.cmake + FindMySQL.cmake + FindOpenJPEG.cmake + FindXmlRpcEpi.cmake + FMOD.cmake + FreeType.cmake + GStreamer.cmake + GooglePerfTools.cmake + JPEG.cmake + LLAudio.cmake + LLCharacter.cmake + LLCommon.cmake + LLCrashLogger.cmake + LLDatabase.cmake + LLImage.cmake + LLImageJ2COJ.cmake + LLInventory.cmake + LLKDU.cmake + LLMath.cmake + LLMedia.cmake + LLMessage.cmake + LLPhysics.cmake + LLPrimitive.cmake + LLRender.cmake + LLScene.cmake + LLUI.cmake + LLVFS.cmake + LLWindow.cmake + LLXML.cmake + LScript.cmake + Linking.cmake + Mozlib.cmake + MySQL.cmake + NDOF.cmake + OpenGL.cmake + OpenJPEG.cmake + OpenSSL.cmake + PNG.cmake + Python.cmake + QuickTime.cmake + Smartheap.cmake + TemplateCheck.cmake + UI.cmake + UnixInstall.cmake + Variables.cmake + XmlRpcEpi.cmake + ZLIB.cmake + ) + +source_group("Shared Rules" FILES ${cmake_SOURCE_FILES}) + +set(master_SOURCE_FILES + ../CMakeLists.txt + ../develop.py + ) + +if (SERVER) + list(APPEND master_SOURCE_FILES ../Server.cmake) +endif (SERVER) + +source_group("Master Rules" FILES ${master_SOURCE_FILES}) + +set_source_files_properties(${cmake_SOURCE_FILES} ${master_SOURCE_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +add_library(cmake + cmake_dummy.cpp + ${cmake_SOURCE_FILES} + ${master_SOURCE_FILES} + ) diff --git a/indra/cmake/CURL.cmake b/indra/cmake/CURL.cmake new file mode 100644 index 0000000000..bce4a85d16 --- /dev/null +++ b/indra/cmake/CURL.cmake @@ -0,0 +1,17 @@ +# -*- cmake -*- + +set(CURL_FIND_QUIETLY ON) +set(CURL_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindCURL) +else (STANDALONE) + if (WINDOWS) + set(CURL_LIBRARIES + debug libcurld + optimized libcurl) + else (WINDOWS) + set(CURL_LIBRARIES curl) + endif (WINDOWS) + set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/indra/cmake/DirectX.cmake b/indra/cmake/DirectX.cmake new file mode 100644 index 0000000000..a011b318d5 --- /dev/null +++ b/indra/cmake/DirectX.cmake @@ -0,0 +1,34 @@ +# -*- cmake -*- + +if (VIEWER AND WINDOWS) + find_path(DIRECTX_INCLUDE_DIR dxdiag.h + "$ENV{DXSDK_DIR}/Include" + "C:/Program Files/Microsoft DirectX SDK (March 2008)/Include" + "C:/Program Files/Microsoft DirectX SDK (November 2007)/Include" + "C:/DX90SDK/Include" + ) + if (DIRECTX_INCLUDE_DIR) + include_directories(${DIRECTX_INCLUDE_DIR}) + if (DIRECTX_FIND_QUIETLY) + message(STATUS "Found DirectX include: ${DIRECTX_INCLUDE_DIR}") + endif (DIRECTX_FIND_QUIETLY) + else (DIRECTX_INCLUDE_DIR) + message(FATAL_ERROR "Could not find DirectX SDK Include") + endif (DIRECTX_INCLUDE_DIR) + + + find_path(DIRECTX_LIBRARY_DIR dxguid.lib + "$ENV{DXSDK_DIR}/Lib/x86" + "C:/Program Files/Microsoft DirectX SDK (March 2008)/Lib/x86" + "C:/Program Files/Microsoft DirectX SDK (November 2007)/Lib/x86" + "C:/DX90SDK/Lib" + ) + if (DIRECTX_LIBRARY_DIR) + if (DIRECTX_FIND_QUIETLY) + message(STATUS "Found DirectX include: ${DIRECTX_LIBRARY_DIR}") + endif (DIRECTX_FIND_QUIETLY) + else (DIRECTX_LIBRARY_DIR) + message(FATAL_ERROR "Could not find DirectX SDK Libraries") + endif (DIRECTX_LIBRARY_DIR) + +endif (VIEWER AND WINDOWS) diff --git a/indra/cmake/ELFIO.cmake b/indra/cmake/ELFIO.cmake new file mode 100644 index 0000000000..2805842cbc --- /dev/null +++ b/indra/cmake/ELFIO.cmake @@ -0,0 +1,16 @@ +# -*- cmake -*- + +set(ELFIO_FIND_QUIETLY ON) + +if (STANDALONE) + include(FindELFIO) +elseif (LINUX) + set(ELFIO_LIBRARIES ELFIO) + set(ELFIO_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) + +if (ELFIO_FOUND) + add_definitions(-DLL_ELFBIN=1) +else (ELFIO_FOUND) + set(ELFIO_INCLUDE_DIR "") +endif (ELFIO_FOUND) diff --git a/indra/cmake/EXPAT.cmake b/indra/cmake/EXPAT.cmake new file mode 100644 index 0000000000..3010d63532 --- /dev/null +++ b/indra/cmake/EXPAT.cmake @@ -0,0 +1,15 @@ +# -*- cmake -*- + +set(EXPAT_FIND_QUIETLY ON) +set(EXPAT_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindEXPAT) +else (STANDALONE) + if (WINDOWS) + set(EXPAT_LIBRARIES libexpatMT) + else (WINDOWS) + set(EXPAT_LIBRARIES expat) + endif (WINDOWS) + set(EXPAT_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/indra/cmake/FMOD.cmake b/indra/cmake/FMOD.cmake new file mode 100644 index 0000000000..781c8babbe --- /dev/null +++ b/indra/cmake/FMOD.cmake @@ -0,0 +1,47 @@ +# -*- cmake -*- + +find_library(FMOD_LIBRARY + NAMES fmod fmodvc fmod-3.75 + PATHS + optimized ${ARCH_PREBUILT_DIRS_RELEASE} + debug ${ARCH_PREBUILT_DIRS_DEBUG} + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release_client + ) + +if (NOT FMOD_LIBRARY) + set(FMOD_SDK_DIR CACHE PATH "Path to the FMOD SDK.") + if (FMOD_SDK_DIR) + find_library(FMOD_LIBRARY + NAMES fmodvc fmod-3.75 fmod + PATHS + ${FMOD_SDK_DIR}/api/lib + ${FMOD_SDK_DIR}/api + ${FMOD_SDK_DIR}/lib + ${FMOD_SDK_DIR} + ) + endif (FMOD_SDK_DIR) +endif (NOT FMOD_LIBRARY) + +find_path(FMOD_INCLUDE_DIR fmod.h + ${LIBS_PREBUILT_DIR}/include + ${FMOD_SDK_DIR}/api/inc + ${FMOD_SDK_DIR}/inc + ${FMOD_SDK_DIR} + ) + +if (FMOD_LIBRARY AND FMOD_INCLUDE_DIR) + set(FMOD ON CACHE BOOL "Use closed source FMOD sound library.") +else (FMOD_LIBRARY AND FMOD_INCLUDE_DIR) + set(FMOD_LIBRARY "") + set(FMOD_INCLUDE_DIR "") + if (FMOD) + message(STATUS "No support for FMOD audio (need to set FMOD_SDK_DIR?)") + endif (FMOD) + set(FMOD OFF CACHE BOOL "Use closed source FMOD sound library.") +endif (FMOD_LIBRARY AND FMOD_INCLUDE_DIR) + +if (FMOD) + message(STATUS "Building with FMOD audio support") +endif (FMOD) diff --git a/indra/cmake/FindAPR.cmake b/indra/cmake/FindAPR.cmake new file mode 100644 index 0000000000..906b6c9452 --- /dev/null +++ b/indra/cmake/FindAPR.cmake @@ -0,0 +1,94 @@ +# -*- cmake -*- + +# - Find Apache Portable Runtime +# Find the APR includes and libraries +# This module defines +# APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc. +# APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR. +# APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR. +# also defined, but not for general use are +# APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library. + +# APR first. + +FIND_PATH(APR_INCLUDE_DIR apr.h +/usr/local/include/apr-1 +/usr/local/include/apr-1.0 +/usr/include/apr-1 +/usr/include/apr-1.0 +) + +SET(APR_NAMES ${APR_NAMES} apr-1) +FIND_LIBRARY(APR_LIBRARY + NAMES ${APR_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (APR_LIBRARY AND APR_INCLUDE_DIR) + SET(APR_LIBRARIES ${APR_LIBRARY}) + SET(APR_FOUND "YES") +ELSE (APR_LIBRARY AND APR_INCLUDE_DIR) + SET(APR_FOUND "NO") +ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR) + + +IF (APR_FOUND) + IF (NOT APR_FIND_QUIETLY) + MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}") + ENDIF (NOT APR_FIND_QUIETLY) +ELSE (APR_FOUND) + IF (APR_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find APR library") + ENDIF (APR_FIND_REQUIRED) +ENDIF (APR_FOUND) + +# Deprecated declarations. +SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH) + +MARK_AS_ADVANCED( + APR_LIBRARY + APR_INCLUDE_DIR + ) + +# Next, APRUTIL. + +FIND_PATH(APRUTIL_INCLUDE_DIR apu.h +/usr/local/include/apr-1 +/usr/local/include/apr-1.0 +/usr/include/apr-1 +/usr/include/apr-1.0 +) + +SET(APRUTIL_NAMES ${APRUTIL_NAMES} aprutil-1) +FIND_LIBRARY(APRUTIL_LIBRARY + NAMES ${APRUTIL_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) + SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY}) + SET(APRUTIL_FOUND "YES") +ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) + SET(APRUTIL_FOUND "NO") +ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) + + +IF (APRUTIL_FOUND) + IF (NOT APRUTIL_FIND_QUIETLY) + MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}") + ENDIF (NOT APRUTIL_FIND_QUIETLY) +ELSE (APRUTIL_FOUND) + IF (APRUTIL_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find APRUTIL library") + ENDIF (APRUTIL_FIND_REQUIRED) +ENDIF (APRUTIL_FOUND) + +# Deprecated declarations. +SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH) + +MARK_AS_ADVANCED( + APRUTIL_LIBRARY + APRUTIL_INCLUDE_DIR + ) diff --git a/indra/cmake/FindBerkeleyDB.cmake b/indra/cmake/FindBerkeleyDB.cmake new file mode 100644 index 0000000000..2d633c74ec --- /dev/null +++ b/indra/cmake/FindBerkeleyDB.cmake @@ -0,0 +1,50 @@ +# -*- cmake -*- + +# - Find BerkeleyDB +# Find the BerkeleyDB includes and library +# This module defines +# DB_INCLUDE_DIR, where to find db.h, etc. +# DB_LIBRARIES, the libraries needed to use BerkeleyDB. +# DB_FOUND, If false, do not try to use BerkeleyDB. +# also defined, but not for general use are +# DB_LIBRARY, where to find the BerkeleyDB library. + +FIND_PATH(DB_INCLUDE_DIR db.h +/usr/local/include/db4 +/usr/local/include +/usr/include/db4 +/usr/include +) + +SET(DB_NAMES ${DB_NAMES} db) +FIND_LIBRARY(DB_LIBRARY + NAMES ${DB_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (DB_LIBRARY AND DB_INCLUDE_DIR) + SET(DB_LIBRARIES ${DB_LIBRARY}) + SET(DB_FOUND "YES") +ELSE (DB_LIBRARY AND DB_INCLUDE_DIR) + SET(DB_FOUND "NO") +ENDIF (DB_LIBRARY AND DB_INCLUDE_DIR) + + +IF (DB_FOUND) + IF (NOT DB_FIND_QUIETLY) + MESSAGE(STATUS "Found BerkeleyDB: ${DB_LIBRARIES}") + ENDIF (NOT DB_FIND_QUIETLY) +ELSE (DB_FOUND) + IF (DB_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find BerkeleyDB library") + ENDIF (DB_FIND_REQUIRED) +ENDIF (DB_FOUND) + +# Deprecated declarations. +SET (NATIVE_DB_INCLUDE_PATH ${DB_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_DB_LIB_PATH ${DB_LIBRARY} PATH) + +MARK_AS_ADVANCED( + DB_LIBRARY + DB_INCLUDE_DIR + ) diff --git a/indra/cmake/FindCARes.cmake b/indra/cmake/FindCARes.cmake new file mode 100644 index 0000000000..1ed5b32913 --- /dev/null +++ b/indra/cmake/FindCARes.cmake @@ -0,0 +1,48 @@ +# -*- cmake -*- + +# - Find c-ares +# Find the c-ares includes and library +# This module defines +# CARES_INCLUDE_DIR, where to find ares.h, etc. +# CARES_LIBRARIES, the libraries needed to use c-ares. +# CARES_FOUND, If false, do not try to use c-ares. +# also defined, but not for general use are +# CARES_LIBRARY, where to find the c-ares library. + +FIND_PATH(CARES_INCLUDE_DIR ares.h +/usr/local/include +/usr/include +) + +SET(CARES_NAMES ${CARES_NAMES} cares) +FIND_LIBRARY(CARES_LIBRARY + NAMES ${CARES_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (CARES_LIBRARY AND CARES_INCLUDE_DIR) + SET(CARES_LIBRARIES ${CARES_LIBRARY}) + SET(CARES_FOUND "YES") +ELSE (CARES_LIBRARY AND CARES_INCLUDE_DIR) + SET(CARES_FOUND "NO") +ENDIF (CARES_LIBRARY AND CARES_INCLUDE_DIR) + + +IF (CARES_FOUND) + IF (NOT CARES_FIND_QUIETLY) + MESSAGE(STATUS "Found c-ares: ${CARES_LIBRARIES}") + ENDIF (NOT CARES_FIND_QUIETLY) +ELSE (CARES_FOUND) + IF (CARES_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find c-ares library") + ENDIF (CARES_FIND_REQUIRED) +ENDIF (CARES_FOUND) + +# Deprecated declarations. +SET (NATIVE_CARES_INCLUDE_PATH ${CARES_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_CARES_LIB_PATH ${CARES_LIBRARY} PATH) + +MARK_AS_ADVANCED( + CARES_LIBRARY + CARES_INCLUDE_DIR + ) diff --git a/indra/cmake/FindELFIO.cmake b/indra/cmake/FindELFIO.cmake new file mode 100644 index 0000000000..8a5421ab9c --- /dev/null +++ b/indra/cmake/FindELFIO.cmake @@ -0,0 +1,48 @@ +# -*- cmake -*- + +# - Find ELFIO +# Find the ELFIO includes and library +# This module defines +# ELFIO_INCLUDE_DIR, where to find elfio.h, etc. +# ELFIO_LIBRARIES, the libraries needed to use ELFIO. +# ELFIO_FOUND, If false, do not try to use ELFIO. +# also defined, but not for general use are +# ELFIO_LIBRARY, where to find the ELFIO library. + +FIND_PATH(ELFIO_INCLUDE_DIR ELFIO/ELFIO.h +/usr/local/include +/usr/include +) + +SET(ELFIO_NAMES ${ELFIO_NAMES} ELFIO) +FIND_LIBRARY(ELFIO_LIBRARY + NAMES ${ELFIO_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) + SET(ELFIO_LIBRARIES ${ELFIO_LIBRARY}) + SET(ELFIO_FOUND "YES") +ELSE (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) + SET(ELFIO_FOUND "NO") +ENDIF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) + + +IF (ELFIO_FOUND) + IF (NOT ELFIO_FIND_QUIETLY) + MESSAGE(STATUS "Found ELFIO: ${ELFIO_LIBRARIES}") + ENDIF (NOT ELFIO_FIND_QUIETLY) +ELSE (ELFIO_FOUND) + IF (ELFIO_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find ELFIO library") + ENDIF (ELFIO_FIND_REQUIRED) +ENDIF (ELFIO_FOUND) + +# Deprecated declarations. +SET (NATIVE_ELFIO_INCLUDE_PATH ${ELFIO_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_ELFIO_LIB_PATH ${ELFIO_LIBRARY} PATH) + +MARK_AS_ADVANCED( + ELFIO_LIBRARY + ELFIO_INCLUDE_DIR + ) diff --git a/indra/cmake/FindGooglePerfTools.cmake b/indra/cmake/FindGooglePerfTools.cmake new file mode 100644 index 0000000000..bb125d538e --- /dev/null +++ b/indra/cmake/FindGooglePerfTools.cmake @@ -0,0 +1,66 @@ +# -*- cmake -*- + +# - Find Google perftools +# Find the Google perftools includes and libraries +# This module defines +# GOOGLE_PERFTOOLS_INCLUDE_DIR, where to find heap-profiler.h, etc. +# GOOGLE_PERFTOOLS_FOUND, If false, do not try to use Google perftools. +# also defined for general use are +# TCMALLOC_LIBRARIES, where to find the tcmalloc library. +# STACKTRACE_LIBRARIES, where to find the stacktrace library. +# PROFILER_LIBRARIES, where to find the profiler library. + +FIND_PATH(GOOGLE_PERFTOOLS_INCLUDE_DIR google/heap-profiler.h +/usr/local/include +/usr/include +) + +SET(TCMALLOC_NAMES ${TCMALLOC_NAMES} tcmalloc) +FIND_LIBRARY(TCMALLOC_LIBRARY + NAMES ${TCMALLOC_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + SET(TCMALLOC_LIBRARIES ${TCMALLOC_LIBRARY}) + SET(GOOGLE_PERFTOOLS_FOUND "YES") +ELSE (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + SET(GOOGLE_PERFTOOLS_FOUND "NO") +ENDIF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + +SET(STACKTRACE_NAMES ${STACKTRACE_NAMES} stacktrace) +FIND_LIBRARY(STACKTRACE_LIBRARY + NAMES ${STACKTRACE_LIBRARY} + PATHS /usr/lib /usr/local/lib + ) + +IF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + SET(STACKTRACE_LIBRARIES ${STACKTRACE_LIBRARY}) +ENDIF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + +SET(PROFILER_NAMES ${PROFILER_NAMES} profiler) +FIND_LIBRARY(PROFILER_LIBRARY + NAMES ${PROFILER_LIBRARY} + PATHS /usr/lib /usr/local/lib + ) + +IF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + SET(PROFILER_LIBRARIES ${PROFILER_LIBRARY}) +ENDIF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + +IF (GOOGLE_PERFTOOLS_FOUND) + IF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY) + MESSAGE(STATUS "Found Google perftools: ${GOOGLE_PERFTOOLS_LIBRARIES}") + ENDIF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY) +ELSE (GOOGLE_PERFTOOLS_FOUND) + IF (GOOGLE_PERFTOOLS_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Google perftools library") + ENDIF (GOOGLE_PERFTOOLS_FIND_REQUIRED) +ENDIF (GOOGLE_PERFTOOLS_FOUND) + +MARK_AS_ADVANCED( + TCMALLOC_LIBRARY + STACKTRACE_LIBRARY + PROFILER_LIBRARY + GOOGLE_PERFTOOLS_INCLUDE_DIR + ) diff --git a/indra/cmake/FindMySQL.cmake b/indra/cmake/FindMySQL.cmake new file mode 100644 index 0000000000..431940328f --- /dev/null +++ b/indra/cmake/FindMySQL.cmake @@ -0,0 +1,48 @@ +# -*- cmake -*- + +# - Find MySQL +# Find the MySQL includes and library +# This module defines +# MYSQL_INCLUDE_DIR, where to find mysql.h, etc. +# MYSQL_LIBRARIES, the libraries needed to use Mysql. +# MYSQL_FOUND, If false, do not try to use Mysql. +# also defined, but not for general use are +# MYSQL_LIBRARY, where to find the Mysql library. + +FIND_PATH(MYSQL_INCLUDE_DIR mysql/mysql.h +/usr/local/include +/usr/include +) + +SET(MYSQL_NAMES ${MYSQL_NAMES} mysqlclient) +FIND_LIBRARY(MYSQL_LIBRARY + NAMES ${MYSQL_NAMES} + PATHS /usr/lib/mysql /usr/lib /usr/local/lib/mysql /usr/local/lib + ) + +IF (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR) + SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY}) + SET(MYSQL_FOUND "YES") +ELSE (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR) + SET(MYSQL_FOUND "NO") +ENDIF (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR) + + +IF (MYSQL_FOUND) + IF (NOT MYSQL_FIND_QUIETLY) + MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARIES}") + ENDIF (NOT MYSQL_FIND_QUIETLY) +ELSE (MYSQL_FOUND) + IF (MYSQL_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find MySQL library") + ENDIF (MYSQL_FIND_REQUIRED) +ENDIF (MYSQL_FOUND) + +# Deprecated declarations. +SET (NATIVE_MYSQL_INCLUDE_PATH ${MYSQL_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_MYSQL_LIB_PATH ${MYSQL_LIBRARY} PATH) + +MARK_AS_ADVANCED( + MYSQL_LIBRARY + MYSQL_INCLUDE_DIR + ) diff --git a/indra/cmake/FindOpenJPEG.cmake b/indra/cmake/FindOpenJPEG.cmake new file mode 100644 index 0000000000..949384eec4 --- /dev/null +++ b/indra/cmake/FindOpenJPEG.cmake @@ -0,0 +1,50 @@ +# -*- cmake -*- + +# - Find OpenJPEG +# Find the OpenJPEG includes and library +# This module defines +# OPENJPEG_INCLUDE_DIR, where to find openjpeg.h, etc. +# OPENJPEG_LIBRARIES, the libraries needed to use OpenJPEG. +# OPENJPEG_FOUND, If false, do not try to use OpenJPEG. +# also defined, but not for general use are +# OPENJPEG_LIBRARY, where to find the OpenJPEG library. + +FIND_PATH(OPENJPEG_INCLUDE_DIR openjpeg.h +/usr/local/include/openjpeg +/usr/local/include +/usr/include/openjpeg +/usr/include +) + +SET(OPENJPEG_NAMES ${OPENJPEG_NAMES} openjpeg) +FIND_LIBRARY(OPENJPEG_LIBRARY + NAMES ${OPENJPEG_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR) + SET(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY}) + SET(OPENJPEG_FOUND "YES") +ELSE (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR) + SET(OPENJPEG_FOUND "NO") +ENDIF (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR) + + +IF (OPENJPEG_FOUND) + IF (NOT OPENJPEG_FIND_QUIETLY) + MESSAGE(STATUS "Found OpenJPEG: ${OPENJPEG_LIBRARIES}") + ENDIF (NOT OPENJPEG_FIND_QUIETLY) +ELSE (OPENJPEG_FOUND) + IF (OPENJPEG_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find OpenJPEG library") + ENDIF (OPENJPEG_FIND_REQUIRED) +ENDIF (OPENJPEG_FOUND) + +# Deprecated declarations. +SET (NATIVE_OPENJPEG_INCLUDE_PATH ${OPENJPEG_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_OPENJPEG_LIB_PATH ${OPENJPEG_LIBRARY} PATH) + +MARK_AS_ADVANCED( + OPENJPEG_LIBRARY + OPENJPEG_INCLUDE_DIR + ) diff --git a/indra/cmake/FindXmlRpcEpi.cmake b/indra/cmake/FindXmlRpcEpi.cmake new file mode 100644 index 0000000000..ba217e7467 --- /dev/null +++ b/indra/cmake/FindXmlRpcEpi.cmake @@ -0,0 +1,48 @@ +# -*- cmake -*- + +# - Find XMLRPC-EPI +# Find the XMLRPC-EPI includes and library +# This module defines +# XMLRPCEPI_INCLUDE_DIR, where to find jpeglib.h, etc. +# XMLRPCEPI_LIBRARIES, the libraries needed to use XMLRPC-EPI. +# XMLRPCEPI_FOUND, If false, do not try to use XMLRPC-EPI. +# also defined, but not for general use are +# XMLRPCEPI_LIBRARY, where to find the XMLRPC-EPI library. + +FIND_PATH(XMLRPCEPI_INCLUDE_DIR xmlrpc-epi/xmlrpc.h +/usr/local/include +/usr/include +) + +SET(XMLRPCEPI_NAMES ${XMLRPCEPI_NAMES} xmlrpc-epi) +FIND_LIBRARY(XMLRPCEPI_LIBRARY + NAMES ${XMLRPCEPI_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR) + SET(XMLRPCEPI_LIBRARIES ${XMLRPCEPI_LIBRARY}) + SET(XMLRPCEPI_FOUND "YES") +ELSE (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR) + SET(XMLRPCEPI_FOUND "NO") +ENDIF (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR) + + +IF (XMLRPCEPI_FOUND) + IF (NOT XMLRPCEPI_FIND_QUIETLY) + MESSAGE(STATUS "Found XMLRPC-EPI: ${XMLRPCEPI_LIBRARIES}") + ENDIF (NOT XMLRPCEPI_FIND_QUIETLY) +ELSE (XMLRPCEPI_FOUND) + IF (XMLRPCEPI_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find XMLRPC-EPI library") + ENDIF (XMLRPCEPI_FIND_REQUIRED) +ENDIF (XMLRPCEPI_FOUND) + +# Deprecated declarations. +SET (NATIVE_XMLRPCEPI_INCLUDE_PATH ${XMLRPCEPI_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_XMLRPCEPI_LIB_PATH ${XMLRPCEPI_LIBRARY} PATH) + +MARK_AS_ADVANCED( + XMLRPCEPI_LIBRARY + XMLRPCEPI_INCLUDE_DIR + ) diff --git a/indra/cmake/FreeType.cmake b/indra/cmake/FreeType.cmake new file mode 100644 index 0000000000..064135bcd1 --- /dev/null +++ b/indra/cmake/FreeType.cmake @@ -0,0 +1,18 @@ +# -*- cmake -*- + +if (STANDALONE) + include(FindPkgConfig) + + pkg_check_modules(FREETYPE REQUIRED freetype2) +else (STANDALONE) + if (LINUX) + set(FREETYPE_INCLUDE_DIRS + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) + else (LINUX) + set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) + endif (LINUX) + + set(FREETYPE_LIBRARIES freetype) +endif (STANDALONE) + +link_directories(${FREETYPE_LIBRARY_DIRS}) diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake new file mode 100644 index 0000000000..61a2631a08 --- /dev/null +++ b/indra/cmake/GooglePerfTools.cmake @@ -0,0 +1,26 @@ +# -*- cmake -*- + +if (STANDALONE) + include(FindGooglePerfTools) +else (STANDALONE) + if (LINUX) + set(TCMALLOC_LIBRARIES tcmalloc) + set(STACKTRACE_LIBRARIES stacktrace) + set(PROFILER_LIBRARIES profiler) + set(GOOGLE_PERFTOOLS_INCLUDE_DIR + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) + set(GOOGLE_PERFTOOLS_FOUND "YES") + endif (LINUX) +endif (STANDALONE) + +if (GOOGLE_PERFTOOLS_FOUND) + set(USE_GOOGLE_PERFTOOLS ON CACHE BOOL "Build with Google PerfTools support.") +endif (GOOGLE_PERFTOOLS_FOUND) + +if (USE_GOOGLE_PERFTOOLS) + set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1) + include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR}) + set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES} ${STACKTRACE_LIBRARIES}) +else (USE_GOOGLE_PERFTOOLS) + set(TCMALLOC_FLAG -ULL_USE_TCMALLOC) +endif (USE_GOOGLE_PERFTOOLS) diff --git a/indra/cmake/JPEG.cmake b/indra/cmake/JPEG.cmake new file mode 100644 index 0000000000..18bdd8bc46 --- /dev/null +++ b/indra/cmake/JPEG.cmake @@ -0,0 +1,22 @@ +# -*- cmake -*- + +include(Linking) +set(JPEG_FIND_QUIETLY ON) +set(JPEG_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindJPEG) +else (STANDALONE) + if (LINUX) + set(JPEG_LIBRARIES jpeg) + elseif (DARWIN) + set(JPEG_LIBRARIES + lljpeg + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/lljpeg + debug ${ARCH_PREBUILT_DIRS_DEBUG}/lljpeg + ) + elseif (WINDOWS) + set(JPEG_LIBRARIES jpeglib_6b) + endif (LINUX) + set(JPEG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/indra/cmake/LLAudio.cmake b/indra/cmake/LLAudio.cmake new file mode 100644 index 0000000000..7b9f2544dd --- /dev/null +++ b/indra/cmake/LLAudio.cmake @@ -0,0 +1,15 @@ +# -*- cmake -*- + +include(Audio) + +set(LLAUDIO_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llaudio + ) + +set(LLAUDIO_LIBRARIES + llaudio + ${VORBISENC_LIBRARIES} + ${VORBISFILE_LIBRARIES} + ${VORBIS_LIBRARIES} + ${OGG_LIBRARIES} + ) diff --git a/indra/cmake/LLCharacter.cmake b/indra/cmake/LLCharacter.cmake new file mode 100644 index 0000000000..c74092cdd5 --- /dev/null +++ b/indra/cmake/LLCharacter.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLCHARACTER_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llcharacter + ) + +set(LLCHARACTER_LIBRARIES + llcharacter + ) diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake new file mode 100644 index 0000000000..f4b251ebc8 --- /dev/null +++ b/indra/cmake/LLCommon.cmake @@ -0,0 +1,21 @@ +# -*- cmake -*- + +include(APR) +include(Boost) +include(EXPAT) +include(ZLIB) + +set(LLCOMMON_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llcommon + ${APRUTIL_INCLUDE_DIR} + ${APR_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} + ) + +set(LLCOMMON_LIBRARIES + llcommon + ${APRUTIL_LIBRARIES} + ${APR_LIBRARIES} + ${EXPAT_LIBRARIES} + ${ZLIB_LIBRARIES} + ) diff --git a/indra/cmake/LLCrashLogger.cmake b/indra/cmake/LLCrashLogger.cmake new file mode 100644 index 0000000000..7b362d084c --- /dev/null +++ b/indra/cmake/LLCrashLogger.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLCRASHLOGGER_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llcrashlogger + ) + +set(LLCRASHLOGGER_LIBRARIES + llcrashlogger + ) diff --git a/indra/cmake/LLDatabase.cmake b/indra/cmake/LLDatabase.cmake new file mode 100644 index 0000000000..c3cf62233c --- /dev/null +++ b/indra/cmake/LLDatabase.cmake @@ -0,0 +1,13 @@ +# -*- cmake -*- + +include(MySQL) + +set(LLDATABASE_INCLUDE_DIRS + ${LIBS_SERVER_DIR}/lldatabase + ${MYSQL_INCLUDE_DIR} + ) + +set(LLDATABASE_LIBRARIES + lldatabase + ${MYSQL_LIBRARIES} + ) diff --git a/indra/cmake/LLImage.cmake b/indra/cmake/LLImage.cmake new file mode 100644 index 0000000000..8874fa54a8 --- /dev/null +++ b/indra/cmake/LLImage.cmake @@ -0,0 +1,15 @@ +# -*- cmake -*- + +include(JPEG) +include(PNG) + +set(LLIMAGE_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llimage + ${JPEG_INCLUDE_DIRS} + ) + +set(LLIMAGE_LIBRARIES + llimage + ${JPEG_LIBRARIES} + ${PNG_LIBRARIES} + ) diff --git a/indra/cmake/LLImageJ2COJ.cmake b/indra/cmake/LLImageJ2COJ.cmake new file mode 100644 index 0000000000..91973e0896 --- /dev/null +++ b/indra/cmake/LLImageJ2COJ.cmake @@ -0,0 +1,8 @@ +# -*- cmake -*- + +include(OpenJPEG) + +set(LLIMAGEJ2COJ_LIBRARIES + llimagej2coj + ${OPENJPEG_LIBRARIES} + ) diff --git a/indra/cmake/LLInventory.cmake b/indra/cmake/LLInventory.cmake new file mode 100644 index 0000000000..7d5f492388 --- /dev/null +++ b/indra/cmake/LLInventory.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLINVENTORY_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llinventory + ) + +set(LLINVENTORY_LIBRARIES + llinventory + ) diff --git a/indra/cmake/LLKDU.cmake b/indra/cmake/LLKDU.cmake new file mode 100644 index 0000000000..6ec14d2588 --- /dev/null +++ b/indra/cmake/LLKDU.cmake @@ -0,0 +1,18 @@ +# -*- cmake -*- + +if (NOT STANDALONE AND EXISTS ${LIBS_CLOSED_DIR}/llkdu) + if (WINDOWS) + set(KDU_LIBRARY debug kdu_cored optimized kdu_core) + elseif (LINUX) + set(KDU_LIBRARY kdu_v42R) + else (WINDOWS) + set(KDU_LIBRARY kdu) + endif (WINDOWS) + + set(KDU_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include) + + set(LLKDU_LIBRARY llkdu) + set(LLKDU_STATIC_LIBRARY llkdu_static) + set(LLKDU_LIBRARIES ${LLKDU_LIBRARY}) + set(LLKDU_STATIC_LIBRARIES ${LLKDU_STATIC_LIBRARY}) +endif (NOT STANDALONE AND EXISTS ${LIBS_CLOSED_DIR}/llkdu) diff --git a/indra/cmake/LLMath.cmake b/indra/cmake/LLMath.cmake new file mode 100644 index 0000000000..8afd45efc6 --- /dev/null +++ b/indra/cmake/LLMath.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLMATH_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llmath + ) + +set(LLMATH_LIBRARIES + llmath + ) diff --git a/indra/cmake/LLMessage.cmake b/indra/cmake/LLMessage.cmake new file mode 100644 index 0000000000..1cea03af2b --- /dev/null +++ b/indra/cmake/LLMessage.cmake @@ -0,0 +1,22 @@ +# -*- cmake -*- + +include(CARes) +include(CURL) +include(OpenSSL) +include(XmlRpcEpi) + +set(LLMESSAGE_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llmessage + ${CARES_INCLUDE_DIRS} + ${CURL_INCLUDE_DIRS} + ${OPENSSL_INCLUDE_DIRS} + ) + +set(LLMESSAGE_LIBRARIES + llmessage + ${CURL_LIBRARIES} + ${CARES_LIBRARIES} + ${OPENSSL_LIBRARIES} + ${CRYPTO_LIBRARIES} + ${XMLRPCEPI_LIBRARIES} + ) diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake new file mode 100644 index 0000000000..0426ae539a --- /dev/null +++ b/indra/cmake/LLPrimitive.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLPRIMITIVE_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llprimitive + ) + +set(LLPRIMITIVE_LIBRARIES + llprimitive + ) diff --git a/indra/cmake/LLRender.cmake b/indra/cmake/LLRender.cmake new file mode 100644 index 0000000000..8fda6c1d6a --- /dev/null +++ b/indra/cmake/LLRender.cmake @@ -0,0 +1,11 @@ +# -*- cmake -*- + +include(FreeType) + +set(LLRENDER_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llrender + ) + +set(LLRENDER_LIBRARIES + llrender + ) diff --git a/indra/cmake/LLScene.cmake b/indra/cmake/LLScene.cmake new file mode 100644 index 0000000000..d1c32b3199 --- /dev/null +++ b/indra/cmake/LLScene.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLSCENE_INCLUDE_DIRS + ${LIBS_SERVER_DIR}/llscene + ) + +set(LLSCENE_LIBRARIES + llscene + ) diff --git a/indra/cmake/LLUI.cmake b/indra/cmake/LLUI.cmake new file mode 100644 index 0000000000..d1287de018 --- /dev/null +++ b/indra/cmake/LLUI.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLUI_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llui + ) + +set(LLUI_LIBRARIES + llui + ) diff --git a/indra/cmake/LLVFS.cmake b/indra/cmake/LLVFS.cmake new file mode 100644 index 0000000000..5ce3d2578e --- /dev/null +++ b/indra/cmake/LLVFS.cmake @@ -0,0 +1,13 @@ +# -*- cmake -*- + +set(LLVFS_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llvfs + ) + +set(LLVFS_LIBRARIES llvfs) + +if (DARWIN) + include(CMakeFindFrameworks) + find_library(CARBON_LIBRARY Carbon) + list(APPEND LLVFS_LIBRARIES ${CARBON_LIBRARY}) +endif (DARWIN) diff --git a/indra/cmake/LLWindow.cmake b/indra/cmake/LLWindow.cmake new file mode 100644 index 0000000000..7a1ecaf0b1 --- /dev/null +++ b/indra/cmake/LLWindow.cmake @@ -0,0 +1,40 @@ +# -*- cmake -*- + +include(OpenGL) + +if (STANDALONE) + include(FindSDL) + + # This should be done by FindSDL. Sigh. + mark_as_advanced( + SDLMAIN_LIBRARY + SDL_INCLUDE_DIR + SDL_LIBRARY + ) +else (STANDALONE) + if (LINUX AND VIEWER) + set (SDL_FOUND TRUE) + set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/i686-linux) + set (SDL_LIBRARY SDL) + endif (LINUX AND VIEWER) +endif (STANDALONE) + +if (SDL_FOUND) + add_definitions(-DLL_SDL=1) + include_directories(${SDL_INCLUDE_DIR}) +endif (SDL_FOUND) + +set(LLWINDOW_INCLUDE_DIRS + ${GLEXT_INCLUDE_DIR} + ${LIBS_OPEN_DIR}/llwindow + ) + +if (SERVER AND LINUX) + set(LLWINDOW_LIBRARIES + llwindowheadless + ) +else (SERVER AND LINUX) + set(LLWINDOW_LIBRARIES + llwindow + ) +endif (SERVER AND LINUX) diff --git a/indra/cmake/LLXML.cmake b/indra/cmake/LLXML.cmake new file mode 100644 index 0000000000..1ce93c0abc --- /dev/null +++ b/indra/cmake/LLXML.cmake @@ -0,0 +1,13 @@ +# -*- cmake -*- + +include(EXPAT) + +set(LLXML_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llxml + ${EXPAT_INCLUDE_DIRS} + ) + +set(LLXML_LIBRARIES + llxml + ${EXPAT_LIBRARIES} + ) diff --git a/indra/cmake/LScript.cmake b/indra/cmake/LScript.cmake new file mode 100644 index 0000000000..227e4aaeda --- /dev/null +++ b/indra/cmake/LScript.cmake @@ -0,0 +1,13 @@ +# -*- cmake -*- + +set(LSCRIPT_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/lscript + ${LIBS_OPEN_DIR}/lscript/lscript_compile + ${LIBS_OPEN_DIR}/lscript/lscript_execute + ) + +set(LSCRIPT_LIBRARIES + lscript_compile + lscript_execute + lscript_library + ) diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake new file mode 100644 index 0000000000..3146016b9a --- /dev/null +++ b/indra/cmake/Linking.cmake @@ -0,0 +1,43 @@ +# -*- cmake -*- + +if (NOT STANDALONE) + if (WINDOWS) + set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib) + set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release) + set(ARCH_PREBUILT_DIRS_DEBUG ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/debug) + elseif (LINUX) + if (VIEWER) + set(ARCH_PREBUILT_DIRS + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release_client) + else (VIEWER) + set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release) + endif (VIEWER) + elseif (DARWIN) + set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release) + set(ARCH_PREBUILT_DIRS_DEBUG ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_debug) + endif (WINDOWS) +endif (NOT STANDALONE) + +link_directories(${ARCH_PREBUILT_DIRS}) + +if (LINUX) + set(DL_LIBRARY dl) + set(PTHREAD_LIBRARY pthread) +else (LINUX) + set(DL_LIBRARY "") + set(PTHREAD_LIBRARY "") +endif (LINUX) + +if (WINDOWS) + set(WINDOWS_LIBRARIES + ws2_32 + mswsock + psapi + winmm + netapi32 + ) +else (WINDOWS) + set(WINDOWS_LIBRARIES "") +endif (WINDOWS) + +mark_as_advanced(DL_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES) diff --git a/indra/cmake/MySQL.cmake b/indra/cmake/MySQL.cmake new file mode 100644 index 0000000000..7dc638ec57 --- /dev/null +++ b/indra/cmake/MySQL.cmake @@ -0,0 +1,20 @@ +# -*- cmake -*- +include(Linking) +# We don't prebuild our own MySQL client library. + +set(MYSQL_FIND_QUIETLY ON) +set(MYSQL_FIND_REQUIRED ON) + +if (WINDOWS) + set(MYSQL_LIBRARIES mysqlclient) + set(MYSQL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) +elseif (DARWIN) + set(MYSQL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) + set(MYSQL_LIBRARIES + optimized ${LIBS_PREBUILT_DIRS_RELEASE}/mysqlclient + debug ${LIBS_PREBUILT_DIRS_DEBUG}/mysqlclient + ) +else (WINDOWS) + set(MYSQL_FIND_REQUIRED) + include(FindMySQL) +endif (WINDOWS) diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake new file mode 100644 index 0000000000..22e9787653 --- /dev/null +++ b/indra/cmake/NDOF.cmake @@ -0,0 +1,11 @@ +# -*- cmake -*- + +if (WINDOWS OR DARWIN) + add_definitions(-DLIB_NDOF=1) +endif (WINDOWS OR DARWIN) + +if (WINDOWS) + set(NDOF_LIBRARY libndofdev) +elseif (DARWIN) + set(NDOF_LIBRARY ndofdev) +endif (WINDOWS) diff --git a/indra/cmake/OpenGL.cmake b/indra/cmake/OpenGL.cmake new file mode 100644 index 0000000000..7395d478fe --- /dev/null +++ b/indra/cmake/OpenGL.cmake @@ -0,0 +1,5 @@ +# -*- cmake -*- + +if (NOT STANDALONE) + set(GLEXT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) +endif (NOT STANDALONE)
\ No newline at end of file diff --git a/indra/cmake/OpenJPEG.cmake b/indra/cmake/OpenJPEG.cmake new file mode 100644 index 0000000000..32dcb505aa --- /dev/null +++ b/indra/cmake/OpenJPEG.cmake @@ -0,0 +1,20 @@ +# -*- cmake -*- + +set(OPENJPEG_FIND_QUIETLY ON) +set(OPENJPEG_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindOpenJPEG) +else (STANDALONE) + + if(WINDOWS) + # Windows has differently named release and debug openjpeg(d) libs. + set(OPENJPEG_LIBRARIES + debug openjpegd + optimized openjpeg) + else(WINDOWS) + set(OPENJPEG_LIBRARIES openjpeg) + endif(WINDOWS) + + set(OPENJPEG_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/openjpeg) +endif (STANDALONE) diff --git a/indra/cmake/OpenSSL.cmake b/indra/cmake/OpenSSL.cmake new file mode 100644 index 0000000000..715af3ba54 --- /dev/null +++ b/indra/cmake/OpenSSL.cmake @@ -0,0 +1,21 @@ +# -*- cmake -*- + +set(OpenSSL_FIND_QUIETLY ON) +set(OpenSSL_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindOpenSSL) +else (STANDALONE) + if (WINDOWS) + set(OPENSSL_LIBRARIES ssleay32 libeay32) + else (WINDOWS) + set(OPENSSL_LIBRARIES ssl) + endif (WINDOWS) + set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) +endif (STANDALONE) + +if (LINUX) + set(CRYPTO_LIBRARIES crypto) +elseif (DARWIN) + set(CRYPTO_LIBRARIES llcrypto) +endif (LINUX) diff --git a/indra/cmake/PNG.cmake b/indra/cmake/PNG.cmake new file mode 100644 index 0000000000..b4f7e5e66b --- /dev/null +++ b/indra/cmake/PNG.cmake @@ -0,0 +1,11 @@ +# -*- cmake -*- + +set(PNG_FIND_QUIETLY ON) +set(PNG_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindPNG) +else (STANDALONE) + set(PNG_LIBRARIES png12) + set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/indra/cmake/Prebuilt.cmake b/indra/cmake/Prebuilt.cmake new file mode 100644 index 0000000000..2f4fbd05c7 --- /dev/null +++ b/indra/cmake/Prebuilt.cmake @@ -0,0 +1,17 @@ +# -*- cmake -*- + +include(Python) + +macro (use_prebuilt_library _lib) + if (NOT STANDALONE) + exec_program(${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR} + ARGS + --install-dir=${LIBS_PREBUILT_DIR} ${_lib}/${ARCH} + RETURN_VALUE _installed + ) + if (NOT _installed) + message(FATAL_ERROR + "Failed to download or unpack prebuilt ${_lib} for ${ARCH}") + endif (NOT _installed) + endif (NOT STANDALONE) +endmacro (use_prebuilt_library _lib) diff --git a/indra/cmake/Python.cmake b/indra/cmake/Python.cmake new file mode 100644 index 0000000000..895b353dbd --- /dev/null +++ b/indra/cmake/Python.cmake @@ -0,0 +1,32 @@ +# -*- cmake -*- + +set(PYTHONINTERP_FOUND) + +if (WINDOWS) + # On Windows, explicitly avoid Cygwin Python. + + find_program(PYTHON_EXECUTABLE + NAMES python25.exe python23.exe python.exe + NO_DEFAULT_PATH # added so that cmake does not find cygwin python + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath] + ) +elseif (EXISTS /etc/debian_version) + # On Debian and Ubuntu, avoid Python 2.4 if possible. + + find_program(PYTHON_EXECUTABLE python2.5 python2.3 python PATHS /usr/bin) + + if (PYTHON_EXECUTABLE) + set(PYTHONINTERP_FOUND ON) + endif (PYTHON_EXECUTABLE) +else (WINDOWS) + include(FindPythonInterp) +endif (WINDOWS) + +if (NOT PYTHON_EXECUTABLE) + message(FATAL_ERROR "No Python interpreter found") +endif (NOT PYTHON_EXECUTABLE) + +mark_as_advanced(PYTHON_EXECUTABLE) diff --git a/indra/cmake/TemplateCheck.cmake b/indra/cmake/TemplateCheck.cmake new file mode 100644 index 0000000000..3b73dc82df --- /dev/null +++ b/indra/cmake/TemplateCheck.cmake @@ -0,0 +1,14 @@ +# -*- cmake -*- + +include(Python) + +macro (check_message_template _target) + add_custom_command( + TARGET ${_target} + PRE_LINK + COMMAND ${PYTHON_EXECUTABLE} + ARGS ${SCRIPTS_DIR}/template_verifier.py + --mode=development --cache_master + COMMENT "Verifying message template" + ) +endmacro (check_message_template) diff --git a/indra/cmake/UI.cmake b/indra/cmake/UI.cmake new file mode 100644 index 0000000000..7d2955ce36 --- /dev/null +++ b/indra/cmake/UI.cmake @@ -0,0 +1,62 @@ +# -*- cmake -*- + +if (STANDALONE) + include(FindPkgConfig) + + if (LINUX) + set(PKGCONFIG_PACKAGES + atk + cairo + gdk-2.0 + gdk-pixbuf-2.0 + glib-2.0 + gmodule-2.0 + gtk+-2.0 + gthread-2.0 + libpng + pango + pangoft2 + pangox + pangoxft + sdl + ) + endif (LINUX) + + foreach(pkg ${PKGCONFIG_PACKAGES}) + pkg_check_modules(${pkg} REQUIRED ${pkg}) + include_directories(${${pkg}_INCLUDE_DIRS}) + link_directories(${${pkg}_LIBRARY_DIRS}) + list(APPEND UI_LIBRARIES ${${pkg}_LIBRARIES}) + add_definitions(${${pkg}_CFLAGS_OTHERS}) + endforeach(pkg) +else (STANDALONE) + if (LINUX) + set(UI_LIBRARIES + atk-1.0 + gdk-x11-2.0 + gdk_pixbuf-2.0 + Xinerama + glib-2.0 + gmodule-2.0 + gobject-2.0 + gthread-2.0 + gtk-x11-2.0 + pango-1.0 + pangoft2-1.0 + pangox-1.0 + pangoxft-1.0 + ) + endif (LINUX) + + include_directories ( + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include + ${LIBS_PREBUILT_DIR}/include + ) + foreach(include ${${LL_ARCH}_INCLUDES}) + include_directories(${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/${include}) + endforeach(include) +endif (STANDALONE) + +if (LINUX) + add_definitions(-DLL_GTK=1 -DLL_X11=1) +endif (LINUX) diff --git a/indra/cmake/UnixInstall.cmake b/indra/cmake/UnixInstall.cmake new file mode 100644 index 0000000000..139be0a008 --- /dev/null +++ b/indra/cmake/UnixInstall.cmake @@ -0,0 +1,31 @@ +if (NOT ${viewer_VERSION}) + MESSAGE(FATAL_ERROR "Viewer version not known!") +endif (NOT ${viewer_VERSION}) + +set(INSTALL OFF CACHE BOOL + "Generate install target.") + +if (INSTALL) + set(INSTALL_PREFIX /usr CACHE PATH + "Top-level installation directory.") + + if (EXISTS /lib64) + set(_LIB lib64) + else (EXISTS /lib64) + set(_LIB lib) + endif (EXISTS /lib64) + + set(INSTALL_LIBRARY_DIR ${INSTALL_PREFIX}/${_LIB} CACHE PATH + "Installation directory for read-only shared files.") + + set(INSTALL_SHARE_DIR ${INSTALL_PREFIX}/share CACHE PATH + "Installation directory for read-only shared files.") + + set(APP_BINARY_DIR ${INSTALL_LIBRARY_DIR}/secondlife-${viewer_VERSION} + CACHE PATH + "Installation directory for binaries.") + + set(APP_SHARE_DIR ${INSTALL_SHARE_DIR}/secondlife-${viewer_VERSION} + CACHE PATH + "Installation directory for read-only data files.") +endif (INSTALL) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake new file mode 100644 index 0000000000..7e10f27418 --- /dev/null +++ b/indra/cmake/Variables.cmake @@ -0,0 +1,81 @@ +# -*- cmake -*- +# +# Definitions of variables used throughout the Second Life build +# process. +# +# Platform variables: +# +# DARWIN - Mac OS X +# LINUX - Linux +# WINDOWS - Windows +# +# What to build: +# +# VIEWER - viewer and other viewer-side components +# SERVER - simulator and other server-side bits + + +# Relative and absolute paths to subtrees. + +set(LIBS_CLOSED_PREFIX) +set(LIBS_OPEN_PREFIX) +set(LIBS_SERVER_PREFIX) +set(SCRIPTS_PREFIX ../scripts) +set(SERVER_PREFIX) +set(VIEWER_PREFIX) + +set(LIBS_CLOSED_DIR ${CMAKE_SOURCE_DIR}/${LIBS_CLOSED_PREFIX}) +set(LIBS_OPEN_DIR ${CMAKE_SOURCE_DIR}/${LIBS_OPEN_PREFIX}) +set(LIBS_SERVER_DIR ${CMAKE_SOURCE_DIR}/${LIBS_SERVER_PREFIX}) +set(SCRIPTS_DIR ${CMAKE_SOURCE_DIR}/${SCRIPTS_PREFIX}) +set(SERVER_DIR ${CMAKE_SOURCE_DIR}/${SERVER_PREFIX}) +set(VIEWER_DIR ${CMAKE_SOURCE_DIR}/${VIEWER_PREFIX}) + +set(LIBS_PREBUILT_DIR ${CMAKE_SOURCE_DIR}/../libraries CACHE PATH + "Location of prebuilt libraries.") + + +if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(WINDOWS ON BOOL FORCE) + set(ARCH i686) + set(LL_ARCH ${ARCH}_win32) + set(LL_ARCH_DIR ${ARCH}-win32) +endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + +if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(LINUX ON BOOl FORCE) + execute_process(COMMAND uname -m COMMAND sed s/i.86/i686/ + OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) + set(LL_ARCH ${ARCH}_linux) + set(LL_ARCH_DIR ${ARCH}-linux) +endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(DARWIN 1) + set(ARCH universal) + set(LL_ARCH ${ARCH}_darwin) + set(LL_ARCH_DIR ${ARCH}-darwin) + set(CMAKE_OSX_ARCHITECTURES i386;ppc) + set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk) +endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + + +set(VIEWER ON CACHE BOOL "Build Second Life viewer.") + + +set(STANDALONE OFF CACHE BOOL "Do not use Linden-supplied prebuilt libraries.") + +if (NOT STANDALONE AND EXISTS ${LIBS_PREBUILT_DIR}/include/havok) + set(SERVER ON CACHE BOOL "Build Second Life server software.") +endif (NOT STANDALONE AND EXISTS ${LIBS_PREBUILT_DIR}/include/havok) + +if (LINUX AND SERVER AND VIEWER) + MESSAGE(FATAL_ERROR " +The indra source does not currently support building SERVER and VIEWER at the same time. +Please set one of these values to OFF in your CMake cache file. +(either by running ccmake or by editing CMakeCache.txt by hand) +For more information, please see JIRA DEV-14943 - Cmake Linux cannot build both VIEWER and SERVER in one build environment + ") +endif (LINUX AND SERVER AND VIEWER) + +source_group("CMake Rules" FILES CMakeLists.txt) diff --git a/indra/cmake/XmlRpcEpi.cmake b/indra/cmake/XmlRpcEpi.cmake new file mode 100644 index 0000000000..3fd6f80eb9 --- /dev/null +++ b/indra/cmake/XmlRpcEpi.cmake @@ -0,0 +1,15 @@ +# -*- cmake -*- + +set(XMLRPCEPI_FIND_QUIETLY ON) +set(XMLRPCEPI_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindXmlRpcEpi) +else (STANDALONE) + if (WINDOWS) + set(XMLRPCEPI_LIBRARIES xmlrpcepi) + else (WINDOWS) + set(XMLRPCEPI_LIBRARIES xmlrpc-epi) + endif (WINDOWS) + set(XMLRPCEPI_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/indra/cmake/ZLIB.cmake b/indra/cmake/ZLIB.cmake new file mode 100644 index 0000000000..3740103a72 --- /dev/null +++ b/indra/cmake/ZLIB.cmake @@ -0,0 +1,15 @@ +# -*- cmake -*- + +set(ZLIB_FIND_QUIETLY ON) +set(ZLIB_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindZLIB) +else (STANDALONE) + if (WINDOWS) + set(ZLIB_LIBRARIES zlib) + else (WINDOWS) + set(ZLIB_LIBRARIES z) + endif (WINDOWS) + set(ZLIB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/indra/cmake/cmake_dummy.cpp b/indra/cmake/cmake_dummy.cpp new file mode 100644 index 0000000000..183bd746d1 --- /dev/null +++ b/indra/cmake/cmake_dummy.cpp @@ -0,0 +1,29 @@ +/** + * @file cmake_dummy.cpp + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ diff --git a/indra/copy_win_scripts/CMakeLists.txt b/indra/copy_win_scripts/CMakeLists.txt new file mode 100644 index 0000000000..b1b1006e56 --- /dev/null +++ b/indra/copy_win_scripts/CMakeLists.txt @@ -0,0 +1,35 @@ +# -*- cmake -*- + +# The copy_win_scripts folder contains scripts handy for launching the +# from the windows command line on windows. +# The cmake target created copies the scripts to the +# build directory being used, which where the scripts +# need to be executed from. + +include(CMakeCopyIfDifferent) + +set(win_scripts-src ${CMAKE_SOURCE_DIR}/copy_win_scripts) +set(win_scripts-dst ${CMAKE_BINARY_DIR}/batch) + +set(file-list + llstart.py + start-client.py + start-servers.py + stop-servers.py + user_config.py + ) + +foreach(file ${file-list}) + if(EXISTS ${file}) + set(win_scripts-files ${win_scripts-files} file) + endif(EXISTS ${file}) +endforeach(file ${file-list}) + +copy_if_different( + ${win_scripts-src} + ${win_scripts-dst} + win_scripts-targets + ${win_scripts-files} + ) + +add_custom_target(copy_win_scripts ALL DEPENDS ${win_scripts-targets}) diff --git a/indra/copy_win_scripts/start-client.py b/indra/copy_win_scripts/start-client.py new file mode 100644 index 0000000000..fe3906ccb1 --- /dev/null +++ b/indra/copy_win_scripts/start-client.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +import sys, getopt +import os +import llstart + +def usage(): + print """start-client.py + + --grid <grid> + --farm <grid> + --region <starting region name> + """ + +def start_client(grid, slurl, build_config, my_args): + login_url = "https://login.%s.lindenlab.com/cgi-bin/login.cgi" % (grid) + + viewer_args = { "--grid" : grid, + "--loginuri" : login_url } + viewer_args.update(my_args) + # *sigh* We must put --url at the end of the argument list. + if viewer_args.has_key("--url"): + slurl = viewer_args["--url"] + del(viewer_args["--url"]) + viewer_args = llstart.get_args_from_dict(viewer_args) + if slurl is not None: + viewer_args += " --url %s" % slurl + + # Figure out path stuff. + # The client should run from indra/newview + # but the exe is at indra/build-<xxx>/newview/<target> + build_path = os.path.dirname(os.getcwd()); + f = open("start-client.log", "w") + print >>f, "Viewer startup arguments:" + llstart.start("viewer", "../../newview", + "%s/newview/%s/secondlife-bin.exe" % (build_path, build_config), + viewer_args, f) + f.close() + +if __name__ == "__main__": + grid = llstart.get_config("grid") + build_config = llstart.get_config("build_config") + my_args = llstart.get_config("viewer_args", force_dict = True) + opts, args = getopt.getopt(sys.argv[1:], "u:r:f:g:i:h", + ["region=", "username=", "farm=", "grid=", "ip=", "help"]) + region = None + for o, a in opts: + if o in ("-r", "--region", "-u", "--username"): + region = a + if o in ("-f", "--farm", "-g", "--grid"): + grid = a + if o in ("-h", "--help"): + usage() + sys.exit(0) + + slurl = llstart.get_config("slurl") + if slurl == "": + if region is None: + region = llstart.get_user_name() + slurl = "//%s/128/128/" % (region) + # Ensure the slurl has quotes around it. + if slurl is not None: + slurl = '"%s"' % (slurl.strip('"\'')) + + start_client(grid, slurl, build_config, my_args) diff --git a/indra/develop.py b/indra/develop.py new file mode 100755 index 0000000000..01e603a020 --- /dev/null +++ b/indra/develop.py @@ -0,0 +1,631 @@ +#!/usr/bin/env python +# +# @file develop.py +# @authors Bryan O'Sullivan, Mark Palange, Aaron Brashears +# @brief Fire and forget script to appropriately configure cmake for SL. +# +# $LicenseInfo:firstyear=2007&license=viewergpl$ +# +# Copyright (c) 2007, 2008 Linden Research, Inc. +# +# Second Life Viewer Source Code +# The source code in this file ("Source Code") is provided by Linden Lab +# to you under the terms of the GNU General Public License, version 2.0 +# ("GPL"), unless you have obtained a separate licensing agreement +# ("Other License"), formally executed by you and Linden Lab. Terms of +# the GPL can be found in doc/GPL-license.txt in this distribution, or +# online at http://secondlife.com/developers/opensource/gplv2 +# +# There are special exceptions to the terms and conditions of the GPL as +# it is applied to this Source Code. View the full text of the exception +# in the file doc/FLOSS-exception.txt in this software distribution, or +# online at http://secondlife.com/developers/opensource/flossexception +# +# By copying, modifying or distributing this software, you acknowledge +# that you have read and understood your obligations described above, +# and agree to abide by those obligations. +# +# ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO +# WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +# COMPLETENESS OR PERFORMANCE. +# $/LicenseInfo$ + + +import errno +import getopt +import os +import random +import re +import shutil +import socket +import sys + +class CommandError(Exception): + pass + + +def mkdir(path): + try: + os.mkdir(path) + return path + except OSError, err: + if err.errno != errno.EEXIST or not os.path.isdir(path): + raise + +def quote(opts): + return '"' + '" "'.join([ opt.replace('"', '') for opt in opts ]) + '"' + +class PlatformSetup(object): + generator = None + build_types = {} + for t in ('Debug', 'Release', 'RelWithDebInfo'): + build_types[t.lower()] = t + + build_type = build_types['relwithdebinfo'] + standalone = 'FALSE' + unattended = 'FALSE' + cmake_opts = [] + + def __init__(self): + self.script_dir = os.path.realpath( + os.path.dirname(__import__(__name__).__file__)) + + def os(self): + '''Return the name of the OS.''' + + raise NotImplemented('os') + + def arch(self): + '''Return the CPU architecture.''' + + return None + + def platform(self): + '''Return a stringified two-tuple of the OS name and CPU + architecture.''' + + ret = self.os() + if self.arch(): + ret += '-' + self.arch() + return ret + + def build_dirs(self): + '''Return the top-level directories in which builds occur. + + This can return more than one directory, e.g. if doing a + 32-bit viewer and server build on Linux.''' + + return ['build-' + self.platform()] + + def cmake_commandline(self, src_dir, build_dir, opts, simple): + '''Return the command line to run cmake with.''' + + args = dict( + dir=src_dir, + generator=self.generator, + opts=quote(opts), + standalone=self.standalone, + unattended=self.unattended, + type=self.build_type.upper(), + ) + if simple: + return 'cmake %(opts)s %(dir)r' % args + return ('cmake -DCMAKE_BUILD_TYPE:STRING=%(type)s ' + '-DSTANDALONE:BOOL=%(standalone)s ' + '-DUNATTENDED:BOOL=%(unattended)s ' + '-G %(generator)r %(opts)s %(dir)r' % args) + + def run(self, command, name=None): + '''Run a program. If the program fails, raise an exception.''' + ret = os.system(command) + if ret: + if name is None: + name = command.split(None, 1)[0] + if os.WIFEXITED(ret): + event = 'exited' + status = 'status %d' % os.WEXITSTATUS(ret) + elif os.WIFSIGNALED(ret): + event = 'was killed' + status = 'signal %d' % os.WTERMSIG(ret) + else: + event = 'died unexpectedly (!?)' + status = '16-bit status %d' % ret + raise CommandError('the command %r %s with %s' % + (name, event, status)) + + def run_cmake(self, args=[]): + '''Run cmake.''' + + # do a sanity check to make sure we have a generator + if not hasattr(self, 'generator'): + raise "No generator available for '%s'" % (self.__name__,) + cwd = os.getcwd() + created = [] + try: + for d in self.build_dirs(): + simple = True + if mkdir(d): + created.append(d) + simple = False + try: + os.chdir(d) + cmd = self.cmake_commandline(cwd, d, args, simple) + print 'Running %r in %r' % (cmd, d) + self.run(cmd, 'cmake') + finally: + os.chdir(cwd) + except: + # If we created a directory in which to run cmake and + # something went wrong, the directory probably just + # contains garbage, so delete it. + os.chdir(cwd) + for d in created: + print 'Cleaning %r' % d + shutil.rmtree(d) + raise + + def parse_build_opts(self, arguments): + opts, targets = getopt.getopt(arguments, 'o:', ['option=']) + build_opts = [] + for o, a in opts: + if o in ('-o', '--option'): + build_opts.append(a) + return build_opts, targets + + def run_build(self, opts, targets): + '''Build the default targets for this platform.''' + + raise NotImplemented('run_build') + + def cleanup(self): + '''Delete all build directories.''' + + cleaned = 0 + for d in self.build_dirs(): + if os.path.isdir(d): + print 'Cleaning %r' % d + shutil.rmtree(d) + cleaned += 1 + if not cleaned: + print 'Nothing to clean up!' + + def is_internal_tree(self): + '''Indicate whether we are building in an internal source tree.''' + + return os.path.isdir(os.path.join(self.script_dir, 'newsim')) + + +class UnixSetup(PlatformSetup): + '''Generic Unixy build instructions.''' + + def __init__(self): + super(UnixSetup, self).__init__() + self.generator = 'Unix Makefiles' + + def os(self): + return 'unix' + + def arch(self): + cpu = os.uname()[-1] + if cpu.endswith('86'): + cpu = 'i686' + elif cpu in ('athlon',): + cpu = 'i686' + elif cpu == 'Power Macintosh': + cpu = 'powerpc' + return cpu + + +class LinuxSetup(UnixSetup): + def __init__(self): + super(LinuxSetup, self).__init__() + + def os(self): + return 'linux' + + def build_dirs(self): + # Only build the server code if (a) we have it and (b) we're + # on 32-bit x86. + if self.arch() == 'i686' and self.is_internal_tree(): + return ['viewer-' + self.platform(), 'server-' + self.platform()] + else: + return ['viewer-' + self.platform()] + + def find_in_path(self, name, defval=None, basename=False): + for p in os.getenv('PATH', '/usr/bin').split(':'): + path = os.path.join(p, name) + if os.access(path, os.X_OK): + return [basename and os.path.basename(path) or path] + if defval: + return [defval] + return [] + + def cmake_commandline(self, src_dir, build_dir, opts, simple): + args = dict( + dir=src_dir, + generator=self.generator, + opts=quote(opts), + standalone=self.standalone, + unattended=self.unattended, + type=self.build_type.upper() + ) + if not self.is_internal_tree(): + args.update({'cxx':'g++', 'server':'FALSE', 'viewer':'TRUE'}) + else: + distcc = self.find_in_path('distcc') + if 'server' in build_dir: + gcc33 = distcc + self.find_in_path('g++-3.3', 'g++', True) + args.update({'cxx':' '.join(gcc33), 'server':'TRUE', + 'viewer':'FALSE'}) + else: + gcc41 = distcc + self.find_in_path('g++-4.1', 'g++', True) + args.update({'cxx': ' '.join(gcc41), 'server':'FALSE', + 'viewer':'TRUE'}) + if simple: + return 'cmake %(opts)s %(dir)r' % args + cmd = (('cmake -DCMAKE_BUILD_TYPE:STRING=%(type)s ' + '-G %(generator)r -DSERVER:BOOL=%(server)s ' + '-DVIEWER:BOOL=%(viewer)s -DSTANDALONE:BOOL=%(standalone)s ' + '-DUNATTENDED:BOOL=%(unattended)s ' + '%(opts)s %(dir)r') + % args) + if 'CXX' not in os.environ: + args.update({'cmd':cmd}) + cmd = ('CXX=%(cxx)r %(cmd)s' % args) + return cmd + + def run_build(self, opts, targets): + job_count = None + + for i in range(len(opts)): + if opts[i].startswith('-j'): + try: + job_count = int(opts[i][2:]) + except ValueError: + try: + job_count = int(opts[i+1]) + except ValueError: + job_count = True + + def get_cpu_count(): + count = 0 + for line in open('/proc/cpuinfo'): + if re.match(r'processor\s*:', line): + count += 1 + return count + + def localhost(): + count = get_cpu_count() + return 'localhost/' + str(count), count + + def get_distcc_hosts(): + try: + hosts = [] + name = os.getenv('DISTCC_DIR', '/etc/distcc') + '/hosts' + for l in open(name): + l = l[l.find('#')+1:].strip() + if l: hosts.append(l) + return hosts + except IOError: + return (os.getenv('DISTCC_HOSTS', '').split() or + [localhost()[0]]) + + def count_distcc_hosts(): + cpus = 0 + hosts = 0 + for host in get_distcc_hosts(): + m = re.match(r'.*/(\d+)', host) + hosts += 1 + cpus += m and int(m.group(1)) or 1 + return hosts, cpus + + def mk_distcc_hosts(): + '''Generate a list of LL-internal machines to build on.''' + loc_entry, cpus = localhost() + hosts = [loc_entry] + dead = [] + stations = [s for s in xrange(36) if s not in dead] + random.shuffle(stations) + hosts += ['station%d.lindenlab.com/2,lzo' % s for s in stations] + cpus += 2 * len(stations) + return ' '.join(hosts), cpus + + if job_count is None: + hosts, job_count = count_distcc_hosts() + if hosts == 1 and socket.gethostname().startswith('station'): + hosts, job_count = mk_distcc_hosts() + os.putenv('DISTCC_HOSTS', hosts) + opts.extend(['-j', str(job_count)]) + + if targets: + targets = ' '.join(targets) + else: + targets = 'all' + + for d in self.build_dirs(): + cmd = 'make -C %r %s %s' % (d, ' '.join(opts), targets) + print 'Running %r' % cmd + self.run(cmd) + + +class DarwinSetup(UnixSetup): + def __init__(self): + super(DarwinSetup, self).__init__() + self.generator = 'Xcode' + + def os(self): + return 'darwin' + + def arch(self): + return 'universal' + + def cmake_commandline(self, src_dir, build_dir, opts, simple): + arches = '' + args = dict( + arches=arches, + dir=src_dir, + generator=self.generator, + opts=quote(opts), + standalone=self.standalone, + unattended=self.unattended, + type=self.build_type.upper() + ) + if simple: + return 'cmake %(opts)s %(dir)r' % args + return ('cmake -G %(generator)r ' + '-DCMAKE_BUILD_TYPE:STRING=%(type)s ' + '-DSTANDALONE:BOOL=%(standalone)s ' + '-DUNATTENDED:BOOL=%(unattended)s ' + '%(arches)s %(opts)s %(dir)r' % args) + + def run_build(self, opts, targets): + cwd = os.getcwd() + if targets: + targets = ' '.join(['-target ' + repr(t) for t in targets]) + else: + targets = '' + cmd = ('xcodebuild -parallelizeTargets ' + '-configuration %s %s %s' % + (self.build_type, ' '.join(opts), targets)) + for d in self.build_dirs(): + try: + os.chdir(d) + print 'Running %r in %r' % (cmd, d) + self.run(cmd) + finally: + os.chdir(cwd) + + +class WindowsSetup(PlatformSetup): + def __init__(self): + super(WindowsSetup, self).__init__() + self.gens = { + 'vc71' : { + 'gen' : r'Visual Studio 7 .NET 2003', + 'ver' : r'7.1' + }, + 'vc80' : { + 'gen' : r'Visual Studio 8 2005', + 'ver' : r'8.0' + }, + 'vc90' : { + 'gen' : r'Visual Studio 9 2008', + 'ver' : r'9.0' + } + } + self.gens['vs2003'] = self.gens['vc71'] + self.gens['vs2005'] = self.gens['vc80'] + self.gens['vs2008'] = self.gens['vc90'] + + self.generator = 'vc71' + self.incredibuild = False + + def os(self): + return 'win32' + + def build_dirs(self): + return ['build-' + self.generator] + + def cmake_commandline(self, src_dir, build_dir, opts, simple): + args = dict( + dir=src_dir, + generator=self.gens[self.generator.lower()]['gen'], + opts=quote(opts), + standalone=self.standalone, + unattended=self.unattended, + ) + if simple: + return 'cmake %(opts)s "%(dir)s"' % args + return ('cmake -G "%(generator)s" ' + '-DSTANDALONE:BOOL=%(standalone)s ' + '-DUNATTENDED:BOOL=%(unattended)s ' + '%(opts)s "%(dir)s"' % args) + + def get_build_cmd(self): + if self.incredibuild: + config = self.build_type + if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]: + config = '\"%s|Win32\"' % config + + return "buildconsole Secondlife.sln /build %s" % config + + value = "" + try: + import _winreg + key_str = (r'SOFTWARE\Microsoft\VisualStudio\%s\Setup\VS' % + self.gens[self.generator.lower()]['ver']) + value_str = (r'EnvironmentDirectory') + print ('Reading VS environment from HKEY_LOCAL_MACHINE\%s\%s' % + (key_str, value_str)) + print key_str + + reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) + key = _winreg.OpenKey(reg, key_str) + value = _winreg.QueryValueEx(key, value_str)[0] + print 'Found: %s' % value + except WindowsError, err: + print "Didn't find Visual Studio installation." + + # devenv.com is CLI friendly, devenv.exe... not so much. + return '"' + value + 'devenv.com" Secondlife.sln /build %s' % self.build_type + + # this override of run exists because the PlatformSetup version + # uses Unix/Mac only calls. Freakin' os module! + def run(self, command, name=None): + '''Run a program. If the program fails, raise an exception.''' + ret = os.system(command) + if ret: + if name is None: + name = command.split(None, 1)[0] + raise CommandError('the command %r exited with %s' % + (name, ret)) + + def run_cmake(self, args=[]): + '''Override to add the vstool.exe call after running cmake.''' + PlatformSetup.run_cmake(self, args) + if self.unattended == 'FALSE': + for build_dir in self.build_dirs(): + vstool_cmd = ('tools\\vstool\\VSTool.exe' + ' --solution %s\\SecondLife.sln' + ' --config RelWithDebInfo' + ' --startup secondlife-bin' % build_dir) + print 'Running %r in %r' % (vstool_cmd, os.getcwd()) + self.run(vstool_cmd) + + def run_build(self, opts, targets): + cwd = os.getcwd() + build_cmd = self.get_build_cmd() + + for d in self.build_dirs(): + try: + os.chdir(d) + if targets: + for t in targets: + cmd = '%s /project %s %s' % (build_cmd, t, ' '.join(opts)) + print 'Running %r in %r' % (cmd, d) + self.run(cmd) + else: + cmd = '%s %s' % (build_cmd, ' '.join(opts)) + print 'Running %r in %r' % (cmd, d) + self.run(cmd) + finally: + os.chdir(cwd) + + +class CygwinSetup(WindowsSetup): + def __init__(self): + super(CygwinSetup, self).__init__() + + def cmake_commandline(self, src_dir, build_dir, opts, simple): + dos_dir = src_dir.split('/')[2:] + dos_dir[0] = dos_dir[0] + ":" + dos_dir = '/'.join(dos_dir) + args = dict( + dir=dos_dir, + generator=self.gens[self.generator.lower()]['gen'], + opts=quote(opts), + standalone=self.standalone, + unattended=self.unattended, + ) + if simple: + return 'cmake %(opts)s "%(dir)s"' % args + return ('cmake -G "%(generator)s" ' + '-DUNATTENDED:BOOl=%(unattended)s ' + '-DSTANDALONE:BOOL=%(standalone)s ' + '%(opts)s "%(dir)s"' % args) + +setup_platform = { + 'darwin': DarwinSetup, + 'linux2': LinuxSetup, + 'win32' : WindowsSetup, + 'cygwin' : CygwinSetup + } + + +usage_msg = ''' +Usage: develop.py [options] command [command-options] + +Options: + -h | --help print this help message + --standalone build standalone, without Linden prebuild libraries + --unattended build unattended, do not invoke any tools requiring + a human response + -t | --type=NAME build type ("Debug", "Release", or "RelWithDebInfo") + -G | --generator=NAME generator name + Windows: VC71 or VS2003 (default), VC80 (VS2005) or VC90 (VS2008) + Mac OS X: Xcode (default), Unix Makefiles + Linux: Unix Makefiles (default), KDevelop3 +Commands: + build configure and build default target + clean delete all build directories (does not affect sources) + configure configure project by running cmake + +If you do not specify a command, the default is "configure". +''' + +def main(arguments): + setup = setup_platform[sys.platform]() + try: + opts, args = getopt.getopt( + arguments, + '?ht:G:', + ['help', 'standalone', 'unattended', 'type=', 'incredibuild', 'generator=']) + except getopt.GetoptError, err: + print >> sys.stderr, 'Error:', err + sys.exit(1) + + for o, a in opts: + if o in ('-?', '-h', '--help'): + print usage_msg.strip() + sys.exit(0) + elif o in ('--standalone',): + setup.standalone = 'TRUE' + elif o in ('--unattended',): + setup.unattended = 'TRUE' + elif o in ('-t', '--type'): + try: + setup.build_type = setup.build_types[a.lower()] + except KeyError: + print >> sys.stderr, 'Error: unknown build type', repr(a) + print >> sys.stderr, 'Supported build types:' + types = setup.build_types.values() + types.sort() + for t in types: + print ' ', t + sys.exit(1) + elif o in ('-G', '--generator'): + setup.generator = a + elif o in ('--incredibuild'): + setup.incredibuild = True + else: + print >> sys.stderr, 'INTERNAL ERROR: unhandled option', repr(o) + sys.exit(1) + if not args: + setup.run_cmake() + return + try: + cmd = args.pop(0) + if cmd in ('cmake', 'configure'): + setup.run_cmake(args) + elif cmd == 'build': + for d in setup.build_dirs(): + if not os.path.exists(d): + raise CommandError('run "develop.py cmake" first') + setup.run_cmake() + opts, targets = setup.parse_build_opts(args) + setup.run_build(opts, targets) + elif cmd == 'clean': + if args: + raise CommandError('clean takes no arguments') + setup.cleanup() + else: + print >> sys.stderr, 'Error: unknown command', repr(arg) + print >> sys.stderr, "(run 'develop.py --help' for help)" + sys.exit(1) + except CommandError, err: + print >> sys.stderr, 'Error:', err + sys.exit(1) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/indra/lib/python/indra/base/cllsd_test.py b/indra/lib/python/indra/base/cllsd_test.py new file mode 100644 index 0000000000..3af59e741a --- /dev/null +++ b/indra/lib/python/indra/base/cllsd_test.py @@ -0,0 +1,51 @@ +from indra.base import llsd, lluuid +from datetime import datetime +import cllsd +import time, sys + +class myint(int): + pass + +values = ( + '&<>', + u'\u81acj', + llsd.uri('http://foo<'), + lluuid.LLUUID(), + llsd.LLSD(['thing']), + 1, + myint(31337), + sys.maxint + 10, + llsd.binary('foo'), + [], + {}, + {u'f&\u1212': 3}, + 3.1, + True, + None, + datetime.fromtimestamp(time.time()), + ) + +def valuator(values): + for v in values: + yield v + +longvalues = () # (values, list(values), iter(values), valuator(values)) + +for v in values + longvalues: + print '%r => %r' % (v, cllsd.llsd_to_xml(v)) + +a = [[{'a':3}]] * 1000000 + +s = time.time() +print hash(cllsd.llsd_to_xml(a)) +e = time.time() +t1 = e - s +print t1 + +s = time.time() +print hash(llsd.LLSDXMLFormatter()._format(a)) +e = time.time() +t2 = e - s +print t2 + +print 'Speedup:', t2 / t1 diff --git a/indra/lib/python/indra/ipc/siesta.py b/indra/lib/python/indra/ipc/siesta.py new file mode 100644 index 0000000000..5fbea29339 --- /dev/null +++ b/indra/lib/python/indra/ipc/siesta.py @@ -0,0 +1,402 @@ +from indra.base import llsd +from webob import exc +import webob +import re, socket + +try: + from cStringIO import StringIO +except ImportError: + from StringIO import StringIO + +try: + import cjson + json_decode = cjson.decode + json_encode = cjson.encode + JsonDecodeError = cjson.DecodeError + JsonEncodeError = cjson.EncodeError +except ImportError: + import simplejson + json_decode = simplejson.loads + json_encode = simplejson.dumps + JsonDecodeError = ValueError + JsonEncodeError = TypeError + + +llsd_parsers = { + 'application/json': json_decode, + 'application/llsd+binary': llsd.parse_binary, + 'application/llsd+notation': llsd.parse_notation, + 'application/llsd+xml': llsd.parse_xml, + 'application/xml': llsd.parse_xml, + } + + +def mime_type(content_type): + '''Given a Content-Type header, return only the MIME type.''' + + return content_type.split(';', 1)[0].strip().lower() + +class BodyLLSD(object): + '''Give a webob Request or Response an llsd property. + + Getting the llsd property parses the body, and caches the result. + + Setting the llsd property formats a payload, and the body property + is set.''' + + def _llsd__get(self): + '''Get, set, or delete the LLSD value stored in this object.''' + + try: + return self._llsd + except AttributeError: + if not self.body: + raise AttributeError('No llsd attribute has been set') + else: + mtype = mime_type(self.content_type) + try: + parser = llsd_parsers[mtype] + except KeyError: + raise exc.HTTPUnsupportedMediaType( + 'Content type %s not supported' % mtype).exception + try: + self._llsd = parser(self.body) + except (llsd.LLSDParseError, JsonDecodeError, TypeError), err: + raise exc.HTTPBadRequest( + 'Could not parse body: %r' % err.args).exception + return self._llsd + + def _llsd__set(self, val): + req = getattr(self, 'request', None) + if req is not None: + formatter, ctype = formatter_for_request(req) + self.content_type = ctype + else: + formatter, ctype = formatter_for_mime_type( + mime_type(self.content_type)) + self.body = formatter(val) + + def _llsd__del(self): + if hasattr(self, '_llsd'): + del self._llsd + + llsd = property(_llsd__get, _llsd__set, _llsd__del) + + +class Response(webob.Response, BodyLLSD): + '''Response class with LLSD support. + + A sensible default content type is used. + + Setting the llsd property also sets the body. Getting the llsd + property parses the body if necessary. + + If you set the body property directly, the llsd property will be + deleted.''' + + default_content_type = 'application/llsd+xml' + + def _body__set(self, body): + if hasattr(self, '_llsd'): + del self._llsd + super(Response, self)._body__set(body) + + def cache_forever(self): + self.cache_expires(86400 * 365) + + body = property(webob.Response._body__get, _body__set, + webob.Response._body__del, + webob.Response._body__get.__doc__) + + +class Request(webob.Request, BodyLLSD): + '''Request class with LLSD support. + + Sensible content type and accept headers are used by default. + + Setting the llsd property also sets the body. Getting the llsd + property parses the body if necessary. + + If you set the body property directly, the llsd property will be + deleted.''' + + default_content_type = 'application/llsd+xml' + default_accept = ('application/llsd+xml; q=0.5, ' + 'application/llsd+notation; q=0.3, ' + 'application/llsd+binary; q=0.2, ' + 'application/xml; q=0.1, ' + 'application/json; q=0.0') + + def __init__(self, environ=None, *args, **kwargs): + if environ is None: + environ = {} + else: + environ = environ.copy() + if 'CONTENT_TYPE' not in environ: + environ['CONTENT_TYPE'] = self.default_content_type + if 'HTTP_ACCEPT' not in environ: + environ['HTTP_ACCEPT'] = self.default_accept + super(Request, self).__init__(environ, *args, **kwargs) + + def _body__set(self, body): + if hasattr(self, '_llsd'): + del self._llsd + super(Request, self)._body__set(body) + + def path_urljoin(self, *parts): + return '/'.join([path_url.rstrip('/')] + list(parts)) + + body = property(webob.Request._body__get, _body__set, + webob.Request._body__del, webob.Request._body__get.__doc__) + + def create_response(self, llsd=None, status='200 OK', + conditional_response=webob.NoDefault): + resp = self.ResponseClass(status=status, request=self, + conditional_response=conditional_response) + resp.llsd = llsd + return resp + + def curl(self): + '''Create and fill out a pycurl easy object from this request.''' + + import pycurl + c = pycurl.Curl() + c.setopt(pycurl.URL, self.url()) + if self.headers: + c.setopt(pycurl.HTTPHEADER, + ['%s: %s' % (k, self.headers[k]) for k in self.headers]) + c.setopt(pycurl.FOLLOWLOCATION, True) + c.setopt(pycurl.AUTOREFERER, True) + c.setopt(pycurl.MAXREDIRS, 16) + c.setopt(pycurl.NOSIGNAL, True) + c.setopt(pycurl.READFUNCTION, self.body_file.read) + c.setopt(pycurl.SSL_VERIFYHOST, 2) + + if self.method == 'POST': + c.setopt(pycurl.POST, True) + post301 = getattr(pycurl, 'POST301', None) + if post301 is not None: + # Added in libcurl 7.17.1. + c.setopt(post301, True) + elif self.method == 'PUT': + c.setopt(pycurl.PUT, True) + elif self.method != 'GET': + c.setopt(pycurl.CUSTOMREQUEST, self.method) + return c + +Request.ResponseClass = Response +Response.RequestClass = Request + + +llsd_formatters = { + 'application/json': json_encode, + 'application/llsd+binary': llsd.format_binary, + 'application/llsd+notation': llsd.format_notation, + 'application/llsd+xml': llsd.format_xml, + 'application/xml': llsd.format_xml, + } + + +def formatter_for_mime_type(mime_type): + '''Return a formatter that encodes to the given MIME type. + + The result is a pair of function and MIME type.''' + + try: + return llsd_formatters[mime_type], mime_type + except KeyError: + raise exc.HTTPInternalServerError( + 'Could not use MIME type %r to format response' % + mime_type).exception + + +def formatter_for_request(req): + '''Return a formatter that encodes to the preferred type of the client. + + The result is a pair of function and actual MIME type.''' + + for ctype in req.accept.best_matches('application/llsd+xml'): + try: + return llsd_formatters[ctype], ctype + except KeyError: + pass + else: + raise exc.HTTPNotAcceptable().exception + + +def wsgi_adapter(func, environ, start_response): + '''Adapt a Siesta callable to act as a WSGI application.''' + + try: + req = Request(environ) + resp = func(req, **req.urlvars) + if not isinstance(resp, webob.Response): + try: + formatter, ctype = formatter_for_request(req) + resp = req.ResponseClass(formatter(resp), content_type=ctype) + resp._llsd = resp + except (JsonEncodeError, TypeError), err: + resp = exc.HTTPInternalServerError( + detail='Could not format response') + except exc.HTTPException, e: + resp = e + except socket.error, e: + resp = exc.HTTPInternalServerError(detail=e.args[1]) + return resp(environ, start_response) + + +def llsd_callable(func): + '''Turn a callable into a Siesta application.''' + + def replacement(environ, start_response): + return wsgi_adapter(func, environ, start_response) + + return replacement + + +def llsd_method(http_method, func): + def replacement(environ, start_response): + if environ['REQUEST_METHOD'] == http_method: + return wsgi_adapter(func, environ, start_response) + return exc.HTTPMethodNotAllowed()(environ, start_response) + + return replacement + + +http11_methods = 'OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT'.split() +http11_methods.sort() + +def llsd_class(cls): + '''Turn a class into a Siesta application. + + A new instance is created for each request. A HTTP method FOO is + turned into a call to the handle_foo method of the instance.''' + + def foo(req, **kwargs): + instance = cls() + method = req.method.lower() + try: + handler = getattr(instance, 'handle_' + method) + except AttributeError: + allowed = [m for m in http11_methods + if hasattr(instance, 'handle_' + m.lower())] + raise exc.HTTPMethodNotAllowed( + headers={'Allowed': ', '.join(allowed)}).exception + return handler(req, **kwargs) + + def replacement(environ, start_response): + return wsgi_adapter(foo, environ, start_response) + + return replacement + + +def curl(reqs): + import pycurl + + m = pycurl.CurlMulti() + curls = [r.curl() for r in reqs] + io = {} + for c in curls: + fp = StringIO() + hdr = StringIO() + c.setopt(pycurl.WRITEFUNCTION, fp.write) + c.setopt(pycurl.HEADERFUNCTION, hdr.write) + io[id(c)] = fp, hdr + m.handles = curls + try: + while True: + ret, num_handles = m.perform() + if ret != pycurl.E_CALL_MULTI_PERFORM: + break + finally: + m.close() + + for req, c in zip(reqs, curls): + fp, hdr = io[id(c)] + hdr.seek(0) + status = hdr.readline().rstrip() + headers = [] + name, values = None, None + + # XXX We don't currently handle bogus header data. + + for line in hdr.readlines(): + if not line[0].isspace(): + if name: + headers.append((name, ' '.join(values))) + name, value = line.strip().split(':', 1) + value = [value] + else: + values.append(line.strip()) + if name: + headers.append((name, ' '.join(values))) + + resp = c.ResponseClass(fp.getvalue(), status, headers, request=req) + + +route_re = re.compile(r''' + \{ # exact character "{" + (\w+) # variable name (restricted to a-z, 0-9, _) + (?:([:~])([^}]+))? # optional :type or ~regex part + \} # exact character "}" + ''', re.VERBOSE) + +predefined_regexps = { + 'uuid': r'[a-f0-9][a-f0-9-]{31,35}', + 'int': r'\d+', + } + +def compile_route(route): + fp = StringIO() + last_pos = 0 + for match in route_re.finditer(route): + fp.write(re.escape(route[last_pos:match.start()])) + var_name = match.group(1) + sep = match.group(2) + expr = match.group(3) + if expr: + if sep == ':': + expr = predefined_regexps[expr] + # otherwise, treat what follows '~' as a regexp + else: + expr = '[^/]+' + expr = '(?P<%s>%s)' % (var_name, expr) + fp.write(expr) + last_pos = match.end() + fp.write(re.escape(route[last_pos:])) + return '^%s$' % fp.getvalue() + +class Router(object): + '''WSGI routing class. Parses a URL and hands off a request to + some other WSGI application. If no suitable application is found, + responds with a 404.''' + + def __init__(self): + self.routes = [] + self.paths = [] + + def add(self, route, app, methods=None): + self.paths.append(route) + self.routes.append((re.compile(compile_route(route)), app, + methods and dict.fromkeys(methods))) + + def __call__(self, environ, start_response): + path_info = environ['PATH_INFO'] + request_method = environ['REQUEST_METHOD'] + allowed = [] + for regex, app, methods in self.routes: + m = regex.match(path_info) + if m: + if not methods or request_method in methods: + environ['paste.urlvars'] = m.groupdict() + return app(environ, start_response) + else: + allowed += methods + if allowed: + allowed = dict.fromkeys(allows).keys() + allowed.sort() + resp = exc.HTTPMethodNotAllowed( + headers={'Allowed': ', '.join(allowed)}) + else: + resp = exc.HTTPNotFound() + return resp(environ, start_response) diff --git a/indra/lib/python/indra/ipc/siesta_test.py b/indra/lib/python/indra/ipc/siesta_test.py new file mode 100644 index 0000000000..177ea710d1 --- /dev/null +++ b/indra/lib/python/indra/ipc/siesta_test.py @@ -0,0 +1,214 @@ +from indra.base import llsd, lluuid +from indra.ipc import siesta +import datetime, math, unittest +from webob import exc + + +class ClassApp(object): + def handle_get(self, req): + pass + + def handle_post(self, req): + return req.llsd + + +def callable_app(req): + if req.method == 'UNDERPANTS': + raise exc.HTTPMethodNotAllowed() + elif req.method == 'GET': + return None + return req.llsd + + +class TestBase: + def test_basic_get(self): + req = siesta.Request.blank('/') + self.assertEquals(req.get_response(self.server).body, + llsd.format_xml(None)) + + def test_bad_method(self): + req = siesta.Request.blank('/') + req.environ['REQUEST_METHOD'] = 'UNDERPANTS' + self.assertEquals(req.get_response(self.server).status_int, + exc.HTTPMethodNotAllowed.code) + + json_safe = { + 'none': None, + 'bool_true': True, + 'bool_false': False, + 'int_zero': 0, + 'int_max': 2147483647, + 'int_min': -2147483648, + 'long_zero': 0, + 'long_max': 2147483647L, + 'long_min': -2147483648L, + 'float_zero': 0, + 'float': math.pi, + 'float_huge': 3.14159265358979323846e299, + 'str_empty': '', + 'str': 'foo', + u'unic\u1e51de_empty': u'', + u'unic\u1e51de': u'\u1e4exx\u10480', + } + json_safe['array'] = json_safe.values() + json_safe['tuple'] = tuple(json_safe.values()) + json_safe['dict'] = json_safe.copy() + + json_unsafe = { + 'uuid_empty': lluuid.UUID(), + 'uuid_full': lluuid.UUID('dc61ab0530200d7554d23510559102c1a98aab1b'), + 'binary_empty': llsd.binary(), + 'binary': llsd.binary('f\0\xff'), + 'uri_empty': llsd.uri(), + 'uri': llsd.uri('http://www.secondlife.com/'), + 'datetime_empty': datetime.datetime(1970,1,1), + 'datetime': datetime.datetime(1999,9,9,9,9,9), + } + json_unsafe.update(json_safe) + json_unsafe['array'] = json_unsafe.values() + json_unsafe['tuple'] = tuple(json_unsafe.values()) + json_unsafe['dict'] = json_unsafe.copy() + json_unsafe['iter'] = iter(json_unsafe.values()) + + def _test_client_content_type_good(self, content_type, ll): + def run(ll): + req = siesta.Request.blank('/') + req.environ['REQUEST_METHOD'] = 'POST' + req.content_type = content_type + req.llsd = ll + req.accept = content_type + resp = req.get_response(self.server) + self.assertEquals(resp.status_int, 200) + return req, resp + + if False and isinstance(ll, dict): + def fixup(v): + if isinstance(v, float): + return '%.5f' % v + if isinstance(v, long): + return int(v) + if isinstance(v, (llsd.binary, llsd.uri)): + return v + if isinstance(v, (tuple, list)): + return [fixup(i) for i in v] + if isinstance(v, dict): + return dict([(k, fixup(i)) for k, i in v.iteritems()]) + return v + for k, v in ll.iteritems(): + l = [k, v] + req, resp = run(l) + self.assertEquals(fixup(resp.llsd), fixup(l)) + + run(ll) + + def test_client_content_type_json_good(self): + self._test_client_content_type_good('application/json', self.json_safe) + + def test_client_content_type_llsd_xml_good(self): + self._test_client_content_type_good('application/llsd+xml', + self.json_unsafe) + + def test_client_content_type_llsd_notation_good(self): + self._test_client_content_type_good('application/llsd+notation', + self.json_unsafe) + + def test_client_content_type_llsd_binary_good(self): + self._test_client_content_type_good('application/llsd+binary', + self.json_unsafe) + + def test_client_content_type_xml_good(self): + self._test_client_content_type_good('application/xml', + self.json_unsafe) + + def _test_client_content_type_bad(self, content_type): + req = siesta.Request.blank('/') + req.environ['REQUEST_METHOD'] = 'POST' + req.body = '\0invalid nonsense under all encodings' + req.content_type = content_type + self.assertEquals(req.get_response(self.server).status_int, + exc.HTTPBadRequest.code) + + def test_client_content_type_json_bad(self): + self._test_client_content_type_bad('application/json') + + def test_client_content_type_llsd_xml_bad(self): + self._test_client_content_type_bad('application/llsd+xml') + + def test_client_content_type_llsd_notation_bad(self): + self._test_client_content_type_bad('application/llsd+notation') + + def test_client_content_type_llsd_binary_bad(self): + self._test_client_content_type_bad('application/llsd+binary') + + def test_client_content_type_xml_bad(self): + self._test_client_content_type_bad('application/xml') + + def test_client_content_type_bad(self): + req = siesta.Request.blank('/') + req.environ['REQUEST_METHOD'] = 'POST' + req.body = 'XXX' + req.content_type = 'application/nonsense' + self.assertEquals(req.get_response(self.server).status_int, + exc.HTTPUnsupportedMediaType.code) + + def test_request_default_content_type(self): + req = siesta.Request.blank('/') + self.assertEquals(req.content_type, req.default_content_type) + + def test_request_default_accept(self): + req = siesta.Request.blank('/') + from webob import acceptparse + self.assertEquals(str(req.accept).replace(' ', ''), + req.default_accept.replace(' ', '')) + + def test_request_llsd_auto_body(self): + req = siesta.Request.blank('/') + req.llsd = {'a': 2} + self.assertEquals(req.body, '<?xml version="1.0" ?><llsd><map>' + '<key>a</key><integer>2</integer></map></llsd>') + + def test_request_llsd_mod_body_changes_llsd(self): + req = siesta.Request.blank('/') + req.llsd = {'a': 2} + req.body = '<?xml version="1.0" ?><llsd><integer>1337</integer></llsd>' + self.assertEquals(req.llsd, 1337) + + def test_request_bad_llsd_fails(self): + def crashme(ctype): + def boom(): + class foo(object): pass + req = siesta.Request.blank('/') + req.content_type = ctype + req.llsd = foo() + for mime_type in siesta.llsd_parsers: + self.assertRaises(TypeError, crashme(mime_type)) + + +class ClassServer(TestBase, unittest.TestCase): + def __init__(self, *args, **kwargs): + unittest.TestCase.__init__(self, *args, **kwargs) + self.server = siesta.llsd_class(ClassApp) + + +class CallableServer(TestBase, unittest.TestCase): + def __init__(self, *args, **kwargs): + unittest.TestCase.__init__(self, *args, **kwargs) + self.server = siesta.llsd_callable(callable_app) + + +class RouterServer(unittest.TestCase): + def test_router(self): + def foo(req, quux): + print quux + + r = siesta.Router() + r.add('/foo/{quux:int}', siesta.llsd_callable(foo), methods=['GET']) + req = siesta.Request.blank('/foo/33') + req.get_response(r) + + req = siesta.Request.blank('/foo/bar') + self.assertEquals(req.get_response(r).status_int, + exc.HTTPNotFound.code) + +if __name__ == '__main__': + unittest.main() diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index 9679650104..467517756a 100644 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -5,7 +5,7 @@ $LicenseInfo:firstyear=2007&license=mit$ -Copyright (c) 2007, Linden Research, Inc. +Copyright (c) 2007-2008, Linden Research, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -34,7 +34,6 @@ import fnmatch import getopt import glob import os -import os.path import re import shutil import sys @@ -42,10 +41,10 @@ import tarfile import errno def path_ancestors(path): - path = os.path.normpath(path) + drive, path = os.path.splitdrive(os.path.normpath(path)) result = [] - while len(path) > 0: - result.append(path) + while len(path) > 0 and path != os.path.sep: + result.append(drive+path) path, sub = os.path.split(path) return result @@ -57,13 +56,13 @@ def proper_windows_path(path, current_platform = sys.platform): drive_letter = None rel = None match = re.match("/cygdrive/([a-z])/(.*)", path) - if(not match): + if not match: match = re.match('([a-zA-Z]):\\\(.*)', path) - if(not match): + if not match: return None # not an absolute path drive_letter = match.group(1) rel = match.group(2) - if(current_platform == "cygwin"): + if current_platform == "cygwin": return "/cygdrive/" + drive_letter.lower() + '/' + rel.replace('\\', '/') else: return drive_letter.upper() + ':\\' + rel.replace('/', '\\') @@ -98,6 +97,7 @@ def get_channel(srctree): return channel +DEFAULT_SRCTREE = os.path.dirname(sys.argv[0]) DEFAULT_CHANNEL = 'Second Life Release' ARGUMENTS=[ @@ -118,10 +118,12 @@ ARGUMENTS=[ Example use: %(name)s --arch=i686 On Linux this would try to use Linux_i686Manifest.""", default=""), + dict(name='build', description='Build directory.', default=DEFAULT_SRCTREE), dict(name='configuration', description="""The build configuration used. Only used on OS X for now, but it could be used for other platforms as well.""", default="Universal"), + dict(name='dest', description='Destination directory.', default=DEFAULT_SRCTREE), dict(name='grid', description="""Which grid the client will try to connect to. Even though it's not strictly a grid, 'firstlook' is also an acceptable @@ -144,6 +146,15 @@ ARGUMENTS=[ description="""The current platform, to be used for looking up which manifest class to run.""", default=get_default_platform), + dict(name='source', + description='Source directory.', + default=DEFAULT_SRCTREE), + dict(name='artwork', description='Artwork directory.', default=DEFAULT_SRCTREE), + dict(name='touch', + description="""File to touch when action is finished. Touch file will + contain the name of the final package in a form suitable + for use by a .bat file.""", + default=None), dict(name='version', description="""This specifies the version of Second Life that is being packaged up.""", @@ -167,63 +178,75 @@ def usage(srctree=""): default, arg['description'] % nd) -def main(argv=None, srctree='.', dsttree='./dst'): - if(argv == None): - argv = sys.argv - +def main(): option_names = [arg['name'] + '=' for arg in ARGUMENTS] option_names.append('help') - options, remainder = getopt.getopt(argv[1:], "", option_names) - if len(remainder) >= 1: - dsttree = remainder[0] - - print "Source tree:", srctree - print "Destination tree:", dsttree + options, remainder = getopt.getopt(sys.argv[1:], "", option_names) # convert options to a hash - args = {} + args = {'source': DEFAULT_SRCTREE, + 'artwork': DEFAULT_SRCTREE, + 'build': DEFAULT_SRCTREE, + 'dest': DEFAULT_SRCTREE } for opt in options: args[opt[0].replace("--", "")] = opt[1] + for k in 'artwork build dest source'.split(): + args[k] = os.path.normpath(args[k]) + + print "Source tree:", args['source'] + print "Artwork tree:", args['artwork'] + print "Build tree:", args['build'] + print "Destination tree:", args['dest'] + # early out for help - if args.has_key('help'): + if 'help' in args: # *TODO: it is a huge hack to pass around the srctree like this - usage(srctree) + usage(args['source']) return # defaults for arg in ARGUMENTS: - if not args.has_key(arg['name']): + if arg['name'] not in args: default = arg['default'] if hasattr(default, '__call__'): - default = default(srctree) + default = default(args['source']) if default is not None: args[arg['name']] = default # fix up version - if args.has_key('version') and type(args['version']) == str: + if isinstance(args.get('version'), str): args['version'] = args['version'].split('.') # default and agni are default if args['grid'] in ['default', 'agni']: args['grid'] = '' - if args.has_key('actions'): + if 'actions' in args: args['actions'] = args['actions'].split() # debugging for opt in args: print "Option:", opt, "=", args[opt] - wm = LLManifest.for_platform(args['platform'], args.get('arch'))(srctree, dsttree, args) + wm = LLManifest.for_platform(args['platform'], args.get('arch'))(args) wm.do(*args['actions']) + + # Write out the package file in this format, so that it can easily be called + # and used in a .bat file - yeah, it sucks, but this is the simplest... + touch = args.get('touch') + if touch: + fp = open(touch, 'w') + fp.write('set package_file=%s\n' % wm.package_file) + fp.close() + print 'touched', touch return 0 class LLManifestRegistry(type): def __init__(cls, name, bases, dct): super(LLManifestRegistry, cls).__init__(name, bases, dct) match = re.match("(\w+)Manifest", name) - if(match): + if match: cls.manifests[match.group(1).lower()] = cls class LLManifest(object): @@ -235,15 +258,18 @@ class LLManifest(object): return self.manifests[platform.lower()] for_platform = classmethod(for_platform) - def __init__(self, srctree, dsttree, args): + def __init__(self, args): super(LLManifest, self).__init__() self.args = args self.file_list = [] self.excludes = [] self.actions = [] - self.src_prefix = [srctree] - self.dst_prefix = [dsttree] + self.src_prefix = [args['source']] + self.artwork_prefix = [args['artwork']] + self.build_prefix = [args['build']] + self.dst_prefix = [args['dest']] self.created_paths = [] + self.package_name = "Unknown" def default_grid(self): return self.args.get('grid', None) == '' @@ -260,16 +286,20 @@ class LLManifest(object): in the file list by path().""" self.excludes.append(glob) - def prefix(self, src='', dst=None): + def prefix(self, src='', build=None, dst=None): """ Pushes a prefix onto the stack. Until end_prefix is called, all relevant method calls (esp. to path()) will prefix paths with the entire prefix stack. Source and destination prefixes can be different, though if only one is provided they are both equal. To specify a no-op, use an empty string, not None.""" - if(dst == None): + if dst is None: dst = src + if build is None: + build = src self.src_prefix.append(src) + self.artwork_prefix.append(src) + self.build_prefix.append(build) self.dst_prefix.append(dst) return True # so that you can wrap it in an if to get indentation @@ -281,14 +311,24 @@ class LLManifest(object): exception is raised.""" # as an error-prevention mechanism, check the prefix and see if it matches the source or destination prefix. If not, improper nesting may have occurred. src = self.src_prefix.pop() + artwork = self.artwork_prefix.pop() + build = self.build_prefix.pop() dst = self.dst_prefix.pop() - if descr and not(src == descr or dst == descr): + if descr and not(src == descr or build == descr or dst == descr): raise ValueError, "End prefix '" + descr + "' didn't match '" +src+ "' or '" +dst + "'" def get_src_prefix(self): """ Returns the current source prefix.""" return os.path.join(*self.src_prefix) + def get_artwork_prefix(self): + """ Returns the current artwork prefix.""" + return os.path.join(*self.artwork_prefix) + + def get_build_prefix(self): + """ Returns the current build prefix.""" + return os.path.join(*self.build_prefix) + def get_dst_prefix(self): """ Returns the current destination prefix.""" return os.path.join(*self.dst_prefix) @@ -298,6 +338,11 @@ class LLManifest(object): relative to the source directory.""" return os.path.join(self.get_src_prefix(), relpath) + def build_path_of(self, relpath): + """Returns the full path to a file or directory specified + relative to the build directory.""" + return os.path.join(self.get_build_prefix(), relpath) + def dst_path_of(self, relpath): """Returns the full path to a file or directory specified relative to the destination directory.""" @@ -329,13 +374,13 @@ class LLManifest(object): lines = [] while True: lines.append(fd.readline()) - if(lines[-1] == ''): + if lines[-1] == '': break else: print lines[-1], output = ''.join(lines) status = fd.close() - if(status): + if status: raise RuntimeError( "Command %s returned non-zero status (%s) \noutput:\n%s" % (command, status, output) ) @@ -356,7 +401,7 @@ class LLManifest(object): f.close() def replace_in(self, src, dst=None, searchdict={}): - if(dst == None): + if dst == None: dst = src # read src f = open(self.src_path_of(src), "rbU") @@ -369,11 +414,11 @@ class LLManifest(object): self.created_paths.append(dst) def copy_action(self, src, dst): - if(src and (os.path.exists(src) or os.path.islink(src))): + if src and (os.path.exists(src) or os.path.islink(src)): # ensure that destination path exists self.cmakedirs(os.path.dirname(dst)) self.created_paths.append(dst) - if(not os.path.isdir(src)): + if not os.path.isdir(src): self.ccopy(src,dst) else: # src is a dir @@ -408,7 +453,7 @@ class LLManifest(object): print "Cleaning up " + c def process_file(self, src, dst): - if(self.includes(src, dst)): + if self.includes(src, dst): # print src, "=>", dst for action in self.actions: methodname = action + "_action" @@ -416,26 +461,29 @@ class LLManifest(object): if method is not None: method(src, dst) self.file_list.append([src, dst]) + return 1 else: - print "Excluding: ", src, dst - + sys.stdout.write(" (excluding %r, %r)" % (src, dst)) + sys.stdout.flush() + return 0 def process_directory(self, src, dst): - if(not self.includes(src, dst)): - print "Excluding: ", src, dst - return + if not self.includes(src, dst): + sys.stdout.write(" (excluding %r, %r)" % (src, dst)) + sys.stdout.flush() + return 0 names = os.listdir(src) self.cmakedirs(dst) errors = [] + count = 0 for name in names: srcname = os.path.join(src, name) dstname = os.path.join(dst, name) if os.path.isdir(srcname): - self.process_directory(srcname, dstname) + count += self.process_directory(srcname, dstname) else: - self.process_file(srcname, dstname) - - + count += self.process_file(srcname, dstname) + return count def includes(self, src, dst): if src: @@ -446,9 +494,9 @@ class LLManifest(object): def remove(self, *paths): for path in paths: - if(os.path.exists(path)): + if os.path.exists(path): print "Removing path", path - if(os.path.isdir(path)): + if os.path.isdir(path): shutil.rmtree(path) else: os.remove(path) @@ -457,17 +505,17 @@ class LLManifest(object): """ Copy a single file or symlink. Uses filecmp to skip copying for existing files.""" if os.path.islink(src): linkto = os.readlink(src) - if(os.path.islink(dst) or os.path.exists(dst)): + if os.path.islink(dst) or os.path.exists(dst): os.remove(dst) # because symlinking over an existing link fails os.symlink(linkto, dst) else: # Don't recopy file if it's up-to-date. # If we seem to be not not overwriting files that have been # updated, set the last arg to False, but it will take longer. - if(os.path.exists(dst) and filecmp.cmp(src, dst, True)): + if os.path.exists(dst) and filecmp.cmp(src, dst, True): return # only copy if it's not excluded - if(self.includes(src, dst)): + if self.includes(src, dst): try: os.unlink(dst) except OSError, err: @@ -481,7 +529,7 @@ class LLManifest(object): feature that the destination directory can exist. It is so dumb that Python doesn't come with this. Also it implements the excludes functionality.""" - if(not self.includes(src, dst)): + if not self.includes(src, dst): return names = os.listdir(src) self.cmakedirs(dst) @@ -512,7 +560,7 @@ class LLManifest(object): def find_existing_file(self, *list): for f in list: - if(os.path.exists(f)): + if os.path.exists(f): return f # didn't find it, return last item in list if len(list) > 0: @@ -535,62 +583,63 @@ class LLManifest(object): def wildcard_regex(self, src_glob, dst_glob): - # print "regex_pair:", src_glob, dst_glob src_re = re.escape(src_glob) src_re = src_re.replace('\*', '([-a-zA-Z0-9._ ]+)') dst_temp = dst_glob i = 1 - while(dst_temp.count("*") > 0): + while dst_temp.count("*") > 0: dst_temp = dst_temp.replace('*', '\g<' + str(i) + '>', 1) i = i+1 - # print "regex_result:", src_re, dst_temp return re.compile(src_re), dst_temp def check_file_exists(self, path): - if(not os.path.exists(path) and not os.path.islink(path)): + if not os.path.exists(path) and not os.path.islink(path): raise RuntimeError("Path %s doesn't exist" % ( os.path.normpath(os.path.join(os.getcwd(), path)),)) wildcard_pattern = re.compile('\*') def expand_globs(self, src, dst): - def fw_slash(str): - return str.replace('\\', '/') - def os_slash(str): - return str.replace('/', os.path.sep) - dst = fw_slash(dst) - src = fw_slash(src) src_list = glob.glob(src) - src_re, d_template = self.wildcard_regex(src, dst) + src_re, d_template = self.wildcard_regex(src.replace('\\', '/'), + dst.replace('\\', '/')) for s in src_list: - s = fw_slash(s) - d = src_re.sub(d_template, s) - #print "s:",s, "d_t", d_template, "dst", dst, "d", d - yield os_slash(s), os_slash(d) + d = src_re.sub(d_template, s.replace('\\', '/')) + yield os.path.normpath(s), os.path.normpath(d) def path(self, src, dst=None): - print "Processing", src, "=>", dst + sys.stdout.write("Processing %s => %s ... " % (src, dst)) + sys.stdout.flush() if src == None: raise RuntimeError("No source file, dst is " + dst) if dst == None: dst = src dst = os.path.join(self.get_dst_prefix(), dst) - src = os.path.join(self.get_src_prefix(), src) - # expand globs - if(self.wildcard_pattern.search(src)): - for s,d in self.expand_globs(src, dst): - self.process_file(s, d) - else: - # if we're specifying a single path (not a glob), - # we should error out if it doesn't exist - self.check_file_exists(src) - # if it's a directory, recurse through it - if(os.path.isdir(src)): - self.process_directory(src, dst) + def try_path(src): + # expand globs + count = 0 + if self.wildcard_pattern.search(src): + for s,d in self.expand_globs(src, dst): + count += self.process_file(s, d) else: - self.process_file(src, dst) - + # if we're specifying a single path (not a glob), + # we should error out if it doesn't exist + self.check_file_exists(src) + # if it's a directory, recurse through it + if os.path.isdir(src): + count += self.process_directory(src, dst) + else: + count += self.process_file(src, dst) + return count + try: + count = try_path(os.path.join(self.get_src_prefix(), src)) + except RuntimeError: + try: + count = try_path(os.path.join(self.get_artwork_prefix(), src)) + except RuntimeError: + count = try_path(os.path.join(self.get_build_prefix(), src)) + print "%d files" % count def do(self, *actions): self.actions = actions diff --git a/indra/linux_crash_logger/CMakeLists.txt b/indra/linux_crash_logger/CMakeLists.txt new file mode 100644 index 0000000000..a3a4d6be0b --- /dev/null +++ b/indra/linux_crash_logger/CMakeLists.txt @@ -0,0 +1,81 @@ +# -*- cmake -*- + +project(linux_crash_logger) + +include(00-Common) +include(Boost) +include(LLCommon) +include(LLCrashLogger) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLXML) +include(Linking) +include(UI) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLCRASHLOGGER_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(linux_crash_logger_SOURCE_FILES + linux_crash_logger.cpp + llcrashloggerlinux.cpp + ) + +set(linux_crash_logger_HEADER_FILES + CMakeLists.txt + + llcrashloggerlinux.h + ) + +set_source_files_properties(${linux_crash_logger_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND linux_crash_logger_SOURCE_FILES + ${linux_crash_logger_HEADER_FILES} + ) + +list(APPEND CMAKE_EXE_LINKER_FLAGS -Wl,--as-needed) + +add_executable(linux-crash-logger ${linux_crash_logger_SOURCE_FILES}) + +target_link_libraries(linux-crash-logger + ${LLCRASHLOGGER_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLXML_LIBRARIES} + ${LLMESSAGE_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${UI_LIBRARIES} + ${BOOST_SIGNALS_LIBRARY} + ${DB_LIBRARIES} + ) + +add_custom_command( + OUTPUT linux-crash-logger-stripped-globalsyms + COMMAND strip + ARGS --strip-debug -o linux-crash-logger-stripped-globalsyms + linux-crash-logger + DEPENDS linux-crash-logger + ) + +add_custom_command( + OUTPUT linux-crash-logger-stripped + COMMAND objcopy + ARGS + --keep-global-symbols + ${VIEWER_DIR}/newview/linux_tools/exposed-symbols.txt + linux-crash-logger-stripped-globalsyms + linux-crash-logger-stripped + DEPENDS + linux-crash-logger-stripped-globalsyms + ${VIEWER_DIR}/newview/linux_tools/exposed-symbols.txt + ) + +add_custom_target(linux-crash-logger-stripped ALL + DEPENDS linux-crash-logger-stripped) diff --git a/indra/llaudio/CMakeLists.txt b/indra/llaudio/CMakeLists.txt new file mode 100644 index 0000000000..27e33b8cf3 --- /dev/null +++ b/indra/llaudio/CMakeLists.txt @@ -0,0 +1,60 @@ +# -*- cmake -*- + +project(llaudio) + +include(00-Common) +include(Audio) +include(FMOD) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLVFS) + +include_directories( + ${FMOD_INCLUDE_DIR} + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${OGG_INCLUDE_DIRS} + ${VORBISENC_INCLUDE_DIRS} + ${VORBISFILE_INCLUDE_DIRS} + ${VORBIS_INCLUDE_DIRS} + ) + +set(llaudio_SOURCE_FILES + audioengine.cpp + listener.cpp + llaudiodecodemgr.cpp + vorbisdecode.cpp + vorbisencode.cpp + ) + +set(llaudio_HEADER_FILES + CMakeLists.txt + + audioengine.h + listener.h + llaudiodecodemgr.h + vorbisdecode.h + vorbisencode.h + ) + +if (FMOD) + list(APPEND llaudio_SOURCE_FILES + audioengine_fmod.cpp + listener_fmod.cpp + ) + + list(APPEND llaudio_HEADER_FILES + audioengine_fmod.h + listener_fmod.h + ) +endif (FMOD) + +set_source_files_properties(${llaudio_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES}) + +add_library (llaudio ${llaudio_SOURCE_FILES}) diff --git a/indra/llcharacter/CMakeLists.txt b/indra/llcharacter/CMakeLists.txt new file mode 100644 index 0000000000..63010626e1 --- /dev/null +++ b/indra/llcharacter/CMakeLists.txt @@ -0,0 +1,76 @@ +# -*- cmake -*- + +project(llcharacter) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLXML) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llcharacter_SOURCE_FILES + llanimationstates.cpp + llbvhloader.cpp + llcharacter.cpp + lleditingmotion.cpp + llgesture.cpp + llhandmotion.cpp + llheadrotmotion.cpp + lljoint.cpp + lljointsolverrp3.cpp + llkeyframefallmotion.cpp + llkeyframemotion.cpp + llkeyframemotionparam.cpp + llkeyframestandmotion.cpp + llkeyframewalkmotion.cpp + llmotioncontroller.cpp + llmotion.cpp + llmultigesture.cpp + llpose.cpp + llstatemachine.cpp + lltargetingmotion.cpp + llvisualparam.cpp + ) + +set(llcharacter_HEADER_FILES + CMakeLists.txt + + llanimationstates.h + llbvhloader.h + llcharacter.h + lleditingmotion.h + llgesture.h + llhandmotion.h + llheadrotmotion.h + lljoint.h + lljointsolverrp3.h + lljointstate.h + llkeyframefallmotion.h + llkeyframemotion.h + llkeyframemotionparam.h + llkeyframestandmotion.h + llkeyframewalkmotion.h + llmotion.h + llmotioncontroller.h + llmultigesture.h + llpose.h + llstatemachine.h + lltargetingmotion.h + llvisualparam.h + ) + +set_source_files_properties(${llcharacter_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llcharacter_SOURCE_FILES ${llcharacter_HEADER_FILES}) + +add_library (llcharacter ${llcharacter_SOURCE_FILES}) diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index 1d157fd5f5..95147ba842 100644 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -59,37 +59,37 @@ char gOutFile[1024]; /* Flawfinder: ignore */ //------------------------------------------------------------------------ // Status Codes //------------------------------------------------------------------------ -char *LLBVHLoader::ST_OK = "Ok"; -char *LLBVHLoader::ST_EOF = "Premature end of file."; -char *LLBVHLoader::ST_NO_CONSTRAINT = "Can't read constraint definition."; -char *LLBVHLoader::ST_NO_FILE = "Can't open BVH file."; -char *LLBVHLoader::ST_NO_HIER = "Invalid HIERARCHY header."; -char *LLBVHLoader::ST_NO_JOINT = "Can't find ROOT or JOINT."; -char *LLBVHLoader::ST_NO_NAME = "Can't get JOINT name."; -char *LLBVHLoader::ST_NO_OFFSET = "Can't find OFFSET."; -char *LLBVHLoader::ST_NO_CHANNELS = "Can't find CHANNELS."; -char *LLBVHLoader::ST_NO_ROTATION = "Can't get rotation order."; -char *LLBVHLoader::ST_NO_AXIS = "Can't get rotation axis."; -char *LLBVHLoader::ST_NO_MOTION = "Can't find MOTION."; -char *LLBVHLoader::ST_NO_FRAMES = "Can't get number of frames."; -char *LLBVHLoader::ST_NO_FRAME_TIME = "Can't get frame time."; -char *LLBVHLoader::ST_NO_POS = "Can't get position values."; -char *LLBVHLoader::ST_NO_ROT = "Can't get rotation values."; -char *LLBVHLoader::ST_NO_XLT_FILE = "Can't open translation file."; -char *LLBVHLoader::ST_NO_XLT_HEADER = "Can't read translation header."; -char *LLBVHLoader::ST_NO_XLT_NAME = "Can't read translation names."; -char *LLBVHLoader::ST_NO_XLT_IGNORE = "Can't read translation ignore value."; -char *LLBVHLoader::ST_NO_XLT_RELATIVE = "Can't read translation relative value."; -char *LLBVHLoader::ST_NO_XLT_OUTNAME = "Can't read translation outname value."; -char *LLBVHLoader::ST_NO_XLT_MATRIX = "Can't read translation matrix."; -char *LLBVHLoader::ST_NO_XLT_MERGECHILD = "Can't get mergechild name."; -char *LLBVHLoader::ST_NO_XLT_MERGEPARENT = "Can't get mergeparent name."; -char *LLBVHLoader::ST_NO_XLT_PRIORITY = "Can't get priority value."; -char *LLBVHLoader::ST_NO_XLT_LOOP = "Can't get loop value."; -char *LLBVHLoader::ST_NO_XLT_EASEIN = "Can't get easeIn values."; -char *LLBVHLoader::ST_NO_XLT_EASEOUT = "Can't get easeOut values."; -char *LLBVHLoader::ST_NO_XLT_HAND = "Can't get hand morph value."; -char *LLBVHLoader::ST_NO_XLT_EMOTE = "Can't read emote name."; +const char *LLBVHLoader::ST_OK = "Ok"; +const char *LLBVHLoader::ST_EOF = "Premature end of file."; +const char *LLBVHLoader::ST_NO_CONSTRAINT = "Can't read constraint definition."; +const char *LLBVHLoader::ST_NO_FILE = "Can't open BVH file."; +const char *LLBVHLoader::ST_NO_HIER = "Invalid HIERARCHY header."; +const char *LLBVHLoader::ST_NO_JOINT = "Can't find ROOT or JOINT."; +const char *LLBVHLoader::ST_NO_NAME = "Can't get JOINT name."; +const char *LLBVHLoader::ST_NO_OFFSET = "Can't find OFFSET."; +const char *LLBVHLoader::ST_NO_CHANNELS = "Can't find CHANNELS."; +const char *LLBVHLoader::ST_NO_ROTATION = "Can't get rotation order."; +const char *LLBVHLoader::ST_NO_AXIS = "Can't get rotation axis."; +const char *LLBVHLoader::ST_NO_MOTION = "Can't find MOTION."; +const char *LLBVHLoader::ST_NO_FRAMES = "Can't get number of frames."; +const char *LLBVHLoader::ST_NO_FRAME_TIME = "Can't get frame time."; +const char *LLBVHLoader::ST_NO_POS = "Can't get position values."; +const char *LLBVHLoader::ST_NO_ROT = "Can't get rotation values."; +const char *LLBVHLoader::ST_NO_XLT_FILE = "Can't open translation file."; +const char *LLBVHLoader::ST_NO_XLT_HEADER = "Can't read translation header."; +const char *LLBVHLoader::ST_NO_XLT_NAME = "Can't read translation names."; +const char *LLBVHLoader::ST_NO_XLT_IGNORE = "Can't read translation ignore value."; +const char *LLBVHLoader::ST_NO_XLT_RELATIVE = "Can't read translation relative value."; +const char *LLBVHLoader::ST_NO_XLT_OUTNAME = "Can't read translation outname value."; +const char *LLBVHLoader::ST_NO_XLT_MATRIX = "Can't read translation matrix."; +const char *LLBVHLoader::ST_NO_XLT_MERGECHILD = "Can't get mergechild name."; +const char *LLBVHLoader::ST_NO_XLT_MERGEPARENT = "Can't get mergeparent name."; +const char *LLBVHLoader::ST_NO_XLT_PRIORITY = "Can't get priority value."; +const char *LLBVHLoader::ST_NO_XLT_LOOP = "Can't get loop value."; +const char *LLBVHLoader::ST_NO_XLT_EASEIN = "Can't get easeIn values."; +const char *LLBVHLoader::ST_NO_XLT_EASEOUT = "Can't get easeOut values."; +const char *LLBVHLoader::ST_NO_XLT_HAND = "Can't get hand morph value."; +const char *LLBVHLoader::ST_NO_XLT_EMOTE = "Can't read emote name."; //------------------------------------------------------------------------ // find_next_whitespace() diff --git a/indra/llcharacter/llbvhloader.h b/indra/llcharacter/llbvhloader.h index 9f69cff7c7..dcd349f828 100644 --- a/indra/llcharacter/llbvhloader.h +++ b/indra/llcharacter/llbvhloader.h @@ -203,38 +203,38 @@ public: ~LLBVHLoader(); // Status Codes - typedef char *Status; - static char *ST_OK; - static char *ST_EOF; - static char *ST_NO_CONSTRAINT; - static char *ST_NO_FILE; - static char *ST_NO_HIER; - static char *ST_NO_JOINT; - static char *ST_NO_NAME; - static char *ST_NO_OFFSET; - static char *ST_NO_CHANNELS; - static char *ST_NO_ROTATION; - static char *ST_NO_AXIS; - static char *ST_NO_MOTION; - static char *ST_NO_FRAMES; - static char *ST_NO_FRAME_TIME; - static char *ST_NO_POS; - static char *ST_NO_ROT; - static char *ST_NO_XLT_FILE; - static char *ST_NO_XLT_HEADER; - static char *ST_NO_XLT_NAME; - static char *ST_NO_XLT_IGNORE; - static char *ST_NO_XLT_RELATIVE; - static char *ST_NO_XLT_OUTNAME; - static char *ST_NO_XLT_MATRIX; - static char *ST_NO_XLT_MERGECHILD; - static char *ST_NO_XLT_MERGEPARENT; - static char *ST_NO_XLT_PRIORITY; - static char *ST_NO_XLT_LOOP; - static char *ST_NO_XLT_EASEIN; - static char *ST_NO_XLT_EASEOUT; - static char *ST_NO_XLT_HAND; - static char *ST_NO_XLT_EMOTE; + typedef const char *Status; + static const char *ST_OK; + static const char *ST_EOF; + static const char *ST_NO_CONSTRAINT; + static const char *ST_NO_FILE; + static const char *ST_NO_HIER; + static const char *ST_NO_JOINT; + static const char *ST_NO_NAME; + static const char *ST_NO_OFFSET; + static const char *ST_NO_CHANNELS; + static const char *ST_NO_ROTATION; + static const char *ST_NO_AXIS; + static const char *ST_NO_MOTION; + static const char *ST_NO_FRAMES; + static const char *ST_NO_FRAME_TIME; + static const char *ST_NO_POS; + static const char *ST_NO_ROT; + static const char *ST_NO_XLT_FILE; + static const char *ST_NO_XLT_HEADER; + static const char *ST_NO_XLT_NAME; + static const char *ST_NO_XLT_IGNORE; + static const char *ST_NO_XLT_RELATIVE; + static const char *ST_NO_XLT_OUTNAME; + static const char *ST_NO_XLT_MATRIX; + static const char *ST_NO_XLT_MERGECHILD; + static const char *ST_NO_XLT_MERGEPARENT; + static const char *ST_NO_XLT_PRIORITY; + static const char *ST_NO_XLT_LOOP; + static const char *ST_NO_XLT_EASEIN; + static const char *ST_NO_XLT_EASEOUT; + static const char *ST_NO_XLT_HAND; + static const char *ST_NO_XLT_EMOTE; // Loads the specified translation table. Status loadTranslationTable(const char *fileName); diff --git a/indra/llcharacter/llmotion.h b/indra/llcharacter/llmotion.h index 13825dde30..7669920339 100644 --- a/indra/llcharacter/llmotion.h +++ b/indra/llcharacter/llmotion.h @@ -49,13 +49,13 @@ class LLCharacter; class LLMotion { public: - typedef enum LLMotionBlendType + enum LLMotionBlendType { NORMAL_BLEND, ADDITIVE_BLEND }; - typedef enum LLMotionInitStatus + enum LLMotionInitStatus { STATUS_FAILURE, STATUS_SUCCESS, diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt new file mode 100644 index 0000000000..72d267d794 --- /dev/null +++ b/indra/llcommon/CMakeLists.txt @@ -0,0 +1,188 @@ +# -*- cmake -*- + +project(llcommon) + +include(00-Common) +include(LLCommon) + +include_directories( + ${EXPAT_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS} + ) + +set(llcommon_SOURCE_FILES + llapp.cpp + llapr.cpp + llassettype.cpp + llbase32.cpp + llbase64.cpp + llcommon.cpp + llcrc.cpp + llcriticaldamp.cpp + lldate.cpp + llerror.cpp + llerrorthread.cpp + llevent.cpp + llfasttimer.cpp + llfile.cpp + llfindlocale.cpp + llfixedbuffer.cpp + llformat.cpp + llframetimer.cpp + llheartbeat.cpp + llindraconfigfile.cpp + llliveappconfig.cpp + lllivefile.cpp + lllog.cpp + llmd5.cpp + llmemory.cpp + llmemorystream.cpp + llmetrics.cpp + llmortician.cpp + llprocessor.cpp + llqueuedthread.cpp + llrand.cpp + llrun.cpp + llsd.cpp + llsdserialize.cpp + llsdserialize_xml.cpp + llsdutil.cpp + llsecondlifeurls.cpp + llstat.cpp + llstreamtools.cpp + llstring.cpp + llstringtable.cpp + llsys.cpp + llthread.cpp + lltimer.cpp + lluri.cpp + lluuid.cpp + llworkerthread.cpp + metaclass.cpp + metaproperty.cpp + reflective.cpp + timing.cpp + u64.cpp + ) + +set(llcommon_HEADER_FILES + CMakeLists.txt + + bitpack.h + ctype_workaround.h + doublelinkedlist.h + imageids.h + indra_constants.h + linden_common.h + linked_lists.h + llagentconstants.h + llapp.h + llapr.h + llassettype.h + llassoclist.h + llavatarconstants.h + llbase32.h + llbase64.h + llboost.h + llchat.h + llclickaction.h + llcommon.h + llcrc.h + llcriticaldamp.h + lldarray.h + lldarrayptr.h + lldate.h + lldefs.h + lldepthstack.h + lldlinked.h + lldqueueptr.h + llendianswizzle.h + llenum.h + llerror.h + llerrorcontrol.h + llerrorlegacy.h + llerrorthread.h + llevent.h + lleventemitter.h + llextendedstatus.h + llfasttimer.h + llfile.h + llfindlocale.h + llfixedbuffer.h + llformat.h + llframetimer.h + llhash.h + llheartbeat.h + llindexedqueue.h + llindraconfigfile.h + llkeythrottle.h + lllinkedqueue.h + llliveappconfig.h + lllivefile.h + lllocalidhashmap.h + lllog.h + lllslconstants.h + llmap.h + llmd5.h + llmemory.h + llmemorystream.h + llmemtype.h + llmetrics.h + llmortician.h + llnametable.h + llpreprocessor.h + llpriqueuemap.h + llprocessor.h + llptrskiplist.h + llptrskipmap.h + llqueuedthread.h + llrand.h + llrun.h + llsd.h + llsdserialize.h + llsdserialize_xml.h + llsdutil.h + llsecondlifeurls.h + llsimplehash.h + llskiplist.h + llskipmap.h + llstack.h + llstat.h + llstatenums.h + llstl.h + llstreamtools.h + llstrider.h + llstring.h + llstringtable.h + llsys.h + llthread.h + lltimer.h + lluri.h + lluuid.h + lluuidhashmap.h + llversionserver.h + llversionviewer.h + llworkerthread.h + metaclass.h + metaclasst.h + metaproperty.h + metapropertyt.h + processor.h + reflective.h + reflectivet.h + roles_constants.h + stdenums.h + stdtypes.h + string_table.h + timer.h + timing.h + u64.h + ) + +set_source_files_properties(${llcommon_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) + +add_library (llcommon ${llcommon_SOURCE_FILES}) diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h index 9ee4d1159e..60ea21d642 100644 --- a/indra/llcommon/linden_common.h +++ b/indra/llcommon/linden_common.h @@ -45,9 +45,10 @@ #include <iostream> #include <fstream> -// Work around stupid Microsoft STL warning +// Work Microsoft compiler warnings #ifdef LL_WINDOWS -#pragma warning (disable : 4702) // warning C4702: unreachable code +#pragma warning (disable : 4702) // unreachable code +#pragma warning (disable : 4244) // conversion from time_t to S32 #endif // LL_WINDOWS #include <algorithm> diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index b6c363886c..3927d5f014 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -40,11 +40,11 @@ #include <boost/noncopyable.hpp> -#include "apr-1/apr_thread_proc.h" -#include "apr-1/apr_thread_mutex.h" -#include "apr-1/apr_getopt.h" -#include "apr-1/apr_signal.h" -#include "apr-1/apr_atomic.h" +#include "apr_thread_proc.h" +#include "apr_thread_mutex.h" +#include "apr_getopt.h" +#include "apr_signal.h" +#include "apr_atomic.h" #include "llstring.h" extern apr_thread_mutex_t* gLogMutexp; diff --git a/indra/llcommon/llbase64.cpp b/indra/llcommon/llbase64.cpp index 207b367f6d..ce10e07a0a 100644 --- a/indra/llcommon/llbase64.cpp +++ b/indra/llcommon/llbase64.cpp @@ -36,7 +36,7 @@ #include <string> -#include "apr-1/apr_base64.h" +#include "apr_base64.h" // static diff --git a/indra/llcommon/llcrc.cpp b/indra/llcommon/llcrc.cpp new file mode 100644 index 0000000000..0836ccb66b --- /dev/null +++ b/indra/llcommon/llcrc.cpp @@ -0,0 +1,224 @@ +/** + * @file llcrc.cpp + * @brief implementation of the crc class. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llcrc.h" +#include "llerror.h" + +/* Copyright (C) 1986 Gary S. Brown. You may use this program, or + code or tables extracted from it, as desired without restriction.*/ + +/* First, the polynomial itself and its table of feedback terms. The */ +/* polynomial is */ +/* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ +/* Note that we take it "backwards" and put the highest-order term in */ +/* the lowest-order bit. The X^32 term is "implied"; the LSB is the */ +/* X^31 term, etc. The X^0 term (usually shown as "+1") results in */ +/* the MSB being 1. */ + +/* Note that the usual hardware shift register implementation, which */ +/* is what we're using (we're merely optimizing it by doing eight-bit */ +/* chunks at a time) shifts bits into the lowest-order term. In our */ +/* implementation, that means shifting towards the right. Why do we */ +/* do it this way? Because the calculated CRC must be transmitted in */ +/* order from highest-order term to lowest-order term. UARTs transmit */ +/* characters in order from LSB to MSB. By storing the CRC this way, */ +/* we hand it to the UART in the order low-byte to high-byte; the UART */ +/* sends each low-bit to hight-bit; and the result is transmission bit */ +/* by bit from highest- to lowest-order term without requiring any bit */ +/* shuffling on our part. Reception works similarly. */ + +/* The feedback terms table consists of 256, 32-bit entries. Notes: */ +/* */ +/* 1. The table can be generated at runtime if desired; code to do so */ +/* is shown later. It might not be obvious, but the feedback */ +/* terms simply represent the results of eight shift/xor opera- */ +/* tions for all combinations of data and CRC register values. */ +/* */ +/* 2. The CRC accumulation logic is the same for all CRC polynomials, */ +/* be they sixteen or thirty-two bits wide. You simply choose the */ +/* appropriate table. Alternatively, because the table can be */ +/* generated at runtime, you can start by generating the table for */ +/* the polynomial in question and use exactly the same "updcrc", */ +/* if your application needn't simultaneously handle two CRC */ +/* polynomials. (Note, however, that XMODEM is strange.) */ +/* */ +/* 3. For 16-bit CRCs, the table entries need be only 16 bits wide; */ +/* of course, 32-bit entries work OK if the high 16 bits are zero. */ +/* */ +/* 4. The values must be right-shifted by eight bits by the "updcrc" */ +/* logic; the shift must be unsigned (bring in zeroes). On some */ +/* hardware you could probably optimize the shift in assembler by */ +/* using byte-swap instructions. */ + +///---------------------------------------------------------------------------- +/// Local function declarations, constants, enums, and typedefs +///---------------------------------------------------------------------------- + +#define UPDC32(octet,crc) (crc_32_tab[((crc) \ + ^ ((U8)octet)) & 0xff] ^ ((crc) >> 8)) + + +static U32 crc_32_tab[] = { /* CRC polynomial 0xedb88320 */ +0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, +0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, +0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, +0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, +0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, +0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, +0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, +0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, +0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, +0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, +0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, +0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, +0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, +0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, +0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, +0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, +0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, +0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, +0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, +0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, +0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, +0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, +0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, +0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, +0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, +0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, +0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, +0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, +0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, +0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, +0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, +0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, +0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, +0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, +0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, +0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, +0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, +0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, +0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, +0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, +0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, +0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, +0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + + +///---------------------------------------------------------------------------- +/// Class llcrc +///---------------------------------------------------------------------------- + +// Default constructor +LLCRC::LLCRC() : mCurrent(0xffffffff) +{ +} + + +U32 LLCRC::getCRC() const +{ + return ~mCurrent; +} + +void LLCRC::update(U8 next_byte) +{ + mCurrent = UPDC32(next_byte, mCurrent); +} + +void LLCRC::update(const U8* buffer, size_t buffer_size) +{ + for (size_t i = 0; i < buffer_size; i++) + { + mCurrent = UPDC32(buffer[i], mCurrent); + } +} + +void LLCRC::update(const char* filename) +{ + if (!filename) + { + llerrs << "No filename specified" << llendl; + return; + } + + FILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ + + if (fp) + { + fseek(fp, 0, SEEK_END); + long size = ftell(fp); + + fseek(fp, 0, SEEK_SET); + + if (size > 0) + { + U8* data = new U8[size]; + size_t nread; + + nread = fread(data, 1, size, fp); + fclose(fp); + + if (nread < (size_t) size) + { + llwarns << "Short read on " << filename << llendl; + } + + update(data, nread); + delete[] data; + } + } +} + + +#ifdef _DEBUG +BOOL LLCRC::testHarness() +{ + const S32 TEST_BUFFER_SIZE = 16; + const char TEST_BUFFER[TEST_BUFFER_SIZE] = "hello &#$)$&Nd0"; /* Flawfinder: ignore */ + LLCRC c1, c2; + c1.update((U8*)TEST_BUFFER, TEST_BUFFER_SIZE - 1); + char* rh = (char*)TEST_BUFFER; + while(*rh != '\0') + { + c2.update(*rh); + ++rh; + } + return(c1.getCRC() == c2.getCRC()); +} +#endif + + + +///---------------------------------------------------------------------------- +/// Local function definitions +///---------------------------------------------------------------------------- diff --git a/indra/llcommon/llcrc.h b/indra/llcommon/llcrc.h new file mode 100644 index 0000000000..287c1fbc41 --- /dev/null +++ b/indra/llcommon/llcrc.h @@ -0,0 +1,73 @@ +/** + * @file llcrc.h + * @brief LLCRC class header file. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLCRC_H +#define LL_LLCRC_H + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class llcrc +// +// Simple 32 bit crc. To use, instantiate an LLCRC instance and feed +// it the bytes you want to check. It will update the internal crc as +// you go, and you can qery it at the end. As a horribly inefficient +// example (don't try this at work kids): +// +// LLCRC crc; +// FILE* fp = LLFile::fopen(filename,"rb"); +// while(!feof(fp)) { +// crc.update(fgetc(fp)); +// } +// fclose(fp); +// llinfos << "File crc: " << crc.getCRC() << llendl; +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLCRC +{ +protected: + U32 mCurrent; + +public: + LLCRC(); + + U32 getCRC() const; + void update(U8 next_byte); + void update(const U8* buffer, size_t buffer_size); + void update(const char *filename); + +#ifdef _DEBUG + // This function runs tests to make sure the crc is + // working. Returns TRUE if it is. + static BOOL testHarness(); +#endif +}; + + +#endif // LL_LLCRC_H diff --git a/indra/llcommon/lldarray.h b/indra/llcommon/lldarray.h index c7268b8dab..8784bdfb02 100644 --- a/indra/llcommon/lldarray.h +++ b/indra/llcommon/lldarray.h @@ -32,7 +32,6 @@ #ifndef LL_LLDARRAY_H #define LL_LLDARRAY_H -#include "llmath.h" #include "llerror.h" #include <vector> diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index 37b912df3d..3cc4cca706 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -34,7 +34,7 @@ #include "linden_common.h" #include "lldate.h" -#include "apr-1/apr_time.h" +#include "apr_time.h" #include <iomanip> #include <sstream> diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 95038bea4c..fa3a01c191 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -168,7 +168,7 @@ namespace { private: bool mTimestamp; - typedef enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO}; + enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO}; ANSIState mUseANSI; void colorANSI(const std::string color) { diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 4e868eb5a1..6b8f8e68c5 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -32,6 +32,10 @@ * $/LicenseInfo$ */ +#if LL_WINDOWS +#include <windows.h> +#endif + #include "linden_common.h" #include "llfile.h" #include "llstring.h" @@ -128,6 +132,50 @@ int LLFile::stat(const char* filename, llstat* filestatus) #endif } +bool LLFile::isdir(const char *filename) +{ + llstat st; + + return stat(filename, &st) == 0 && S_ISDIR(st.st_mode); +} + +bool LLFile::isfile(const char *filename) +{ + llstat st; + + return stat(filename, &st) == 0 && S_ISREG(st.st_mode); +} + +const char *LLFile::tmpdir() +{ + static std::string utf8path; + + if (utf8path.empty()) + { + char sep; +#if LL_WINDOWS + sep = '\\'; + + DWORD len = GetTempPathW(0, L""); + llutf16string utf16path; + utf16path.resize(len + 1); + len = GetTempPathW(static_cast<DWORD>(utf16path.size()), &utf16path[0]); + utf8path = utf16str_to_utf8str(utf16path); +#else + sep = '/'; + + char *env = getenv("TMPDIR"); + + utf8path = env ? env : "/tmp/"; +#endif + if (utf8path[utf8path.size() - 1] != sep) + { + utf8path += sep; + } + } + return utf8path.c_str(); +} + /***************** Modified file stream created to overcome the incorrect behaviour of posix fopen in windows *******************/ diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index a8a6965c0d..bd51ac2aa9 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -50,15 +50,23 @@ typedef FILE LLFILE; #define USE_LLFILESTREAMS 0 #endif +#include <sys/stat.h> #if LL_WINDOWS // windows version of stat function and stat data structure are called _stat typedef struct _stat llstat; #else -#include <sys/stat.h> typedef struct stat llstat; #endif +#ifndef S_ISREG +# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) +#endif + +#ifndef S_ISDIR +# define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) +#endif + class LLFile { public: @@ -74,7 +82,10 @@ public: static int remove(const char* filename); static int rename(const char* filename,const char* newname); static int stat(const char* filename,llstat* file_status); + static bool isdir(const char* filename); + static bool isfile(const char* filename); static LLFILE * _Fiopen(const char *filename, std::ios::openmode mode,int); // protection currently unused + static const char * tmpdir(); }; diff --git a/indra/llcommon/llhash.h b/indra/llcommon/llhash.h index f4b05869a4..08299f5ddc 100644 --- a/indra/llcommon/llhash.h +++ b/indra/llcommon/llhash.h @@ -38,7 +38,9 @@ #include <hash_map> #include <algorithm> #elif LL_DARWIN || LL_LINUX -# if GCC_VERSION >= 30400 // gcc 3.4 and up +# if GCC_VERSION >= 40300 // gcc 4.3 and up +# include <backward/hashtable.h> +# elif GCC_VERSION >= 30400 // gcc 3.4 and up # include <ext/hashtable.h> # elif __GNUC__ >= 3 # include <ext/stl_hashtable.h> diff --git a/indra/llcommon/llheartbeat.cpp b/indra/llcommon/llheartbeat.cpp index 782a4f7ff6..b08e72137a 100644 --- a/indra/llcommon/llheartbeat.cpp +++ b/indra/llcommon/llheartbeat.cpp @@ -72,8 +72,13 @@ LLHeartbeat::rawSend() if (mSuppressed) return 0; // Pretend we succeeded. + int result; +#ifndef LL_DARWIN union sigval dummy; - int result = sigqueue(getppid(), LL_HEARTBEAT_SIGNAL, dummy); + result = sigqueue(getppid(), LL_HEARTBEAT_SIGNAL, dummy); +#else + result = kill(getppid(), LL_HEARTBEAT_SIGNAL); +#endif if (result == 0) return 0; // success diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp new file mode 100644 index 0000000000..033eb2f44d --- /dev/null +++ b/indra/llcommon/llmd5.cpp @@ -0,0 +1,531 @@ +/** + * @file llmd5.cpp + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +// llMD5.CC - source code for the C++/object oriented translation and +// modification of MD5. +// +// Adapted to Linden Lab by Frank Filipanits, 6/25/2002 +// Fixed potential memory leak, James Cook, 6/27/2002 + +// Translation and modification (c) 1995 by Mordechai T. Abzug + +// This translation/ modification is provided "as is," without express or +// implied warranty of any kind. + +// The translator/ modifier does not claim (1) that MD5 will do what you think +// it does; (2) that this translation/ modification is accurate; or (3) that +// this software is "merchantible." (Language for this disclaimer partially +// copied from the disclaimer below). + +/* based on: + + MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + MDDRIVER.C - test driver for MD2, MD4 and MD5 + + + Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + + */ + + + + + +#include "linden_common.h" + +#include "llmd5.h" + +#include <cassert> + +// how many bytes to grab at a time when checking files +const int LLMD5::BLOCK_LEN = 4096; + + +// LLMD5 simple initialization method + +LLMD5::LLMD5() +{ + init(); +} + + + + +// MD5 block update operation. Continues an MD5 message-digest +// operation, processing another message block, and updating the +// context. + +void LLMD5::update (const uint1 *input, const uint4 input_length) { + + uint4 input_index, buffer_index; + uint4 buffer_space; // how much space is left in buffer + + if (finalized){ // so we can't update! + std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl; + return; + } + + // Compute number of bytes mod 64 + buffer_index = (unsigned int)((count[0] >> 3) & 0x3F); + + // Update number of bits + if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) ) + count[1]++; + + count[1] += ((uint4)input_length >> 29); + + + buffer_space = 64 - buffer_index; // how much space is left in buffer + + // Transform as many times as possible. + if (input_length >= buffer_space) { // ie. we have enough to fill the buffer + // fill the rest of the buffer and transform + memcpy( /* Flawfinder: ignore */ + buffer + buffer_index, + input, + buffer_space); + transform (buffer); + + // now, transform each 64-byte piece of the input, bypassing the buffer + if (input == NULL || input_length == 0){ + std::cerr << "LLMD5::update: Invalid input!" << std::endl; + return; + } + + for (input_index = buffer_space; input_index + 63 < input_length; + input_index += 64) + transform (input+input_index); + + buffer_index = 0; // so we can buffer remaining + } + else + input_index=0; // so we can buffer the whole input + + + // and here we do the buffering: + memcpy(buffer+buffer_index, input+input_index, input_length-input_index); /* Flawfinder: ignore */ +} + + + +// MD5 update for files. +// Like above, except that it works on files (and uses above as a primitive.) + +void LLMD5::update(FILE* file){ + + unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ + int len; + + while ( (len=(int)fread(buffer, 1, BLOCK_LEN, file)) ) + update(buffer, len); + + fclose (file); + +} + + + + + + +// MD5 update for istreams. +// Like update for files; see above. + +void LLMD5::update(std::istream& stream){ + + unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ + int len; + + while (stream.good()){ + stream.read( (char*)buffer, BLOCK_LEN); /* Flawfinder: ignore */ // note that return value of read is unusable. + len=stream.gcount(); + update(buffer, len); + } + +} + + + + + +// MD5 finalization. Ends an MD5 message-digest operation, writing the +// the message digest and zeroizing the context. + + +void LLMD5::finalize (){ + + unsigned char bits[8]; /* Flawfinder: ignore */ + unsigned int index, padLen; + static uint1 PADDING[64]={ + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + if (finalized){ + std::cerr << "LLMD5::finalize: Already finalized this digest!" << std::endl; + return; + } + + // Save number of bits + encode (bits, count, 8); + + // Pad out to 56 mod 64. + index = (uint4) ((count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + update (PADDING, padLen); + + // Append length (before padding) + update (bits, 8); + + // Store state in digest + encode (digest, state, 16); + + // Zeroize sensitive information + memset (buffer, 0, sizeof(*buffer)); + + finalized=1; + +} + + + + +LLMD5::LLMD5(FILE *file){ + + init(); // must be called be all constructors + update(file); + finalize (); +} + + + + +LLMD5::LLMD5(std::istream& stream){ + + init(); // must called by all constructors + update (stream); + finalize(); +} + +// Digest a string of the format ("%s:%i" % (s, number)) +LLMD5::LLMD5(const unsigned char *string, const unsigned int number) +{ + const char *colon = ":"; + char tbuf[16]; /* Flawfinder: ignore */ + init(); + update(string, (U32)strlen((const char *) string)); /* Flawfinder: ignore */ + update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */ + snprintf(tbuf, sizeof(tbuf), "%i", number); /* Flawfinder: ignore */ + update((const unsigned char *) tbuf, (U32)strlen(tbuf)); /* Flawfinder: ignore */ + finalize(); +} + +// Digest a string +LLMD5::LLMD5(const unsigned char *s) +{ + init(); + update(s, (U32)strlen((const char *) s)); /* Flawfinder: ignore */ + finalize(); +} + +void LLMD5::raw_digest(unsigned char *s) +{ + if (!finalized) + { + std::cerr << "LLMD5::raw_digest: Can't get digest if you haven't "<< + "finalized the digest!" << std::endl; + s[0] = '\0'; + return; + } + + memcpy(s, digest, 16); /* Flawfinder: ignore */ + return; +} + + + +void LLMD5::hex_digest(char *s) +{ + int i; + + if (!finalized) + { + std::cerr << "LLMD5::hex_digest: Can't get digest if you haven't "<< + "finalized the digest!" <<std::endl; + s[0] = '\0'; + return; + } + + for (i=0; i<16; i++) + { + sprintf(s+i*2, "%02x", digest[i]); /* Flawfinder: ignore */ + } + + s[32]='\0'; + + return; +} + + + + + +std::ostream& operator<<(std::ostream &stream, LLMD5 context) +{ + char s[33]; /* Flawfinder: ignore */ + context.hex_digest(s); + stream << s; + return stream; +} + + + + +// PRIVATE METHODS: + + + +void LLMD5::init(){ + finalized=0; // we just started! + + // Nothing counted, so count=0 + count[0] = 0; + count[1] = 0; + + // Load magic initialization constants. + state[0] = 0x67452301; + state[1] = 0xefcdab89; + state[2] = 0x98badcfe; + state[3] = 0x10325476; +} + + + +// Constants for MD5Transform routine. +// Although we could use C++ style constants, defines are actually better, +// since they let us easily evade scope clashes. + +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + +// #defines are faster then inline, etc because the compiler is not required to inline. +// Timing tests prove that this works ~40% faster on win with msvc++2k3 over using static inline. + +/* F, G, H and I are basic MD5 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. +Rotation is separate from addition to prevent recomputation. + */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + + + +// LLMD5 basic transformation. Transforms state based on block. +void LLMD5::transform (const U8 block[64]){ + + uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + decode (x, block, 64); + + assert(!finalized); // not just a user error, since the method is private + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + // Zeroize sensitive information. + memset ( (uint1 *) x, 0, sizeof(x)); + +} + + + +// Encodes input (UINT4) into output (unsigned char). Assumes len is +// a multiple of 4. +void LLMD5::encode (uint1 *output, const uint4 *input, const uint4 len) { + + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (uint1) (input[i] & 0xff); + output[j+1] = (uint1) ((input[i] >> 8) & 0xff); + output[j+2] = (uint1) ((input[i] >> 16) & 0xff); + output[j+3] = (uint1) ((input[i] >> 24) & 0xff); + } +} + + + + +// Decodes input (unsigned char) into output (UINT4). Assumes len is +// a multiple of 4. +void LLMD5::decode (uint4 *output, const uint1 *input, const uint4 len){ + + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) | + (((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24); +} diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h new file mode 100644 index 0000000000..7dabbfeb0f --- /dev/null +++ b/indra/llcommon/llmd5.h @@ -0,0 +1,133 @@ +/** + * @file llmd5.h + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLMD5_H +#define LL_LLMD5_H + +// LLMD5.CC - source code for the C++/object oriented translation and +// modification of MD5. + +// Translation and modification (c) 1995 by Mordechai T. Abzug + +// This translation/ modification is provided "as is," without express or +// implied warranty of any kind. + +// The translator/ modifier does not claim (1) that MD5 will do what you think +// it does; (2) that this translation/ modification is accurate; or (3) that +// this software is "merchantible." (Language for this disclaimer partially +// copied from the disclaimer below). + +/* based on: + + MD5.H - header file for MD5C.C + MDDRIVER.C - test driver for MD2, MD4 and MD5 + + Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + +*/ + +// use for the raw digest output +const int MD5RAW_BYTES = 16; + +// use for outputting hex digests +const int MD5HEX_STR_SIZE = 33; // char hex[MD5HEX_STR_SIZE]; with null +const int MD5HEX_STR_BYTES = 32; // message system fixed size + +class LLMD5 { +// first, some types: + typedef unsigned int uint4; // assumes integer is 4 words long + typedef unsigned short int uint2; // assumes short integer is 2 words long + typedef unsigned char uint1; // assumes char is 1 word long + +// how many bytes to grab at a time when checking files + static const int BLOCK_LEN; + +public: +// methods for controlled operation: + LLMD5 (); // simple initializer + void update (const uint1 *input, const uint4 input_length); + void update (std::istream& stream); + void update (FILE *file); + void finalize (); + +// constructors for special circumstances. All these constructors finalize +// the MD5 context. + LLMD5 (const unsigned char *string); // digest string, finalize + LLMD5 (std::istream& stream); // digest stream, finalize + LLMD5 (FILE *file); // digest file, close, finalize + LLMD5 (const unsigned char *string, const unsigned int number); + +// methods to acquire finalized result + void raw_digest(unsigned char *array); // provide 16-byte array for binary data + void hex_digest(char *string); // provide 33-byte array for ascii-hex string + friend std::ostream& operator<< (std::ostream&, LLMD5 context); + + + +private: + + +// next, the private data: + uint4 state[4]; + uint4 count[2]; // number of *bits*, mod 2^64 + uint1 buffer[64]; // input buffer + uint1 digest[16]; + uint1 finalized; + +// last, the private methods, mostly static: + void init (); // called by all constructors + void transform (const uint1 *buffer); // does the real update work. Note + // that length is implied to be 64. + + static void encode (uint1 *dest, const uint4 *src, const uint4 length); + static void decode (uint4 *dest, const uint1 *src, const uint4 length); + +}; + +#endif // LL_LLMD5_H diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 454a820ce5..dc4ac18c4d 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -64,6 +64,9 @@ #ifndef LL_MSVC #define LL_MSVC 1 #endif + #if _MSC_VER < 1400 + #define LL_MSVC7 //Visual C++ 2003 or earlier + #endif #endif // Deal with minor differences on Unixy OSes. @@ -104,9 +107,7 @@ using snprintf_hack::snprintf; #if defined(LL_WINDOWS) #define BOOST_REGEX_NO_LIB 1 #define CURL_STATICLIB 1 - -#define LL_LCD_COMPILE 1 - +#define XML_STATIC #endif // LL_WINDOWS diff --git a/indra/llcommon/llptrskiplist.h b/indra/llcommon/llptrskiplist.h index b03faf57f1..90bcec535d 100644 --- a/indra/llcommon/llptrskiplist.h +++ b/indra/llcommon/llptrskiplist.h @@ -33,6 +33,7 @@ #define LL_LLPTRSKIPLIST_H #include "llerror.h" +#include "llrand.h" //#include "vmath.h" #include "llrand.h" diff --git a/indra/llcommon/llrand.cpp b/indra/llcommon/llrand.cpp new file mode 100644 index 0000000000..11ecd8efde --- /dev/null +++ b/indra/llcommon/llrand.cpp @@ -0,0 +1,176 @@ +/** + * @file llrand.cpp + * @brief Global random generator. + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llrand.h" +#include "lluuid.h" + +/** + * Through analysis, we have decided that we want to take values which + * are close enough to 1.0 to map back to 0.0. We came to this + * conclusion from noting that: + * + * [0.0, 1.0) + * + * when scaled to the integer set: + * + * [0, 4) + * + * there is some value close enough to 1.0 that when multiplying by 4, + * gets truncated to 4. Therefore: + * + * [0,1-eps] => 0 + * [1,2-eps] => 1 + * [2,3-eps] => 2 + * [3,4-eps] => 3 + * + * So 0 gets uneven distribution if we simply clamp. The actual + * clamp utilized in this file is to map values out of range back + * to 0 to restore uniform distribution. + * + * Also, for clamping floats when asking for a distribution from + * [0.0,g) we have determined that for values of g < 0.5, then + * rand*g=g, which is not the desired result. As above, we clamp to 0 + * to restore uniform distribution. + */ + +// *NOTE: The system rand implementation is probably not correct. +#define LL_USE_SYSTEM_RAND 0 + +#if LL_USE_SYSTEM_RAND +#include <cstdlib> +#endif + +#if LL_USE_SYSTEM_RAND +class LLSeedRand +{ +public: + LLSeedRand() + { +#if LL_WINDOWS + srand(LLUUID::getRandomSeed()); +#else + srand48(LLUUID::getRandomSeed()); +#endif + } +}; +static LLSeedRand sRandomSeeder; +inline F64 ll_internal_random_double() +{ +#if LL_WINDOWS + return (F64)rand() / (F64)RAND_MAX; +#else + return drand48(); +#endif +} +inline F32 ll_internal_random_float() +{ +#if LL_WINDOWS + return (F32)rand() / (F32)RAND_MAX; +#else + return (F32)drand48(); +#endif +} +#else +static LLRandLagFib2281 gRandomGenerator(LLUUID::getRandomSeed()); +inline F64 ll_internal_random_double() +{ + // *HACK: Through experimentation, we have found that dual core + // CPUs (or at least multi-threaded processes) seem to + // occasionally give an obviously incorrect random number -- like + // 5^15 or something. Sooooo, clamp it as described above. + F64 rv = gRandomGenerator(); + if(!((rv >= 0.0) && (rv < 1.0))) return fmod(rv, 1.0); + return rv; +} + +inline F32 ll_internal_random_float() +{ + // The clamping rules are described above. + F32 rv = (F32)gRandomGenerator(); + if(!((rv >= 0.0f) && (rv < 1.0f))) return fmod(rv, 1.f); + return rv; +} +#endif + +S32 ll_rand() +{ + return ll_rand(RAND_MAX); +} + +S32 ll_rand(S32 val) +{ + // The clamping rules are described above. + S32 rv = (S32)(ll_internal_random_double() * val); + if(rv == val) return 0; + return rv; +} + +F32 ll_frand() +{ + return ll_internal_random_float(); +} + +F32 ll_frand(F32 val) +{ + // The clamping rules are described above. + F32 rv = ll_internal_random_float() * val; + if(val > 0) + { + if(rv >= val) return 0.0f; + } + else + { + if(rv <= val) return 0.0f; + } + return rv; +} + +F64 ll_drand() +{ + return ll_internal_random_double(); +} + +F64 ll_drand(F64 val) +{ + // The clamping rules are described above. + F64 rv = ll_internal_random_double() * val; + if(val > 0) + { + if(rv >= val) return 0.0; + } + else + { + if(rv <= val) return 0.0; + } + return rv; +} diff --git a/indra/llcommon/llrand.h b/indra/llcommon/llrand.h new file mode 100644 index 0000000000..5bd874ba83 --- /dev/null +++ b/indra/llcommon/llrand.h @@ -0,0 +1,132 @@ +/** + * @file llrand.h + * @brief Information, functions, and typedefs for randomness. + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLRAND_H +#define LL_LLRAND_H + +#include <boost/random/lagged_fibonacci.hpp> +#include <boost/random/mersenne_twister.hpp> + +/** + * Use the boost random number generators if you want a stateful + * random numbers. If you want more random numbers, use the + * c-functions since they will generate faster/better randomness + * across the process. + * + * I tested some of the boost random engines, and picked a good double + * generator and a good integer generator. I also took some timings + * for them on linux using gcc 3.3.5. The harness also did some other + * fairly trivial operations to try to limit compiler optimizations, + * so these numbers are only good for relative comparisons. + * + * usec/inter algorithm + * 0.21 boost::minstd_rand0 + * 0.039 boost:lagged_fibonacci19937 + * 0.036 boost:lagged_fibonacci607 + * 0.44 boost::hellekalek1995 + * 0.44 boost::ecuyer1988 + * 0.042 boost::rand48 + * 0.043 boost::mt11213b + * 0.028 stdlib random() + * 0.05 stdlib lrand48() + * 0.034 stdlib rand() + * 0.020 the old & lame LLRand + */ + +/** + *@brief Generate a float from [0, RAND_MAX). + */ +S32 ll_rand(); + +/** + *@brief Generate a float from [0, val) or (val, 0]. + */ +S32 ll_rand(S32 val); + +/** + *@brief Generate a float from [0, 1.0). + */ +F32 ll_frand(); + +/** + *@brief Generate a float from [0, val) or (val, 0]. + */ +F32 ll_frand(F32 val); + +/** + *@brief Generate a double from [0, 1.0). + */ +F64 ll_drand(); + +/** + *@brief Generate a double from [0, val) or (val, 0]. + */ +F64 ll_drand(F64 val); + +/** + * @brief typedefs for good boost lagged fibonacci. + * @see boost::lagged_fibonacci + * + * These generators will quickly generate doubles. Note the memory + * requirements, because they are somewhat high. I chose the smallest + * one, and one comparable in speed but higher periodicity without + * outrageous memory requirements. + * To use: + * LLRandLagFib607 foo((U32)time(NULL)); + * double bar = foo(); + */ + +typedef boost::lagged_fibonacci607 LLRandLagFib607; +/**< + * lengh of cycle: 2^32,000 + * memory: 607*sizeof(double) (about 5K) + */ + +typedef boost::lagged_fibonacci2281 LLRandLagFib2281; +/**< + * lengh of cycle: 2^120,000 + * memory: 2281*sizeof(double) (about 17K) + */ + +/** + * @breif typedefs for a good boost mersenne twister implementation. + * @see boost::mersenne_twister + * + * This fairly quickly generates U32 values + * To use: + * LLRandMT19937 foo((U32)time(NULL)); + * U32 bar = foo(); + * + * lengh of cycle: 2^19,937-1 + * memory: about 2496 bytes + */ +typedef boost::mt11213b LLRandMT19937; +#endif diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index 19030cd4fd..099f233f56 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -42,10 +42,11 @@ #endif #ifdef NAME_UNNAMED_NAMESPACE -namespace LLSDUnnamedNamespace { +namespace LLSDUnnamedNamespace #else -namespace { +namespace #endif +{ class ImplMap; class ImplArray; } @@ -127,10 +128,10 @@ public: virtual void erase(Integer) { } virtual const LLSD& ref(Integer) const { return undef(); } - virtual LLSD::map_const_iterator beginMap() const { return LLSD::map_const_iterator(); } - virtual LLSD::map_const_iterator endMap() const { return LLSD::map_const_iterator(); } - virtual LLSD::array_const_iterator beginArray() const { return LLSD::array_const_iterator(); } - virtual LLSD::array_const_iterator endArray() const { return LLSD::array_const_iterator(); } + virtual LLSD::map_const_iterator beginMap() const { return endMap(); } + virtual LLSD::map_const_iterator endMap() const { static const std::map<String, LLSD> empty; return empty.end(); } + virtual LLSD::array_const_iterator beginArray() const { return endArray(); } + virtual LLSD::array_const_iterator endArray() const { static const std::vector<LLSD> empty; return empty.end(); } static const LLSD& undef(); @@ -139,10 +140,11 @@ public: }; #ifdef NAME_UNNAMED_NAMESPACE -namespace LLSDUnnamedNamespace { +namespace LLSDUnnamedNamespace #else -namespace { +namespace #endif +{ template<LLSD::Type T, class Data, class DataRef = Data> class ImplBase : public LLSD::Impl ///< This class handles most of the work for a subclass of Impl @@ -655,10 +657,11 @@ U32 LLSD::Impl::sOutstandingCount = 0; #ifdef NAME_UNNAMED_NAMESPACE -namespace LLSDUnnamedNamespace { +namespace LLSDUnnamedNamespace #else -namespace { +namespace #endif +{ inline LLSD::Impl& safe(LLSD::Impl* impl) { return LLSD::Impl::safe(impl); } diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 1ba57b1e95..307d73608c 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -40,7 +40,7 @@ #include "lldate.h" #include "lluri.h" -#include "../llmath/lluuid.h" +#include "lluuid.h" /** LLSD provides a flexible data system similar to the data facilities of diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 6f4a49180d..2183792bb1 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -37,7 +37,7 @@ #include "llstreamtools.h" // for fullread #include <iostream> -#include "apr-1/apr_base64.h" +#include "apr_base64.h" #if !LL_WINDOWS #include <netinet/in.h> // htonl & ntohl diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index b3596e8705..cddb243faf 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -35,7 +35,7 @@ #include <iostream> #include <deque> -#include "apr-1/apr_base64.h" +#include "apr_base64.h" extern "C" { diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 992c883a7e..6f26447695 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -46,124 +46,6 @@ #include "llsdserialize.h" -// vector3 -LLSD ll_sd_from_vector3(const LLVector3& vec) -{ - LLSD rv; - rv.append((F64)vec.mV[VX]); - rv.append((F64)vec.mV[VY]); - rv.append((F64)vec.mV[VZ]); - return rv; -} - -LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index) -{ - LLVector3 rv; - rv.mV[VX] = (F32)sd[start_index].asReal(); - rv.mV[VY] = (F32)sd[++start_index].asReal(); - rv.mV[VZ] = (F32)sd[++start_index].asReal(); - return rv; -} - -// vector4 -LLSD ll_sd_from_vector4(const LLVector4& vec) -{ - LLSD rv; - rv.append((F64)vec.mV[VX]); - rv.append((F64)vec.mV[VY]); - rv.append((F64)vec.mV[VZ]); - rv.append((F64)vec.mV[VW]); - return rv; -} - -LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index) -{ - LLVector4 rv; - rv.mV[VX] = (F32)sd[start_index].asReal(); - rv.mV[VY] = (F32)sd[++start_index].asReal(); - rv.mV[VZ] = (F32)sd[++start_index].asReal(); - rv.mV[VW] = (F32)sd[++start_index].asReal(); - return rv; -} - -// vector3d -LLSD ll_sd_from_vector3d(const LLVector3d& vec) -{ - LLSD rv; - rv.append(vec.mdV[VX]); - rv.append(vec.mdV[VY]); - rv.append(vec.mdV[VZ]); - return rv; -} - -LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index) -{ - LLVector3d rv; - rv.mdV[VX] = sd[start_index].asReal(); - rv.mdV[VY] = sd[++start_index].asReal(); - rv.mdV[VZ] = sd[++start_index].asReal(); - return rv; -} - -//vector2 -LLSD ll_sd_from_vector2(const LLVector2& vec) -{ - LLSD rv; - rv.append((F64)vec.mV[VX]); - rv.append((F64)vec.mV[VY]); - return rv; -} - -LLVector2 ll_vector2_from_sd(const LLSD& sd) -{ - LLVector2 rv; - rv.mV[VX] = (F32)sd[0].asReal(); - rv.mV[VY] = (F32)sd[1].asReal(); - return rv; -} - -// Quaternion -LLSD ll_sd_from_quaternion(const LLQuaternion& quat) -{ - LLSD rv; - rv.append((F64)quat.mQ[VX]); - rv.append((F64)quat.mQ[VY]); - rv.append((F64)quat.mQ[VZ]); - rv.append((F64)quat.mQ[VW]); - return rv; -} - -LLQuaternion ll_quaternion_from_sd(const LLSD& sd) -{ - LLQuaternion quat; - quat.mQ[VX] = (F32)sd[0].asReal(); - quat.mQ[VY] = (F32)sd[1].asReal(); - quat.mQ[VZ] = (F32)sd[2].asReal(); - quat.mQ[VW] = (F32)sd[3].asReal(); - return quat; -} - -// color4 -LLSD ll_sd_from_color4(const LLColor4& c) -{ - LLSD rv; - rv.append(c.mV[0]); - rv.append(c.mV[1]); - rv.append(c.mV[2]); - rv.append(c.mV[3]); - return rv; -} - -LLColor4 ll_color4_from_sd(const LLSD& sd) -{ - LLColor4 c; - c.mV[0] = (F32)sd[0].asReal(); - c.mV[1] = (F32)sd[1].asReal(); - c.mV[2] = (F32)sd[2].asReal(); - c.mV[3] = (F32)sd[3].asReal(); - return c; -} - // U32 LLSD ll_sd_from_U32(const U32 val) { diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index 9f73222bc3..7098fa8252 100644 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -35,35 +35,34 @@ #define LL_LLSDUTIL_H #include "llsd.h" -#include "../llmath/v3math.h" -#include "../llmath/v4math.h" -#include "../llmath/v3dmath.h" -#include "../llmath/v2math.h" -#include "../llmath/llquaternion.h" -#include "../llmath/v4color.h" -#include "../llprimitive/lltextureanim.h" // vector3 +class LLVector3; LLSD ll_sd_from_vector3(const LLVector3& vec); LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index = 0); // vector4 +class LLVector4; LLSD ll_sd_from_vector4(const LLVector4& vec); LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index = 0); // vector3d (double) +class LLVector3d; LLSD ll_sd_from_vector3d(const LLVector3d& vec); LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index = 0); // vector2 +class LLVector2; LLSD ll_sd_from_vector2(const LLVector2& vec); LLVector2 ll_vector2_from_sd(const LLSD& sd); // Quaternion +class LLQuaternion; LLSD ll_sd_from_quaternion(const LLQuaternion& quat); LLQuaternion ll_quaternion_from_sd(const LLSD& sd); // color4 +class LLColor4; LLSD ll_sd_from_color4(const LLColor4& c); LLColor4 ll_color4_from_sd(const LLSD& sd); diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 59d71a8e8e..7a2d42dfaa 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -70,7 +70,7 @@ bool _read_file_into_string(std::string& str, const char* filename) llifstream ifs(filename, llifstream::binary); if (!ifs.is_open()) { - llinfos << "Unable to open file" << filename << llendl; + llinfos << "Unable to open file " << filename << llendl; return false; } diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 02ed0dcfc6..dc0a7a83e4 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -31,7 +31,7 @@ #include "linden_common.h" #include "llapr.h" -#include "apr-1/apr_portable.h" +#include "apr_portable.h" #include "llthread.h" diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index a07c64b8fc..7864d93395 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -36,7 +36,7 @@ #include "llapp.h" #include "llmemory.h" -#include "apr-1/apr_thread_cond.h" +#include "apr_thread_cond.h" class LLThread; class LLMutex; diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index af89a09d2f..3d05699cd6 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -429,10 +429,9 @@ BOOL LLTimer::knownBadTimer() // /////////////////////////////////////////////////////////////////////////////// -U32 time_corrected() +time_t time_corrected() { - U32 corrected_time = (U32)time(NULL) + gUTCOffset; - return corrected_time; + return time(NULL) + gUTCOffset; } @@ -452,27 +451,25 @@ BOOL is_daylight_savings() } -struct tm* utc_to_pacific_time(S32 utc_time, BOOL pacific_daylight_time) +struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time) { - time_t unix_time = (time_t)utc_time; - S32 pacific_offset_hours; if (pacific_daylight_time) { - pacific_offset_hours = -7; + pacific_offset_hours = 7; } else { - pacific_offset_hours = -8; + pacific_offset_hours = 8; } // We subtract off the PST/PDT offset _before_ getting // "UTC" time, because this will handle wrapping around // for 5 AM UTC -> 10 PM PDT of the previous day. - unix_time += pacific_offset_hours * MIN_PER_HOUR * SEC_PER_MIN; + utc_time -= pacific_offset_hours * MIN_PER_HOUR * SEC_PER_MIN; // Internal buffer to PST/PDT (see above) - struct tm* internal_time = gmtime(&unix_time); + struct tm* internal_time = gmtime(&utc_time); /* // Don't do this, this won't correctly tell you if daylight savings is active in CA or not. diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index 57f9e23e7a..41562f4a51 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -35,6 +35,7 @@ #if LL_LINUX || LL_DARWIN #include <sys/time.h> #endif +#include <limits.h> #include "stdtypes.h" @@ -117,7 +118,35 @@ void ms_sleep(U32 ms); // Returns the correct UTC time in seconds, like time(NULL). // Useful on the viewer, which may have its local clock set wrong. -U32 time_corrected(); +time_t time_corrected(); + +static inline time_t time_min() +{ + if (sizeof(time_t) == 4) + { + return (time_t) INT_MIN; + } else { +#ifdef LLONG_MIN + return (time_t) LLONG_MIN; +#else + return (time_t) LONG_MIN; +#endif + } +} + +static inline time_t time_max() +{ + if (sizeof(time_t) == 4) + { + return (time_t) INT_MAX; + } else { +#ifdef LLONG_MAX + return (time_t) LLONG_MAX; +#else + return (time_t) LONG_MAX; +#endif + } +} // Correction factor used by time_corrected() above. extern S32 gUTCOffset; @@ -131,7 +160,7 @@ BOOL is_daylight_savings(); // S32 utc_time; // utc_time = time_corrected(); // struct tm* internal_time = utc_to_pacific_time(utc_time, gDaylight); -struct tm* utc_to_pacific_time(S32 utc_time, BOOL pacific_daylight_time); +struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time); void microsecondsToTimecodeString(U64 current_time, char *tcstring); void secondsToTimecodeString(F32 current_time, char *tcstring); diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index 022742660d..57d55c7e71 100644 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -38,7 +38,7 @@ #include "llsd.h" #include <iomanip> -#include "../llmath/lluuid.h" +#include "lluuid.h" // system includes #include <boost/tokenizer.hpp> diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp new file mode 100644 index 0000000000..3f86681315 --- /dev/null +++ b/indra/llcommon/lluuid.cpp @@ -0,0 +1,923 @@ +/** + * @file lluuid.cpp + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes. +#if LL_WINDOWS +# undef WIN32_LEAN_AND_MEAN +# include <winsock2.h> +# include <windows.h> +#endif + +#include "lldefs.h" +#include "llerror.h" + +#include "lluuid.h" +#include "llerror.h" +#include "llrand.h" +#include "llmd5.h" +#include "llstring.h" +#include "lltimer.h" + +const LLUUID LLUUID::null; +const LLTransactionID LLTransactionID::tnull; + +/* + +NOT DONE YET!!! + +static char BASE85_TABLE[] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', + 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', + 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', + 'y', 'z', '!', '#', '$', '%', '&', '(', ')', '*', + '+', '-', ';', '[', '=', '>', '?', '@', '^', '_', + '`', '{', '|', '}', '~', '\0' +}; + + +void encode( char * fiveChars, unsigned int word ) throw( ) +{ +for( int ix = 0; ix < 5; ++ix ) { +fiveChars[4-ix] = encodeTable[ word % 85]; +word /= 85; +} +} + +To decode: +unsigned int decode( char const * fiveChars ) throw( bad_input_data ) +{ +unsigned int ret = 0; +for( int ix = 0; ix < 5; ++ix ) { +char * s = strchr( encodeTable, fiveChars[ ix ] ); +if( s == 0 ) throw bad_input_data(); +ret = ret * 85 + (s-encodeTable); +} +return ret; +} + +void LLUUID::toBase85(char* out) +{ + U32* me = (U32*)&(mData[0]); + for(S32 i = 0; i < 4; ++i) + { + char* o = &out[i*i]; + for(S32 j = 0; j < 5; ++j) + { + o[4-j] = BASE85_TABLE[ me[i] % 85]; + word /= 85; + } + } +} + +unsigned int decode( char const * fiveChars ) throw( bad_input_data ) +{ + unsigned int ret = 0; + for( S32 ix = 0; ix < 5; ++ix ) + { + char * s = strchr( encodeTable, fiveChars[ ix ] ); + ret = ret * 85 + (s-encodeTable); + } + return ret; +} +*/ + +#define LL_USE_JANKY_RANDOM_NUMBER_GENERATOR 0 +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR +/** + * @brief a global for + */ +static U64 sJankyRandomSeed(LLUUID::getRandomSeed()); + +/** + * @brief generate a random U32. + */ +U32 janky_fast_random_bytes() +{ + sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); + return (U32)sJankyRandomSeed; +} + +/** + * @brief generate a random U32 from [0, val) + */ +U32 janky_fast_random_byes_range(U32 val) +{ + sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); + return (U32)(sJankyRandomSeed) % val; +} + +/** + * @brief generate a random U32 from [0, val) + */ +U32 janky_fast_random_seeded_bytes(U32 seed, U32 val) +{ + seed = U64L(1664525) * (U64)(seed) + U64L(1013904223); + return (U32)(seed) % val; +} +#endif + +// Common to all UUID implementations +void LLUUID::toString(char *out) const +{ + sprintf(out, + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + (U8)(mData[0]), + (U8)(mData[1]), + (U8)(mData[2]), + (U8)(mData[3]), + (U8)(mData[4]), + (U8)(mData[5]), + (U8)(mData[6]), + (U8)(mData[7]), + (U8)(mData[8]), + (U8)(mData[9]), + (U8)(mData[10]), + (U8)(mData[11]), + (U8)(mData[12]), + (U8)(mData[13]), + (U8)(mData[14]), + (U8)(mData[15])); +} + +void LLUUID::toCompressedString(char *out) const +{ + memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */ + out[UUID_BYTES] = '\0'; +} + +std::string LLUUID::getString() const +{ + return asString(); +} + +std::string LLUUID::asString() const +{ + char str[UUID_STR_SIZE]; /* Flawfinder: ignore */ + toString(str); + return std::string(str); +} + +BOOL LLUUID::set(const std::string& in_string, BOOL emit) +{ + return set(in_string.c_str(), emit); +} + +BOOL LLUUID::set(const char *in_string, BOOL emit) +{ + BOOL broken_format = FALSE; + if (!in_string) + { + llerrs << "No string pointer in LLUUID::set!" << llendl; + setNull(); + return FALSE; + } + + // empty strings should make NULL uuid + if (!in_string[0]) + { + setNull(); + return TRUE; + } + + if (strlen(in_string) != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ + { + // I'm a moron. First implementation didn't have the right UUID format. + // Shouldn't see any of these any more + if (strlen(in_string) == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ + { + if(emit) + { + llinfos << "Warning! Using broken UUID string format" << llendl; + } + broken_format = TRUE; + } + else + { + // Bad UUID string. Spam as INFO, as most cases we don't care. + if(emit) + { + llinfos << "Bad UUID string: " << in_string << llendl; + } + setNull(); + return FALSE; + } + } + + U8 cur_pos = 0; + S32 i; + for (i = 0; i < UUID_BYTES; i++) + { + if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) + { + cur_pos++; + if (broken_format && (i==10)) + { + // Missing - in the broken format + cur_pos--; + } + } + + mData[i] = 0; + + if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) + { + mData[i] += (U8)(*(in_string + cur_pos) - '0'); + } + else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) + { + mData[i] += (U8)(10 + *(in_string + cur_pos) - 'a'); + } + else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) + { + mData[i] += (U8)(10 + *(in_string + cur_pos) - 'A'); + } + else + { + if(emit) + { + llwarns << "Invalid UUID string character" << llendl; + } + setNull(); + return FALSE; + } + + mData[i] = mData[i] << 4; + cur_pos++; + + if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) + { + mData[i] += (U8)(*(in_string + cur_pos) - '0'); + } + else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) + { + mData[i] += (U8)(10 + *(in_string + cur_pos) - 'a'); + } + else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) + { + mData[i] += (U8)(10 + *(in_string + cur_pos) - 'A'); + } + else + { + if(emit) + { + llwarns << "Invalid UUID string character" << llendl; + } + setNull(); + return FALSE; + } + cur_pos++; + } + + return TRUE; +} + +BOOL LLUUID::validate(const std::string& in_string) +{ + return validate(in_string.c_str()); +} + +BOOL LLUUID::validate(const char *in_string) +{ + BOOL broken_format = FALSE; + if (!in_string) + { + return FALSE; + } + if (strlen(in_string) != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ + { + // I'm a moron. First implementation didn't have the right UUID format. + if (strlen(in_string) == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ + { + broken_format = TRUE; + } + else + { + return FALSE; + } + } + + U8 cur_pos = 0; + U32 i; + for (i = 0; i < 16; i++) + { + if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) + { + cur_pos++; + if (broken_format && (i==10)) + { + // Missing - in the broken format + cur_pos--; + } + } + + if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) + { + } + else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) + { + } + else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) + { + } + else + { + return FALSE; + } + + cur_pos++; + + if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) + { + } + else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) + { + } + else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) + { + } + else + { + return FALSE; + } + cur_pos++; + } + return TRUE; +} + +const LLUUID& LLUUID::operator^=(const LLUUID& rhs) +{ + U32* me = (U32*)&(mData[0]); + const U32* other = (U32*)&(rhs.mData[0]); + for(S32 i = 0; i < 4; ++i) + { + me[i] = me[i] ^ other[i]; + } + return *this; +} + +LLUUID LLUUID::operator^(const LLUUID& rhs) const +{ + LLUUID id(*this); + id ^= rhs; + return id; +} + +void LLUUID::combine(const LLUUID& other, LLUUID& result) const +{ + LLMD5 md5_uuid; + md5_uuid.update((unsigned char*)mData, 16); + md5_uuid.update((unsigned char*)other.mData, 16); + md5_uuid.finalize(); + md5_uuid.raw_digest(result.mData); +} + +LLUUID LLUUID::combine(const LLUUID &other) const +{ + LLUUID combination; + combine(other, combination); + return combination; +} + +std::ostream& operator<<(std::ostream& s, const LLUUID &uuid) +{ + char uuid_str[UUID_STR_LENGTH]; + + uuid.toString(uuid_str); + s << uuid_str; + return s; +} + +std::istream& operator>>(std::istream &s, LLUUID &uuid) +{ + U32 i; + char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + for (i = 0; i < UUID_STR_LENGTH-1; i++) + { + s >> uuid_str[i]; + } + uuid_str[i] = '\0'; + uuid.set(uuid_str); + return s; +} + +static void get_random_bytes(void *buf, int nbytes) +{ + int i; + char *cp = (char *) buf; + + // *NOTE: If we are not using the janky generator ll_rand() + // generates at least 3 good bytes of data since it is 0 to + // RAND_MAX. This could be made more efficient by copying all the + // bytes. + for (i=0; i < nbytes; i++) +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR + *cp++ = janky_fast_random_bytes() & 0xFF; +#else + *cp++ = ll_rand() & 0xFF; +#endif + return; +} + +#if LL_WINDOWS +typedef struct _ASTAT_ +{ + ADAPTER_STATUS adapt; + NAME_BUFFER NameBuff [30]; +}ASTAT, * PASTAT; + +// static +S32 LLUUID::getNodeID(unsigned char * node_id) +{ + ASTAT Adapter; + NCB Ncb; + UCHAR uRetCode; + LANA_ENUM lenum; + int i; + int retval = 0; + + memset( &Ncb, 0, sizeof(Ncb) ); + Ncb.ncb_command = NCBENUM; + Ncb.ncb_buffer = (UCHAR *)&lenum; + Ncb.ncb_length = sizeof(lenum); + uRetCode = Netbios( &Ncb ); + // printf( "The NCBENUM return code is: 0x%x \n", uRetCode ); + + for(i=0; i < lenum.length ;i++) + { + memset( &Ncb, 0, sizeof(Ncb) ); + Ncb.ncb_command = NCBRESET; + Ncb.ncb_lana_num = lenum.lana[i]; + + uRetCode = Netbios( &Ncb ); + // printf( "The NCBRESET on LANA %d return code is: 0x%x \n", + // lenum.lana[i], uRetCode ); + + memset( &Ncb, 0, sizeof (Ncb) ); + Ncb.ncb_command = NCBASTAT; + Ncb.ncb_lana_num = lenum.lana[i]; + + strcpy( (char *)Ncb.ncb_callname, "* " ); /* Flawfinder: ignore */ + Ncb.ncb_buffer = (unsigned char *)&Adapter; + Ncb.ncb_length = sizeof(Adapter); + + uRetCode = Netbios( &Ncb ); +// printf( "The NCBASTAT on LANA %d return code is: 0x%x \n", +// lenum.lana[i], uRetCode ); + if ( uRetCode == 0 ) + { +// printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n", +// lenum.lana[i], +// Adapter.adapt.adapter_address[0], +// Adapter.adapt.adapter_address[1], +// Adapter.adapt.adapter_address[2], +// Adapter.adapt.adapter_address[3], +// Adapter.adapt.adapter_address[4], +// Adapter.adapt.adapter_address[5] ); + memcpy(node_id,Adapter.adapt.adapter_address,6); /* Flawfinder: ignore */ + retval = 1; + + } + } + return retval; +} + +#elif LL_DARWIN +// Mac OS X version of the UUID generation code... +/* + * Get an ethernet hardware address, if we can find it... + */ +#include <unistd.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/socket.h> +#include <sys/ioctl.h> +#include <net/if.h> +#include <net/if_types.h> +#include <net/if_dl.h> +#include <net/route.h> +#include <ifaddrs.h> + +// static +S32 LLUUID::getNodeID(unsigned char *node_id) +{ + int i; + unsigned char *a = NULL; + struct ifaddrs *ifap, *ifa; + int rv; + S32 result = 0; + + if ((rv=getifaddrs(&ifap))==-1) + { + return -1; + } + if (ifap == NULL) + { + return -1; + } + + for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) + { +// printf("Interface %s, address family %d, ", ifa->ifa_name, ifa->ifa_addr->sa_family); + for(i=0; i< ifa->ifa_addr->sa_len; i++) + { +// printf("%02X ", (unsigned char)ifa->ifa_addr->sa_data[i]); + } +// printf("\n"); + + if(ifa->ifa_addr->sa_family == AF_LINK) + { + // This is a link-level address + struct sockaddr_dl *lla = (struct sockaddr_dl *)ifa->ifa_addr; + +// printf("\tLink level address, type %02X\n", lla->sdl_type); + + if(lla->sdl_type == IFT_ETHER) + { + // Use the first ethernet MAC in the list. + // For some reason, the macro LLADDR() defined in net/if_dl.h doesn't expand correctly. This is what it would do. + a = (unsigned char *)&((lla)->sdl_data); + a += (lla)->sdl_nlen; + + if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) + { + continue; + } + + if (node_id) + { + memcpy(node_id, a, 6); + result = 1; + } + + // We found one. + break; + } + } + } + freeifaddrs(ifap); + + return result; +} + +#else + +// Linux version of the UUID generation code... +/* + * Get the ethernet hardware address, if we can find it... + */ +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/stat.h> +#include <sys/file.h> +#include <sys/ioctl.h> +#include <sys/socket.h> +#include <net/if.h> +#define HAVE_NETINET_IN_H +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#if LL_SOLARIS +#include <sys/sockio.h> +#elif !LL_DARWIN +#include <linux/sockios.h> +#endif +#endif + +// static +S32 LLUUID::getNodeID(unsigned char *node_id) +{ + int sd; + struct ifreq ifr, *ifrp; + struct ifconf ifc; + char buf[1024]; + int n, i; + unsigned char *a; + +/* + * BSD 4.4 defines the size of an ifreq to be + * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len + * However, under earlier systems, sa_len isn't present, so the size is + * just sizeof(struct ifreq) + */ +#ifdef HAVE_SA_LEN +#ifndef max +#define max(a,b) ((a) > (b) ? (a) : (b)) +#endif +#define ifreq_size(i) max(sizeof(struct ifreq),\ + sizeof((i).ifr_name)+(i).ifr_addr.sa_len) +#else +#define ifreq_size(i) sizeof(struct ifreq) +#endif /* HAVE_SA_LEN*/ + + sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); + if (sd < 0) { + return -1; + } + memset(buf, 0, sizeof(buf)); + ifc.ifc_len = sizeof(buf); + ifc.ifc_buf = buf; + if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) { + close(sd); + return -1; + } + n = ifc.ifc_len; + for (i = 0; i < n; i+= ifreq_size(*ifr) ) { + ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i); + strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ); /* Flawfinder: ignore */ +#ifdef SIOCGIFHWADDR + if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0) + continue; + a = (unsigned char *) &ifr.ifr_hwaddr.sa_data; +#else +#ifdef SIOCGENADDR + if (ioctl(sd, SIOCGENADDR, &ifr) < 0) + continue; + a = (unsigned char *) ifr.ifr_enaddr; +#else + /* + * XXX we don't have a way of getting the hardware + * address + */ + close(sd); + return 0; +#endif /* SIOCGENADDR */ +#endif /* SIOCGIFHWADDR */ + if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) + continue; + if (node_id) { + memcpy(node_id, a, 6); /* Flawfinder: ignore */ + close(sd); + return 1; + } + } + close(sd); + return 0; +} + +#endif + +S32 LLUUID::cmpTime(uuid_time_t *t1, uuid_time_t *t2) +{ + // Compare two time values. + + if (t1->high < t2->high) return -1; + if (t1->high > t2->high) return 1; + if (t1->low < t2->low) return -1; + if (t1->low > t2->low) return 1; + return 0; +} + +void LLUUID::getSystemTime(uuid_time_t *timestamp) +{ + // Get system time with 100ns precision. Time is since Oct 15, 1582. +#if LL_WINDOWS + ULARGE_INTEGER time; + GetSystemTimeAsFileTime((FILETIME *)&time); + // NT keeps time in FILETIME format which is 100ns ticks since + // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582. + // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec) + // + 18 years and 5 leap days. + time.QuadPart += + (unsigned __int64) (1000*1000*10) // seconds + * (unsigned __int64) (60 * 60 * 24) // days + * (unsigned __int64) (17+30+31+365*18+5); // # of days + + timestamp->high = time.HighPart; + timestamp->low = time.LowPart; +#else + struct timeval tp; + gettimeofday(&tp, 0); + + // Offset between UUID formatted times and Unix formatted times. + // UUID UTC base time is October 15, 1582. + // Unix base time is January 1, 1970. + U64 uuid_time = ((U64)tp.tv_sec * 10000000) + (tp.tv_usec * 10) + + U64L(0x01B21DD213814000); + timestamp->high = (U32) (uuid_time >> 32); + timestamp->low = (U32) (uuid_time & 0xFFFFFFFF); +#endif +} + +void LLUUID::getCurrentTime(uuid_time_t *timestamp) +{ + // Get current time as 60 bit 100ns ticks since whenever. + // Compensate for the fact that real clock resolution is less + // than 100ns. + + const U32 uuids_per_tick = 1024; + + static uuid_time_t time_last; + static U32 uuids_this_tick; + static BOOL init = FALSE; + + if (!init) { + getSystemTime(&time_last); + uuids_this_tick = uuids_per_tick; + init = TRUE; + } + + uuid_time_t time_now = {0,0}; + + while (1) { + getSystemTime(&time_now); + + // if clock reading changed since last UUID generated + if (cmpTime(&time_last, &time_now)) { + // reset count of uuid's generated with this clock reading + uuids_this_tick = 0; + break; + } + if (uuids_this_tick < uuids_per_tick) { + uuids_this_tick++; + break; + } + // going too fast for our clock; spin + } + + time_last = time_now; + + if (uuids_this_tick != 0) { + if (time_now.low & 0x80000000) { + time_now.low += uuids_this_tick; + if (!(time_now.low & 0x80000000)) + time_now.high++; + } else + time_now.low += uuids_this_tick; + } + + timestamp->high = time_now.high; + timestamp->low = time_now.low; +} + +void LLUUID::generate() +{ + // Create a UUID. + uuid_time_t timestamp; + + static unsigned char node_id[6]; /* Flawfinder: ignore */ + static int has_init = 0; + + // Create a UUID. + static uuid_time_t time_last = {0,0}; + static U16 clock_seq = 0; +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR + static U32 seed = 0L; // dummy seed. reset it below +#endif + if (!has_init) + { + if (getNodeID(node_id) <= 0) + { + get_random_bytes(node_id, 6); + /* + * Set multicast bit, to prevent conflicts + * with IEEE 802 addresses obtained from + * network cards + */ + node_id[0] |= 0x80; + } + + getCurrentTime(&time_last); +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR + seed = time_last.low; +#endif + +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR + clock_seq = (U16)janky_fast_random_seeded_bytes(seed, 65536); +#else + clock_seq = (U16)ll_rand(65536); +#endif + has_init = 1; + } + + // get current time + getCurrentTime(×tamp); + + // if clock went backward change clockseq + if (cmpTime(×tamp, &time_last) == -1) { + clock_seq = (clock_seq + 1) & 0x3FFF; + if (clock_seq == 0) clock_seq++; + } + + memcpy(mData+10, node_id, 6); /* Flawfinder: ignore */ + U32 tmp; + tmp = timestamp.low; + mData[3] = (unsigned char) tmp; + tmp >>= 8; + mData[2] = (unsigned char) tmp; + tmp >>= 8; + mData[1] = (unsigned char) tmp; + tmp >>= 8; + mData[0] = (unsigned char) tmp; + + tmp = (U16) timestamp.high; + mData[5] = (unsigned char) tmp; + tmp >>= 8; + mData[4] = (unsigned char) tmp; + + tmp = (timestamp.high >> 16) | 0x1000; + mData[7] = (unsigned char) tmp; + tmp >>= 8; + mData[6] = (unsigned char) tmp; + + tmp = clock_seq; + mData[9] = (unsigned char) tmp; + tmp >>= 8; + mData[8] = (unsigned char) tmp; + + LLMD5 md5_uuid; + + md5_uuid.update(mData,16); + md5_uuid.finalize(); + md5_uuid.raw_digest(mData); + + time_last = timestamp; +} + +void LLUUID::generate(const std::string& hash_string) +{ + LLMD5 md5_uuid((U8*)hash_string.c_str()); + md5_uuid.raw_digest(mData); +} + +U32 LLUUID::getRandomSeed() +{ + static unsigned char seed[16]; /* Flawfinder: ignore */ + + getNodeID(&seed[0]); + seed[6]='\0'; + seed[7]='\0'; + getSystemTime((uuid_time_t *)(&seed[8])); + + LLMD5 md5_seed; + + md5_seed.update(seed,16); + md5_seed.finalize(); + md5_seed.raw_digest(seed); + + return(*(U32 *)seed); +} + +BOOL LLUUID::parseUUID(const char* buf, LLUUID* value) +{ + if( buf == NULL || buf[0] == '\0' || value == NULL) + { + return FALSE; + } + + LLString temp( buf ); + LLString::trim(temp); + if( LLUUID::validate( temp ) ) + { + value->set( temp ); + return TRUE; + } + return FALSE; +} + +LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const +{ + LLAssetID result; + if (isNull()) + { + result.setNull(); + } + else + { + combine(session, result); + } + return result; +} diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h new file mode 100644 index 0000000000..2f82ec9a93 --- /dev/null +++ b/indra/llcommon/lluuid.h @@ -0,0 +1,330 @@ +/** + * @file lluuid.h + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLUUID_H +#define LL_LLUUID_H + +#include <iostream> +#include <set> +#include "stdtypes.h" + +const S32 UUID_BYTES = 16; +const S32 UUID_WORDS = 4; +const S32 UUID_STR_LENGTH = 37; // actually wrong, should be 36 and use size below +const S32 UUID_STR_SIZE = 37; +const S32 UUID_BASE85_LENGTH = 21; // including the trailing NULL. + +struct uuid_time_t { + U32 high; + U32 low; + }; + +class LLUUID +{ +public: + // + // CREATORS + // + LLUUID(); + explicit LLUUID(const char *in_string); // Convert from string. + explicit LLUUID(const std::string& in_string); // Convert from string. + LLUUID(const LLUUID &in); + LLUUID &operator=(const LLUUID &rhs); + + ~LLUUID(); + + // + // MANIPULATORS + // + void generate(); // Generate a new UUID + void generate(const std::string& stream); //Generate a new UUID based on hash of input stream + BOOL set(const char *in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings + BOOL set(const std::string& in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings + void setNull(); // Faster than setting to LLUUID::null. + + S32 cmpTime(uuid_time_t *t1, uuid_time_t *t2); + static void getSystemTime(uuid_time_t *timestamp); + void getCurrentTime(uuid_time_t *timestamp); + + // + // ACCESSORS + // + BOOL isNull() const; // Faster than comparing to LLUUID::null. + BOOL notNull() const; // Faster than comparing to LLUUID::null. + // JC: This is dangerous. It allows UUIDs to be cast automatically + // to integers, among other things. Use isNull() or notNull(). + // operator bool() const; + + // JC: These must return real bool's (not BOOLs) or else use of the STL + // will generate bool-to-int performance warnings. + bool operator==(const LLUUID &rhs) const; + bool operator!=(const LLUUID &rhs) const; + bool operator<(const LLUUID &rhs) const; + bool operator>(const LLUUID &rhs) const; + + // xor functions. Useful since any two random uuids xored together + // will yield a determinate third random unique id that can be + // used as a key in a single uuid that represents 2. + const LLUUID& operator^=(const LLUUID& rhs); + LLUUID operator^(const LLUUID& rhs) const; + + // similar to functions above, but not invertible + // yields a third random UUID that can be reproduced from the two inputs + // but which, given the result and one of the inputs can't be used to + // deduce the other input + LLUUID combine(const LLUUID& other) const; + void combine(const LLUUID& other, LLUUID& result) const; + + friend std::ostream& operator<<(std::ostream& s, const LLUUID &uuid); + friend std::istream& operator>>(std::istream& s, LLUUID &uuid); + + void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0) + void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0) + + std::string asString() const; + std::string getString() const; + + U16 getCRC16() const; + U32 getCRC32() const; + + static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal. + static BOOL validate(const char *in_string); // Validate that the UUID string is legal. + + static const LLUUID null; + + static U32 getRandomSeed(); + static S32 getNodeID(unsigned char * node_id); + + static BOOL parseUUID(const char* buf, LLUUID* value); + + U8 mData[UUID_BYTES]; +}; + + +// Construct +inline LLUUID::LLUUID() +{ + setNull(); +} + + +// Faster than copying from memory +inline void LLUUID::setNull() +{ + U32 *word = (U32 *)mData; + word[0] = 0; + word[1] = 0; + word[2] = 0; + word[3] = 0; +} + + +// Compare +inline bool LLUUID::operator==(const LLUUID& rhs) const +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + // Note: binary & to avoid branching + return + (tmp[0] == rhstmp[0]) & + (tmp[1] == rhstmp[1]) & + (tmp[2] == rhstmp[2]) & + (tmp[3] == rhstmp[3]); +} + + +inline bool LLUUID::operator!=(const LLUUID& rhs) const +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + // Note: binary | to avoid branching + return + (tmp[0] != rhstmp[0]) | + (tmp[1] != rhstmp[1]) | + (tmp[2] != rhstmp[2]) | + (tmp[3] != rhstmp[3]); +} + +/* +// JC: This is dangerous. It allows UUIDs to be cast automatically +// to integers, among other things. Use isNull() or notNull(). +inline LLUUID::operator bool() const +{ + U32 *word = (U32 *)mData; + return (word[0] | word[1] | word[2] | word[3]) > 0; +} +*/ + +inline BOOL LLUUID::notNull() const +{ + U32 *word = (U32 *)mData; + return (word[0] | word[1] | word[2] | word[3]) > 0; +} + +// Faster than == LLUUID::null because doesn't require +// as much memory access. +inline BOOL LLUUID::isNull() const +{ + U32 *word = (U32 *)mData; + // If all bits are zero, return !0 == TRUE + return !(word[0] | word[1] | word[2] | word[3]); +} + +// Copy constructor +inline LLUUID::LLUUID(const LLUUID& rhs) +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + tmp[0] = rhstmp[0]; + tmp[1] = rhstmp[1]; + tmp[2] = rhstmp[2]; + tmp[3] = rhstmp[3]; +} + +inline LLUUID::~LLUUID() +{ +} + +// Assignment +inline LLUUID& LLUUID::operator=(const LLUUID& rhs) +{ + // No need to check the case where this==&rhs. The branch is slower than the write. + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + tmp[0] = rhstmp[0]; + tmp[1] = rhstmp[1]; + tmp[2] = rhstmp[2]; + tmp[3] = rhstmp[3]; + + return *this; +} + + +inline LLUUID::LLUUID(const char *in_string) +{ + if (!in_string || in_string[0] == 0) + { + setNull(); + return; + } + + set(in_string); +} + +inline LLUUID::LLUUID(const std::string& in_string) +{ + if (in_string.empty()) + { + setNull(); + return; + } + + set(in_string); +} + +// IW: DON'T "optimize" these w/ U32s or you'll scoogie the sort order +// IW: this will make me very sad +inline bool LLUUID::operator<(const LLUUID &rhs) const +{ + U32 i; + for( i = 0; i < (UUID_BYTES - 1); i++ ) + { + if( mData[i] != rhs.mData[i] ) + { + return (mData[i] < rhs.mData[i]); + } + } + return (mData[UUID_BYTES - 1] < rhs.mData[UUID_BYTES - 1]); +} + +inline bool LLUUID::operator>(const LLUUID &rhs) const +{ + U32 i; + for( i = 0; i < (UUID_BYTES - 1); i++ ) + { + if( mData[i] != rhs.mData[i] ) + { + return (mData[i] > rhs.mData[i]); + } + } + return (mData[UUID_BYTES - 1] > rhs.mData[UUID_BYTES - 1]); +} + +inline U16 LLUUID::getCRC16() const +{ + // A UUID is 16 bytes, or 8 shorts. + U16 *short_data = (U16*)mData; + U16 out = 0; + out += short_data[0]; + out += short_data[1]; + out += short_data[2]; + out += short_data[3]; + out += short_data[4]; + out += short_data[5]; + out += short_data[6]; + out += short_data[7]; + return out; +} + +inline U32 LLUUID::getCRC32() const +{ + U32 *tmp = (U32*)mData; + return tmp[0] + tmp[1] + tmp[2] + tmp[3]; +} + + +// Helper structure for ordering lluuids in stl containers. +// eg: std::map<LLUUID, LLWidget*, lluuid_less> widget_map; +struct lluuid_less +{ + bool operator()(const LLUUID& lhs, const LLUUID& rhs) const + { + return (lhs < rhs) ? true : false; + } +}; + +typedef std::set<LLUUID, lluuid_less> uuid_list_t; + +/* + * Sub-classes for keeping transaction IDs and asset IDs + * straight. + */ +typedef LLUUID LLAssetID; + +class LLTransactionID : public LLUUID +{ +public: + LLTransactionID() : LLUUID() { } + + static const LLTransactionID tnull; + LLAssetID makeAssetID(const LLUUID& session) const; +}; + +#endif diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index f8982d79f8..ea89d724d8 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -31,6 +31,8 @@ #ifndef LL_STDTYPES_H #define LL_STDTYPES_H +#include <cfloat> + typedef signed char S8; typedef unsigned char U8; typedef signed short S16; diff --git a/indra/llcrashlogger/CMakeLists.txt b/indra/llcrashlogger/CMakeLists.txt new file mode 100644 index 0000000000..b2639aec30 --- /dev/null +++ b/indra/llcrashlogger/CMakeLists.txt @@ -0,0 +1,35 @@ +# -*- cmake -*- + +project(llcrashlogger) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLXML) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llcrashlogger_SOURCE_FILES + llcrashlogger.cpp + ) + +set(llcrashlogger_HEADER_FILES + CMakeLists.txt + + llcrashlogger.h + ) + +set_source_files_properties(${llcrashlogger_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llcrashlogger_SOURCE_FILES ${llcrashlogger_HEADER_FILES}) + +add_library(llcrashlogger ${llcrashlogger_SOURCE_FILES}) diff --git a/indra/llimage/CMakeLists.txt b/indra/llimage/CMakeLists.txt new file mode 100644 index 0000000000..5593b4a0cb --- /dev/null +++ b/indra/llimage/CMakeLists.txt @@ -0,0 +1,50 @@ +# -*- cmake -*- + +project(llimage) + +include(00-Common) +include(LLCommon) +include(LLImage) +include(LLMath) +include(LLVFS) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${PNG_INCLUDE_DIRS} + ) + +set(llimage_SOURCE_FILES + llimagebmp.cpp + llimage.cpp + llimagedxt.cpp + llimagej2c.cpp + llimagejpeg.cpp + llimagepng.cpp + llimagetga.cpp + llimageworker.cpp + llpngwrapper.cpp + ) + +set(llimage_HEADER_FILES + CMakeLists.txt + + llimage.h + llimagebmp.h + llimagedxt.h + llimagej2c.h + llimagejpeg.h + llimagepng.h + llimagetga.h + llimageworker.h + llmapimagetype.h + llpngwrapper.h + ) + +set_source_files_properties(${llimage_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llimage_SOURCE_FILES ${llimage_HEADER_FILES}) + +add_library (llimage ${llimage_SOURCE_FILES}) diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 450d6ff93a..3a6fd2db18 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -29,8 +29,8 @@ */ #include "linden_common.h" -#include <apr-1/apr_pools.h> -#include <apr-1/apr_dso.h> +#include "apr_pools.h" +#include "apr_dso.h" #include "lldir.h" #include "llimagej2c.h" diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp index 1ec92460bd..aebe87d626 100644 --- a/indra/llimage/llimagejpeg.cpp +++ b/indra/llimage/llimagejpeg.cpp @@ -40,8 +40,7 @@ LLImageJPEG::LLImageJPEG() LLImageFormatted(IMG_CODEC_JPEG), mOutputBuffer( NULL ), mOutputBufferSize( 0 ), - mEncodeQuality( 75 ), // on a scale from 1 to 100 - mSetjmpBuffer() + mEncodeQuality( 75 ) // on a scale from 1 to 100 { } diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index 7ba1520a31..054ddad9bc 100644 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h @@ -32,7 +32,7 @@ #ifndef LL_LLIMAGEJPEG_H #define LL_LLIMAGEJPEG_H -#include <setjmp.h> +#include <csetjmp> #include "llimage.h" diff --git a/indra/llimagej2coj/CMakeLists.txt b/indra/llimagej2coj/CMakeLists.txt new file mode 100644 index 0000000000..ed3ff3c8ee --- /dev/null +++ b/indra/llimagej2coj/CMakeLists.txt @@ -0,0 +1,31 @@ +# -*- cmake -*- + +project(llimagej2coj) + +include(00-Common) +include(LLCommon) +include(LLImage) +include(OpenJPEG) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${OPENJPEG_INCLUDE_DIR} + ) + +set(llimagej2coj_SOURCE_FILES + llimagej2coj.cpp + ) + +set(llimagej2coj_HEADER_FILES + CMakeLists.txt + + llimagej2coj.h + ) + +set_source_files_properties(${llimagej2coj_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llimagej2coj_SOURCE_FILES ${llimagej2coj_HEADER_FILES}) + +add_library (llimagej2coj ${llimagej2coj_SOURCE_FILES}) diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index c71ba1b3c2..2818859d93 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -33,7 +33,7 @@ #include "llimagej2coj.h" // this is defined so that we get static linking. -#include "openjpeg/openjpeg.h" +#include "openjpeg.h" #include "lltimer.h" #include "llmemory.h" @@ -268,12 +268,12 @@ BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con if (!comment_text) { - parameters.cp_comment = ""; + parameters.cp_comment = (char *) ""; } else { // Awful hacky cast, too lazy to copy right now. - parameters.cp_comment = (char *)comment_text; + parameters.cp_comment = (char *) comment_text; } // diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt new file mode 100644 index 0000000000..b70548a9ba --- /dev/null +++ b/indra/llinventory/CMakeLists.txt @@ -0,0 +1,56 @@ +# -*- cmake -*- + +project(llinventory) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLXML) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llinventory_SOURCE_FILES + llcategory.cpp + lleconomy.cpp + llinventory.cpp + llinventorytype.cpp + lllandmark.cpp + llnotecard.cpp + llparcel.cpp + llpermissions.cpp + llsaleinfo.cpp + lltransactionflags.cpp + lluserrelations.cpp + ) + +set(llinventory_HEADER_FILES + CMakeLists.txt + + llcategory.h + lleconomy.h + llinventory.h + llinventorytype.h + lllandmark.h + llnotecard.h + llparcel.h + llparcelflags.h + llpermissions.h + llpermissionsflags.h + llsaleinfo.h + lltransactionflags.h + lltransactiontypes.h + lluserrelations.h + ) + +set_source_files_properties(${llinventory_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llinventory_SOURCE_FILES ${llinventory_HEADER_FILES}) + +add_library (llinventory ${llinventory_SOURCE_FILES}) diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 0b28c70965..7dbc72e7a5 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -364,7 +364,7 @@ const LLString& LLInventoryItem::getDescription() const return mDescription; } -S32 LLInventoryItem::getCreationDate() const +time_t LLInventoryItem::getCreationDate() const { return mCreationDate; } @@ -422,7 +422,7 @@ void LLInventoryItem::setFlags(U32 flags) mFlags = flags; } -void LLInventoryItem::setCreationDate(S32 creation_date_utc) +void LLInventoryItem::setCreationDate(time_t creation_date_utc) { mCreationDate = creation_date_utc; } @@ -496,7 +496,9 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 mDescription.assign(desc); LLString::replaceNonstandardASCII(mDescription, ' '); - msg->getS32(block, "CreationDate", mCreationDate, block_num); + S32 date; + msg->getS32(block, "CreationDate", date, block_num); + mCreationDate = date; U32 local_crc = getCRC32(); U32 remote_crc = 0; @@ -653,7 +655,9 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) } else if(0 == strcmp("creation_date", keyword)) { - sscanf(valuestr, "%d", &mCreationDate); + S32 date; + sscanf(valuestr, "%d", &date); + mCreationDate = date; } else { @@ -716,7 +720,7 @@ BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const mSaleInfo.exportFile(fp); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); fprintf(fp, "\t\tdesc\t%s|\n", mDescription.c_str()); - fprintf(fp, "\t\tcreation_date\t%d\n", mCreationDate); + fprintf(fp, "\t\tcreation_date\t%d\n", (S32) mCreationDate); fprintf(fp,"\t}\n"); return TRUE; } @@ -854,7 +858,9 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } else if(0 == strcmp("creation_date", keyword)) { - sscanf(valuestr, "%d", &mCreationDate); + S32 date; + sscanf(valuestr, "%d", &date); + mCreationDate = date; } else { @@ -956,7 +962,7 @@ LLSD LLInventoryItem::asLLSD() const sd[INV_SALE_INFO_LABEL] = mSaleInfo; sd[INV_NAME_LABEL] = mName; sd[INV_DESC_LABEL] = mDescription; - sd[INV_CREATION_DATE_LABEL] = mCreationDate; + sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate; return sd; } @@ -1052,7 +1058,7 @@ bool LLInventoryItem::fromLLSD(LLSD& sd) w = INV_CREATION_DATE_LABEL; if (sd.has(w)) { - mCreationDate = sd[w]; + mCreationDate = sd[w].asInteger(); } // Need to convert 1.0 simstate files to a useful inventory type @@ -1116,7 +1122,8 @@ LLXMLNode *LLInventoryItem::exportFileXML(BOOL include_asset_key) const ret->createChild("name", FALSE)->setStringValue(1, &temp); temp.assign(mDescription); ret->createChild("description", FALSE)->setStringValue(1, &temp); - ret->createChild("creation_date", FALSE)->setIntValue(1, &mCreationDate); + S32 date = mCreationDate; + ret->createChild("creation_date", FALSE)->setIntValue(1, &date); return ret; } @@ -1159,7 +1166,12 @@ BOOL LLInventoryItem::importXML(LLXMLNode* node) if (node->getChild("description", sub_node)) mDescription = sub_node->getValue(); if (node->getChild("creation_date", sub_node)) - success = success && (1 == sub_node->getIntValue(1, &mCreationDate)); + { + S32 date = 0; + success = success && (1 == sub_node->getIntValue(1, &date)); + mCreationDate = date; + } + if (!success) { lldebugs << "LLInventory::importXML() failed for node named '" @@ -1615,7 +1627,7 @@ LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item) rv[INV_INVENTORY_TYPE_LABEL] = LLInventoryType::lookup(item->getInventoryType()); rv[INV_FLAGS_LABEL] = (S32)item->getFlags(); - rv[INV_CREATION_DATE_LABEL] = item->getCreationDate(); + rv[INV_CREATION_DATE_LABEL] = (S32)item->getCreationDate(); return rv; } diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 6a743e2bbd..6655d6f215 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -132,7 +132,7 @@ protected: LLSaleInfo mSaleInfo; LLInventoryType::EType mInventoryType; U32 mFlags; - S32 mCreationDate; // seconds from 1/1/1970, UTC + time_t mCreationDate; // seconds from 1/1/1970, UTC public: @@ -237,7 +237,7 @@ public: const LLSaleInfo& getSaleInfo() const; LLInventoryType::EType getInventoryType() const; U32 getFlags() const; - S32 getCreationDate() const; + time_t getCreationDate() const; U32 getCRC32() const; // really more of a checksum. // mutators - will not call updateServer(), and will never fail @@ -248,7 +248,7 @@ public: void setPermissions(const LLPermissions& perm); void setInventoryType(LLInventoryType::EType inv_type); void setFlags(U32 flags); - void setCreationDate(S32 creation_date_utc); + void setCreationDate(time_t creation_date_utc); // Put this inventory item onto the current outgoing mesage. It // assumes you have already called nextBlock(). diff --git a/indra/llinventory/lltransactionflags.cpp b/indra/llinventory/lltransactionflags.cpp index 9b49a6b589..6b90fbdc5a 100644 --- a/indra/llinventory/lltransactionflags.cpp +++ b/indra/llinventory/lltransactionflags.cpp @@ -32,9 +32,9 @@ #include "linden_common.h" +#include "lluuid.h" #include "lltransactionflags.h" #include "lltransactiontypes.h" -#include "lluuid.h" const U8 TRANSACTION_FLAGS_NONE = 0; const U8 TRANSACTION_FLAG_SOURCE_GROUP = 1; diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt new file mode 100644 index 0000000000..6a329fabb6 --- /dev/null +++ b/indra/llmath/CMakeLists.txt @@ -0,0 +1,81 @@ +# -*- cmake -*- + +project(llmath) + +include(00-Common) +include(LLCommon) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ) + +set(llmath_SOURCE_FILES + llbboxlocal.cpp + llcamera.cpp + llcoordframe.cpp + llline.cpp + llperlin.cpp + llquaternion.cpp + llrect.cpp + llsphere.cpp + llvolume.cpp + llvolumemgr.cpp + llsdutil_math.cpp + m3math.cpp + m4math.cpp + raytrace.cpp + v2math.cpp + v3color.cpp + v3dmath.cpp + v3math.cpp + v4color.cpp + v4coloru.cpp + v4math.cpp + xform.cpp + ) + +set(llmath_HEADER_FILES + CMakeLists.txt + + camera.h + coordframe.h + llbboxlocal.h + llcamera.h + llcoord.h + llcoordframe.h + llinterp.h + llline.h + llmath.h + lloctree.h + llperlin.h + llplane.h + llquantize.h + llquaternion.h + llrect.h + llsphere.h + lltreenode.h + llv4math.h + llv4matrix3.h + llv4matrix4.h + llv4vector3.h + llvolume.h + llvolumemgr.h + m3math.h + m4math.h + raytrace.h + v2math.h + v3color.h + v3dmath.h + v3math.h + v4color.h + v4coloru.h + v4math.h + xform.h + ) + +set_source_files_properties(${llmath_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llmath_SOURCE_FILES ${llmath_HEADER_FILES}) + +add_library (llmath ${llmath_SOURCE_FILES}) diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 5dfddff4eb..bf98801508 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -33,8 +33,7 @@ #define LLMATH_H #include <cmath> -//#include <math.h> -//#include <stdlib.h> +#include <cstdlib> #include "lldefs.h" // work around for Windows & older gcc non-standard function names. @@ -102,13 +101,13 @@ inline BOOL is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < inline BOOL is_approx_equal(F32 x, F32 y) { const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; - return (abs((S32) ((U32&)x - (U32&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); + return (std::abs((S32) ((U32&)x - (U32&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); } inline BOOL is_approx_equal(F64 x, F64 y) { const S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02; - return (abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); + return (std::abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); } inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits) @@ -155,17 +154,17 @@ inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits) inline S32 llabs(const S32 a) { - return S32(labs(a)); + return S32(std::labs(a)); } inline F32 llabs(const F32 a) { - return F32(fabs(a)); + return F32(std::fabs(a)); } inline F64 llabs(const F64 a) { - return F64(fabs(a)); + return F64(std::fabs(a)); } inline S32 lltrunc( F32 f ) diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 80211fb0a2..25b7100eb7 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -37,7 +37,7 @@ #include <vector> #include <set> -#ifdef LL_RELEASE_FOR_DOWNLOAD +#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG #define OCT_ERRS LL_WARNS("OctreeErrors") #else #define OCT_ERRS LL_ERRS("OctreeErrors") diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index c3e84e366d..7711d0881d 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -791,7 +791,7 @@ LLQuaternion mayaQ(F32 xRot, F32 yRot, F32 zRot, LLQuaternion::Order order) const char *OrderToString( const LLQuaternion::Order order ) { - char *p = NULL; + const char *p = NULL; switch( order ) { default: diff --git a/indra/llmath/llsdutil_math.cpp b/indra/llmath/llsdutil_math.cpp new file mode 100644 index 0000000000..04b9d892e7 --- /dev/null +++ b/indra/llmath/llsdutil_math.cpp @@ -0,0 +1,172 @@ +/** + * @file llsdutil_math.cpp + * @author Phoenix + * @date 2006-05-24 + * @brief Implementation of classes, functions, etc, for using structured data. + * + * $LicenseInfo:firstyear=2006&license=viewergpl$ + * + * Copyright (c) 2006-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llsdutil.h" + +#include "v3math.h" +#include "v4math.h" +#include "v3dmath.h" +#include "v2math.h" +#include "llquaternion.h" +#include "v4color.h" + +#if LL_WINDOWS +# define WIN32_LEAN_AND_MEAN +# include <winsock2.h> // for htonl +#elif LL_LINUX || LL_SOLARIS +# include <netinet/in.h> +#elif LL_DARWIN +# include <arpa/inet.h> +#endif + +#include "llsdserialize.h" + +// vector3 +LLSD ll_sd_from_vector3(const LLVector3& vec) +{ + LLSD rv; + rv.append((F64)vec.mV[VX]); + rv.append((F64)vec.mV[VY]); + rv.append((F64)vec.mV[VZ]); + return rv; +} + +LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index) +{ + LLVector3 rv; + rv.mV[VX] = (F32)sd[start_index].asReal(); + rv.mV[VY] = (F32)sd[++start_index].asReal(); + rv.mV[VZ] = (F32)sd[++start_index].asReal(); + return rv; +} + +// vector4 +LLSD ll_sd_from_vector4(const LLVector4& vec) +{ + LLSD rv; + rv.append((F64)vec.mV[VX]); + rv.append((F64)vec.mV[VY]); + rv.append((F64)vec.mV[VZ]); + rv.append((F64)vec.mV[VW]); + return rv; +} + +LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index) +{ + LLVector4 rv; + rv.mV[VX] = (F32)sd[start_index].asReal(); + rv.mV[VY] = (F32)sd[++start_index].asReal(); + rv.mV[VZ] = (F32)sd[++start_index].asReal(); + rv.mV[VW] = (F32)sd[++start_index].asReal(); + return rv; +} + +// vector3d +LLSD ll_sd_from_vector3d(const LLVector3d& vec) +{ + LLSD rv; + rv.append(vec.mdV[VX]); + rv.append(vec.mdV[VY]); + rv.append(vec.mdV[VZ]); + return rv; +} + +LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index) +{ + LLVector3d rv; + rv.mdV[VX] = sd[start_index].asReal(); + rv.mdV[VY] = sd[++start_index].asReal(); + rv.mdV[VZ] = sd[++start_index].asReal(); + return rv; +} + +//vector2 +LLSD ll_sd_from_vector2(const LLVector2& vec) +{ + LLSD rv; + rv.append((F64)vec.mV[VX]); + rv.append((F64)vec.mV[VY]); + return rv; +} + +LLVector2 ll_vector2_from_sd(const LLSD& sd) +{ + LLVector2 rv; + rv.mV[VX] = (F32)sd[0].asReal(); + rv.mV[VY] = (F32)sd[1].asReal(); + return rv; +} + +// Quaternion +LLSD ll_sd_from_quaternion(const LLQuaternion& quat) +{ + LLSD rv; + rv.append((F64)quat.mQ[VX]); + rv.append((F64)quat.mQ[VY]); + rv.append((F64)quat.mQ[VZ]); + rv.append((F64)quat.mQ[VW]); + return rv; +} + +LLQuaternion ll_quaternion_from_sd(const LLSD& sd) +{ + LLQuaternion quat; + quat.mQ[VX] = (F32)sd[0].asReal(); + quat.mQ[VY] = (F32)sd[1].asReal(); + quat.mQ[VZ] = (F32)sd[2].asReal(); + quat.mQ[VW] = (F32)sd[3].asReal(); + return quat; +} + +// color4 +LLSD ll_sd_from_color4(const LLColor4& c) +{ + LLSD rv; + rv.append(c.mV[0]); + rv.append(c.mV[1]); + rv.append(c.mV[2]); + rv.append(c.mV[3]); + return rv; +} + +LLColor4 ll_color4_from_sd(const LLSD& sd) +{ + LLColor4 c; + c.mV[0] = (F32)sd[0].asReal(); + c.mV[1] = (F32)sd[1].asReal(); + c.mV[2] = (F32)sd[2].asReal(); + c.mV[3] = (F32)sd[3].asReal(); + return c; +} diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h index 56820148d5..e2a8274839 100644 --- a/indra/llmath/v3color.h +++ b/indra/llmath/v3color.h @@ -174,6 +174,10 @@ inline LLColor3::LLColor3(const F32 *vec) mV[VZ] = vec[VZ]; } +#if LL_WINDOWS +# pragma warning( disable : 4996 ) // strncpy teh sux0r +#endif + inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF { if (strlen(color_string) < 6) /* Flawfinder: ignore */ diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt new file mode 100644 index 0000000000..ba17265a66 --- /dev/null +++ b/indra/llmessage/CMakeLists.txt @@ -0,0 +1,191 @@ +# -*- cmake -*- + +project(llmessage) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLVFS) + +include_directories (${CMAKE_CURRENT_SOURCE_DIR}) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ) + +set(llmessage_SOURCE_FILES + llares.cpp + llassetstorage.cpp + llblowfishcipher.cpp + llbuffer.cpp + llbufferstream.cpp + llcachename.cpp + llchainio.cpp + llcircuit.cpp + llclassifiedflags.cpp + llcurl.cpp + lldatapacker.cpp + lldispatcher.cpp + llfiltersd2xmlrpc.cpp + llhost.cpp + llhttpassetstorage.cpp + llhttpclient.cpp + llhttpnode.cpp + llhttpsender.cpp + llinstantmessage.cpp + lliobuffer.cpp + lliohttpserver.cpp + lliopipe.cpp + lliosocket.cpp + llioutil.cpp + llmail.cpp + llmessagebuilder.cpp + llmessageconfig.cpp + llmessagereader.cpp + llmessagetemplate.cpp + llmessagetemplateparser.cpp + llmessagethrottle.cpp + llmime.cpp + llnamevalue.cpp + llnullcipher.cpp + llpacketack.cpp + llpacketbuffer.cpp + llpacketring.cpp + llpartdata.cpp + llpumpio.cpp + llsdappservices.cpp + llsdhttpserver.cpp + llsdmessagebuilder.cpp + llsdmessagereader.cpp + llsdrpcclient.cpp + llsdrpcserver.cpp + llservicebuilder.cpp + llservice.cpp + lltemplatemessagebuilder.cpp + lltemplatemessagereader.cpp + llthrottle.cpp + lltransfermanager.cpp + lltransfersourceasset.cpp + lltransfersourcefile.cpp + lltransfertargetfile.cpp + lltransfertargetvfile.cpp + llurlrequest.cpp + lluseroperation.cpp + llxfer.cpp + llxfer_file.cpp + llxfermanager.cpp + llxfer_mem.cpp + llxfer_vfile.cpp + llxorcipher.cpp + message.cpp + message_prehash.cpp + message_string_table.cpp + net.cpp + network.cpp + partsyspacket.cpp + patch_code.cpp + patch_dct.cpp + patch_idct.cpp + ) + +set(llmessage_HEADER_FILES + CMakeLists.txt + + llares.h + llassetstorage.h + llblowfishcipher.h + llbuffer.h + llbufferstream.h + llcachename.h + llchainio.h + llcipher.h + llcircuit.h + llclassifiedflags.h + llcurl.h + lldatapacker.h + lldbstrings.h + lldispatcher.h + lleventflags.h + llfiltersd2xmlrpc.h + llfollowcamparams.h + llhost.h + llhttpassetstorage.h + llhttpclient.h + llhttpnode.h + llhttpsender.h + llinstantmessage.h + llinvite.h + lliobuffer.h + lliohttpserver.h + lliopipe.h + lliosocket.h + llioutil.h + llloginflags.h + llmail.h + llmessagebuilder.h + llmessageconfig.h + llmessagereader.h + llmessagetemplate.h + llmessagetemplateparser.h + llmessagethrottle.h + llmime.h + llmsgvariabletype.h + llnamevalue.h + llnullcipher.h + llpacketack.h + llpacketbuffer.h + llpacketring.h + llpartdata.h + llpumpio.h + llqueryflags.h + llregionflags.h + llregionhandle.h + llsdappservices.h + llsdhttpserver.h + llsdmessagebuilder.h + llsdmessagereader.h + llsdrpcclient.h + llsdrpcserver.h + llservice.h + llservicebuilder.h + lltaskname.h + llteleportflags.h + lltemplatemessagebuilder.h + lltemplatemessagereader.h + llthrottle.h + lltransfermanager.h + lltransfersourceasset.h + lltransfersourcefile.h + lltransfertargetfile.h + lltransfertargetvfile.h + llurlrequest.h + lluseroperation.h + llvehicleparams.h + llxfer.h + llxfermanager.h + llxfer_file.h + llxfer_mem.h + llxfer_vfile.h + llxorcipher.h + machine.h + mean_collision_data.h + message.h + message_prehash.h + net.h + network.h + partsyspacket.h + patch_code.h + patch_dct.h + sound_ids.h + ) + +set_source_files_properties(${llmessage_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llmessage_SOURCE_FILES ${llmessage_HEADER_FILES}) + +add_library (llmessage ${llmessage_SOURCE_FILES}) diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp new file mode 100644 index 0000000000..d11f227c21 --- /dev/null +++ b/indra/llmessage/llares.cpp @@ -0,0 +1,804 @@ +/** + * @file llares.cpp + * @author Bryan O'Sullivan + * @date 2007-08-15 + * @brief Wrapper for asynchronous DNS lookups. + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include <ares_dns.h> +#include <ares_version.h> + +#include "apr_portable.h" +#include "apr_network_io.h" +#include "apr_poll.h" + +#include "llapr.h" +#include "llares.h" + +#if defined(LL_WINDOWS) +# define ns_c_in 1 +# define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ +# define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ +# define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#else +# include <arpa/nameser.h> +#endif + +LLAres::HostResponder::~HostResponder() +{ +} + +void LLAres::HostResponder::hostResult(const hostent *ent) +{ + llinfos << "LLAres::HostResponder::hostResult not implemented" << llendl; +} + +void LLAres::HostResponder::hostError(int code) +{ + llinfos << "LLAres::HostResponder::hostError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +LLAres::NameInfoResponder::~NameInfoResponder() +{ +} + +void LLAres::NameInfoResponder::nameInfoResult(const char *node, + const char *service) +{ + llinfos << "LLAres::NameInfoResponder::nameInfoResult not implemented" + << llendl; +} + +void LLAres::NameInfoResponder::nameInfoError(int code) +{ + llinfos << "LLAres::NameInfoResponder::nameInfoError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +LLAres::QueryResponder::~QueryResponder() +{ +} + +void LLAres::QueryResponder::queryResult(const char *buf, size_t len) +{ + llinfos << "LLAres::QueryResponder::queryResult not implemented" + << llendl; +} + +void LLAres::QueryResponder::queryError(int code) +{ + llinfos << "LLAres::QueryResponder::queryError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +LLAres::LLAres() +{ + ares_init(&chan_); +} + +LLAres::~LLAres() +{ + ares_destroy(chan_); +} + +void LLAres::cancel() +{ + ares_cancel(chan_); +} + +static void host_callback_1_5(void *arg, int status, int timeouts, + struct hostent *ent) +{ + LLPointer<LLAres::HostResponder> *resp = + (LLPointer<LLAres::HostResponder> *) arg; + + if (status == ARES_SUCCESS) + { + (*resp)->hostResult(ent); + } else { + (*resp)->hostError(status); + } + + delete resp; +} + +#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4 +static void host_callback(void *arg, int status, struct hostent *ent) +{ + host_callback_1_5(arg, status, 0, ent); +} +#else +# define host_callback host_callback_1_5 +#endif + +void LLAres::getHostByName(const char *name, HostResponder *resp, + int family) +{ + ares_gethostbyname(chan_, name, family, host_callback, + new LLPointer<LLAres::HostResponder>(resp)); +} + +void LLAres::getSrvRecords(const std::string &name, SrvResponder *resp) +{ + search(name, RES_SRV, resp); +} + +void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp) +{ + llinfos << "Rewriting " << uri << llendl; + + resp->mUri = LLURI(uri); + search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(), + RES_SRV, resp); +} + +LLQueryResponder::LLQueryResponder() + : LLAres::QueryResponder(), + mResult(ARES_ENODATA) +{ +} + +int LLQueryResponder::parseRR(const char *buf, size_t len, const char *&pos, + LLPointer<LLDnsRecord> &r) +{ + std::string rrname; + size_t enclen; + int ret; + + // RR name. + + ret = LLAres::expandName(pos, buf, len, rrname, enclen); + if (ret != ARES_SUCCESS) + { + return ret; + } + + pos += enclen; + + if (pos + NS_RRFIXEDSZ > buf + len) + { + return ARES_EBADRESP; + } + + int rrtype = DNS_RR_TYPE(pos); + int rrclass = DNS_RR_CLASS(pos); + int rrttl = DNS_RR_TTL(pos); + int rrlen = DNS_RR_LEN(pos); + + if (rrclass != ns_c_in) + { + return ARES_EBADRESP; + } + + pos += NS_RRFIXEDSZ; + + if (pos + rrlen > buf + len) + { + return ARES_EBADRESP; + } + + switch (rrtype) + { + case RES_A: + r = new LLARecord(rrname, rrttl); + break; + case RES_NS: + r = new LLNsRecord(rrname, rrttl); + break; + case RES_CNAME: + r = new LLCnameRecord(rrname, rrttl); + break; + case RES_PTR: + r = new LLPtrRecord(rrname, rrttl); + break; + case RES_AAAA: + r = new LLAaaaRecord(rrname, rrttl); + break; + case RES_SRV: + r = new LLSrvRecord(rrname, rrttl); + break; + default: + llinfos << "LLQueryResponder::parseRR got unknown RR type " << rrtype + << llendl; + return ARES_EBADRESP; + } + + ret = r->parse(buf, len, pos, rrlen); + + if (ret == ARES_SUCCESS) + { + pos += rrlen; + } else { + r = NULL; + } + + return ret; +} + +int LLQueryResponder::parseSection(const char *buf, size_t len, + size_t count, const char *&pos, + dns_rrs_t &rrs) +{ + int ret = ARES_SUCCESS; + + for (size_t i = 0; i < count; i++) + { + LLPointer<LLDnsRecord> r; + ret = parseRR(buf, len, pos, r); + if (ret != ARES_SUCCESS) + { + break; + } + rrs.push_back(r); + } + + return ret; +} + +void LLQueryResponder::queryResult(const char *buf, size_t len) +{ + const char *pos = buf; + int qdcount = DNS_HEADER_QDCOUNT(pos); + int ancount = DNS_HEADER_ANCOUNT(pos); + int nscount = DNS_HEADER_NSCOUNT(pos); + int arcount = DNS_HEADER_ARCOUNT(pos); + int ret; + + if (qdcount == 0 || ancount + nscount + arcount == 0) + { + ret = ARES_ENODATA; + goto bail; + } + + pos += NS_HFIXEDSZ; + + for (int i = 0; i < qdcount; i++) + { + std::string ignore; + size_t enclen; + + ret = LLAres::expandName(pos, buf, len, i == 0 ? mQuery : ignore, + enclen); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + pos += enclen; + + if (i == 0) + { + int t = DNS_QUESTION_TYPE(pos); + switch (t) + { + case RES_A: + case RES_NS: + case RES_CNAME: + case RES_PTR: + case RES_AAAA: + case RES_SRV: + mType = (LLResType) t; + break; + default: + llinfos << "Cannot grok query type " << t << llendl; + ret = ARES_EBADQUERY; + goto bail; + } + } + + pos += NS_QFIXEDSZ; + if (pos > buf + len) + { + ret = ARES_EBADRESP; + goto bail; + } + } + + ret = parseSection(buf, len, ancount, pos, mAnswers); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + ret = parseSection(buf, len, nscount, pos, mAuthorities); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + ret = parseSection(buf, len, arcount, pos, mAdditional); + +bail: + mResult = ret; + if (mResult == ARES_SUCCESS) + { + querySuccess(); + } else { + queryError(mResult); + } +} + +void LLQueryResponder::querySuccess() +{ + llinfos << "LLQueryResponder::queryResult not implemented" << llendl; +} + +void LLAres::SrvResponder::querySuccess() +{ + if (mType == RES_SRV) + { + srvResult(mAnswers); + } else { + srvError(ARES_EBADRESP); + } +} + +void LLAres::SrvResponder::queryError(int code) +{ + srvError(code); +} + +void LLAres::SrvResponder::srvResult(const dns_rrs_t &ents) +{ + llinfos << "LLAres::SrvResponder::srvResult not implemented" << llendl; + + for (size_t i = 0; i < ents.size(); i++) + { + const LLSrvRecord *s = (const LLSrvRecord *) ents[i].get(); + + llinfos << "[" << i << "] " << s->host() << ":" << s->port() + << " priority " << s->priority() + << " weight " << s->weight() + << llendl; + } +} + +void LLAres::SrvResponder::srvError(int code) +{ + llinfos << "LLAres::SrvResponder::srvError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +static void nameinfo_callback_1_5(void *arg, int status, int timeouts, + char *node, char *service) +{ + LLPointer<LLAres::NameInfoResponder> *resp = + (LLPointer<LLAres::NameInfoResponder> *) arg; + + if (status == ARES_SUCCESS) + { + (*resp)->nameInfoResult(node, service); + } else { + (*resp)->nameInfoError(status); + } + + delete resp; +} + +#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4 +static void nameinfo_callback(void *arg, int status, char *node, char *service) +{ + nameinfo_callback_1_5(arg, status, 0, node, service); +} +#else +# define nameinfo_callback nameinfo_callback_1_5 +#endif + +void LLAres::getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags, + NameInfoResponder *resp) +{ + ares_getnameinfo(chan_, &sa, salen, flags, nameinfo_callback, + new LLPointer<NameInfoResponder>(resp)); +} + +static void search_callback_1_5(void *arg, int status, int timeouts, + unsigned char *abuf, int alen) +{ + LLPointer<LLAres::QueryResponder> *resp = + (LLPointer<LLAres::QueryResponder> *) arg; + + if (status == ARES_SUCCESS) + { + (*resp)->queryResult((const char *) abuf, alen); + } else { + (*resp)->queryError(status); + } + + delete resp; +} + +#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4 +static void search_callback(void *arg, int status, unsigned char *abuf, + int alen) +{ + search_callback_1_5(arg, status, 0, abuf, alen); +} +#else +# define search_callback search_callback_1_5 +#endif + +void LLAres::search(const std::string &query, LLResType type, + QueryResponder *resp) +{ + ares_search(chan_, query.c_str(), ns_c_in, type, search_callback, + new LLPointer<QueryResponder>(resp)); +} + +bool LLAres::process(U64 timeout) +{ + if (!gAPRPoolp) + { + ll_init_apr(); + } + + int socks[ARES_GETSOCK_MAXNUM]; + apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM]; + apr_int32_t nsds = 0; + apr_status_t status; + apr_pool_t *pool; + int nactive = 0; + int bitmask; + + bitmask = ares_getsock(chan_, socks, ARES_GETSOCK_MAXNUM); + + if (bitmask == 0) + { + goto bail; + } + + status = apr_pool_create(&pool, gAPRPoolp); + ll_apr_assert_status(status); + + for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++) + { + if (ARES_GETSOCK_READABLE(bitmask, i)) + { + aprFds[nactive].reqevents = APR_POLLIN | APR_POLLERR; + } + else if (ARES_GETSOCK_WRITABLE(bitmask, i)) + { + aprFds[nactive].reqevents = APR_POLLOUT | APR_POLLERR; + } else { + continue; + } + + apr_socket_t *aprSock = NULL; + + status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], pool); + if (status != APR_SUCCESS) + { + ll_apr_warn_status(status); + goto bail_pool; + } + + aprFds[nactive].desc.s = aprSock; + aprFds[nactive].desc_type = APR_POLL_SOCKET; + aprFds[nactive].p = pool; + aprFds[nactive].rtnevents = 0; + aprFds[nactive].client_data = &socks[i]; + + nactive++; + } + + if (nactive > 0) + { + status = apr_poll(aprFds, nactive, &nsds, timeout); + + if (status != APR_SUCCESS && status != APR_TIMEUP) + { + ll_apr_warn_status(status); + } + + for (int i = 0; i < nactive; i++) + { + int evts = aprFds[i].rtnevents; + int ifd = (evts & (APR_POLLIN | APR_POLLERR)) + ? *((int *) aprFds[i].client_data) : ARES_SOCKET_BAD; + int ofd = (evts & (APR_POLLOUT | APR_POLLERR)) + ? *((int *) aprFds[i].client_data) : ARES_SOCKET_BAD; + + ares_process_fd(chan_, ifd, ofd); + } + } + +bail_pool: + apr_pool_destroy(pool); + +bail: + return nsds > 0; +} + +bool LLAres::processAll() +{ + bool anyProcessed = false, ret; + + do { + timeval tv; + + ret = ares_timeout(chan_, NULL, &tv) != NULL; + + if (ret) + { + ret = process(tv.tv_sec * 1000000LL + tv.tv_usec); + anyProcessed |= ret; + } + } while (ret); + + return anyProcessed; +} + +int LLAres::expandName(const char *encoded, const char *abuf, size_t alen, + std::string &s, size_t &enclen) +{ + char *t; + int ret; + long e; + + ret = ares_expand_name((const unsigned char *) encoded, + (const unsigned char *) abuf, alen, &t, &e); + if (ret == ARES_SUCCESS) + { + s.assign(t); + enclen = e; + ares_free_string(t); + } + return ret; +} + +const char *LLAres::strerror(int code) +{ + return ares_strerror(code); +} + +LLAres *gAres; + +LLAres *ll_init_ares() +{ + if (gAres == NULL) + { + gAres = new LLAres(); + } + return gAres; +} + +LLDnsRecord::LLDnsRecord(LLResType type, const std::string &name, + unsigned ttl) + : LLRefCount(), + mType(type), + mName(name), + mTTL(ttl) +{ +} + +LLHostRecord::LLHostRecord(LLResType type, const std::string &name, + unsigned ttl) + : LLDnsRecord(type, name, ttl) +{ +} + +int LLHostRecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + ret = LLAres::expandName(pos, buf, len, mHost); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + ret = ARES_SUCCESS; + +bail: + return ret; +} + +LLCnameRecord::LLCnameRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_CNAME, name, ttl) +{ +} + +LLPtrRecord::LLPtrRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_PTR, name, ttl) +{ +} + +LLAddrRecord::LLAddrRecord(LLResType type, const std::string &name, + unsigned ttl) + : LLDnsRecord(type, name, ttl) +{ +} + +LLARecord::LLARecord(const std::string &name, unsigned ttl) + : LLAddrRecord(RES_A, name, ttl) +{ +} + +int LLARecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + if (rrlen != sizeof(mSA.sin.sin_addr.s_addr)) + { + ret = ARES_EBADRESP; + goto bail; + } + + memset(&mSA, 0, sizeof(mSA)); + memcpy(&mSA.sin.sin_addr.s_addr, pos, rrlen); + mSA.sin.sin_family = AF_INET6; + mSize = sizeof(mSA.sin); + + ret = ARES_SUCCESS; + +bail: + return ret; +} + +LLAaaaRecord::LLAaaaRecord(const std::string &name, unsigned ttl) + : LLAddrRecord(RES_AAAA, name, ttl) +{ +} + +int LLAaaaRecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + if (rrlen != sizeof(mSA.sin6.sin6_addr)) + { + ret = ARES_EBADRESP; + goto bail; + } + + memset(&mSA, 0, sizeof(mSA)); + memcpy(&mSA.sin6.sin6_addr.s6_addr, pos, rrlen); + mSA.sin6.sin6_family = AF_INET6; + mSize = sizeof(mSA.sin6); + + ret = ARES_SUCCESS; + +bail: + return ret; +} + +LLSrvRecord::LLSrvRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_SRV, name, ttl) +{ +} + +int LLSrvRecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + if (rrlen < 6) + { + ret = ARES_EBADRESP; + goto bail; + } + + memcpy(&mPriority, pos, 2); + memcpy(&mWeight, pos + 2, 2); + memcpy(&mPort, pos + 4, 2); + + mPriority = ntohs(mPriority); + mWeight = ntohs(mWeight); + mPort = ntohs(mPort); + + ret = LLHostRecord::parse(buf, len, pos + 6, rrlen - 6); + +bail: + return ret; +} + +LLNsRecord::LLNsRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_NS, name, ttl) +{ +} + +void LLAres::UriRewriteResponder::queryError(int code) +{ + std::vector<std::string> uris; + uris.push_back(mUri.asString()); + rewriteResult(uris); +} + +void LLAres::UriRewriteResponder::querySuccess() +{ + std::vector<std::string> uris; + + if (mType != RES_SRV) + { + goto bail; + } + + for (size_t i = 0; i < mAnswers.size(); i++) + { + const LLSrvRecord *r = (const LLSrvRecord *) mAnswers[i].get(); + + if (r->type() == RES_SRV) + { + // Check the domain in the response to ensure that it's + // the same as the domain in the request, so that bad guys + // can't forge responses that point to their own login + // servers with their own certificates. + + // Hard-coding the domain to check here is a bit of a + // hack. Hoist it to an outer caller if anyone ever needs + // this functionality on other domains. + + static const std::string domain(".lindenlab.com"); + const std::string &host = r->host(); + + std::string::size_type s = host.find(domain) + domain.length(); + + if (s != host.length() && s != host.length() - 1) + { + continue; + } + + LLURI uri(mUri.scheme(), + mUri.userName(), + mUri.password(), + r->host(), + mUri.defaultPort() ? r->port() : mUri.hostPort(), + mUri.escapedPath(), + mUri.escapedQuery()); + uris.push_back(uri.asString()); + } + } + + if (!uris.empty()) + { + goto done; + } + +bail: + uris.push_back(mUri.asString()); + +done: + rewriteResult(uris); +} + +void LLAres::UriRewriteResponder::rewriteResult( + const std::vector<std::string> &uris) +{ + llinfos << "LLAres::UriRewriteResponder::rewriteResult not implemented" + << llendl; + + for (size_t i = 0; i < uris.size(); i++) + { + llinfos << "[" << i << "] " << uris[i] << llendl; + } +} diff --git a/indra/llmessage/llares.h b/indra/llmessage/llares.h new file mode 100644 index 0000000000..4dd65600cc --- /dev/null +++ b/indra/llmessage/llares.h @@ -0,0 +1,572 @@ +/** + * @file llares.h + * @author Bryan O'Sullivan + * @date 2007-08-15 + * @brief Wrapper for asynchronous DNS lookups. + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLARES_H +#define LL_LLARES_H + +#ifdef LL_WINDOWS +# include <ws2tcpip.h> +#endif + +#ifdef LL_STANDALONE +# include <ares.h> +#else +# include <ares/ares.h> +#endif + +#include "llmemory.h" +#include "lluri.h" + +class LLQueryResponder; + +/** + * @brief Supported DNS RR types. + */ +enum LLResType +{ + RES_INVALID = 0, /**< Cookie. */ + RES_A = 1, /**< "A" record. IPv4 address. */ + RES_NS = 2, /**< "NS" record. Authoritative server. */ + RES_CNAME = 5, /**< "CNAME" record. Canonical name. */ + RES_PTR = 12, /**< "PTR" record. Domain name pointer. */ + RES_AAAA = 28, /**< "AAAA" record. IPv6 Address. */ + RES_SRV = 33, /**< "SRV" record. Server Selection. */ + RES_MAX = 65536 /**< Sentinel; RR types are 16 bits wide. */ +}; + +/** + * @class LLDnsRecord + * @brief Base class for all DNS RR types. + */ +class LLDnsRecord : public LLRefCount +{ +protected: + friend class LLQueryResponder; + + LLResType mType; + std::string mName; + unsigned mTTL; + + virtual int parse(const char *buf, size_t len, const char *pos, + size_t rrlen) = 0; + + LLDnsRecord(LLResType type, const std::string &name, unsigned ttl); + +public: + /** + * @brief Record name. + */ + const std::string &name() const { return mName; } + + /** + * @brief Time-to-live value, in seconds. + */ + unsigned ttl() const { return mTTL; } + + /** + * @brief RR type. + */ + LLResType type() const { return mType; } +}; + +/** + * @class LLAddrRecord + * @brief Base class for address-related RRs. + */ +class LLAddrRecord : public LLDnsRecord +{ +protected: + friend class LLQueryResponder; + + LLAddrRecord(LLResType type, const std::string &name, unsigned ttl); + + union + { + sockaddr sa; + sockaddr_in sin; + sockaddr_in6 sin6; + } mSA; + + socklen_t mSize; + +public: + /** + * @brief Generic socket address. + */ + const sockaddr &addr() const { return mSA.sa; } + + /** + * @brief Size of the socket structure. + */ + socklen_t size() const { return mSize; } +}; + +/** + * @class LLARecord + * @brief A RR, for IPv4 addresses. + */ +class LLARecord : public LLAddrRecord +{ +protected: + friend class LLQueryResponder; + + LLARecord(const std::string &name, unsigned ttl); + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + +public: + /** + * @brief Socket address. + */ + const sockaddr_in &addr_in() const { return mSA.sin; } +}; + +/** + * @class LLAaaaRecord + * @brief AAAA RR, for IPv6 addresses. + */ +class LLAaaaRecord : public LLAddrRecord +{ +protected: + friend class LLQueryResponder; + + LLAaaaRecord(const std::string &name, unsigned ttl); + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + +public: + /** + * @brief Socket address. + */ + const sockaddr_in6 &addr_in6() const { return mSA.sin6; } +}; + +/** + * @class LLHostRecord + * @brief Base class for host-related RRs. + */ +class LLHostRecord : public LLDnsRecord +{ +protected: + LLHostRecord(LLResType type, const std::string &name, unsigned ttl); + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + + std::string mHost; + +public: + /** + * @brief Host name. + */ + const std::string &host() const { return mHost; } +}; + +/** + * @class LLCnameRecord + * @brief CNAME RR. + */ +class LLCnameRecord : public LLHostRecord +{ +protected: + friend class LLQueryResponder; + + LLCnameRecord(const std::string &name, unsigned ttl); +}; + +/** + * @class LLPtrRecord + * @brief PTR RR. + */ +class LLPtrRecord : public LLHostRecord +{ +protected: + friend class LLQueryResponder; + + LLPtrRecord(const std::string &name, unsigned ttl); +}; + +/** + * @class LLSrvRecord + * @brief SRV RR. + */ +class LLSrvRecord : public LLHostRecord +{ +protected: + U16 mPriority; + U16 mWeight; + U16 mPort; + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + +public: + LLSrvRecord(const std::string &name, unsigned ttl); + + /** + * @brief Service priority. + */ + U16 priority() const { return mPriority; } + + /** + * @brief Service weight. + */ + U16 weight() const { return mWeight; } + + /** + * @brief Port number of service. + */ + U16 port() const { return mPort; } + + /** + * @brief Functor for sorting SRV records by priority. + */ + struct ComparePriorityLowest + { + bool operator()(const LLSrvRecord& lhs, const LLSrvRecord& rhs) + { + return lhs.mPriority < rhs.mPriority; + } + }; +}; + +/** + * @class LLNsRecord + * @brief NS RR. + */ +class LLNsRecord : public LLHostRecord +{ +public: + LLNsRecord(const std::string &name, unsigned ttl); +}; + +class LLQueryResponder; + +/** + * @class LLAres + * @brief Asynchronous address resolver. + */ +class LLAres +{ +public: + /** + * @class HostResponder + * @brief Base class for responding to hostname lookups. + * @see LLAres::getHostByName + */ + class HostResponder : public LLRefCount + { + public: + virtual ~HostResponder(); + + virtual void hostResult(const hostent *ent); + virtual void hostError(int code); + }; + + /** + * @class NameInfoResponder + * @brief Base class for responding to address lookups. + * @see LLAres::getNameInfo + */ + class NameInfoResponder : public LLRefCount + { + public: + virtual ~NameInfoResponder(); + + virtual void nameInfoResult(const char *node, const char *service); + virtual void nameInfoError(int code); + }; + + /** + * @class QueryResponder + * @brief Base class for responding to custom searches. + * @see LLAres::search + */ + class QueryResponder : public LLRefCount + { + public: + virtual ~QueryResponder(); + + virtual void queryResult(const char *buf, size_t len); + virtual void queryError(int code); + }; + + class SrvResponder; + class UriRewriteResponder; + + LLAres(); + + ~LLAres(); + + /** + * Cancel all outstanding requests. The error methods of the + * corresponding responders will be called, with ARES_ETIMEOUT. + */ + void cancel(); + + /** + * Look up the address of a host. + * + * @param name name of host to look up + * @param resp responder to call with result + * @param family AF_INET for IPv4 addresses, AF_INET6 for IPv6 + */ + void getHostByName(const std::string &name, HostResponder *resp, + int family = AF_INET) { + getHostByName(name.c_str(), resp, family); + } + + /** + * Look up the address of a host. + * + * @param name name of host to look up + * @param resp responder to call with result + * @param family AF_INET for IPv4 addresses, AF_INET6 for IPv6 + */ + void getHostByName(const char *name, HostResponder *resp, + int family = PF_INET); + + /** + * Look up the name associated with a socket address. + * + * @param sa socket address to look up + * @param salen size of socket address + * @param flags flags to use + * @param resp responder to call with result + */ + void getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags, + NameInfoResponder *resp); + + /** + * Look up SRV (service location) records for a service name. + * + * @param name service name (e.g. "_https._tcp.login.agni.lindenlab.com") + * @param resp responder to call with result + */ + void getSrvRecords(const std::string &name, SrvResponder *resp); + + /** + * Rewrite a URI, using SRV (service location) records for its + * protocol if available. If no SRV records are published, the + * existing URI is handed to the responder. + * + * @param uri URI to rewrite + * @param resp responder to call with result + */ + void rewriteURI(const std::string &uri, + UriRewriteResponder *resp); + + /** + * Start a custom search. + * + * @param query query to make + * @param type type of query to perform + * @param resp responder to call with result + */ + void search(const std::string &query, LLResType type, + QueryResponder *resp); + + /** + * Process any outstanding queries. This method takes an optional + * timeout parameter (specified in microseconds). If provided, it + * will block the calling thread for that length of time to await + * possible responses. A timeout of zero will return immediately + * if there are no responses or timeouts to process. + * + * @param timeoutUsecs number of microseconds to block before timing out + * @return whether any responses were processed + */ + bool process(U64 timeoutUsecs = 0); + + /** + * Process all outstanding queries, blocking the calling thread + * until all have either been responded to or timed out. + * + * @return whether any responses were processed + */ + bool processAll(); + + /** + * Expand a DNS-encoded compressed string into a normal string. + * + * @param encoded the encoded name (null-terminated) + * @param abuf the response buffer in which the string is embedded + * @param alen the length of the response buffer + * @param s the string into which to place the result + * @return ARES_SUCCESS on success, otherwise an error indicator + */ + static int expandName(const char *encoded, const char *abuf, size_t alen, + std::string &s) { + size_t ignore; + return expandName(encoded, abuf, alen, s, ignore); + } + + static int expandName(const char *encoded, const char *abuf, size_t alen, + std::string &s, size_t &enclen); + + /** + * Return a string describing an error code. + */ + static const char *strerror(int code); + +protected: + ares_channel chan_; + +}; + +/** + * An ordered collection of DNS resource records. + */ +typedef std::vector<LLPointer<LLDnsRecord> > dns_rrs_t; + +/** + * @class LLQueryResponder + * @brief Base class for friendly handling of DNS query responses. + * + * This class parses a DNS response and represents it in a friendly + * manner. + * + * @see LLDnsRecord + * @see LLARecord + * @see LLNsRecord + * @see LLCnameRecord + * @see LLPtrRecord + * @see LLAaaaRecord + * @see LLSrvRecord + */ +class LLQueryResponder : public LLAres::QueryResponder +{ +protected: + int mResult; + std::string mQuery; + LLResType mType; + + dns_rrs_t mAnswers; + dns_rrs_t mAuthorities; + dns_rrs_t mAdditional; + + /** + * Parse a single RR. + */ + int parseRR(const char *buf, size_t len, const char *&pos, + LLPointer<LLDnsRecord> &r); + /** + * Parse one section of a response. + */ + int parseSection(const char *buf, size_t len, + size_t count, const char *& pos, dns_rrs_t &rrs); + + void queryResult(const char *buf, size_t len); + virtual void querySuccess(); + +public: + LLQueryResponder(); + + /** + * Indicate whether the response could be parsed successfully. + */ + bool valid() const { return mResult == ARES_SUCCESS; } + + /** + * The more detailed result of parsing the response. + */ + int result() const { return mResult; } + + /** + * Return the query embedded in the response. + */ + const std::string &query() const { return mQuery; } + + /** + * Return the contents of the "answers" section of the response. + */ + const dns_rrs_t &answers() const { return mAnswers; } + + /** + * Return the contents of the "authorities" section of the + * response. + */ + const dns_rrs_t &authorities() const { return mAuthorities; } + + /** + * Return the contents of the "additional records" section of the + * response. + */ + const dns_rrs_t &additional() const { return mAdditional; } +}; + +/** + * @class LLAres::SrvResponder + * @brief Class for handling SRV query responses. + */ +class LLAres::SrvResponder : public LLQueryResponder +{ +public: + friend void LLAres::getSrvRecords(const std::string &name, + SrvResponder *resp); + void querySuccess(); + void queryError(int code); + + virtual void srvResult(const dns_rrs_t &ents); + virtual void srvError(int code); +}; + +/** + * @class LLAres::UriRewriteResponder + * @brief Class for handling URI rewrites based on SRV records. + */ +class LLAres::UriRewriteResponder : public LLQueryResponder +{ +protected: + LLURI mUri; + +public: + friend void LLAres::rewriteURI(const std::string &uri, + UriRewriteResponder *resp); + void querySuccess(); + void queryError(int code); + + virtual void rewriteResult(const std::vector<std::string> &uris); +}; + +/** + * Singleton responder. + */ +extern LLAres *gAres; + +/** + * Set up the singleton responder. It's safe to call this more than + * once from within a single thread, but this function is not + * thread safe. + */ +extern LLAres *ll_init_ares(); + +#endif // LL_LLARES_H diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index 07a3655697..d561087ae4 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -81,7 +81,7 @@ #include <sstream> #include <iterator> #include <xmlrpc-epi/xmlrpc.h> -#include "apr-1/apr_base64.h" +#include "apr_base64.h" #include "llbuffer.h" #include "llbufferstream.h" diff --git a/indra/llmessage/lliopipe.h b/indra/llmessage/lliopipe.h index e480f83b55..d8b34cbe44 100644 --- a/indra/llmessage/lliopipe.h +++ b/indra/llmessage/lliopipe.h @@ -36,7 +36,7 @@ #include <boost/intrusive_ptr.hpp> #include <boost/shared_ptr.hpp> -#include "apr-1/apr_poll.h" +#include "apr_poll.h" #include "llsd.h" diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index b1f55a297c..ff7c32aee8 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -68,7 +68,7 @@ bool is_addr_in_use(apr_status_t status) // Define this to see the actual file descriptors being tossed around. //#define LL_DEBUG_SOCKET_FILE_DESCRIPTORS 1 #if LL_DEBUG_SOCKET_FILE_DESCRIPTORS -#include "apr-1/apr_portable.h" +#include "apr_portable.h" #endif #endif diff --git a/indra/llmessage/lliosocket.h b/indra/llmessage/lliosocket.h index 586f489b28..b6cf0f3e70 100644 --- a/indra/llmessage/lliosocket.h +++ b/indra/llmessage/lliosocket.h @@ -43,8 +43,8 @@ */ #include "lliopipe.h" -#include "apr-1/apr_pools.h" -#include "apr-1/apr_network_io.h" +#include "apr_pools.h" +#include "apr_network_io.h" #include "llchainio.h" class LLHost; diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index ac0ee66e41..1a076b7281 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -42,10 +42,9 @@ #include <string> #include <sstream> -#include <boost/regex.hpp> -#include "apr-1/apr_pools.h" -#include "apr-1/apr_network_io.h" +#include "apr_pools.h" +#include "apr_network_io.h" #include "llapr.h" #include "llbase32.h" // IM-to-email address @@ -66,8 +65,6 @@ static apr_pool_t* gMailPool; static apr_sockaddr_t* gSockAddr; static apr_socket_t* gMailSocket; -// According to RFC2822 -static const boost::regex valid_subject_chars("[\\x1-\\x9\\xb\\xc\\xe-\\x7f]*"); bool connect_smtp(); void disconnect_smtp(); @@ -173,6 +170,22 @@ void LLMail::enable(bool mail_enabled) gMailEnabled = mail_enabled; } +// Test a subject line for RFC2822 compliance. +static bool valid_subject_chars(const char *subject) +{ + for (; *subject != '\0'; subject++) + { + unsigned char c = *subject; + + if (c == '\xa' || c == '\xd' || c > '\x7f') + { + return false; + } + } + + return true; +} + // static std::string LLMail::buildSMTPTransaction( const char* from_name, @@ -187,7 +200,7 @@ std::string LLMail::buildSMTPTransaction( << " from address." << llendl; return std::string(); } - if(! boost::regex_match(subject, valid_subject_chars)) + if(!valid_subject_chars(subject)) { llinfos << "send_mail build_smtp_transaction reject: bad subject header: " << "to=<" << to_address diff --git a/indra/llmessage/llmessagetemplateparser.cpp b/indra/llmessage/llmessagetemplateparser.cpp index e8843c7696..50f216ed6f 100644 --- a/indra/llmessage/llmessagetemplateparser.cpp +++ b/indra/llmessage/llmessagetemplateparser.cpp @@ -161,7 +161,7 @@ S32 get_checker_number(char checker) } // check token based on passed simplified regular expression -BOOL b_check_token(const char *token, char *regexp) +BOOL b_check_token(const char *token, const char *regexp) { S32 tptr, rptr = 0; S32 current_checker, next_checker = 0; diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index b87b66822c..503ca947df 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -36,7 +36,7 @@ #include <map> #include <set> -#include "apr-1/apr_poll.h" +#include "apr_poll.h" #include "llapr.h" #include "llmemtype.h" @@ -49,7 +49,7 @@ //#define LL_DEBUG_PIPE_TYPE_IN_PUMP 1 //#define LL_DEBUG_POLL_FILE_DESCRIPTORS 1 #if LL_DEBUG_POLL_FILE_DESCRIPTORS -#include "apr-1/apr_portable.h" +#include "apr_portable.h" #endif #endif @@ -261,7 +261,7 @@ bool LLPumpIO::addChain( bool LLPumpIO::setTimeoutSeconds(F32 timeout) { // If no chain is running, return failure. - if(current_chain_t() == mCurrentChain) + if(mRunningChains.end() == mCurrentChain) { return false; } @@ -365,7 +365,7 @@ S32 LLPumpIO::setLock() // lock the runner at the same time. // If no chain is running, return failure. - if(current_chain_t() == mCurrentChain) + if(mRunningChains.end() == mCurrentChain) { return 0; } @@ -414,7 +414,7 @@ bool LLPumpIO::sleepChain(F64 seconds) bool LLPumpIO::copyCurrentLinkInfo(links_t& links) const { LLMemType m1(LLMemType::MTYPE_IO_PUMP); - if(current_chain_t() == mCurrentChain) + if(mRunningChains.end() == mCurrentChain) { return false; } @@ -584,6 +584,7 @@ void LLPumpIO::pump(const S32& poll_timeout) } PUMP_DEBUG; mCurrentChain = run_chain; + if((*run_chain).mDescriptors.empty()) { // if there are no conditionals, just process this chain. @@ -702,7 +703,7 @@ void LLPumpIO::pump(const S32& poll_timeout) PUMP_DEBUG; // null out the chain - mCurrentChain = current_chain_t(); + mCurrentChain = mRunningChains.end(); END_PUMP_DEBUG; } diff --git a/indra/llmessage/llpumpio.h b/indra/llmessage/llpumpio.h index 1609650f1f..fe7012ad6c 100644 --- a/indra/llmessage/llpumpio.h +++ b/indra/llmessage/llpumpio.h @@ -39,7 +39,7 @@ #include <sys/param.h> #endif -#include "apr-1/apr_pools.h" +#include "apr_pools.h" #include "llbuffer.h" #include "llframetimer.h" #include "lliopipe.h" diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index ad4e21efa9..4ca7895613 100755 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -37,6 +37,13 @@ #include "llsdmessagebuilder.h" #include "llsdutil.h" +#include "v3math.h" +#include "v4math.h" +#include "v3dmath.h" +#include "v2math.h" +#include "llquaternion.h" +#include "v4color.h" + LLSDMessageReader::LLSDMessageReader() : mMessageName(NULL) { diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index 87e1d4e50f..e7be235221 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -42,7 +42,7 @@ #include "llpumpio.h" #include "llsd.h" #include "llstring.h" -#include "apr-1/apr_env.h" +#include "apr_env.h" static const U32 HTTP_STATUS_PIPE_ERROR = 499; diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 04f61c53d7..c1731532ca 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -46,9 +46,9 @@ #include <sstream> #include "llapr.h" -#include "apr-1/apr_portable.h" -#include "apr-1/apr_network_io.h" -#include "apr-1/apr_poll.h" +#include "apr_portable.h" +#include "apr_network_io.h" +#include "apr_poll.h" // linden library headers #include "indra_constants.h" @@ -289,7 +289,8 @@ void LLMessageSystem::init() LLMessageSystem::LLMessageSystem(const char *filename, U32 port, S32 version_major, S32 version_minor, - S32 version_patch) + S32 version_patch, + bool failure_is_fatal) { init(); @@ -306,7 +307,7 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port, mCircuitPrintFreq = 60.f; // seconds - loadTemplateFile(filename); + loadTemplateFile(filename, failure_is_fatal); mTemplateMessageBuilder = new LLTemplateMessageBuilder(mMessageTemplates); mLLSDMessageBuilder = new LLSDMessageBuilder(); @@ -365,7 +366,8 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port, // Read file and build message templates -void LLMessageSystem::loadTemplateFile(const char* filename) +void LLMessageSystem::loadTemplateFile(const char* filename, + bool failure_is_fatal) { if(!filename) { @@ -377,7 +379,11 @@ void LLMessageSystem::loadTemplateFile(const char* filename) std::string template_body; if(!_read_file_into_string(template_body, filename)) { - LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl; + if (failure_is_fatal) { + LL_ERRS("Messaging") << "Failed to open template: " << filename << llendl; + } else { + LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl; + } mbError = TRUE; return; } @@ -2475,22 +2481,24 @@ void dump_prehash_files() } } -BOOL start_messaging_system( +bool start_messaging_system( const std::string& template_name, U32 port, S32 version_major, S32 version_minor, S32 version_patch, - BOOL b_dump_prehash_file, + bool b_dump_prehash_file, const std::string& secret, - const LLUseCircuitCodeResponder* responder) + const LLUseCircuitCodeResponder* responder, + bool failure_is_fatal) { gMessageSystem = new LLMessageSystem( template_name.c_str(), port, version_major, version_minor, - version_patch); + version_patch, + failure_is_fatal); g_shared_secret.assign(secret); if (!gMessageSystem) diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 7d3c0e93ec..7462e1b1df 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -284,7 +284,8 @@ public: public: // Read file and build message templates LLMessageSystem(const char *filename, U32 port, S32 version_major, - S32 version_minor, S32 version_patch); + S32 version_minor, S32 version_patch, + bool failure_is_fatal = true); ~LLMessageSystem(); @@ -294,7 +295,7 @@ public: // Read file and build message templates filename must point to a // valid string which specifies the path of a valid linden // template. - void loadTemplateFile(const char* filename); + void loadTemplateFile(const char* filename, bool failure_is_fatal); // methods for building, sending, receiving, and handling messages @@ -764,16 +765,17 @@ extern LLMessageSystem *gMessageSystem; // Must specific overall system version, which is used to determine // if a patch is available in the message template checksum verification. -// Return TRUE if able to initialize system. -BOOL start_messaging_system( +// Return true if able to initialize system. +bool start_messaging_system( const std::string& template_name, U32 port, S32 version_major, S32 version_minor, S32 version_patch, - BOOL b_dump_prehash_file, + bool b_dump_prehash_file, const std::string& secret, - const LLUseCircuitCodeResponder* responder = NULL); + const LLUseCircuitCodeResponder* responder = NULL, + bool failure_is_fatal = true); void end_messaging_system(); diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt new file mode 100644 index 0000000000..5dc4c701a1 --- /dev/null +++ b/indra/llprimitive/CMakeLists.txt @@ -0,0 +1,49 @@ +# -*- cmake -*- + +project(llprimitive) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLXML) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llprimitive_SOURCE_FILES + llmaterialtable.cpp + llprimitive.cpp + lltextureanim.cpp + lltextureentry.cpp + lltreeparams.cpp + llvolumemessage.cpp + llvolumexml.cpp + ) + +set(llprimitive_HEADER_FILES + CMakeLists.txt + + legacy_object_types.h + llmaterialtable.h + llprimitive.h + lltextureanim.h + lltextureentry.h + lltreeparams.h + lltree_common.h + llvolumemessage.h + llvolumexml.h + material_codes.h + object_flags.h + ) + +set_source_files_properties(${llprimitive_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llprimitive_SOURCE_FILES ${llprimitive_HEADER_FILES}) + +add_library (llprimitive ${llprimitive_SOURCE_FILES}) diff --git a/indra/llprimitive/llmaterialtable.cpp b/indra/llprimitive/llmaterialtable.cpp index 6d30917bd9..61c9849144 100644 --- a/indra/llprimitive/llmaterialtable.cpp +++ b/indra/llprimitive/llmaterialtable.cpp @@ -331,7 +331,7 @@ void LLMaterialTable::initBasicTable() } } -BOOL LLMaterialTable::add(U8 mcode, char* name, const LLUUID &uuid) +BOOL LLMaterialTable::add(U8 mcode, const char* name, const LLUUID &uuid) { LLMaterialInfo *infop; diff --git a/indra/llprimitive/llmaterialtable.h b/indra/llprimitive/llmaterialtable.h index e84e75c677..7dbe7de917 100644 --- a/indra/llprimitive/llmaterialtable.h +++ b/indra/llprimitive/llmaterialtable.h @@ -79,12 +79,12 @@ public: F32 mDamageModifier; // modifier on KE based damage F32 mEPModifier; // modifier on mass based EP total - LLMaterialInfo(U8 mcode, char* name, const LLUUID &uuid) + LLMaterialInfo(U8 mcode, const char* name, const LLUUID &uuid) { init(mcode,name,uuid); }; - void init(U8 mcode, char* name, const LLUUID &uuid) + void init(U8 mcode, const char* name, const LLUUID &uuid) { mName[0] = 0; mDensity = 1000.f; // default to 1000.0 (water) @@ -150,7 +150,7 @@ public: void initBasicTable(); - BOOL add(U8 mcode, char* name, const LLUUID &uuid); + BOOL add(U8 mcode, const char* name, const LLUUID &uuid); BOOL addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid); BOOL addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); BOOL addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt new file mode 100644 index 0000000000..9938a0198b --- /dev/null +++ b/indra/llrender/CMakeLists.txt @@ -0,0 +1,51 @@ +# -*- cmake -*- + +project(llrender) + +include(00-Common) +include(FreeType) +include(LLCommon) +include(LLImage) +include(LLMath) +include(LLRender) +include(LLWindow) + +include_directories( + ${FREETYPE_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLRENDER_INCLUDE_DIRS} + ${LLWINDOW_INCLUDE_DIRS} + ) + +set(llrender_SOURCE_FILES + llfont.cpp + llfontgl.cpp + llgldbg.cpp + llglimmediate.cpp + llimagegl.cpp + llrendertarget.cpp + llvertexbuffer.cpp + llvertexprogramgl.cpp + ) + +set(llrender_HEADER_FILES + CMakeLists.txt + + llfontgl.h + llfont.h + llgldbg.h + llglimmediate.h + llimagegl.h + llrendertarget.h + llvertexbuffer.h + llvertexprogramgl.h + ) + +set_source_files_properties(${llrender_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llrender_SOURCE_FILES ${llrender_HEADER_FILES}) + +add_library (llrender ${llrender_SOURCE_FILES}) diff --git a/indra/llrender/llgldbg.cpp b/indra/llrender/llgldbg.cpp index 59a818d817..704cda9a23 100644 --- a/indra/llrender/llgldbg.cpp +++ b/indra/llrender/llgldbg.cpp @@ -43,7 +43,7 @@ //------------------------------------------------------------------------ // cmstr() //------------------------------------------------------------------------ -char *cmstr(int i) +const char *cmstr(int i) { switch( i ) { @@ -59,7 +59,7 @@ char *cmstr(int i) //------------------------------------------------------------------------ // facestr() //------------------------------------------------------------------------ -char *facestr(int i) +const char *facestr(int i) { switch( i ) { @@ -81,7 +81,7 @@ const char *boolstr(int b) //------------------------------------------------------------------------ // fv4() //------------------------------------------------------------------------ -char *fv4(F32 *f) +const char *fv4(F32 *f) { static char str[128]; sprintf(str, "%8.3f %8.3f %8.3f %8.3f", f[0], f[1], f[2], f[3]); @@ -91,7 +91,7 @@ char *fv4(F32 *f) //------------------------------------------------------------------------ // fv3() //------------------------------------------------------------------------ -char *fv3(F32 *f) +const char *fv3(F32 *f) { static char str[128]; /* Flawfinder: ignore */ snprintf(str, sizeof(str), "%8.3f, %8.3f, %8.3f", f[0], f[1], f[2]); /* Flawfinder: ignore */ @@ -101,7 +101,7 @@ char *fv3(F32 *f) //------------------------------------------------------------------------ // fv1() //------------------------------------------------------------------------ -char *fv1(F32 *f) +const char *fv1(F32 *f) { static char str[128]; /* Flawfinder: ignore */ snprintf(str, sizeof(str), "%8.3f", f[0]); /* Flawfinder: ignore */ diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt new file mode 100644 index 0000000000..77efec5696 --- /dev/null +++ b/indra/llui/CMakeLists.txt @@ -0,0 +1,133 @@ +# -*- cmake -*- + +project(llui) + +include(00-Common) +include(LLAudio) +include(LLCommon) +include(LLImage) +include(LLMath) +include(LLMessage) +include(LLRender) +include(LLWindow) +include(LLVFS) +include(LLXML) + +include_directories( + ${LLAUDIO_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLRENDER_INCLUDE_DIRS} + ${LLWINDOW_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llui_SOURCE_FILES + llalertdialog.cpp + llbutton.cpp + llcheckboxctrl.cpp + llclipboard.cpp + llcombobox.cpp + llctrlselectioninterface.cpp + lldraghandle.cpp + lleditmenuhandler.cpp + llfloater.cpp + llfocusmgr.cpp + lliconctrl.cpp + llkeywords.cpp + lllineeditor.cpp + llmenugl.cpp + llmodaldialog.cpp + llmultislider.cpp + llmultisliderctrl.cpp + llpanel.cpp + llradiogroup.cpp + llresizebar.cpp + llresizehandle.cpp + llresmgr.cpp + llrootview.cpp + llscrollbar.cpp + llscrollcontainer.cpp + llscrollingpanellist.cpp + llscrolllistctrl.cpp + llslider.cpp + llsliderctrl.cpp + llspinctrl.cpp + llstyle.cpp + lltabcontainer.cpp + lltabcontainervertical.cpp + lltextbox.cpp + lltexteditor.cpp + llui.cpp + lluictrl.cpp + lluictrlfactory.cpp + lluistring.cpp + llundo.cpp + llviewborder.cpp + llview.cpp + llviewquery.cpp + ) + +set(llui_HEADER_FILES + CMakeLists.txt + + llalertdialog.h + llbutton.h + llcallbackmap.h + llcheckboxctrl.h + llclipboard.h + llcombobox.h + llctrlselectioninterface.h + lldraghandle.h + lleditmenuhandler.h + llfloater.h + llfocusmgr.h + llhtmlhelp.h + lliconctrl.h + llkeywords.h + lllineeditor.h + llmemberlistener.h + llmenugl.h + llmodaldialog.h + llmultisliderctrl.h + llmultislider.h + llpanel.h + llradiogroup.h + llresizebar.h + llresizehandle.h + llresmgr.h + llrootview.h + llscrollbar.h + llscrollcontainer.h + llscrollingpanellist.h + llscrolllistctrl.h + llsliderctrl.h + llslider.h + llspinctrl.h + llstyle.h + lltabcontainer.h + lltabcontainervertical.h + lltextbox.h + lltexteditor.h + lluiconstants.h + lluictrlfactory.h + lluictrl.h + lluifwd.h + llui.h + lluistring.h + lluixmltags.h + llundo.h + llviewborder.h + llview.h + llviewquery.h + ) + +set_source_files_properties(${llui_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llui_SOURCE_FILES ${llui_HEADER_FILES}) + +add_library (llui ${llui_SOURCE_FILES}) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index e0ac3cebd7..4fa2a3de92 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -39,13 +39,10 @@ // Project includes #include "llkeyboard.h" -#include "llgl.h" #include "llui.h" #include "lluiconstants.h" -//#include "llcallbacklist.h" #include "llresmgr.h" #include "llcriticaldamp.h" -#include "llglheaders.h" #include "llfocusmgr.h" #include "llwindow.h" #include "llglimmediate.h" diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 90e0552861..96039ce943 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -39,7 +39,6 @@ #include "llmath.h" #include "llfontgl.h" #include "llgl.h" -#include "sound_ids.h" #include "lltimer.h" //#include "llclipboard.h" diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index bc4445ea6c..c2b2e08755 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -46,7 +46,6 @@ #include "llmenugl.h" #include "llmath.h" -#include "llgl.h" #include "llglimmediate.h" #include "llfocusmgr.h" #include "llfont.h" @@ -59,7 +58,6 @@ #include "llresmgr.h" #include "llui.h" -#include "llglheaders.h" #include "llstl.h" #include "v2math.h" diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 875f114ce3..fb14470612 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -55,8 +55,6 @@ #include "llbutton.h" // LLLayoutStack -#include "llgl.h" -#include "llglheaders.h" #include "llresizebar.h" #include "llcriticaldamp.h" diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index 2c4a5cbc58..3536e6bb03 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -41,10 +41,8 @@ #include "llcriticaldamp.h" #include "llkeyboard.h" #include "llui.h" -//#include "llviewerimagelist.h" #include "llfocusmgr.h" #include "llwindow.h" -#include "llglheaders.h" #include "llcontrol.h" #include "llglimmediate.h" diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index edad4c4d6b..72fe2040af 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -32,9 +32,7 @@ #include "linden_common.h" -#include "llgl.h" #include "llglimmediate.h" - #include "llscrollcontainer.h" #include "llscrollbar.h" #include "llui.h" @@ -45,8 +43,6 @@ #include "lluictrlfactory.h" #include "llfontgl.h" -#include "llglheaders.h" - ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 05888fe382..c923f6b116 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -42,9 +42,7 @@ #include "llcheckboxctrl.h" #include "llclipboard.h" #include "llfocusmgr.h" -#include "llgl.h" #include "llglimmediate.h" -#include "llglheaders.h" #include "llresmgr.h" #include "llscrollbar.h" #include "llstring.h" diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 9cf1ca5929..a2b0718c50 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -34,7 +34,6 @@ #include "llsliderctrl.h" #include "audioengine.h" -#include "sound_ids.h" #include "llmath.h" #include "llfontgl.h" diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 36b84c741f..c577b35e19 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -44,7 +44,6 @@ #include "lltextbox.h" #include "llkeyboard.h" #include "llmath.h" -#include "sound_ids.h" #include "audioengine.h" #include "llcontrol.h" #include "llfocusmgr.h" diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 2d1228b084..fabdbd6860 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -42,7 +42,6 @@ #include "lltabcontainervertical.h" #include "llglimmediate.h" - const F32 SCROLL_STEP_TIME = 0.4f; const F32 SCROLL_DELAY_TIME = 0.5f; const S32 TAB_PADDING = 15; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index f0f3ac3bdc..8264f0cf87 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -36,13 +36,11 @@ #include "lltexteditor.h" #include "llfontgl.h" -#include "llgl.h" #include "llglimmediate.h" #include "llui.h" #include "lluictrlfactory.h" #include "llrect.h" #include "llfocusmgr.h" -#include "sound_ids.h" #include "lltimer.h" #include "llmath.h" @@ -58,7 +56,6 @@ #include "llcontrol.h" #include "llimagegl.h" #include "llwindow.h" -#include "llglheaders.h" #include <queue> // diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index f7489a7512..1a238ce7fa 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -41,25 +41,19 @@ #include "audioengine.h" #include "v2math.h" #include "v4color.h" -#include "llgl.h" #include "llglimmediate.h" #include "llrect.h" #include "llimagegl.h" -//#include "llviewerimage.h" #include "lldir.h" #include "llfontgl.h" // Project includes -//#include "audioengine.h" #include "llcontrol.h" -//#include "llstartup.h" #include "llui.h" #include "llview.h" #include "lllineeditor.h" #include "llwindow.h" -#include "llglheaders.h" - // // Globals // diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 0fafc1fecd..fa78534a83 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -41,8 +41,6 @@ #include "llevent.h" #include "llfontgl.h" #include "llfocusmgr.h" -#include "llgl.h" -#include "llglheaders.h" #include "llrect.h" #include "llstl.h" #include "llui.h" // colors saved settings diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt new file mode 100644 index 0000000000..9f136f7772 --- /dev/null +++ b/indra/llvfs/CMakeLists.txt @@ -0,0 +1,58 @@ +# -*- cmake -*- + +project(llvfs) + +include(00-Common) +include(LLCommon) +include(UnixInstall) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ) + +set(llvfs_SOURCE_FILES + lldir.cpp + lllfsthread.cpp + llvfile.cpp + llvfs.cpp + llvfsthread.cpp + ) + +set(llvfs_HEADER_FILES + CMakeLists.txt + + lldir.h + lllfsthread.h + llvfile.h + llvfs.h + llvfsthread.h + ) + +if (DARWIN) + LIST(APPEND llvfs_SOURCE_FILES lldir_mac.cpp) + LIST(APPEND llvfs_HEADER_FILES lldir_mac.h) +endif (DARWIN) + +if (LINUX) + LIST(APPEND llvfs_SOURCE_FILES lldir_linux.cpp) + LIST(APPEND llvfs_HEADER_FILES lldir_linux.h) + + if (VIEWER AND INSTALL) + set_source_files_properties(lldir_linux.cpp + PROPERTIES COMPILE_FLAGS + "-DAPP_RO_DATA_DIR=\\\"${APP_SHARE_DIR}\\\"" + ) + endif (VIEWER AND INSTALL) +endif (LINUX) + +if (WINDOWS) + LIST(APPEND llvfs_SOURCE_FILES lldir_win32.cpp) + LIST(APPEND llvfs_HEADER_FILES lldir_win32.h) +endif (WINDOWS) + +set_source_files_properties(${llvfs_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llvfs_SOURCE_FILES ${llvfs_HEADER_FILES}) + +add_library (llvfs ${llvfs_SOURCE_FILES}) diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp index 8f9f577804..222c97156e 100644 --- a/indra/llvfs/lldir_linux.cpp +++ b/indra/llvfs/lldir_linux.cpp @@ -93,7 +93,11 @@ LLDir_Linux::LLDir_Linux() mExecutablePathAndName = ""; mExecutableDir = tmp_str; mWorkingDir = tmp_str; +#ifdef APP_RO_DATA_DIR + mAppRODataDir = APP_RO_DATA_DIR; +#else mAppRODataDir = tmp_str; +#endif mOSUserDir = getCurrentUserHome(tmp_str); mOSUserAppDir = ""; mLindenUserDir = tmp_str; diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index f415fe56ed..17723b36d1 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -116,10 +116,16 @@ LLDir_Win32::LLDir_Win32() GetCurrentDirectory(MAX_PATH, w_str); mExecutableDir = utf16str_to_utf8str(llutf16string(w_str)); #endif + + mAppRODataDir = getCurPath(); + // *FIX:Mani - The following is the old way we did things. I'm keeping this around + // in case there is some really good reason to make mAppRODataDir == mExecutableDir + /* if (strstr(mExecutableDir.c_str(), "indra\\newview")) mAppRODataDir = getCurPath(); else mAppRODataDir = mExecutableDir; + */ } LLDir_Win32::~LLDir_Win32() diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp index 8d2dc72ffc..76e25e2272 100644 --- a/indra/llvfs/lllfsthread.cpp +++ b/indra/llvfs/lllfsthread.cpp @@ -30,7 +30,6 @@ */ #include "linden_common.h" -#include "llmath.h" #include "lllfsthread.h" #include "llstl.h" #include "llapr.h" diff --git a/indra/llvfs/llvfsthread.cpp b/indra/llvfs/llvfsthread.cpp index fbfbdffaf3..c9bc544d72 100644 --- a/indra/llvfs/llvfsthread.cpp +++ b/indra/llvfs/llvfsthread.cpp @@ -30,7 +30,6 @@ */ #include "linden_common.h" -#include "llmath.h" #include "llvfsthread.h" #include "llstl.h" diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt new file mode 100644 index 0000000000..acfeb6484f --- /dev/null +++ b/indra/llwindow/CMakeLists.txt @@ -0,0 +1,163 @@ +# -*- cmake -*- +# +# Compared to other libraries, compiling this one is a mess. The +# reason is that we have several source files that have two different +# sets of behaviour, depending on whether they're intended to be part +# of the viewer or the map server. +# +# Unfortunately, the affected code is a rat's nest of #ifdefs, so it's +# easier to play compilation tricks than to actually fix the problem. + +project(llwindow) + +include(00-Common) +include(DirectX) +include(LLCommon) +include(LLImage) +include(LLMath) +include(LLRender) +include(LLVFS) +include(LLWindow) +include(LLXML) +include(Mozlib) +include(UI) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLRENDER_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLWINDOW_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llwindow_SOURCE_FILES + llkeyboard.cpp + llwindowheadless.cpp + ) + +set(llwindows_HEADER_FILES + CMakeLists.txt + + llkeyboard.h + llwindowheadless.h + ) + +set(viewer_SOURCE_FILES + llgl.cpp + llwindow.cpp + ) + +set(viewer_HEADER_FILES + llgl.h + llwindow.h + llglheaders.h + llglstates.h + llgltypes.h + llpreeditor.h + llmousehandler.h + ) + +if (DARWIN) + list(APPEND llwindow_SOURCE_FILES + llkeyboardmacosx.cpp + llwindowmacosx.cpp + llwindowmacosx-objc.mm + ) + list(APPEND llwindow_HEADER_FILES + llkeyboardmacosx.h + llwindowmacosx.h + llwindowmacosx-objc.h + ) + + # We use a bunch of deprecated system APIs. + set_source_files_properties( + llkeyboardmacosx.cpp + llwindowmacosx.cpp + PROPERTIES + COMPILE_FLAGS "-Wno-deprecated-declarations -fpascal-strings" + ) +endif (DARWIN) + +if (LINUX) + list(APPEND viewer_SOURCE_FILES + llkeyboardsdl.cpp + llwindowsdl.cpp + ) + list(APPEND viewer_HEADER_FILES + llkeyboardsdl.h + llwindowsdl.h + ) +endif (LINUX) + +if (WINDOWS) + list(APPEND llwindow_SOURCE_FILES + llwindowwin32.cpp + lldxhardware.cpp + llkeyboardwin32.cpp + ) + list(APPEND llwindow_HEADER_FILES + llwindowwin32.h + lldxhardware.h + llkeyboardwin32.h + ) +endif (WINDOWS) + +if (SOLARIS) + list(APPEND llwindow_SOURCE_FILES + llwindowsolaris.cpp + ) + list(APPEND llwindow_HEADER_FILES + llwindowsolaris.h + ) +endif (SOLARIS) + +set_source_files_properties(${llwindow_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +if (SERVER AND NOT WINDOWS AND NOT DARWIN) + set(server_SOURCE_FILES + llwindowmesaheadless.cpp + ) + set(server_HEADER_FILES + llwindowmesaheadless.h + ) + set(copied_SOURCES + llgl + llwindow + ) + + foreach (PREFIX ${copied_SOURCES}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}_server.cpp + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${PREFIX}.cpp + ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}_server.cpp + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PREFIX}.cpp + ) + list(APPEND server_SOURCE_FILES ${PREFIX}_server.cpp) + endforeach (PREFIX ${copied_SOURCES}) + + set_source_files_properties( + ${server_SOURCE_FILES} + PROPERTIES + COMPILE_FLAGS "-DLL_MESA=1 -DLL_MESA_HEADLESS=1" + ) + add_library (llwindowheadless + ${llwindow_SOURCE_FILES} + ${server_SOURCE_FILES} + ) +endif (SERVER AND NOT WINDOWS AND NOT DARWIN) + +if (llwindow_HEADER_FILES) + list(APPEND llwindow_SOURCE_FILES ${llwindow_HEADER_FILES}) +endif (llwindow_HEADER_FILES) + list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES}) + +if (VIEWER) + add_library (llwindow + ${llwindow_SOURCE_FILES} + ${viewer_SOURCE_FILES} + ) +endif (VIEWER) diff --git a/indra/llwindow/GL/glh_extensions.h b/indra/llwindow/GL/glh_extensions.h new file mode 100644 index 0000000000..b936b5d307 --- /dev/null +++ b/indra/llwindow/GL/glh_extensions.h @@ -0,0 +1,207 @@ +/* + * glh_extensions.h + * From nVidia Corporation, downloaded 2006-12-18 from: + * http://developer.nvidia.com/attach/8196 + * ("NVParse Library with Source (.zip) (2390 KB)") + * + * License (quoted from license_info.txt in aforementioned file): + * "The files bison.exe, bison.simple, and flex.exe are covered by + * the GPL. All other files in this distribution can be used however + * you want." + */ + +#ifndef GLH_EXTENSIONS +#define GLH_EXTENSIONS + +#include <string.h> +#include <stdio.h> + +#ifdef _WIN32 +# include <windows.h> +#endif + +#ifndef __APPLE__ +#include <GL/gl.h> +#endif + +#ifdef _WIN32 +# include "GL/wglext.h" +#endif + +#define CHECK_MEMORY(ptr) \ + if (NULL == ptr) { \ + printf("Error allocating memory in file %s, line %d\n", __FILE__, __LINE__); \ + exit(-1); \ + } + +#ifdef GLH_EXT_SINGLE_FILE +# define GLH_EXTENSIONS_SINGLE_FILE // have to do this because glh_genext.h unsets GLH_EXT_SINGLE_FILE +#endif + +#include "glh_genext.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef GLH_EXTENSIONS_SINGLE_FILE + +class GLHExts +{ +public: + GLHExts() + { + mSysExts = NULL; +// mUnsupportedExts = NULL; + } + ~GLHExts() + { + if (mSysExts) + { + free(mSysExts); + } +// if (mUnsupportedExts) +// { +// free(mUnsupportedExts); +// } + } + char *mSysExts; +// char *mUnsupportedExts; +}; + +GLHExts gGLHExts; + +static int ExtensionExists(const char* extName, const char* sysExts) +{ + char *padExtName = (char*)malloc(strlen(extName) + 2); + strcat(strcpy(padExtName, extName), " "); + + if (0 == strcmp(extName, "GL_VERSION_1_2")) { + const char *version = (const char*)glGetString(GL_VERSION); + if (strstr(version, "1.0") == version || strstr(version, "1.1") == version) { + return FALSE; + } else { + return TRUE; + } + } + if (strstr(sysExts, padExtName)) { + free(padExtName); + return TRUE; + } else { + free(padExtName); + return FALSE; + } +} + +static const char* EatWhiteSpace(const char *str) +{ + for (; *str && (' ' == *str || '\t' == *str || '\n' == *str); str++); + return str; +} + +static const char* EatNonWhiteSpace(const char *str) +{ + for (; *str && (' ' != *str && '\t' != *str && '\n' != *str); str++); + return str; +} + + +int glh_init_extensions(const char *origReqExts) +{ + // Length of requested extensions string + unsigned reqExtsLen; + char *reqExts; + // Ptr for individual extensions within reqExts + char *reqExt; + int success = TRUE; + + // build space-padded extension string + if (NULL == gGLHExts.mSysExts) { + const char *extensions = (const char*)glGetString(GL_EXTENSIONS); + int sysExtsLen = (int)strlen(extensions); + const char *winsys_extensions = 0; + int winsysExtsLen = 0; +#ifdef _WIN32 + { + PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = 0; + wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB"); + if(wglGetExtensionsStringARB) + { + winsys_extensions = wglGetExtensionsStringARB(wglGetCurrentDC()); + winsysExtsLen = (S32)strlen(winsys_extensions); + } + } +#endif + // Add 2 bytes, one for padding space, one for terminating NULL + gGLHExts.mSysExts = (char*)malloc(sysExtsLen + winsysExtsLen + 3); + CHECK_MEMORY(gGLHExts.mSysExts); + strcpy(gGLHExts.mSysExts, extensions); + gGLHExts.mSysExts[sysExtsLen] = ' '; + gGLHExts.mSysExts[sysExtsLen + 1] = 0; + if (winsysExtsLen) + { + strcat(gGLHExts.mSysExts, winsys_extensions); + } + gGLHExts.mSysExts[sysExtsLen + 1 + winsysExtsLen] = ' '; + gGLHExts.mSysExts[sysExtsLen + 1 + winsysExtsLen + 1] = 0; + } + + if (NULL == origReqExts) + { + return TRUE; + } + reqExts = strdup(origReqExts); + reqExtsLen = (S32)strlen(reqExts); + /* + if (NULL == gGLHExts.mUnsupportedExts) + { + gGLHExts.mUnsupportedExts = (char*)malloc(reqExtsLen + 1); + } + else if (reqExtsLen > strlen(gGLHExts.mUnsupportedExts)) + { + gGLHExts.mUnsupportedExts = (char*)realloc(gGLHExts.mUnsupportedExts, reqExtsLen + 1); + } + CHECK_MEMORY(gGLHExts.mUnsupportedExts); + *gGLHExts.mUnsupportedExts = 0; + */ + + // Parse requested extension list + for (reqExt = reqExts; + (reqExt = (char*)EatWhiteSpace(reqExt)) && *reqExt; + reqExt = (char*)EatNonWhiteSpace(reqExt)) + { + char *extEnd = (char*)EatNonWhiteSpace(reqExt); + char saveChar = *extEnd; + *extEnd = (char)0; + + if (!ExtensionExists(reqExt, gGLHExts.mSysExts) || + !glh_init_extension(reqExt)) { + /* + // add reqExt to end of unsupportedExts + strcat(gGLHExts.mUnsupportedExts, reqExt); + strcat(gGLHExts.mUnsupportedExts, " "); + */ + success = FALSE; + } + *extEnd = saveChar; + } + free(reqExts); + return success; +} + +const char* glh_get_unsupported_extensions() +{ + return ""; +// return (const char*)gGLHExts.mUnsupportedExts; +} + +#else +int glh_init_extensions(const char *origReqExts); +const char* glh_get_unsupported_extensions(); +#endif /* GLH_EXT_SINGLE_FILE */ + +#ifdef __cplusplus +} +#endif + +#endif /* GLH_EXTENSIONS */ diff --git a/indra/llwindow/GL/glh_genext.h b/indra/llwindow/GL/glh_genext.h new file mode 100644 index 0000000000..8d42025198 --- /dev/null +++ b/indra/llwindow/GL/glh_genext.h @@ -0,0 +1,1671 @@ +/* + * glh_genext.h + * From nVidia Corporation, downloaded 2006-12-18 from: + * http://developer.nvidia.com/attach/8196 + * ("NVParse Library with Source (.zip) (2390 KB)") + * + * License (quoted from license_info.txt in aforementioned file): + * "The files bison.exe, bison.simple, and flex.exe are covered by + * the GPL. All other files in this distribution can be used however + * you want." + */ + +/* File generated by extgen.cpp -- do not modify */ +#ifndef GLH_GENEXT_H +#define GLH_GENEXT_H + +// MBW -- None of this is necessary on Mac OS. +#ifndef __APPLE__ + +#include <GL/gl.h> +#include <GL/glext.h> + +#ifdef _WIN32 /* supports windows, x -- need to generalize */ +# include <GL/wglext.h> +# define GLH_EXT_GET_PROC_ADDRESS(p) wglGetProcAddress(p) +#else if GLX_VERSION_1_3 +# include <GL/glxext.h> +# define GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddressARB(p) +#endif + +#ifdef GLH_EXT_SINGLE_FILE + #define GLH_EXTERN + #define GLH_INITIALIZER = 0 +#else + #define GLH_EXTERN extern + #define GLH_INITIALIZER +#endif + +#define GLH__PREPROCESSOR_GYMNASTICS2(a,b) a##b +#define GLH__PREPROCESSOR_GYMNASTICS(a,b) GLH__PREPROCESSOR_GYMNASTICS2(a,b) + +#ifndef GLH_EXT_PREFIX +# define GLH_EXT_NAME(a) a +#else +# define GLH_EXT_NAME(a) GLH__PREPROCESSOR_GYMNASTICS(GLH_EXT_PREFIX,a) +#endif + +#ifndef _WIN32 +# ifndef GLH_CORE_1_2_PREFIX +# define GLH_CORE_1_2_PREFIX _ +# endif +#endif + +#ifndef GLH_CORE_1_2_PREFIX +# define GLH_CORE_1_2_NAME(a) a +#else +# define GLH_CORE_1_2_NAME(a) GLH__PREPROCESSOR_GYMNASTICS(GLH_CORE_1_2_PREFIX,a) +#endif + +#ifdef GL_ARB_multitexture + GLH_EXTERN PFNGLMULTITEXCOORD1DARBPROC GLH_EXT_NAME(glMultiTexCoord1dARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD1DVARBPROC GLH_EXT_NAME(glMultiTexCoord1dvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD1FARBPROC GLH_EXT_NAME(glMultiTexCoord1fARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD1FVARBPROC GLH_EXT_NAME(glMultiTexCoord1fvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD1IARBPROC GLH_EXT_NAME(glMultiTexCoord1iARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD1IVARBPROC GLH_EXT_NAME(glMultiTexCoord1ivARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD1SARBPROC GLH_EXT_NAME(glMultiTexCoord1sARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD1SVARBPROC GLH_EXT_NAME(glMultiTexCoord1svARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD2DARBPROC GLH_EXT_NAME(glMultiTexCoord2dARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD2DVARBPROC GLH_EXT_NAME(glMultiTexCoord2dvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD2FARBPROC GLH_EXT_NAME(glMultiTexCoord2fARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD2FVARBPROC GLH_EXT_NAME(glMultiTexCoord2fvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD2IARBPROC GLH_EXT_NAME(glMultiTexCoord2iARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD2IVARBPROC GLH_EXT_NAME(glMultiTexCoord2ivARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD2SARBPROC GLH_EXT_NAME(glMultiTexCoord2sARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD2SVARBPROC GLH_EXT_NAME(glMultiTexCoord2svARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD3DARBPROC GLH_EXT_NAME(glMultiTexCoord3dARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD3DVARBPROC GLH_EXT_NAME(glMultiTexCoord3dvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD3FARBPROC GLH_EXT_NAME(glMultiTexCoord3fARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD3FVARBPROC GLH_EXT_NAME(glMultiTexCoord3fvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD3IARBPROC GLH_EXT_NAME(glMultiTexCoord3iARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD3IVARBPROC GLH_EXT_NAME(glMultiTexCoord3ivARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD3SARBPROC GLH_EXT_NAME(glMultiTexCoord3sARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD3SVARBPROC GLH_EXT_NAME(glMultiTexCoord3svARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD4DARBPROC GLH_EXT_NAME(glMultiTexCoord4dARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD4DVARBPROC GLH_EXT_NAME(glMultiTexCoord4dvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD4FARBPROC GLH_EXT_NAME(glMultiTexCoord4fARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD4FVARBPROC GLH_EXT_NAME(glMultiTexCoord4fvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD4IARBPROC GLH_EXT_NAME(glMultiTexCoord4iARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD4IVARBPROC GLH_EXT_NAME(glMultiTexCoord4ivARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD4SARBPROC GLH_EXT_NAME(glMultiTexCoord4sARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTITEXCOORD4SVARBPROC GLH_EXT_NAME(glMultiTexCoord4svARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLACTIVETEXTUREARBPROC GLH_EXT_NAME(glActiveTextureARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLCLIENTACTIVETEXTUREARBPROC GLH_EXT_NAME(glClientActiveTextureARB) GLH_INITIALIZER; +#endif + +#ifdef GL_ARB_texture_border_clamp +#endif + +#ifdef GL_ARB_texture_compression + GLH_EXTERN PFNGLCOMPRESSEDTEXIMAGE3DARBPROC GLH_EXT_NAME(glCompressedTexImage3DARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOMPRESSEDTEXIMAGE2DARBPROC GLH_EXT_NAME(glCompressedTexImage2DARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOMPRESSEDTEXIMAGE1DARBPROC GLH_EXT_NAME(glCompressedTexImage1DARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC GLH_EXT_NAME(glCompressedTexSubImage3DARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC GLH_EXT_NAME(glCompressedTexSubImage2DARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC GLH_EXT_NAME(glCompressedTexSubImage1DARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GLH_EXT_NAME(glGetCompressedTexImageARB) GLH_INITIALIZER; +#endif + +#ifdef GL_ARB_texture_cube_map +#endif + +#ifdef GL_ARB_transpose_matrix + GLH_EXTERN PFNGLLOADTRANSPOSEMATRIXFARBPROC GLH_EXT_NAME(glLoadTransposeMatrixfARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLLOADTRANSPOSEMATRIXDARBPROC GLH_EXT_NAME(glLoadTransposeMatrixdARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTTRANSPOSEMATRIXFARBPROC GLH_EXT_NAME(glMultTransposeMatrixfARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLMULTTRANSPOSEMATRIXDARBPROC GLH_EXT_NAME(glMultTransposeMatrixdARB) GLH_INITIALIZER; +#endif + +#ifdef GL_ARB_vertex_program + GLH_EXTERN PFNGLVERTEXATTRIB1SARBPROC GLH_EXT_NAME(glVertexAttrib1sARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1FARBPROC GLH_EXT_NAME(glVertexAttrib1fARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1DARBPROC GLH_EXT_NAME(glVertexAttrib1dARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2SARBPROC GLH_EXT_NAME(glVertexAttrib2sARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2FARBPROC GLH_EXT_NAME(glVertexAttrib2fARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2DARBPROC GLH_EXT_NAME(glVertexAttrib2dARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3SARBPROC GLH_EXT_NAME(glVertexAttrib3sARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3FARBPROC GLH_EXT_NAME(glVertexAttrib3fARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3DARBPROC GLH_EXT_NAME(glVertexAttrib3dARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4SARBPROC GLH_EXT_NAME(glVertexAttrib4sARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4FARBPROC GLH_EXT_NAME(glVertexAttrib4fARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4DARBPROC GLH_EXT_NAME(glVertexAttrib4dARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4NUBARBPROC GLH_EXT_NAME(glVertexAttrib4NubARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1SVARBPROC GLH_EXT_NAME(glVertexAttrib1svARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1FVARBPROC GLH_EXT_NAME(glVertexAttrib1fvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1DVARBPROC GLH_EXT_NAME(glVertexAttrib1dvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2SVARBPROC GLH_EXT_NAME(glVertexAttrib2svARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2FVARBPROC GLH_EXT_NAME(glVertexAttrib2fvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2DVARBPROC GLH_EXT_NAME(glVertexAttrib2dvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3SVARBPROC GLH_EXT_NAME(glVertexAttrib3svARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3FVARBPROC GLH_EXT_NAME(glVertexAttrib3fvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3DVARBPROC GLH_EXT_NAME(glVertexAttrib3dvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4BVARBPROC GLH_EXT_NAME(glVertexAttrib4bvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4SVARBPROC GLH_EXT_NAME(glVertexAttrib4svARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4IVARBPROC GLH_EXT_NAME(glVertexAttrib4ivARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4UBVARBPROC GLH_EXT_NAME(glVertexAttrib4ubvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4USVARBPROC GLH_EXT_NAME(glVertexAttrib4usvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4UIVARBPROC GLH_EXT_NAME(glVertexAttrib4uivARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4FVARBPROC GLH_EXT_NAME(glVertexAttrib4fvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4DVARBPROC GLH_EXT_NAME(glVertexAttrib4dvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4NBVARBPROC GLH_EXT_NAME(glVertexAttrib4NbvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4NSVARBPROC GLH_EXT_NAME(glVertexAttrib4NsvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4NIVARBPROC GLH_EXT_NAME(glVertexAttrib4NivARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4NUBVARBPROC GLH_EXT_NAME(glVertexAttrib4NubvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4NUSVARBPROC GLH_EXT_NAME(glVertexAttrib4NusvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4NUIVARBPROC GLH_EXT_NAME(glVertexAttrib4NuivARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBPOINTERARBPROC GLH_EXT_NAME(glVertexAttribPointerARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLENABLEVERTEXATTRIBARRAYARBPROC GLH_EXT_NAME(glEnableVertexAttribArrayARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLDISABLEVERTEXATTRIBARRAYARBPROC GLH_EXT_NAME(glDisableVertexAttribArrayARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMSTRINGARBPROC GLH_EXT_NAME(glProgramStringARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLBINDPROGRAMARBPROC GLH_EXT_NAME(glBindProgramARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLDELETEPROGRAMSARBPROC GLH_EXT_NAME(glDeleteProgramsARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGENPROGRAMSARBPROC GLH_EXT_NAME(glGenProgramsARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMENVPARAMETER4DARBPROC GLH_EXT_NAME(glProgramEnvParameter4dARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMENVPARAMETER4DVARBPROC GLH_EXT_NAME(glProgramEnvParameter4dvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMENVPARAMETER4FARBPROC GLH_EXT_NAME(glProgramEnvParameter4fARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMENVPARAMETER4FVARBPROC GLH_EXT_NAME(glProgramEnvParameter4fvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4DARBPROC GLH_EXT_NAME(glProgramLocalParameter4dARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4DVARBPROC GLH_EXT_NAME(glProgramLocalParameter4dvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4FARBPROC GLH_EXT_NAME(glProgramLocalParameter4fARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4FVARBPROC GLH_EXT_NAME(glProgramLocalParameter4fvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPROGRAMENVPARAMETERDVARBPROC GLH_EXT_NAME(glGetProgramEnvParameterdvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPROGRAMENVPARAMETERFVARBPROC GLH_EXT_NAME(glGetProgramEnvParameterfvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC GLH_EXT_NAME(glGetProgramLocalParameterdvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC GLH_EXT_NAME(glGetProgramLocalParameterfvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPROGRAMIVARBPROC GLH_EXT_NAME(glGetProgramivARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPROGRAMSTRINGARBPROC GLH_EXT_NAME(glGetProgramStringARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETVERTEXATTRIBDVARBPROC GLH_EXT_NAME(glGetVertexAttribdvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETVERTEXATTRIBFVARBPROC GLH_EXT_NAME(glGetVertexAttribfvARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETVERTEXATTRIBIVARBPROC GLH_EXT_NAME(glGetVertexAttribivARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETVERTEXATTRIBPOINTERVARBPROC GLH_EXT_NAME(glGetVertexAttribPointervARB) GLH_INITIALIZER; + GLH_EXTERN PFNGLISPROGRAMARBPROC GLH_EXT_NAME(glIsProgramARB) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_abgr +#endif + +#ifdef GL_EXT_bgra +#endif + +#ifdef GL_EXT_blend_color + GLH_EXTERN PFNGLBLENDCOLOREXTPROC GLH_EXT_NAME(glBlendColorEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_blend_minmax + GLH_EXTERN PFNGLBLENDEQUATIONEXTPROC GLH_EXT_NAME(glBlendEquationEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_blend_subtract +#endif + +#ifdef GL_EXT_compiled_vertex_array + GLH_EXTERN PFNGLLOCKARRAYSEXTPROC GLH_EXT_NAME(glLockArraysEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLUNLOCKARRAYSEXTPROC GLH_EXT_NAME(glUnlockArraysEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_fog_coord + GLH_EXTERN PFNGLFOGCOORDDEXTPROC GLH_EXT_NAME(glFogCoorddEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLFOGCOORDDVEXTPROC GLH_EXT_NAME(glFogCoorddvEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLFOGCOORDFEXTPROC GLH_EXT_NAME(glFogCoordfEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLFOGCOORDFVEXTPROC GLH_EXT_NAME(glFogCoordfvEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLFOGCOORDPOINTEREXTPROC GLH_EXT_NAME(glFogCoordPointerEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_light_max_exponent +#endif + +#ifdef GL_EXT_packed_pixels +#endif + +#ifdef GL_EXT_paletted_texture + GLH_EXTERN PFNGLCOLORSUBTABLEEXTPROC GLH_EXT_NAME(glColorSubTableEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOLORTABLEEXTPROC GLH_EXT_NAME(glColorTableEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOLORTABLEEXTPROC GLH_EXT_NAME(glGetColorTableEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERFVEXTPROC GLH_EXT_NAME(glGetColorTableParameterfvEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERIVEXTPROC GLH_EXT_NAME(glGetColorTableParameterivEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_point_parameters + GLH_EXTERN PFNGLPOINTPARAMETERFEXTPROC GLH_EXT_NAME(glPointParameterfEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLPOINTPARAMETERFVEXTPROC GLH_EXT_NAME(glPointParameterfvEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_rescale_normal +#endif + +#ifdef GL_EXT_secondary_color + GLH_EXTERN PFNGLSECONDARYCOLOR3BEXTPROC GLH_EXT_NAME(glSecondaryColor3bEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3BVEXTPROC GLH_EXT_NAME(glSecondaryColor3bvEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3DEXTPROC GLH_EXT_NAME(glSecondaryColor3dEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3DVEXTPROC GLH_EXT_NAME(glSecondaryColor3dvEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3FEXTPROC GLH_EXT_NAME(glSecondaryColor3fEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3FVEXTPROC GLH_EXT_NAME(glSecondaryColor3fvEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3IEXTPROC GLH_EXT_NAME(glSecondaryColor3iEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3IVEXTPROC GLH_EXT_NAME(glSecondaryColor3ivEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3SEXTPROC GLH_EXT_NAME(glSecondaryColor3sEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3SVEXTPROC GLH_EXT_NAME(glSecondaryColor3svEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3UBEXTPROC GLH_EXT_NAME(glSecondaryColor3ubEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3UBVEXTPROC GLH_EXT_NAME(glSecondaryColor3ubvEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3UIEXTPROC GLH_EXT_NAME(glSecondaryColor3uiEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3UIVEXTPROC GLH_EXT_NAME(glSecondaryColor3uivEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3USEXTPROC GLH_EXT_NAME(glSecondaryColor3usEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLOR3USVEXTPROC GLH_EXT_NAME(glSecondaryColor3usvEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLSECONDARYCOLORPOINTEREXTPROC GLH_EXT_NAME(glSecondaryColorPointerEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_separate_specular_color +#endif + +#ifdef GL_EXT_shared_texture_palette +#endif + +#ifdef GL_EXT_stencil_wrap +#endif + +#ifdef GL_EXT_texture_compression_s3tc +#endif + +#ifdef GL_EXT_texture_cube_map +#endif + +#ifdef GL_EXT_texture_edge_clamp +#endif + +#ifdef GL_EXT_texture_env_add +#endif + +#ifdef GL_EXT_texture_env_combine +#endif + +#ifdef GL_EXT_texture_filter_anisotropic +#endif + +#ifdef GL_EXT_texture_lod_bias +#endif + +#ifdef GL_EXT_texture_object + GLH_EXTERN PFNGLARETEXTURESRESIDENTEXTPROC GLH_EXT_NAME(glAreTexturesResidentEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLBINDTEXTUREEXTPROC GLH_EXT_NAME(glBindTextureEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLDELETETEXTURESEXTPROC GLH_EXT_NAME(glDeleteTexturesEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLGENTEXTURESEXTPROC GLH_EXT_NAME(glGenTexturesEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLISTEXTUREEXTPROC GLH_EXT_NAME(glIsTextureEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLPRIORITIZETEXTURESEXTPROC GLH_EXT_NAME(glPrioritizeTexturesEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_texture3D + GLH_EXTERN PFNGLTEXIMAGE3DEXTPROC GLH_EXT_NAME(glTexImage3DEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_vertex_array + GLH_EXTERN PFNGLARRAYELEMENTEXTPROC GLH_EXT_NAME(glArrayElementEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOLORPOINTEREXTPROC GLH_EXT_NAME(glColorPointerEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLEDGEFLAGPOINTEREXTPROC GLH_EXT_NAME(glEdgeFlagPointerEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPOINTERVEXTPROC GLH_EXT_NAME(glGetPointervEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLINDEXPOINTEREXTPROC GLH_EXT_NAME(glIndexPointerEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLNORMALPOINTEREXTPROC GLH_EXT_NAME(glNormalPointerEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLTEXCOORDPOINTEREXTPROC GLH_EXT_NAME(glTexCoordPointerEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXPOINTEREXTPROC GLH_EXT_NAME(glVertexPointerEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLDRAWARRAYSEXTPROC GLH_EXT_NAME(glDrawArraysEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_EXT_vertex_weighting + GLH_EXTERN PFNGLVERTEXWEIGHTFEXTPROC GLH_EXT_NAME(glVertexWeightfEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXWEIGHTFVEXTPROC GLH_EXT_NAME(glVertexWeightfvEXT) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXWEIGHTPOINTEREXTPROC GLH_EXT_NAME(glVertexWeightPointerEXT) GLH_INITIALIZER; +#endif + +#ifdef GL_NV_blend_square +#endif + +#ifdef GL_NV_evaluators + GLH_EXTERN PFNGLMAPCONTROLPOINTSNVPROC GLH_EXT_NAME(glMapControlPointsNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLMAPPARAMETERIVNVPROC GLH_EXT_NAME(glMapParameterivNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLMAPPARAMETERFVNVPROC GLH_EXT_NAME(glMapParameterfvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETMAPCONTROLPOINTSNVPROC GLH_EXT_NAME(glGetMapControlPointsNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETMAPPARAMETERIVNVPROC GLH_EXT_NAME(glGetMapParameterivNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETMAPPARAMETERFVNVPROC GLH_EXT_NAME(glGetMapParameterfvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETMAPATTRIBPARAMETERIVNVPROC GLH_EXT_NAME(glGetMapAttribParameterivNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETMAPATTRIBPARAMETERFVNVPROC GLH_EXT_NAME(glGetMapAttribParameterfvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLEVALMAPSNVPROC GLH_EXT_NAME(glEvalMapsNV) GLH_INITIALIZER; +#endif + +#ifdef GL_NV_fence + GLH_EXTERN PFNGLGENFENCESNVPROC GLH_EXT_NAME(glGenFencesNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLDELETEFENCESNVPROC GLH_EXT_NAME(glDeleteFencesNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLSETFENCENVPROC GLH_EXT_NAME(glSetFenceNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLTESTFENCENVPROC GLH_EXT_NAME(glTestFenceNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLFINISHFENCENVPROC GLH_EXT_NAME(glFinishFenceNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLISFENCENVPROC GLH_EXT_NAME(glIsFenceNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETFENCEIVNVPROC GLH_EXT_NAME(glGetFenceivNV) GLH_INITIALIZER; +#endif + +#ifdef GL_NV_fog_distance +#endif + +#ifdef GL_NV_packed_depth_stencil +#endif + +#ifdef GL_NV_register_combiners + GLH_EXTERN PFNGLCOMBINERPARAMETERFVNVPROC GLH_EXT_NAME(glCombinerParameterfvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOMBINERPARAMETERFNVPROC GLH_EXT_NAME(glCombinerParameterfNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOMBINERPARAMETERIVNVPROC GLH_EXT_NAME(glCombinerParameterivNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOMBINERPARAMETERINVPROC GLH_EXT_NAME(glCombinerParameteriNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOMBINERINPUTNVPROC GLH_EXT_NAME(glCombinerInputNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOMBINEROUTPUTNVPROC GLH_EXT_NAME(glCombinerOutputNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLFINALCOMBINERINPUTNVPROC GLH_EXT_NAME(glFinalCombinerInputNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC GLH_EXT_NAME(glGetCombinerInputParameterfvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC GLH_EXT_NAME(glGetCombinerInputParameterivNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC GLH_EXT_NAME(glGetCombinerOutputParameterfvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC GLH_EXT_NAME(glGetCombinerOutputParameterivNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC GLH_EXT_NAME(glGetFinalCombinerInputParameterfvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC GLH_EXT_NAME(glGetFinalCombinerInputParameterivNV) GLH_INITIALIZER; +#endif + +#ifdef GL_NV_register_combiners2 + GLH_EXTERN PFNGLCOMBINERSTAGEPARAMETERFVNVPROC GLH_EXT_NAME(glCombinerStageParameterfvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC GLH_EXT_NAME(glGetCombinerStageParameterfvNV) GLH_INITIALIZER; +#endif + +#ifdef GL_NV_texgen_reflection +#endif + +#ifdef GL_NV_texture_env_combine4 +#endif + +#ifdef GL_NV_texture_rectangle +#endif + +#ifdef GL_NV_texture_shader +#endif + +#ifdef GL_NV_vertex_array_range + GLH_EXTERN PFNGLFLUSHVERTEXARRAYRANGENVPROC GLH_EXT_NAME(glFlushVertexArrayRangeNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXARRAYRANGENVPROC GLH_EXT_NAME(glVertexArrayRangeNV) GLH_INITIALIZER; +# ifdef _WIN32 + GLH_EXTERN PFNWGLALLOCATEMEMORYNVPROC GLH_EXT_NAME(wglAllocateMemoryNV) GLH_INITIALIZER; +# endif +# ifdef GLX_VERSION_1_3 + GLH_EXTERN PFNGLXALLOCATEMEMORYNVPROC GLH_EXT_NAME(glXAllocateMemoryNV) GLH_INITIALIZER; +# endif +# ifdef _WIN32 + GLH_EXTERN PFNWGLFREEMEMORYNVPROC GLH_EXT_NAME(wglFreeMemoryNV) GLH_INITIALIZER; +# endif +# ifdef GLX_VERSION_1_3 + GLH_EXTERN PFNGLXFREEMEMORYNVPROC GLH_EXT_NAME(glXFreeMemoryNV) GLH_INITIALIZER; +# endif +#endif + +#ifdef GL_NV_vertex_program + GLH_EXTERN PFNGLAREPROGRAMSRESIDENTNVPROC GLH_EXT_NAME(glAreProgramsResidentNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLBINDPROGRAMNVPROC GLH_EXT_NAME(glBindProgramNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLDELETEPROGRAMSNVPROC GLH_EXT_NAME(glDeleteProgramsNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLEXECUTEPROGRAMNVPROC GLH_EXT_NAME(glExecuteProgramNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGENPROGRAMSNVPROC GLH_EXT_NAME(glGenProgramsNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPROGRAMPARAMETERDVNVPROC GLH_EXT_NAME(glGetProgramParameterdvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPROGRAMPARAMETERFVNVPROC GLH_EXT_NAME(glGetProgramParameterfvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPROGRAMIVNVPROC GLH_EXT_NAME(glGetProgramivNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETPROGRAMSTRINGNVPROC GLH_EXT_NAME(glGetProgramStringNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETTRACKMATRIXIVNVPROC GLH_EXT_NAME(glGetTrackMatrixivNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETVERTEXATTRIBDVNVPROC GLH_EXT_NAME(glGetVertexAttribdvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETVERTEXATTRIBFVNVPROC GLH_EXT_NAME(glGetVertexAttribfvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETVERTEXATTRIBIVNVPROC GLH_EXT_NAME(glGetVertexAttribivNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETVERTEXATTRIBPOINTERVNVPROC GLH_EXT_NAME(glGetVertexAttribPointervNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLISPROGRAMNVPROC GLH_EXT_NAME(glIsProgramNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLLOADPROGRAMNVPROC GLH_EXT_NAME(glLoadProgramNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMPARAMETER4DNVPROC GLH_EXT_NAME(glProgramParameter4dNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMPARAMETER4DVNVPROC GLH_EXT_NAME(glProgramParameter4dvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMPARAMETER4FNVPROC GLH_EXT_NAME(glProgramParameter4fNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMPARAMETER4FVNVPROC GLH_EXT_NAME(glProgramParameter4fvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMPARAMETERS4DVNVPROC GLH_EXT_NAME(glProgramParameters4dvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLPROGRAMPARAMETERS4FVNVPROC GLH_EXT_NAME(glProgramParameters4fvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLREQUESTRESIDENTPROGRAMSNVPROC GLH_EXT_NAME(glRequestResidentProgramsNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLTRACKMATRIXNVPROC GLH_EXT_NAME(glTrackMatrixNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBPOINTERNVPROC GLH_EXT_NAME(glVertexAttribPointerNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1DNVPROC GLH_EXT_NAME(glVertexAttrib1dNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1DVNVPROC GLH_EXT_NAME(glVertexAttrib1dvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1FNVPROC GLH_EXT_NAME(glVertexAttrib1fNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1FVNVPROC GLH_EXT_NAME(glVertexAttrib1fvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1SNVPROC GLH_EXT_NAME(glVertexAttrib1sNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB1SVNVPROC GLH_EXT_NAME(glVertexAttrib1svNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2DNVPROC GLH_EXT_NAME(glVertexAttrib2dNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2DVNVPROC GLH_EXT_NAME(glVertexAttrib2dvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2FNVPROC GLH_EXT_NAME(glVertexAttrib2fNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2FVNVPROC GLH_EXT_NAME(glVertexAttrib2fvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2SNVPROC GLH_EXT_NAME(glVertexAttrib2sNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB2SVNVPROC GLH_EXT_NAME(glVertexAttrib2svNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3DNVPROC GLH_EXT_NAME(glVertexAttrib3dNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3DVNVPROC GLH_EXT_NAME(glVertexAttrib3dvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3FNVPROC GLH_EXT_NAME(glVertexAttrib3fNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3FVNVPROC GLH_EXT_NAME(glVertexAttrib3fvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3SNVPROC GLH_EXT_NAME(glVertexAttrib3sNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB3SVNVPROC GLH_EXT_NAME(glVertexAttrib3svNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4DNVPROC GLH_EXT_NAME(glVertexAttrib4dNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4DVNVPROC GLH_EXT_NAME(glVertexAttrib4dvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4FNVPROC GLH_EXT_NAME(glVertexAttrib4fNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4FVNVPROC GLH_EXT_NAME(glVertexAttrib4fvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4SNVPROC GLH_EXT_NAME(glVertexAttrib4sNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4SVNVPROC GLH_EXT_NAME(glVertexAttrib4svNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIB4UBVNVPROC GLH_EXT_NAME(glVertexAttrib4ubvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS1DVNVPROC GLH_EXT_NAME(glVertexAttribs1dvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS1FVNVPROC GLH_EXT_NAME(glVertexAttribs1fvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS1SVNVPROC GLH_EXT_NAME(glVertexAttribs1svNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS2DVNVPROC GLH_EXT_NAME(glVertexAttribs2dvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS2FVNVPROC GLH_EXT_NAME(glVertexAttribs2fvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS2SVNVPROC GLH_EXT_NAME(glVertexAttribs2svNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS3DVNVPROC GLH_EXT_NAME(glVertexAttribs3dvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS3FVNVPROC GLH_EXT_NAME(glVertexAttribs3fvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS3SVNVPROC GLH_EXT_NAME(glVertexAttribs3svNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS4DVNVPROC GLH_EXT_NAME(glVertexAttribs4dvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS4FVNVPROC GLH_EXT_NAME(glVertexAttribs4fvNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS4SVNVPROC GLH_EXT_NAME(glVertexAttribs4svNV) GLH_INITIALIZER; + GLH_EXTERN PFNGLVERTEXATTRIBS4UBVNVPROC GLH_EXT_NAME(glVertexAttribs4ubvNV) GLH_INITIALIZER; +#endif + +#ifdef GL_SGIS_generate_mipmap +#endif + +#ifdef GL_SGIS_texture_lod +#endif + +#ifdef GL_SGIX_depth_texture +#endif + +#ifdef GL_SGIX_shadow +#endif + +#ifdef GL_VERSION_1_2 + /* These routines are prefixed by the preprocessor constant + GLH_CORE_1_2_PREFIX to avoid colliding with the OpenGL 1.2 namespace. */ + GLH_EXTERN PFNGLBLENDCOLORPROC GLH_CORE_1_2_NAME(glBlendColor) GLH_INITIALIZER; + GLH_EXTERN PFNGLBLENDEQUATIONPROC GLH_CORE_1_2_NAME(glBlendEquation) GLH_INITIALIZER; + GLH_EXTERN PFNGLDRAWRANGEELEMENTSPROC GLH_CORE_1_2_NAME(glDrawRangeElements) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOLORTABLEPROC GLH_CORE_1_2_NAME(glColorTable) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOLORTABLEPARAMETERFVPROC GLH_CORE_1_2_NAME(glColorTableParameterfv) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOLORTABLEPARAMETERIVPROC GLH_CORE_1_2_NAME(glColorTableParameteriv) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOPYCOLORTABLEPROC GLH_CORE_1_2_NAME(glCopyColorTable) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOLORTABLEPROC GLH_CORE_1_2_NAME(glGetColorTable) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERFVPROC GLH_CORE_1_2_NAME(glGetColorTableParameterfv) GLH_INITIALIZER; + GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERIVPROC GLH_CORE_1_2_NAME(glGetColorTableParameteriv) GLH_INITIALIZER; + GLH_EXTERN PFNGLTEXIMAGE3DPROC GLH_CORE_1_2_NAME(glTexImage3D) GLH_INITIALIZER; + GLH_EXTERN PFNGLTEXSUBIMAGE3DPROC GLH_CORE_1_2_NAME(glTexSubImage3D) GLH_INITIALIZER; + GLH_EXTERN PFNGLCOPYTEXSUBIMAGE3DPROC GLH_CORE_1_2_NAME(glCopyTexSubImage3D) GLH_INITIALIZER; +#endif + +#ifdef GL_WIN_swap_hint + GLH_EXTERN PFNGLADDSWAPHINTRECTWINPROC GLH_EXT_NAME(glAddSwapHintRectWIN) GLH_INITIALIZER; +#endif + +#ifdef WGL_ARB_pbuffer +# ifdef _WIN32 + GLH_EXTERN PFNWGLCREATEPBUFFERARBPROC GLH_EXT_NAME(wglCreatePbufferARB) GLH_INITIALIZER; +# endif +# ifdef _WIN32 + GLH_EXTERN PFNWGLGETPBUFFERDCARBPROC GLH_EXT_NAME(wglGetPbufferDCARB) GLH_INITIALIZER; +# endif +# ifdef _WIN32 + GLH_EXTERN PFNWGLRELEASEPBUFFERDCARBPROC GLH_EXT_NAME(wglReleasePbufferDCARB) GLH_INITIALIZER; +# endif +# ifdef _WIN32 + GLH_EXTERN PFNWGLDESTROYPBUFFERARBPROC GLH_EXT_NAME(wglDestroyPbufferARB) GLH_INITIALIZER; +# endif +# ifdef _WIN32 + GLH_EXTERN PFNWGLQUERYPBUFFERARBPROC GLH_EXT_NAME(wglQueryPbufferARB) GLH_INITIALIZER; +# endif +#endif + +#ifdef WGL_ARB_render_texture +# ifdef _WIN32 + GLH_EXTERN PFNWGLBINDTEXIMAGEARBPROC GLH_EXT_NAME(wglBindTexImageARB) GLH_INITIALIZER; +# endif +# ifdef _WIN32 + GLH_EXTERN PFNWGLRELEASETEXIMAGEARBPROC GLH_EXT_NAME(wglReleaseTexImageARB) GLH_INITIALIZER; +# endif +# ifdef _WIN32 + GLH_EXTERN PFNWGLSETPBUFFERATTRIBARBPROC GLH_EXT_NAME(wglSetPbufferAttribARB) GLH_INITIALIZER; +# endif +#endif + +#ifdef WGL_ARB_pixel_format +# ifdef _WIN32 + GLH_EXTERN PFNWGLGETPIXELFORMATATTRIBIVARBPROC GLH_EXT_NAME(wglGetPixelFormatAttribivARB) GLH_INITIALIZER; +# endif +# ifdef _WIN32 + GLH_EXTERN PFNWGLGETPIXELFORMATATTRIBFVARBPROC GLH_EXT_NAME(wglGetPixelFormatAttribfvARB) GLH_INITIALIZER; +# endif +# ifdef _WIN32 + GLH_EXTERN PFNWGLCHOOSEPIXELFORMATARBPROC GLH_EXT_NAME(wglChoosePixelFormatARB) GLH_INITIALIZER; +# endif +#endif + + +#ifdef GLH_EXT_SINGLE_FILE + +int glh_init_extension(const char* extension) +{ + if (NULL == extension) { + return FALSE; +#ifdef GL_ARB_multitexture + } else if (0 == strcmp(extension, "GL_ARB_multitexture")) { + GLH_EXT_NAME(glMultiTexCoord1dARB) = (PFNGLMULTITEXCOORD1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1dARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord1dARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord1dvARB) = (PFNGLMULTITEXCOORD1DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1dvARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord1dvARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord1fARB) = (PFNGLMULTITEXCOORD1FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1fARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord1fARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord1fvARB) = (PFNGLMULTITEXCOORD1FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1fvARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord1fvARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord1iARB) = (PFNGLMULTITEXCOORD1IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1iARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord1iARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord1ivARB) = (PFNGLMULTITEXCOORD1IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1ivARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord1ivARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord1sARB) = (PFNGLMULTITEXCOORD1SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1sARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord1sARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord1svARB) = (PFNGLMULTITEXCOORD1SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1svARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord1svARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord2dARB) = (PFNGLMULTITEXCOORD2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2dARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord2dARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord2dvARB) = (PFNGLMULTITEXCOORD2DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2dvARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord2dvARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord2fARB) = (PFNGLMULTITEXCOORD2FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2fARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord2fARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord2fvARB) = (PFNGLMULTITEXCOORD2FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2fvARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord2fvARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord2iARB) = (PFNGLMULTITEXCOORD2IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2iARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord2iARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord2ivARB) = (PFNGLMULTITEXCOORD2IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2ivARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord2ivARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord2sARB) = (PFNGLMULTITEXCOORD2SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2sARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord2sARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord2svARB) = (PFNGLMULTITEXCOORD2SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2svARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord2svARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord3dARB) = (PFNGLMULTITEXCOORD3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3dARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord3dARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord3dvARB) = (PFNGLMULTITEXCOORD3DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3dvARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord3dvARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord3fARB) = (PFNGLMULTITEXCOORD3FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3fARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord3fARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord3fvARB) = (PFNGLMULTITEXCOORD3FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3fvARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord3fvARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord3iARB) = (PFNGLMULTITEXCOORD3IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3iARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord3iARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord3ivARB) = (PFNGLMULTITEXCOORD3IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3ivARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord3ivARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord3sARB) = (PFNGLMULTITEXCOORD3SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3sARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord3sARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord3svARB) = (PFNGLMULTITEXCOORD3SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3svARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord3svARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord4dARB) = (PFNGLMULTITEXCOORD4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4dARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord4dARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord4dvARB) = (PFNGLMULTITEXCOORD4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4dvARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord4dvARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord4fARB) = (PFNGLMULTITEXCOORD4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4fARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord4fARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord4fvARB) = (PFNGLMULTITEXCOORD4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4fvARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord4fvARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord4iARB) = (PFNGLMULTITEXCOORD4IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4iARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord4iARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord4ivARB) = (PFNGLMULTITEXCOORD4IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4ivARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord4ivARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord4sARB) = (PFNGLMULTITEXCOORD4SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4sARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord4sARB)) + return FALSE; + GLH_EXT_NAME(glMultiTexCoord4svARB) = (PFNGLMULTITEXCOORD4SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4svARB"); + if (NULL == GLH_EXT_NAME(glMultiTexCoord4svARB)) + return FALSE; + GLH_EXT_NAME(glActiveTextureARB) = (PFNGLACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glActiveTextureARB"); + if (NULL == GLH_EXT_NAME(glActiveTextureARB)) + return FALSE; + GLH_EXT_NAME(glClientActiveTextureARB) = (PFNGLCLIENTACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glClientActiveTextureARB"); + if (NULL == GLH_EXT_NAME(glClientActiveTextureARB)) + return FALSE; +#endif + +#ifdef GL_ARB_texture_border_clamp + } else if (0 == strcmp(extension, "GL_ARB_texture_border_clamp")) { +#endif + +#ifdef GL_ARB_texture_compression + } else if (0 == strcmp(extension, "GL_ARB_texture_compression")) { + GLH_EXT_NAME(glCompressedTexImage3DARB) = (PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexImage3DARB"); + if (NULL == GLH_EXT_NAME(glCompressedTexImage3DARB)) + return FALSE; + GLH_EXT_NAME(glCompressedTexImage2DARB) = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexImage2DARB"); + if (NULL == GLH_EXT_NAME(glCompressedTexImage2DARB)) + return FALSE; + GLH_EXT_NAME(glCompressedTexImage1DARB) = (PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexImage1DARB"); + if (NULL == GLH_EXT_NAME(glCompressedTexImage1DARB)) + return FALSE; + GLH_EXT_NAME(glCompressedTexSubImage3DARB) = (PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexSubImage3DARB"); + if (NULL == GLH_EXT_NAME(glCompressedTexSubImage3DARB)) + return FALSE; + GLH_EXT_NAME(glCompressedTexSubImage2DARB) = (PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexSubImage2DARB"); + if (NULL == GLH_EXT_NAME(glCompressedTexSubImage2DARB)) + return FALSE; + GLH_EXT_NAME(glCompressedTexSubImage1DARB) = (PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexSubImage1DARB"); + if (NULL == GLH_EXT_NAME(glCompressedTexSubImage1DARB)) + return FALSE; + GLH_EXT_NAME(glGetCompressedTexImageARB) = (PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCompressedTexImageARB"); + if (NULL == GLH_EXT_NAME(glGetCompressedTexImageARB)) + return FALSE; +#endif + +#ifdef GL_ARB_texture_cube_map + } else if (0 == strcmp(extension, "GL_ARB_texture_cube_map")) { +#endif + +#ifdef GL_ARB_transpose_matrix + } else if (0 == strcmp(extension, "GL_ARB_transpose_matrix")) { + GLH_EXT_NAME(glLoadTransposeMatrixfARB) = (PFNGLLOADTRANSPOSEMATRIXFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glLoadTransposeMatrixfARB"); + if (NULL == GLH_EXT_NAME(glLoadTransposeMatrixfARB)) + return FALSE; + GLH_EXT_NAME(glLoadTransposeMatrixdARB) = (PFNGLLOADTRANSPOSEMATRIXDARBPROC)GLH_EXT_GET_PROC_ADDRESS("glLoadTransposeMatrixdARB"); + if (NULL == GLH_EXT_NAME(glLoadTransposeMatrixdARB)) + return FALSE; + GLH_EXT_NAME(glMultTransposeMatrixfARB) = (PFNGLMULTTRANSPOSEMATRIXFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultTransposeMatrixfARB"); + if (NULL == GLH_EXT_NAME(glMultTransposeMatrixfARB)) + return FALSE; + GLH_EXT_NAME(glMultTransposeMatrixdARB) = (PFNGLMULTTRANSPOSEMATRIXDARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultTransposeMatrixdARB"); + if (NULL == GLH_EXT_NAME(glMultTransposeMatrixdARB)) + return FALSE; +#endif + +#ifdef GL_ARB_vertex_program + } else if (0 == strcmp(extension, "GL_ARB_vertex_program")) { + GLH_EXT_NAME(glVertexAttrib1sARB) = (PFNGLVERTEXATTRIB1SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1sARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1sARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib1fARB) = (PFNGLVERTEXATTRIB1FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1fARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib1dARB) = (PFNGLVERTEXATTRIB1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1dARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib2sARB) = (PFNGLVERTEXATTRIB2SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2sARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2sARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib2fARB) = (PFNGLVERTEXATTRIB2FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2fARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib2dARB) = (PFNGLVERTEXATTRIB2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2dARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib3sARB) = (PFNGLVERTEXATTRIB3SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3sARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3sARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib3fARB) = (PFNGLVERTEXATTRIB3FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3fARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib3dARB) = (PFNGLVERTEXATTRIB3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3dARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4sARB) = (PFNGLVERTEXATTRIB4SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4sARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4sARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4fARB) = (PFNGLVERTEXATTRIB4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4fARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4dARB) = (PFNGLVERTEXATTRIB4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4dARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4NubARB) = (PFNGLVERTEXATTRIB4NUBARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NubARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4NubARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib1svARB) = (PFNGLVERTEXATTRIB1SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1svARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1svARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib1fvARB) = (PFNGLVERTEXATTRIB1FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1fvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib1dvARB) = (PFNGLVERTEXATTRIB1DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1dvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib2svARB) = (PFNGLVERTEXATTRIB2SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2svARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2svARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib2fvARB) = (PFNGLVERTEXATTRIB2FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2fvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib2dvARB) = (PFNGLVERTEXATTRIB2DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2dvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib3svARB) = (PFNGLVERTEXATTRIB3SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3svARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3svARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib3fvARB) = (PFNGLVERTEXATTRIB3FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3fvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib3dvARB) = (PFNGLVERTEXATTRIB3DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3dvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4bvARB) = (PFNGLVERTEXATTRIB4BVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4bvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4bvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4svARB) = (PFNGLVERTEXATTRIB4SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4svARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4svARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4ivARB) = (PFNGLVERTEXATTRIB4IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ivARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4ivARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4ubvARB) = (PFNGLVERTEXATTRIB4UBVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ubvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4ubvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4usvARB) = (PFNGLVERTEXATTRIB4USVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4usvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4usvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4uivARB) = (PFNGLVERTEXATTRIB4UIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4uivARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4uivARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4fvARB) = (PFNGLVERTEXATTRIB4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4fvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4dvARB) = (PFNGLVERTEXATTRIB4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4dvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4NbvARB) = (PFNGLVERTEXATTRIB4NBVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NbvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4NbvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4NsvARB) = (PFNGLVERTEXATTRIB4NSVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NsvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4NsvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4NivARB) = (PFNGLVERTEXATTRIB4NIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NivARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4NivARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4NubvARB) = (PFNGLVERTEXATTRIB4NUBVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NubvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4NubvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4NusvARB) = (PFNGLVERTEXATTRIB4NUSVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NusvARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4NusvARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttrib4NuivARB) = (PFNGLVERTEXATTRIB4NUIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NuivARB"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4NuivARB)) + return GL_FALSE; + GLH_EXT_NAME(glVertexAttribPointerARB) = (PFNGLVERTEXATTRIBPOINTERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribPointerARB"); + if (NULL == GLH_EXT_NAME(glVertexAttribPointerARB)) + return GL_FALSE; + GLH_EXT_NAME(glEnableVertexAttribArrayARB) = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glEnableVertexAttribArrayARB"); + if (NULL == GLH_EXT_NAME(glEnableVertexAttribArrayARB)) + return GL_FALSE; + GLH_EXT_NAME(glDisableVertexAttribArrayARB) = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDisableVertexAttribArrayARB"); + if (NULL == GLH_EXT_NAME(glDisableVertexAttribArrayARB)) + return GL_FALSE; + GLH_EXT_NAME(glProgramStringARB) = (PFNGLPROGRAMSTRINGARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramStringARB"); + if (NULL == GLH_EXT_NAME(glProgramStringARB)) + return GL_FALSE; + GLH_EXT_NAME(glBindProgramARB) = (PFNGLBINDPROGRAMARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindProgramARB"); + if (NULL == GLH_EXT_NAME(glBindProgramARB)) + return GL_FALSE; + GLH_EXT_NAME(glDeleteProgramsARB) = (PFNGLDELETEPROGRAMSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteProgramsARB"); + if (NULL == GLH_EXT_NAME(glDeleteProgramsARB)) + return GL_FALSE; + GLH_EXT_NAME(glGenProgramsARB) = (PFNGLGENPROGRAMSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenProgramsARB"); + if (NULL == GLH_EXT_NAME(glGenProgramsARB)) + return GL_FALSE; + GLH_EXT_NAME(glProgramEnvParameter4dARB) = (PFNGLPROGRAMENVPARAMETER4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4dARB"); + if (NULL == GLH_EXT_NAME(glProgramEnvParameter4dARB)) + return GL_FALSE; + GLH_EXT_NAME(glProgramEnvParameter4dvARB) = (PFNGLPROGRAMENVPARAMETER4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4dvARB"); + if (NULL == GLH_EXT_NAME(glProgramEnvParameter4dvARB)) + return GL_FALSE; + GLH_EXT_NAME(glProgramEnvParameter4fARB) = (PFNGLPROGRAMENVPARAMETER4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4fARB"); + if (NULL == GLH_EXT_NAME(glProgramEnvParameter4fARB)) + return GL_FALSE; + GLH_EXT_NAME(glProgramEnvParameter4fvARB) = (PFNGLPROGRAMENVPARAMETER4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4fvARB"); + if (NULL == GLH_EXT_NAME(glProgramEnvParameter4fvARB)) + return GL_FALSE; + GLH_EXT_NAME(glProgramLocalParameter4dARB) = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4dARB"); + if (NULL == GLH_EXT_NAME(glProgramLocalParameter4dARB)) + return GL_FALSE; + GLH_EXT_NAME(glProgramLocalParameter4dvARB) = (PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4dvARB"); + if (NULL == GLH_EXT_NAME(glProgramLocalParameter4dvARB)) + return GL_FALSE; + GLH_EXT_NAME(glProgramLocalParameter4fARB) = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4fARB"); + if (NULL == GLH_EXT_NAME(glProgramLocalParameter4fARB)) + return GL_FALSE; + GLH_EXT_NAME(glProgramLocalParameter4fvARB) = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4fvARB"); + if (NULL == GLH_EXT_NAME(glProgramLocalParameter4fvARB)) + return GL_FALSE; + GLH_EXT_NAME(glGetProgramEnvParameterdvARB) = (PFNGLGETPROGRAMENVPARAMETERDVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramEnvParameterdvARB"); + if (NULL == GLH_EXT_NAME(glGetProgramEnvParameterdvARB)) + return GL_FALSE; + GLH_EXT_NAME(glGetProgramEnvParameterfvARB) = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramEnvParameterfvARB"); + if (NULL == GLH_EXT_NAME(glGetProgramEnvParameterfvARB)) + return GL_FALSE; + GLH_EXT_NAME(glGetProgramLocalParameterdvARB) = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramLocalParameterdvARB"); + if (NULL == GLH_EXT_NAME(glGetProgramLocalParameterdvARB)) + return GL_FALSE; + GLH_EXT_NAME(glGetProgramLocalParameterfvARB) = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramLocalParameterfvARB"); + if (NULL == GLH_EXT_NAME(glGetProgramLocalParameterfvARB)) + return GL_FALSE; + GLH_EXT_NAME(glGetProgramivARB) = (PFNGLGETPROGRAMIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramivARB"); + if (NULL == GLH_EXT_NAME(glGetProgramivARB)) + return GL_FALSE; + GLH_EXT_NAME(glGetProgramStringARB) = (PFNGLGETPROGRAMSTRINGARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramStringARB"); + if (NULL == GLH_EXT_NAME(glGetProgramStringARB)) + return GL_FALSE; + GLH_EXT_NAME(glGetVertexAttribdvARB) = (PFNGLGETVERTEXATTRIBDVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribdvARB"); + if (NULL == GLH_EXT_NAME(glGetVertexAttribdvARB)) + return GL_FALSE; + GLH_EXT_NAME(glGetVertexAttribfvARB) = (PFNGLGETVERTEXATTRIBFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribfvARB"); + if (NULL == GLH_EXT_NAME(glGetVertexAttribfvARB)) + return GL_FALSE; + GLH_EXT_NAME(glGetVertexAttribivARB) = (PFNGLGETVERTEXATTRIBIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribivARB"); + if (NULL == GLH_EXT_NAME(glGetVertexAttribivARB)) + return GL_FALSE; + GLH_EXT_NAME(glGetVertexAttribPointervARB) = (PFNGLGETVERTEXATTRIBPOINTERVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribPointervARB"); + if (NULL == GLH_EXT_NAME(glGetVertexAttribPointervARB)) + return GL_FALSE; + GLH_EXT_NAME(glIsProgramARB) = (PFNGLISPROGRAMARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsProgramARB"); + if (NULL == GLH_EXT_NAME(glIsProgramARB)) + return GL_FALSE; +#endif + +#ifdef GL_EXT_abgr + } else if (0 == strcmp(extension, "GL_EXT_abgr")) { +#endif + +#ifdef GL_EXT_bgra + } else if (0 == strcmp(extension, "GL_EXT_bgra")) { +#endif + +#ifdef GL_EXT_blend_color + } else if (0 == strcmp(extension, "GL_EXT_blend_color")) { + GLH_EXT_NAME(glBlendColorEXT) = (PFNGLBLENDCOLOREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendColorEXT"); + if (NULL == GLH_EXT_NAME(glBlendColorEXT)) + return FALSE; +#endif + +#ifdef GL_EXT_blend_minmax + } else if (0 == strcmp(extension, "GL_EXT_blend_minmax")) { + GLH_EXT_NAME(glBlendEquationEXT) = (PFNGLBLENDEQUATIONEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendEquationEXT"); + if (NULL == GLH_EXT_NAME(glBlendEquationEXT)) + return FALSE; +#endif + +#ifdef GL_EXT_blend_subtract + } else if (0 == strcmp(extension, "GL_EXT_blend_subtract")) { +#endif + +#ifdef GL_EXT_compiled_vertex_array + } else if (0 == strcmp(extension, "GL_EXT_compiled_vertex_array")) { + GLH_EXT_NAME(glLockArraysEXT) = (PFNGLLOCKARRAYSEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glLockArraysEXT"); + if (NULL == GLH_EXT_NAME(glLockArraysEXT)) + return FALSE; + GLH_EXT_NAME(glUnlockArraysEXT) = (PFNGLUNLOCKARRAYSEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glUnlockArraysEXT"); + if (NULL == GLH_EXT_NAME(glUnlockArraysEXT)) + return FALSE; +#endif + +#ifdef GL_EXT_fog_coord + } else if (0 == strcmp(extension, "GL_EXT_fog_coord")) { + GLH_EXT_NAME(glFogCoorddEXT) = (PFNGLFOGCOORDDEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoorddEXT"); + if (NULL == GLH_EXT_NAME(glFogCoorddEXT)) + return FALSE; + GLH_EXT_NAME(glFogCoorddvEXT) = (PFNGLFOGCOORDDVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoorddvEXT"); + if (NULL == GLH_EXT_NAME(glFogCoorddvEXT)) + return FALSE; + GLH_EXT_NAME(glFogCoordfEXT) = (PFNGLFOGCOORDFEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoordfEXT"); + if (NULL == GLH_EXT_NAME(glFogCoordfEXT)) + return FALSE; + GLH_EXT_NAME(glFogCoordfvEXT) = (PFNGLFOGCOORDFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoordfvEXT"); + if (NULL == GLH_EXT_NAME(glFogCoordfvEXT)) + return FALSE; + GLH_EXT_NAME(glFogCoordPointerEXT) = (PFNGLFOGCOORDPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoordPointerEXT"); + if (NULL == GLH_EXT_NAME(glFogCoordPointerEXT)) + return FALSE; +#endif + +#ifdef GL_EXT_light_max_exponent + } else if (0 == strcmp(extension, "GL_EXT_light_max_exponent")) { +#endif + +#ifdef GL_EXT_packed_pixels + } else if (0 == strcmp(extension, "GL_EXT_packed_pixels")) { +#endif + +#ifdef GL_EXT_paletted_texture + } else if (0 == strcmp(extension, "GL_EXT_paletted_texture")) { + GLH_EXT_NAME(glColorSubTableEXT) = (PFNGLCOLORSUBTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorSubTableEXT"); + if (NULL == GLH_EXT_NAME(glColorSubTableEXT)) + return FALSE; + GLH_EXT_NAME(glColorTableEXT) = (PFNGLCOLORTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableEXT"); + if (NULL == GLH_EXT_NAME(glColorTableEXT)) + return FALSE; + GLH_EXT_NAME(glGetColorTableEXT) = (PFNGLGETCOLORTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableEXT"); + if (NULL == GLH_EXT_NAME(glGetColorTableEXT)) + return FALSE; + GLH_EXT_NAME(glGetColorTableParameterfvEXT) = (PFNGLGETCOLORTABLEPARAMETERFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameterfvEXT"); + if (NULL == GLH_EXT_NAME(glGetColorTableParameterfvEXT)) + return FALSE; + GLH_EXT_NAME(glGetColorTableParameterivEXT) = (PFNGLGETCOLORTABLEPARAMETERIVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameterivEXT"); + if (NULL == GLH_EXT_NAME(glGetColorTableParameterivEXT)) + return FALSE; +#endif + +#ifdef GL_EXT_point_parameters + } else if (0 == strcmp(extension, "GL_EXT_point_parameters")) { + GLH_EXT_NAME(glPointParameterfEXT) = (PFNGLPOINTPARAMETERFEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfEXT"); + if (NULL == GLH_EXT_NAME(glPointParameterfEXT)) + return FALSE; + GLH_EXT_NAME(glPointParameterfvEXT) = (PFNGLPOINTPARAMETERFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvEXT"); + if (NULL == GLH_EXT_NAME(glPointParameterfvEXT)) + return FALSE; +#endif + +#ifdef GL_EXT_rescale_normal + } else if (0 == strcmp(extension, "GL_EXT_rescale_normal")) { +#endif + +#ifdef GL_EXT_secondary_color + } else if (0 == strcmp(extension, "GL_EXT_secondary_color")) { + GLH_EXT_NAME(glSecondaryColor3bEXT) = (PFNGLSECONDARYCOLOR3BEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3bEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3bEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3bvEXT) = (PFNGLSECONDARYCOLOR3BVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3bvEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3bvEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3dEXT) = (PFNGLSECONDARYCOLOR3DEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3dEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3dEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3dvEXT) = (PFNGLSECONDARYCOLOR3DVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3dvEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3dvEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3fEXT) = (PFNGLSECONDARYCOLOR3FEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3fEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3fEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3fvEXT) = (PFNGLSECONDARYCOLOR3FVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3fvEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3fvEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3iEXT) = (PFNGLSECONDARYCOLOR3IEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3iEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3iEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3ivEXT) = (PFNGLSECONDARYCOLOR3IVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3ivEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3ivEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3sEXT) = (PFNGLSECONDARYCOLOR3SEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3sEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3sEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3svEXT) = (PFNGLSECONDARYCOLOR3SVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3svEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3svEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3ubEXT) = (PFNGLSECONDARYCOLOR3UBEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3ubEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3ubEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3ubvEXT) = (PFNGLSECONDARYCOLOR3UBVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3ubvEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3ubvEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3uiEXT) = (PFNGLSECONDARYCOLOR3UIEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3uiEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3uiEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3uivEXT) = (PFNGLSECONDARYCOLOR3UIVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3uivEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3uivEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3usEXT) = (PFNGLSECONDARYCOLOR3USEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3usEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3usEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColor3usvEXT) = (PFNGLSECONDARYCOLOR3USVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3usvEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColor3usvEXT)) + return FALSE; + GLH_EXT_NAME(glSecondaryColorPointerEXT) = (PFNGLSECONDARYCOLORPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColorPointerEXT"); + if (NULL == GLH_EXT_NAME(glSecondaryColorPointerEXT)) + return FALSE; +#endif + +#ifdef GL_EXT_separate_specular_color + } else if (0 == strcmp(extension, "GL_EXT_separate_specular_color")) { +#endif + +#ifdef GL_EXT_shared_texture_palette + } else if (0 == strcmp(extension, "GL_EXT_shared_texture_palette")) { +#endif + +#ifdef GL_EXT_stencil_wrap + } else if (0 == strcmp(extension, "GL_EXT_stencil_wrap")) { +#endif + +#ifdef GL_EXT_texture_compression_s3tc + } else if (0 == strcmp(extension, "GL_EXT_texture_compression_s3tc")) { +#endif + +#ifdef GL_EXT_texture_cube_map + } else if (0 == strcmp(extension, "GL_EXT_texture_cube_map")) { +#endif + +#ifdef GL_EXT_texture_edge_clamp + } else if (0 == strcmp(extension, "GL_EXT_texture_edge_clamp")) { +#endif + +#ifdef GL_EXT_texture_env_add + } else if (0 == strcmp(extension, "GL_EXT_texture_env_add")) { +#endif + +#ifdef GL_EXT_texture_env_combine + } else if (0 == strcmp(extension, "GL_EXT_texture_env_combine")) { +#endif + +#ifdef GL_EXT_texture_filter_anisotropic + } else if (0 == strcmp(extension, "GL_EXT_texture_filter_anisotropic")) { +#endif + +#ifdef GL_EXT_texture_lod_bias + } else if (0 == strcmp(extension, "GL_EXT_texture_lod_bias")) { +#endif + +#ifdef GL_EXT_texture_object + } else if (0 == strcmp(extension, "GL_EXT_texture_object")) { + GLH_EXT_NAME(glAreTexturesResidentEXT) = (PFNGLARETEXTURESRESIDENTEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glAreTexturesResidentEXT"); + if (NULL == GLH_EXT_NAME(glAreTexturesResidentEXT)) + return FALSE; + GLH_EXT_NAME(glBindTextureEXT) = (PFNGLBINDTEXTUREEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glBindTextureEXT"); + if (NULL == GLH_EXT_NAME(glBindTextureEXT)) + return FALSE; + GLH_EXT_NAME(glDeleteTexturesEXT) = (PFNGLDELETETEXTURESEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteTexturesEXT"); + if (NULL == GLH_EXT_NAME(glDeleteTexturesEXT)) + return FALSE; + GLH_EXT_NAME(glGenTexturesEXT) = (PFNGLGENTEXTURESEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGenTexturesEXT"); + if (NULL == GLH_EXT_NAME(glGenTexturesEXT)) + return FALSE; + GLH_EXT_NAME(glIsTextureEXT) = (PFNGLISTEXTUREEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glIsTextureEXT"); + if (NULL == GLH_EXT_NAME(glIsTextureEXT)) + return FALSE; + GLH_EXT_NAME(glPrioritizeTexturesEXT) = (PFNGLPRIORITIZETEXTURESEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glPrioritizeTexturesEXT"); + if (NULL == GLH_EXT_NAME(glPrioritizeTexturesEXT)) + return FALSE; +#endif + +#ifdef GL_EXT_texture3D + } else if (0 == strcmp(extension, "GL_EXT_texture3D")) { + GLH_EXT_NAME(glTexImage3DEXT) = (PFNGLTEXIMAGE3DEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glTexImage3DEXT"); + if (NULL == GLH_EXT_NAME(glTexImage3DEXT)) + return FALSE; +#endif + +#ifdef GL_EXT_vertex_array + } else if (0 == strcmp(extension, "GL_EXT_vertex_array")) { + GLH_EXT_NAME(glArrayElementEXT) = (PFNGLARRAYELEMENTEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glArrayElementEXT"); + if (NULL == GLH_EXT_NAME(glArrayElementEXT)) + return FALSE; + GLH_EXT_NAME(glColorPointerEXT) = (PFNGLCOLORPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorPointerEXT"); + if (NULL == GLH_EXT_NAME(glColorPointerEXT)) + return FALSE; + GLH_EXT_NAME(glEdgeFlagPointerEXT) = (PFNGLEDGEFLAGPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glEdgeFlagPointerEXT"); + if (NULL == GLH_EXT_NAME(glEdgeFlagPointerEXT)) + return FALSE; + GLH_EXT_NAME(glGetPointervEXT) = (PFNGLGETPOINTERVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetPointervEXT"); + if (NULL == GLH_EXT_NAME(glGetPointervEXT)) + return FALSE; + GLH_EXT_NAME(glIndexPointerEXT) = (PFNGLINDEXPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glIndexPointerEXT"); + if (NULL == GLH_EXT_NAME(glIndexPointerEXT)) + return FALSE; + GLH_EXT_NAME(glNormalPointerEXT) = (PFNGLNORMALPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glNormalPointerEXT"); + if (NULL == GLH_EXT_NAME(glNormalPointerEXT)) + return FALSE; + GLH_EXT_NAME(glTexCoordPointerEXT) = (PFNGLTEXCOORDPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glTexCoordPointerEXT"); + if (NULL == GLH_EXT_NAME(glTexCoordPointerEXT)) + return FALSE; + GLH_EXT_NAME(glVertexPointerEXT) = (PFNGLVERTEXPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexPointerEXT"); + if (NULL == GLH_EXT_NAME(glVertexPointerEXT)) + return FALSE; + GLH_EXT_NAME(glDrawArraysEXT) = (PFNGLDRAWARRAYSEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawArraysEXT"); + if (NULL == GLH_EXT_NAME(glDrawArraysEXT)) + return FALSE; +#endif + +#ifdef GL_EXT_vertex_weighting + } else if (0 == strcmp(extension, "GL_EXT_vertex_weighting")) { + GLH_EXT_NAME(glVertexWeightfEXT) = (PFNGLVERTEXWEIGHTFEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexWeightfEXT"); + if (NULL == GLH_EXT_NAME(glVertexWeightfEXT)) + return FALSE; + GLH_EXT_NAME(glVertexWeightfvEXT) = (PFNGLVERTEXWEIGHTFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexWeightfvEXT"); + if (NULL == GLH_EXT_NAME(glVertexWeightfvEXT)) + return FALSE; + GLH_EXT_NAME(glVertexWeightPointerEXT) = (PFNGLVERTEXWEIGHTPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexWeightPointerEXT"); + if (NULL == GLH_EXT_NAME(glVertexWeightPointerEXT)) + return FALSE; +#endif + +#ifdef GL_NV_blend_square + } else if (0 == strcmp(extension, "GL_NV_blend_square")) { +#endif + +#ifdef GL_NV_evaluators + } else if (0 == strcmp(extension, "GL_NV_evaluators")) { + GLH_EXT_NAME(glMapControlPointsNV) = (PFNGLMAPCONTROLPOINTSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glMapControlPointsNV"); + if (NULL == GLH_EXT_NAME(glMapControlPointsNV)) + return FALSE; + GLH_EXT_NAME(glMapParameterivNV) = (PFNGLMAPPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glMapParameterivNV"); + if (NULL == GLH_EXT_NAME(glMapParameterivNV)) + return FALSE; + GLH_EXT_NAME(glMapParameterfvNV) = (PFNGLMAPPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glMapParameterfvNV"); + if (NULL == GLH_EXT_NAME(glMapParameterfvNV)) + return FALSE; + GLH_EXT_NAME(glGetMapControlPointsNV) = (PFNGLGETMAPCONTROLPOINTSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapControlPointsNV"); + if (NULL == GLH_EXT_NAME(glGetMapControlPointsNV)) + return FALSE; + GLH_EXT_NAME(glGetMapParameterivNV) = (PFNGLGETMAPPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapParameterivNV"); + if (NULL == GLH_EXT_NAME(glGetMapParameterivNV)) + return FALSE; + GLH_EXT_NAME(glGetMapParameterfvNV) = (PFNGLGETMAPPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapParameterfvNV"); + if (NULL == GLH_EXT_NAME(glGetMapParameterfvNV)) + return FALSE; + GLH_EXT_NAME(glGetMapAttribParameterivNV) = (PFNGLGETMAPATTRIBPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapAttribParameterivNV"); + if (NULL == GLH_EXT_NAME(glGetMapAttribParameterivNV)) + return FALSE; + GLH_EXT_NAME(glGetMapAttribParameterfvNV) = (PFNGLGETMAPATTRIBPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapAttribParameterfvNV"); + if (NULL == GLH_EXT_NAME(glGetMapAttribParameterfvNV)) + return FALSE; + GLH_EXT_NAME(glEvalMapsNV) = (PFNGLEVALMAPSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glEvalMapsNV"); + if (NULL == GLH_EXT_NAME(glEvalMapsNV)) + return FALSE; +#endif + +#ifdef GL_NV_fence + } else if (0 == strcmp(extension, "GL_NV_fence")) { + GLH_EXT_NAME(glGenFencesNV) = (PFNGLGENFENCESNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGenFencesNV"); + if (NULL == GLH_EXT_NAME(glGenFencesNV)) + return FALSE; + GLH_EXT_NAME(glDeleteFencesNV) = (PFNGLDELETEFENCESNVPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteFencesNV"); + if (NULL == GLH_EXT_NAME(glDeleteFencesNV)) + return FALSE; + GLH_EXT_NAME(glSetFenceNV) = (PFNGLSETFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glSetFenceNV"); + if (NULL == GLH_EXT_NAME(glSetFenceNV)) + return FALSE; + GLH_EXT_NAME(glTestFenceNV) = (PFNGLTESTFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glTestFenceNV"); + if (NULL == GLH_EXT_NAME(glTestFenceNV)) + return FALSE; + GLH_EXT_NAME(glFinishFenceNV) = (PFNGLFINISHFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glFinishFenceNV"); + if (NULL == GLH_EXT_NAME(glFinishFenceNV)) + return FALSE; + GLH_EXT_NAME(glIsFenceNV) = (PFNGLISFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glIsFenceNV"); + if (NULL == GLH_EXT_NAME(glIsFenceNV)) + return FALSE; + GLH_EXT_NAME(glGetFenceivNV) = (PFNGLGETFENCEIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetFenceivNV"); + if (NULL == GLH_EXT_NAME(glGetFenceivNV)) + return FALSE; +#endif + +#ifdef GL_NV_fog_distance + } else if (0 == strcmp(extension, "GL_NV_fog_distance")) { +#endif + +#ifdef GL_NV_packed_depth_stencil + } else if (0 == strcmp(extension, "GL_NV_packed_depth_stencil")) { +#endif + +#ifdef GL_NV_register_combiners + } else if (0 == strcmp(extension, "GL_NV_register_combiners")) { + GLH_EXT_NAME(glCombinerParameterfvNV) = (PFNGLCOMBINERPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameterfvNV"); + if (NULL == GLH_EXT_NAME(glCombinerParameterfvNV)) + return FALSE; + GLH_EXT_NAME(glCombinerParameterfNV) = (PFNGLCOMBINERPARAMETERFNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameterfNV"); + if (NULL == GLH_EXT_NAME(glCombinerParameterfNV)) + return FALSE; + GLH_EXT_NAME(glCombinerParameterivNV) = (PFNGLCOMBINERPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameterivNV"); + if (NULL == GLH_EXT_NAME(glCombinerParameterivNV)) + return FALSE; + GLH_EXT_NAME(glCombinerParameteriNV) = (PFNGLCOMBINERPARAMETERINVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameteriNV"); + if (NULL == GLH_EXT_NAME(glCombinerParameteriNV)) + return FALSE; + GLH_EXT_NAME(glCombinerInputNV) = (PFNGLCOMBINERINPUTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerInputNV"); + if (NULL == GLH_EXT_NAME(glCombinerInputNV)) + return FALSE; + GLH_EXT_NAME(glCombinerOutputNV) = (PFNGLCOMBINEROUTPUTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerOutputNV"); + if (NULL == GLH_EXT_NAME(glCombinerOutputNV)) + return FALSE; + GLH_EXT_NAME(glFinalCombinerInputNV) = (PFNGLFINALCOMBINERINPUTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glFinalCombinerInputNV"); + if (NULL == GLH_EXT_NAME(glFinalCombinerInputNV)) + return FALSE; + GLH_EXT_NAME(glGetCombinerInputParameterfvNV) = (PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerInputParameterfvNV"); + if (NULL == GLH_EXT_NAME(glGetCombinerInputParameterfvNV)) + return FALSE; + GLH_EXT_NAME(glGetCombinerInputParameterivNV) = (PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerInputParameterivNV"); + if (NULL == GLH_EXT_NAME(glGetCombinerInputParameterivNV)) + return FALSE; + GLH_EXT_NAME(glGetCombinerOutputParameterfvNV) = (PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerOutputParameterfvNV"); + if (NULL == GLH_EXT_NAME(glGetCombinerOutputParameterfvNV)) + return FALSE; + GLH_EXT_NAME(glGetCombinerOutputParameterivNV) = (PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerOutputParameterivNV"); + if (NULL == GLH_EXT_NAME(glGetCombinerOutputParameterivNV)) + return FALSE; + GLH_EXT_NAME(glGetFinalCombinerInputParameterfvNV) = (PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetFinalCombinerInputParameterfvNV"); + if (NULL == GLH_EXT_NAME(glGetFinalCombinerInputParameterfvNV)) + return FALSE; + GLH_EXT_NAME(glGetFinalCombinerInputParameterivNV) = (PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetFinalCombinerInputParameterivNV"); + if (NULL == GLH_EXT_NAME(glGetFinalCombinerInputParameterivNV)) + return FALSE; +#endif + +#ifdef GL_NV_register_combiners2 + } else if (0 == strcmp(extension, "GL_NV_register_combiners2")) { + GLH_EXT_NAME(glCombinerStageParameterfvNV) = (PFNGLCOMBINERSTAGEPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerStageParameterfvNV"); + if (NULL == GLH_EXT_NAME(glCombinerStageParameterfvNV)) + return FALSE; + GLH_EXT_NAME(glGetCombinerStageParameterfvNV) = (PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerStageParameterfvNV"); + if (NULL == GLH_EXT_NAME(glGetCombinerStageParameterfvNV)) + return FALSE; +#endif + +#ifdef GL_NV_texgen_reflection + } else if (0 == strcmp(extension, "GL_NV_texgen_reflection")) { +#endif + +#ifdef GL_NV_texture_env_combine4 + } else if (0 == strcmp(extension, "GL_NV_texture_env_combine4")) { +#endif + +#ifdef GL_NV_texture_rectangle + } else if (0 == strcmp(extension, "GL_NV_texture_rectangle")) { +#endif + +#ifdef GL_NV_texture_shader + } else if (0 == strcmp(extension, "GL_NV_texture_shader")) { +#endif + +#ifdef GL_NV_vertex_array_range + } else if (0 == strcmp(extension, "GL_NV_vertex_array_range")) { + GLH_EXT_NAME(glFlushVertexArrayRangeNV) = (PFNGLFLUSHVERTEXARRAYRANGENVPROC)GLH_EXT_GET_PROC_ADDRESS("glFlushVertexArrayRangeNV"); + if (NULL == GLH_EXT_NAME(glFlushVertexArrayRangeNV)) + return FALSE; + GLH_EXT_NAME(glVertexArrayRangeNV) = (PFNGLVERTEXARRAYRANGENVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexArrayRangeNV"); + if (NULL == GLH_EXT_NAME(glVertexArrayRangeNV)) + return FALSE; +# ifdef _WIN32 + GLH_EXT_NAME(wglAllocateMemoryNV) = (PFNWGLALLOCATEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("wglAllocateMemoryNV"); + if (NULL == GLH_EXT_NAME(wglAllocateMemoryNV)) + return FALSE; +# endif +# ifdef GLX_VERSION_1_3 + GLH_EXT_NAME(glXAllocateMemoryNV) = (PFNGLXALLOCATEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("glXAllocateMemoryNV"); + if (NULL == GLH_EXT_NAME(glXAllocateMemoryNV)) + return FALSE; +# endif +# ifdef _WIN32 + GLH_EXT_NAME(wglFreeMemoryNV) = (PFNWGLFREEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("wglFreeMemoryNV"); + if (NULL == GLH_EXT_NAME(wglFreeMemoryNV)) + return FALSE; +# endif +# ifdef GLX_VERSION_1_3 + GLH_EXT_NAME(glXFreeMemoryNV) = (PFNGLXFREEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("glXFreeMemoryNV"); + if (NULL == GLH_EXT_NAME(glXFreeMemoryNV)) + return FALSE; +# endif +#endif + +#ifdef GL_NV_vertex_program + } else if (0 == strcmp(extension, "GL_NV_vertex_program")) { + GLH_EXT_NAME(glAreProgramsResidentNV) = (PFNGLAREPROGRAMSRESIDENTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glAreProgramsResidentNV"); + if (NULL == GLH_EXT_NAME(glAreProgramsResidentNV)) + return FALSE; + GLH_EXT_NAME(glBindProgramNV) = (PFNGLBINDPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glBindProgramNV"); + if (NULL == GLH_EXT_NAME(glBindProgramNV)) + return FALSE; + GLH_EXT_NAME(glDeleteProgramsNV) = (PFNGLDELETEPROGRAMSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteProgramsNV"); + if (NULL == GLH_EXT_NAME(glDeleteProgramsNV)) + return FALSE; + GLH_EXT_NAME(glExecuteProgramNV) = (PFNGLEXECUTEPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glExecuteProgramNV"); + if (NULL == GLH_EXT_NAME(glExecuteProgramNV)) + return FALSE; + GLH_EXT_NAME(glGenProgramsNV) = (PFNGLGENPROGRAMSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGenProgramsNV"); + if (NULL == GLH_EXT_NAME(glGenProgramsNV)) + return FALSE; + GLH_EXT_NAME(glGetProgramParameterdvNV) = (PFNGLGETPROGRAMPARAMETERDVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramParameterdvNV"); + if (NULL == GLH_EXT_NAME(glGetProgramParameterdvNV)) + return FALSE; + GLH_EXT_NAME(glGetProgramParameterfvNV) = (PFNGLGETPROGRAMPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramParameterfvNV"); + if (NULL == GLH_EXT_NAME(glGetProgramParameterfvNV)) + return FALSE; + GLH_EXT_NAME(glGetProgramivNV) = (PFNGLGETPROGRAMIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramivNV"); + if (NULL == GLH_EXT_NAME(glGetProgramivNV)) + return FALSE; + GLH_EXT_NAME(glGetProgramStringNV) = (PFNGLGETPROGRAMSTRINGNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramStringNV"); + if (NULL == GLH_EXT_NAME(glGetProgramStringNV)) + return FALSE; + GLH_EXT_NAME(glGetTrackMatrixivNV) = (PFNGLGETTRACKMATRIXIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetTrackMatrixivNV"); + if (NULL == GLH_EXT_NAME(glGetTrackMatrixivNV)) + return FALSE; + GLH_EXT_NAME(glGetVertexAttribdvNV) = (PFNGLGETVERTEXATTRIBDVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribdvNV"); + if (NULL == GLH_EXT_NAME(glGetVertexAttribdvNV)) + return FALSE; + GLH_EXT_NAME(glGetVertexAttribfvNV) = (PFNGLGETVERTEXATTRIBFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribfvNV"); + if (NULL == GLH_EXT_NAME(glGetVertexAttribfvNV)) + return FALSE; + GLH_EXT_NAME(glGetVertexAttribivNV) = (PFNGLGETVERTEXATTRIBIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribivNV"); + if (NULL == GLH_EXT_NAME(glGetVertexAttribivNV)) + return FALSE; + GLH_EXT_NAME(glGetVertexAttribPointervNV) = (PFNGLGETVERTEXATTRIBPOINTERVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribPointervNV"); + if (NULL == GLH_EXT_NAME(glGetVertexAttribPointervNV)) + return FALSE; + GLH_EXT_NAME(glIsProgramNV) = (PFNGLISPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glIsProgramNV"); + if (NULL == GLH_EXT_NAME(glIsProgramNV)) + return FALSE; + GLH_EXT_NAME(glLoadProgramNV) = (PFNGLLOADPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glLoadProgramNV"); + if (NULL == GLH_EXT_NAME(glLoadProgramNV)) + return FALSE; + GLH_EXT_NAME(glProgramParameter4dNV) = (PFNGLPROGRAMPARAMETER4DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4dNV"); + if (NULL == GLH_EXT_NAME(glProgramParameter4dNV)) + return FALSE; + GLH_EXT_NAME(glProgramParameter4dvNV) = (PFNGLPROGRAMPARAMETER4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4dvNV"); + if (NULL == GLH_EXT_NAME(glProgramParameter4dvNV)) + return FALSE; + GLH_EXT_NAME(glProgramParameter4fNV) = (PFNGLPROGRAMPARAMETER4FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4fNV"); + if (NULL == GLH_EXT_NAME(glProgramParameter4fNV)) + return FALSE; + GLH_EXT_NAME(glProgramParameter4fvNV) = (PFNGLPROGRAMPARAMETER4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4fvNV"); + if (NULL == GLH_EXT_NAME(glProgramParameter4fvNV)) + return FALSE; + GLH_EXT_NAME(glProgramParameters4dvNV) = (PFNGLPROGRAMPARAMETERS4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameters4dvNV"); + if (NULL == GLH_EXT_NAME(glProgramParameters4dvNV)) + return FALSE; + GLH_EXT_NAME(glProgramParameters4fvNV) = (PFNGLPROGRAMPARAMETERS4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameters4fvNV"); + if (NULL == GLH_EXT_NAME(glProgramParameters4fvNV)) + return FALSE; + GLH_EXT_NAME(glRequestResidentProgramsNV) = (PFNGLREQUESTRESIDENTPROGRAMSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glRequestResidentProgramsNV"); + if (NULL == GLH_EXT_NAME(glRequestResidentProgramsNV)) + return FALSE; + GLH_EXT_NAME(glTrackMatrixNV) = (PFNGLTRACKMATRIXNVPROC)GLH_EXT_GET_PROC_ADDRESS("glTrackMatrixNV"); + if (NULL == GLH_EXT_NAME(glTrackMatrixNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribPointerNV) = (PFNGLVERTEXATTRIBPOINTERNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribPointerNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribPointerNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib1dNV) = (PFNGLVERTEXATTRIB1DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1dNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib1dvNV) = (PFNGLVERTEXATTRIB1DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1dvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib1fNV) = (PFNGLVERTEXATTRIB1FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1fNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib1fvNV) = (PFNGLVERTEXATTRIB1FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1fvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib1sNV) = (PFNGLVERTEXATTRIB1SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1sNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1sNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib1svNV) = (PFNGLVERTEXATTRIB1SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1svNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib1svNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib2dNV) = (PFNGLVERTEXATTRIB2DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2dNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib2dvNV) = (PFNGLVERTEXATTRIB2DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2dvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib2fNV) = (PFNGLVERTEXATTRIB2FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2fNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib2fvNV) = (PFNGLVERTEXATTRIB2FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2fvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib2sNV) = (PFNGLVERTEXATTRIB2SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2sNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2sNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib2svNV) = (PFNGLVERTEXATTRIB2SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2svNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib2svNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib3dNV) = (PFNGLVERTEXATTRIB3DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3dNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib3dvNV) = (PFNGLVERTEXATTRIB3DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3dvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib3fNV) = (PFNGLVERTEXATTRIB3FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3fNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib3fvNV) = (PFNGLVERTEXATTRIB3FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3fvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib3sNV) = (PFNGLVERTEXATTRIB3SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3sNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3sNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib3svNV) = (PFNGLVERTEXATTRIB3SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3svNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib3svNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib4dNV) = (PFNGLVERTEXATTRIB4DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4dNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib4dvNV) = (PFNGLVERTEXATTRIB4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4dvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib4fNV) = (PFNGLVERTEXATTRIB4FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4fNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib4fvNV) = (PFNGLVERTEXATTRIB4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4fvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib4sNV) = (PFNGLVERTEXATTRIB4SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4sNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4sNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib4svNV) = (PFNGLVERTEXATTRIB4SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4svNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4svNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttrib4ubvNV) = (PFNGLVERTEXATTRIB4UBVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ubvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttrib4ubvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs1dvNV) = (PFNGLVERTEXATTRIBS1DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs1dvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs1dvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs1fvNV) = (PFNGLVERTEXATTRIBS1FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs1fvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs1fvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs1svNV) = (PFNGLVERTEXATTRIBS1SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs1svNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs1svNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs2dvNV) = (PFNGLVERTEXATTRIBS2DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs2dvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs2dvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs2fvNV) = (PFNGLVERTEXATTRIBS2FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs2fvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs2fvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs2svNV) = (PFNGLVERTEXATTRIBS2SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs2svNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs2svNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs3dvNV) = (PFNGLVERTEXATTRIBS3DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs3dvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs3dvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs3fvNV) = (PFNGLVERTEXATTRIBS3FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs3fvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs3fvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs3svNV) = (PFNGLVERTEXATTRIBS3SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs3svNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs3svNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs4dvNV) = (PFNGLVERTEXATTRIBS4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4dvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs4dvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs4fvNV) = (PFNGLVERTEXATTRIBS4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4fvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs4fvNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs4svNV) = (PFNGLVERTEXATTRIBS4SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4svNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs4svNV)) + return FALSE; + GLH_EXT_NAME(glVertexAttribs4ubvNV) = (PFNGLVERTEXATTRIBS4UBVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4ubvNV"); + if (NULL == GLH_EXT_NAME(glVertexAttribs4ubvNV)) + return FALSE; +#endif + +#ifdef GL_SGIS_generate_mipmap + } else if (0 == strcmp(extension, "GL_SGIS_generate_mipmap")) { +#endif + +#ifdef GL_SGIS_texture_lod + } else if (0 == strcmp(extension, "GL_SGIS_texture_lod")) { +#endif + +#ifdef GL_SGIX_depth_texture + } else if (0 == strcmp(extension, "GL_SGIX_depth_texture")) { +#endif + +#ifdef GL_SGIX_shadow + } else if (0 == strcmp(extension, "GL_SGIX_shadow")) { +#endif + +#ifdef GL_VERSION_1_2 + } else if (0 == strcmp(extension, "GL_VERSION_1_2")) { + GLH_CORE_1_2_NAME(glBlendColor) = (PFNGLBLENDCOLORPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendColor"); + if (NULL == GLH_CORE_1_2_NAME(glBlendColor)) + return FALSE; + GLH_CORE_1_2_NAME(glBlendEquation) = (PFNGLBLENDEQUATIONPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendEquation"); + if (NULL == GLH_CORE_1_2_NAME(glBlendEquation)) + return FALSE; + GLH_CORE_1_2_NAME(glDrawRangeElements) = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements"); + if (NULL == GLH_CORE_1_2_NAME(glDrawRangeElements)) + return FALSE; + GLH_CORE_1_2_NAME(glColorTable) = (PFNGLCOLORTABLEPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTable"); + if (NULL == GLH_CORE_1_2_NAME(glColorTable)) + return FALSE; + GLH_CORE_1_2_NAME(glColorTableParameterfv) = (PFNGLCOLORTABLEPARAMETERFVPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableParameterfv"); + if (NULL == GLH_CORE_1_2_NAME(glColorTableParameterfv)) + return FALSE; + GLH_CORE_1_2_NAME(glColorTableParameteriv) = (PFNGLCOLORTABLEPARAMETERIVPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableParameteriv"); + if (NULL == GLH_CORE_1_2_NAME(glColorTableParameteriv)) + return FALSE; + GLH_CORE_1_2_NAME(glCopyColorTable) = (PFNGLCOPYCOLORTABLEPROC)GLH_EXT_GET_PROC_ADDRESS("glCopyColorTable"); + if (NULL == GLH_CORE_1_2_NAME(glCopyColorTable)) + return FALSE; + GLH_CORE_1_2_NAME(glGetColorTable) = (PFNGLGETCOLORTABLEPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTable"); + if (NULL == GLH_CORE_1_2_NAME(glGetColorTable)) + return FALSE; + GLH_CORE_1_2_NAME(glGetColorTableParameterfv) = (PFNGLGETCOLORTABLEPARAMETERFVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameterfv"); + if (NULL == GLH_CORE_1_2_NAME(glGetColorTableParameterfv)) + return FALSE; + GLH_CORE_1_2_NAME(glGetColorTableParameteriv) = (PFNGLGETCOLORTABLEPARAMETERIVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameteriv"); + if (NULL == GLH_CORE_1_2_NAME(glGetColorTableParameteriv)) + return FALSE; + GLH_CORE_1_2_NAME(glTexImage3D) = (PFNGLTEXIMAGE3DPROC)GLH_EXT_GET_PROC_ADDRESS("glTexImage3D"); + if (NULL == GLH_CORE_1_2_NAME(glTexImage3D)) + return FALSE; + GLH_CORE_1_2_NAME(glTexSubImage3D) = (PFNGLTEXSUBIMAGE3DPROC)GLH_EXT_GET_PROC_ADDRESS("glTexSubImage3D"); + if (NULL == GLH_CORE_1_2_NAME(glTexSubImage3D)) + return FALSE; + GLH_CORE_1_2_NAME(glCopyTexSubImage3D) = (PFNGLCOPYTEXSUBIMAGE3DPROC)GLH_EXT_GET_PROC_ADDRESS("glCopyTexSubImage3D"); + if (NULL == GLH_CORE_1_2_NAME(glCopyTexSubImage3D)) + return FALSE; +#endif + +#ifdef GL_WIN_swap_hint + } else if (0 == strcmp(extension, "GL_WIN_swap_hint")) { + GLH_EXT_NAME(glAddSwapHintRectWIN) = (PFNGLADDSWAPHINTRECTWINPROC)GLH_EXT_GET_PROC_ADDRESS("glAddSwapHintRectWIN"); + if (NULL == GLH_EXT_NAME(glAddSwapHintRectWIN)) + return FALSE; +#endif + +#ifdef WGL_ARB_pbuffer + } else if (0 == strcmp(extension, "WGL_ARB_pbuffer")) { +# ifdef _WIN32 + GLH_EXT_NAME(wglCreatePbufferARB) = (PFNWGLCREATEPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglCreatePbufferARB"); + if (NULL == GLH_EXT_NAME(wglCreatePbufferARB)) + return FALSE; +# endif +# ifdef _WIN32 + GLH_EXT_NAME(wglGetPbufferDCARB) = (PFNWGLGETPBUFFERDCARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetPbufferDCARB"); + if (NULL == GLH_EXT_NAME(wglGetPbufferDCARB)) + return FALSE; +# endif +# ifdef _WIN32 + GLH_EXT_NAME(wglReleasePbufferDCARB) = (PFNWGLRELEASEPBUFFERDCARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglReleasePbufferDCARB"); + if (NULL == GLH_EXT_NAME(wglReleasePbufferDCARB)) + return FALSE; +# endif +# ifdef _WIN32 + GLH_EXT_NAME(wglDestroyPbufferARB) = (PFNWGLDESTROYPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglDestroyPbufferARB"); + if (NULL == GLH_EXT_NAME(wglDestroyPbufferARB)) + return FALSE; +# endif +# ifdef _WIN32 + GLH_EXT_NAME(wglQueryPbufferARB) = (PFNWGLQUERYPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglQueryPbufferARB"); + if (NULL == GLH_EXT_NAME(wglQueryPbufferARB)) + return FALSE; +# endif +#endif + +#ifdef WGL_ARB_render_texture +# ifdef _WIN32 + GLH_EXT_NAME(wglBindTexImageARB) = (PFNWGLBINDTEXIMAGEARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglBindTexImageARB"); + if (NULL == GLH_EXT_NAME(wglBindTexImageARB)) + return FALSE; +# endif +# ifdef _WIN32 + GLH_EXT_NAME(wglReleaseTexImageARB) = (PFNWGLRELEASETEXIMAGEARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglReleaseTexImageARB"); + if (NULL == GLH_EXT_NAME(wglReleaseTexImageARB)) + return FALSE; +# endif +# ifdef _WIN32 + GLH_EXT_NAME(wglSetPbufferAttribARB) = (PFNWGLSETPBUFFERATTRIBARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglSetPbufferAttribARB"); + if (NULL == GLH_EXT_NAME(wglSetPbufferAttribARB)) + return FALSE; +# endif +#endif + +#ifdef WGL_ARB_pixel_format + } else if (0 == strcmp(extension, "WGL_ARB_pixel_format")) { +# ifdef _WIN32 + GLH_EXT_NAME(wglGetPixelFormatAttribivARB) = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetPixelFormatAttribivARB"); + if (NULL == GLH_EXT_NAME(wglGetPixelFormatAttribivARB)) + return FALSE; +# endif +# ifdef _WIN32 + GLH_EXT_NAME(wglGetPixelFormatAttribfvARB) = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetPixelFormatAttribfvARB"); + if (NULL == GLH_EXT_NAME(wglGetPixelFormatAttribfvARB)) + return FALSE; +# endif +# ifdef _WIN32 + GLH_EXT_NAME(wglChoosePixelFormatARB) = (PFNWGLCHOOSEPIXELFORMATARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglChoosePixelFormatARB"); + if (NULL == GLH_EXT_NAME(wglChoosePixelFormatARB)) + return FALSE; +# endif +#endif + + } else { + return FALSE; + } + return TRUE; +} +#endif + +#else // defined(__APPLE__) + +#ifdef GLH_EXT_SINGLE_FILE + +int glh_init_extension(const char* extension) +{ + // MBW -- XXX -- Should this check for extension availability? + return TRUE; +} +#endif // GLH_EXT_SINGLE_FILE + +#endif // defined(__APPLE__) + +#undef GLH_EXT_SINGLE_FILE + +#endif /* GLH_GENEXT_H */ diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 1c1e1b6f2b..d954bdf86b 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -417,8 +417,8 @@ void LLSplashScreen::hide() static std::set<LLWindow*> sWindowList; LLWindow* LLWindowManager::createWindow( - char *title, - char *name, + const char *title, + const char *name, LLCoordScreen upper_left, LLCoordScreen size, U32 flags, @@ -434,7 +434,7 @@ LLWindow* LLWindowManager::createWindow( } LLWindow* LLWindowManager::createWindow( - char *title, char *name, S32 x, S32 y, S32 width, S32 height, U32 flags, + const char *title, const char *name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 7a7c14fa35..9fc91d3643 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -325,8 +325,8 @@ class LLWindowManager { public: static LLWindow* createWindow( - char *title, - char *name, + const char *title, + const char *name, LLCoordScreen upper_left = LLCoordScreen(10, 10), LLCoordScreen size = LLCoordScreen(320, 240), U32 flags = 0, @@ -336,7 +336,7 @@ public: BOOL use_gl = TRUE, BOOL ignore_pixel_depth = FALSE); static LLWindow *createWindow( - char* title, char* name, S32 x, S32 y, S32 width, S32 height, + const char* title, const char* name, S32 x, S32 y, S32 width, S32 height, U32 flags = 0, BOOL fullscreen = FALSE, BOOL clearBg = FALSE, diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp index 1b55791467..77bee891b7 100644 --- a/indra/llwindow/llwindowheadless.cpp +++ b/indra/llwindow/llwindowheadless.cpp @@ -37,7 +37,7 @@ // // LLWindowHeadless // -LLWindowHeadless::LLWindowHeadless(char *title, char *name, S32 x, S32 y, S32 width, S32 height, +LLWindowHeadless::LLWindowHeadless(const char *title, const char *name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth) : LLWindow(fullscreen, flags) diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index a138814241..1970a03931 100644 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -99,7 +99,7 @@ public: /*virtual*/ void *getPlatformWindow() { return 0; }; /*virtual*/ void bringToFront() {}; - LLWindowHeadless(char *title, char *name, S32 x, S32 y, S32 width, S32 height, + LLWindowHeadless(const char *title, const char *name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth); virtual ~LLWindowHeadless(); diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 4940e06f39..22b594d745 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -29,8 +29,6 @@ * $/LicenseInfo$ */ -#if LL_DARWIN - #include "linden_common.h" #include <Carbon/Carbon.h> @@ -42,10 +40,6 @@ #include "llgl.h" #include "llstring.h" #include "lldir.h" -#include "llviewercontrol.h" - -#include "llglheaders.h" - #include "indra_constants.h" #include "llwindowmacosx-objc.h" @@ -66,6 +60,8 @@ const S32 MAX_NUM_RESOLUTIONS = 32; // LLWindowMacOSX // +BOOL LLWindowMacOSX::sUseMultGL = FALSE; + // Cross-platform bits: void show_window_creation_error(const char* title) @@ -242,7 +238,7 @@ static LLWindowMacOSX *gWindowImplementation = NULL; -LLWindowMacOSX::LLWindowMacOSX(char *title, char *name, S32 x, S32 y, S32 width, +LLWindowMacOSX::LLWindowMacOSX(const char *title, const char *name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, @@ -809,7 +805,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap); //enable multi-threaded OpenGL - if (gSavedSettings.getBOOL("RenderAppleUseMultGL")) + if (sUseMultGL) { CGLError cgl_err; CGLContextObj ctx = CGLGetCurrentContext(); @@ -3286,7 +3282,7 @@ void *LLWindowMacOSX::getPlatformWindow() dummywindowref = NewCWindow( NULL, &window_rect, - "\p", + (ConstStr255Param) "\p", false, // Create the window invisible. zoomDocProc, // Window with a grow box and a zoom box kLastWindowOfClass, // create it behind other windows @@ -3402,5 +3398,3 @@ std::string LLWindowMacOSX::getFontListSans() // The third filename is in UTF8, but it shows up in the font menu as "STHeiti Light" return "\xE3\x83\x92\xE3\x83\xA9\xE3\x82\xAD\xE3\x82\x99\xE3\x83\x8E\xE8\xA7\x92\xE3\x82\xB3\xE3\x82\x99 Pro W3.otf;\xE3\x83\x92\xE3\x83\xA9\xE3\x82\xAD\xE3\x82\x99\xE3\x83\x8E\xE8\xA7\x92\xE3\x82\xB3\xE3\x82\x99 ProN W3.otf;AppleGothic.dfont;AppleGothic.ttf;\xe5\x8d\x8e\xe6\x96\x87\xe7\xbb\x86\xe9\xbb\x91.ttf"; } - -#endif // LL_DARWIN diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 0534893aa7..171ec9864a 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -120,7 +120,7 @@ public: protected: LLWindowMacOSX( - char *title, char *name, int x, int y, int width, int height, U32 flags, + const char *title, const char *name, int x, int y, int width, int height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth, U32 fsaa_samples); @@ -203,6 +203,8 @@ protected: LangCode mTSMLangCode; LLPreeditor* mPreeditor; + static BOOL sUseMultGL; + friend class LLWindowManager; }; diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp index f32ca01888..b24d3b91f8 100644 --- a/indra/llwindow/llwindowmesaheadless.cpp +++ b/indra/llwindow/llwindowmesaheadless.cpp @@ -29,14 +29,11 @@ * $/LicenseInfo$ */ -#if LL_MESA_HEADLESS - #include "linden_common.h" #include "indra_constants.h" #include "llwindowmesaheadless.h" #include "llgl.h" -#include "llglheaders.h" #define MESA_CHANNEL_TYPE GL_UNSIGNED_SHORT #define MESA_CHANNEL_SIZE 2 @@ -46,7 +43,7 @@ U16 *gMesaBuffer = NULL; // // LLWindowMesaHeadless // -LLWindowMesaHeadless::LLWindowMesaHeadless(char *title, char *name, S32 x, S32 y, S32 width, S32 height, +LLWindowMesaHeadless::LLWindowMesaHeadless(const char *title, const char *name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth) : LLWindow(fullscreen, flags) @@ -83,5 +80,3 @@ void LLWindowMesaHeadless::swapBuffers() { glFinish(); } - -#endif diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index 4ed88d7b81..4ecc971abb 100644 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h @@ -103,7 +103,7 @@ public: /*virtual*/ void *getPlatformWindow() { return 0; }; /*virtual*/ void bringToFront() {}; - LLWindowMesaHeadless(char *title, char *name, S32 x, S32 y, S32 width, S32 height, + LLWindowMesaHeadless(const char *title, const char *name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth); ~LLWindowMesaHeadless(); diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 8ca0b4b4b8..50925dcebf 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -41,8 +41,6 @@ #include "lldir.h" #include "llfindlocale.h" -#include "llglheaders.h" - #include "indra_constants.h" #if LL_GTK @@ -219,7 +217,7 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card) -LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width, +LLWindowSDL::LLWindowSDL(const char *title, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 58bb93bbc7..f878ded891 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -134,7 +134,7 @@ public: protected: LLWindowSDL( - char *title, int x, int y, int width, int height, U32 flags, + const char *title, int x, int y, int width, int height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth, U32 fsaa_samples); ~LLWindowSDL(); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 841cac941a..3ed566062f 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -54,8 +54,6 @@ #include "llstring.h" #include "lldir.h" -#include "llglheaders.h" - #include "indra_constants.h" #include "llpreeditor.h" @@ -359,7 +357,7 @@ LLWinImm::~LLWinImm() } -LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width, +LLWindowWin32::LLWindowWin32(const char *title, const char *name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 38836e0d81..039774f138 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -120,7 +120,7 @@ public: protected: LLWindowWin32( - char *title, char *name, int x, int y, int width, int height, U32 flags, + const char *title, const char *name, int x, int y, int width, int height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth, U32 fsaa_samples); ~LLWindowWin32(); diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt new file mode 100644 index 0000000000..d86bc0d564 --- /dev/null +++ b/indra/llxml/CMakeLists.txt @@ -0,0 +1,36 @@ +# -*- cmake -*- + +project(llxml) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLXML) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ) + +set(llxml_SOURCE_FILES + llcontrol.cpp + llxmlnode.cpp + llxmlparser.cpp + llxmltree.cpp + ) + +set(llxml_HEADER_FILES + CMakeLists.txt + + llcontrol.h + llxmlnode.h + llxmlparser.h + llxmltree.h + ) + +set_source_files_properties(${llxml_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llxml_SOURCE_FILES ${llxml_HEADER_FILES}) + +add_library (llxml ${llxml_SOURCE_FILES}) diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 0429e30db6..ef6e32a7a0 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -49,7 +49,7 @@ #include "llxmltree.h" #include "llsdserialize.h" -#if LL_RELEASE_FOR_DOWNLOAD +#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG #define CONTROL_ERRS LL_WARNS("ControlErrors") #else #define CONTROL_ERRS LL_ERRS("ControlErrors") diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index 12160680f1..58cef95ce0 100644 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -79,6 +79,14 @@ typedef std::multimap<LLString, LLXMLNodePtr > LLXMLNodeList; typedef std::multimap<const LLStringTableEntry *, LLXMLNodePtr > LLXMLChildList; typedef std::map<const LLStringTableEntry *, LLXMLNodePtr, CompareAttributes> LLXMLAttribList; +class LLColor4; +class LLColor4U; +class LLQuaternion; +class LLVector3; +class LLVector3d; +class LLVector4; +class LLVector4U; + struct LLXMLChildren { LLXMLChildList map; // Map of children names->pointers diff --git a/indra/lscript/CMakeLists.txt b/indra/lscript/CMakeLists.txt new file mode 100644 index 0000000000..d3e3dc1103 --- /dev/null +++ b/indra/lscript/CMakeLists.txt @@ -0,0 +1,17 @@ +# -*- cmake -*- + +set(lscript_HEADER_FILES + lscript_alloc.h + lscript_byteconvert.h + lscript_byteformat.h + lscript_execute.h + lscript_export.h + lscript_http.h + lscript_library.h + lscript_rt_interface.h + ) + +add_subdirectory (lscript_compile) +add_subdirectory (lscript_execute) +add_subdirectory (lscript_library) + diff --git a/indra/lscript/lscript_byteformat.h b/indra/lscript/lscript_byteformat.h index 4e8f13f68a..6edf2b740d 100644 --- a/indra/lscript/lscript_byteformat.h +++ b/indra/lscript/lscript_byteformat.h @@ -515,7 +515,7 @@ typedef enum e_lscript_runtime_faults LSRF_EOF } LSCRIPTRunTimeFaults; -extern char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/ +extern const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/ const S32 LSCRIPTRunTimeFaultBits[LSRF_EOF] = { diff --git a/indra/lscript/lscript_compile/CMakeLists.txt b/indra/lscript/lscript_compile/CMakeLists.txt new file mode 100644 index 0000000000..3b144c5338 --- /dev/null +++ b/indra/lscript/lscript_compile/CMakeLists.txt @@ -0,0 +1,142 @@ +# -*- cmake -*- + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLInventory) +include(LScript) + +include(FindCygwin) + +find_program(FLEX flex + "C:/Program Files/GnuWin32/bin" + ${CYGWIN_INSTALL_PATH}/bin + /bin + /usr/bin + /usr/local/bin + ) +mark_as_advanced(FLEX) + +find_program(BISON bison + "C:/Program Files/GnuWin32/bin" + ${CYGWIN_INSTALL_PATH}/bin + /bin + /usr/bin + /usr/local/bin + ) +mark_as_advanced(BISON) + +find_program(M4 m4 + "C:/Program Files/GnuWin32/bin" + ${CYGWIN_INSTALL_PATH}/bin + /bin + /usr/bin + /usr/local/bin + ) +mark_as_advanced(M4) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLINVENTORY_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS} + ) + +set(lscript_compile_SOURCE_FILES + indra.l.cpp + indra.y.cpp + lscript_alloc.cpp + lscript_bytecode.cpp + lscript_error.cpp + lscript_heap.cpp + lscript_resource.cpp + lscript_scope.cpp + lscript_tree.cpp + lscript_typecheck.cpp + ) + +set(lscript_compile_HEADER_FILES + CMakeLists.txt + + indra.l + indra.y + + ../lscript_alloc.h + ../lscript_byteformat.h + ../lscript_byteconvert.h + ../lscript_http.h + + lscript_error.h + lscript_bytecode.h + lscript_heap.h + lscript_resource.h + lscript_scope.h + lscript_tree.h + lscript_typecheck.h + ) + +set_source_files_properties(${lscript_compile_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND lscript_compile_SOURCE_FILES ${lscript_compile_HEADER_FILES}) + +add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp + COMMAND ${FLEX} + ARGS + -o${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/indra.l + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/indra.l + ) + +if (WINDOWS) + set_source_files_properties(indra.l.cpp + PROPERTIES COMPILE_FLAGS /DYY_NO_UNISTD_H) +endif (WINDOWS) + +if (WINDOWS) + get_filename_component(M4_PATH ${M4} PATH) + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat + ${BISON} ${M4_PATH} + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + ) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/windows) +else (WINDOWS) + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + COMMAND + ${BISON} + ARGS + -d -o ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + ) +endif (WINDOWS) + +if (DARWIN) + # Mac OS X 10.4 compatibility + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + COMMAND + mv + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp.h + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + ) +endif (DARWIN) + +add_library (lscript_compile ${lscript_compile_SOURCE_FILES}) diff --git a/indra/lscript/lscript_compile/bison.bat b/indra/lscript/lscript_compile/bison.bat new file mode 100644 index 0000000000..54cf0231d9 --- /dev/null +++ b/indra/lscript/lscript_compile/bison.bat @@ -0,0 +1,11 @@ +@REM Run bison under Windows. This script is needed so that bison can +@REM find m4, even if neither program is present in PATH. + +@set bison=%1 +set M4PATH=%2 +set M4= +@set output=%3 +@set input=%4 + +set PATH=%M4PATH%;%PATH% +%bison% -d -o %output% %input% diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index ba10ef6fcc..eec3cb7bbf 100644 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -19,11 +19,7 @@ FS (f|F) #include "lscript_tree.h" #include "lscript_typecheck.h" #include "lscript_resource.h" -#if LL_WINDOWS -#include "ytab.h" -#else -#include "indra.y.h" -#endif +#include "indra.y.hpp" #include "lltimer.h" #include "indra_constants.h" #include "llagentconstants.h" diff --git a/indra/lscript/lscript_compile/lscript_bytecode.cpp b/indra/lscript/lscript_compile/lscript_bytecode.cpp index 5fe42fd9a8..4ff9849193 100644 --- a/indra/lscript/lscript_compile/lscript_bytecode.cpp +++ b/indra/lscript/lscript_compile/lscript_bytecode.cpp @@ -101,7 +101,7 @@ void LLScriptByteCodeChunk::addU16(U16 data) addBytes(temp, 2); } -void LLScriptByteCodeChunk::addBytes(U8 *bytes, S32 size) +void LLScriptByteCodeChunk::addBytes(const U8 *bytes, S32 size) { if (mCodeChunk) { @@ -118,7 +118,7 @@ void LLScriptByteCodeChunk::addBytes(U8 *bytes, S32 size) mCurrentOffset += size; } -void LLScriptByteCodeChunk::addBytes(char *bytes, S32 size) +void LLScriptByteCodeChunk::addBytes(const char *bytes, S32 size) { if (mCodeChunk) { diff --git a/indra/lscript/lscript_compile/lscript_bytecode.h b/indra/lscript/lscript_compile/lscript_bytecode.h index fcc5a23403..28505a12a9 100644 --- a/indra/lscript/lscript_compile/lscript_bytecode.h +++ b/indra/lscript/lscript_compile/lscript_bytecode.h @@ -56,8 +56,8 @@ public: void addByte(U8 byte); void addU16(U16 data); - void addBytes(U8 *bytes, S32 size); - void addBytes(char *bytes, S32 size); + void addBytes(const U8 *bytes, S32 size); + void addBytes(const char *bytes, S32 size); void addBytes(S32 size); void addBytesDontInc(S32 size); void addInteger(S32 value); diff --git a/indra/lscript/lscript_compile/lscript_error.cpp b/indra/lscript/lscript_compile/lscript_error.cpp index 62d36f74d7..309eb07dc2 100644 --- a/indra/lscript/lscript_compile/lscript_error.cpp +++ b/indra/lscript/lscript_compile/lscript_error.cpp @@ -49,13 +49,13 @@ void LLScriptFilePosition::fdotabs(LLFILE *fp, S32 tabs, S32 tabsize) } } -char* gWarningText[LSWARN_EOF] = /*Flawfinder: ignore*/ +const char* gWarningText[LSWARN_EOF] = /*Flawfinder: ignore*/ { "INVALID", "Dead code found beyond return statement" }; -char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/ +const char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/ { "INVALID", "Syntax error", diff --git a/indra/lscript/lscript_compile/lscript_scope.h b/indra/lscript/lscript_compile/lscript_scope.h index c55d99577a..5a629df021 100644 --- a/indra/lscript/lscript_compile/lscript_scope.h +++ b/indra/lscript/lscript_compile/lscript_scope.h @@ -277,14 +277,14 @@ public: class LLScriptScopeEntry { public: - LLScriptScopeEntry(char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type, S32 count = 0) + LLScriptScopeEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type, S32 count = 0) : mIdentifier(identifier), mIDType(idtype), mType(type), mOffset(0), mSize(0), mAssignable(NULL), mCount(count), mLibraryNumber(0) { } ~LLScriptScopeEntry() {} - char *mIdentifier; + const char *mIdentifier; LSCRIPTIdentifierType mIDType; LSCRIPTType mType; S32 mOffset; @@ -309,9 +309,9 @@ public: mEntryMap.deleteAllData(); } - LLScriptScopeEntry *addEntry(char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type) + LLScriptScopeEntry *addEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); if (!mEntryMap.checkData(name)) { if (idtype == LIT_FUNCTION) @@ -329,9 +329,9 @@ public: } } - BOOL checkEntry(char *identifier) + BOOL checkEntry(const char *identifier) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); if (mEntryMap.checkData(name)) { return TRUE; @@ -343,9 +343,9 @@ public: } } - LLScriptScopeEntry *findEntry(char *identifier) + LLScriptScopeEntry *findEntry(const char *identifier) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); LLScriptScope *scope = this; while (scope) @@ -360,9 +360,9 @@ public: return NULL; } - LLScriptScopeEntry *findEntryTyped(char *identifier, LSCRIPTIdentifierType idtype) + LLScriptScopeEntry *findEntryTyped(const char *identifier, LSCRIPTIdentifierType idtype) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); LLScriptScope *scope = this; while (scope) @@ -397,7 +397,7 @@ public: mParentScope = scope; } - LLMap<char *, LLScriptScopeEntry *> mEntryMap; + LLMap<const char *, LLScriptScopeEntry *> mEntryMap; LLScriptScope *mParentScope; LLStringTable *mSTable; S32 mFunctionCount; diff --git a/indra/lscript/lscript_compile/lscript_tree.cpp b/indra/lscript/lscript_compile/lscript_tree.cpp index f00a2e51e7..efbbe374ed 100644 --- a/indra/lscript/lscript_compile/lscript_tree.cpp +++ b/indra/lscript/lscript_compile/lscript_tree.cpp @@ -9804,7 +9804,7 @@ void LLScriptScript::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa mGlobalScope = new LLScriptScope(gScopeStringTable); // zeroth, add library functions to global scope S32 i; - char *arg; + const char *arg; LLScriptScopeEntry *sentry; for (i = 0; i < gScriptLibrary.mNextNumber; i++) { diff --git a/indra/lscript/lscript_compile/windows/unistd.h b/indra/lscript/lscript_compile/windows/unistd.h new file mode 100644 index 0000000000..b8034039e6 --- /dev/null +++ b/indra/lscript/lscript_compile/windows/unistd.h @@ -0,0 +1,29 @@ +/** + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +/* After all that, this file is empty. */ diff --git a/indra/lscript/lscript_execute.h b/indra/lscript/lscript_execute.h index 5048f5a8d9..dd1aa97e71 100644 --- a/indra/lscript/lscript_execute.h +++ b/indra/lscript/lscript_execute.h @@ -372,7 +372,7 @@ public: ~LLScriptExecute(); void init(); - U32 run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL &state_transition); + U32 run(BOOL b_print, const LLUUID &id, const char **errorstr, BOOL &state_transition); BOOL (*mExecuteFuncs[0x100])(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id); diff --git a/indra/lscript/lscript_execute/CMakeLists.txt b/indra/lscript/lscript_execute/CMakeLists.txt new file mode 100644 index 0000000000..f30915bab0 --- /dev/null +++ b/indra/lscript/lscript_execute/CMakeLists.txt @@ -0,0 +1,34 @@ +# -*- cmake -*- + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LScript) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS} + ) + +set(lscript_execute_SOURCE_FILES + lscript_execute.cpp + lscript_heapruntime.cpp + lscript_readlso.cpp + ) + +set(lscript_execute_HEADER_FILES + CMakeLists.txt + + ../lscript_execute.h + ../lscript_rt_interface.h + lscript_heapruntime.h + lscript_readlso.h + ) + +set_source_files_properties(${lscript_execute_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND lscript_execute_SOURCE_FILES ${lscript_execute_HEADER_FILES}) + +add_library (lscript_execute ${lscript_execute_SOURCE_FILES}) diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index f1c0ead118..77e24cd8f4 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -43,7 +43,7 @@ void (*binary_operations[LST_EOF][LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); void (*unary_operations[LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); -char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ +const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ { "invalid", // LSRF_INVALID, "Math Error", // LSRF_MATH, @@ -296,7 +296,7 @@ void LLScriptExecute::setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEv S32 lscript_push_variable(LLScriptLibData *data, U8 *buffer); -U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL &state_transition) +U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, const char **errorstr, BOOL &state_transition) { // is there a fault? // if yes, print out message and exit @@ -3687,7 +3687,7 @@ void lscript_run(char *filename, BOOL b_debug) } else { - char *error; + const char *error; BOOL b_state; LLScriptExecute *execute = NULL; diff --git a/indra/lscript/lscript_library.h b/indra/lscript/lscript_library.h index d9702ced84..48a566de3e 100644 --- a/indra/lscript/lscript_library.h +++ b/indra/lscript/lscript_library.h @@ -43,16 +43,16 @@ class LLScriptLibData; class LLScriptLibraryFunction { public: - LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only = FALSE); + LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, const char *desc, BOOL god_only = FALSE); ~LLScriptLibraryFunction(); F32 mEnergyUse; F32 mSleepTime; void (*mExecFunc)(LLScriptLibData *, LLScriptLibData *, const LLUUID &); - char *mName; - char *mReturnType; - char *mArgs; - char *mDesc; + const char *mName; + const char *mReturnType; + const char *mArgs; + const char *mDesc; BOOL mGodOnly; }; @@ -65,7 +65,7 @@ public: void init(); void addFunction(LLScriptLibraryFunction *func); - void assignExec(char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)); + void assignExec(const char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)); S32 mNextNumber; LLScriptLibraryFunction **mFunctions; @@ -365,7 +365,7 @@ public: void print(std::ostream &s, BOOL b_prepend_comma); void print_separator(std::ostream& ostr, BOOL b_prepend_sep, char* sep); - void setFromCSV(char *src) + void setFromCSV(const char *src) { mType = LST_STRING; mString = new char[strlen(src) + 1]; /* Flawfinder: ignore */ @@ -391,25 +391,6 @@ public: id.toString(mKey); } - LLScriptLibData(char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) - { - if (!string) - { - mString = new char[1]; - mString[0] = 0; - } - else - { - mString = new char[strlen(string) + 1]; /* Flawfinder: ignore */ - if (mString == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } - strcpy(mString, string); /* Flawfinder: ignore */ - } - } - LLScriptLibData(const char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) { if (!string) diff --git a/indra/lscript/lscript_library/CMakeLists.txt b/indra/lscript/lscript_library/CMakeLists.txt new file mode 100644 index 0000000000..f6bc67a994 --- /dev/null +++ b/indra/lscript/lscript_library/CMakeLists.txt @@ -0,0 +1,32 @@ +# -*- cmake -*- + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LScript) + +set(lscript_library_SOURCE_FILES + lscript_alloc.cpp + lscript_export.cpp + lscript_library.cpp + ) + +set(lscript_library_HEADER_FILES + CMakeLists.txt + + ../lscript_library.h + ../lscript_export.h + ) + +set_source_files_properties(${lscript_library_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND lscript_library_SOURCE_FILES ${lscript_library_HEADER_FILES}) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS} + ) + +add_library (lscript_library ${lscript_library_SOURCE_FILES}) diff --git a/indra/lscript/lscript_library/lscript_library.cpp b/indra/lscript/lscript_library/lscript_library.cpp index 3a5b6eacc0..0b357c9182 100644 --- a/indra/lscript/lscript_library/lscript_library.cpp +++ b/indra/lscript/lscript_library/lscript_library.cpp @@ -468,14 +468,14 @@ void LLScriptLibrary::init() //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForSale", "i", "ii", "integer llSetForSale(integer selltype, integer price)\nSets this object for sale in mode selltype for price. Returns TRUE if successfully set for sale.")); -LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only) +LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, const char *desc, BOOL god_only) : mEnergyUse(eu), mSleepTime(st), mExecFunc(exec_func), mName(name), mReturnType(ret_type), mArgs(args), mGodOnly(god_only) { - mDesc = new char[512]; + char *mDesc_ = new char[512]; if (mSleepTime) { snprintf( /* Flawfinder: ignore */ - mDesc, + mDesc_, 512, "%s\nSleeps script for %.1f seconds.", desc, @@ -483,9 +483,10 @@ LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_fun } else { - strncpy(mDesc, desc, 512); /* Flawfinder: ignore */ - mDesc[511] = '\0'; // just in case. + strncpy(mDesc_, desc, 512); /* Flawfinder: ignore */ + mDesc_[511] = '\0'; // just in case. } + mDesc = mDesc_; } LLScriptLibraryFunction::~LLScriptLibraryFunction() @@ -509,7 +510,7 @@ void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func) mNextNumber++; } -void LLScriptLibrary::assignExec(char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)) +void LLScriptLibrary::assignExec(const char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)) { S32 i; for (i = 0; i < mNextNumber; i++) diff --git a/indra/mac_crash_logger/CMakeLists.txt b/indra/mac_crash_logger/CMakeLists.txt new file mode 100644 index 0000000000..c8eb17e325 --- /dev/null +++ b/indra/mac_crash_logger/CMakeLists.txt @@ -0,0 +1,50 @@ +# -*- cmake -*- + +project(mac_crash_logger) + +include(00-Common) +include(Boost) +include(LLCommon) +include(LLCrashLogger) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLXML) +include(Linking) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLCRASHLOGGER_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(mac_crash_logger_SOURCE_FILES + mac_crash_logger.cpp + llcrashloggermac.cpp + ) + +set(mac_crash_logger_HEADER_FILES + CMakeLists.txt + + llcrashloggermac.h + ) + +set_source_files_properties(${mac_crash_logger_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND mac_crash_logger_SOURCE_FILES ${mac_crash_logger_HEADER_FILES}) + +add_executable(mac-crash-logger ${mac_crash_logger_SOURCE_FILES}) + +target_link_libraries(mac-crash-logger + ${LLCRASHLOGGER_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLXML_LIBRARIES} + ${LLMESSAGE_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${BOOST_SIGNALS_LIBRARY} + ) diff --git a/indra/mac_updater/CMakeLists.txt b/indra/mac_updater/CMakeLists.txt new file mode 100644 index 0000000000..39aa4d2b15 --- /dev/null +++ b/indra/mac_updater/CMakeLists.txt @@ -0,0 +1,49 @@ +# -*- cmake -*- + +project(mac_updater) + +include(00-Common) +include(CURL) +include(LLCommon) +include(LLVFS) +include(Linking) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ) + +set(mac_updater_SOURCE_FILES + mac_updater.cpp + FSCopyObject.c + GenLinkedList.c + MoreFilesX.c + ) + +set(mac_updater_HEADER_FILES + CMakeLists.txt + + FSCopyObject.h + GenLinkedList.h + MoreFilesX.h + ) + +set_source_files_properties( + FSCopyObject.c + MoreFilesX.c + PROPERTIES + COMPILE_FLAGS -Wno-deprecated-declarations + ) + +set_source_files_properties(${mac_updater_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND mac_updater_SOURCE_FILES ${mac_updater_HEADER_FILES}) + +add_executable(mac-updater ${mac_updater_SOURCE_FILES}) + +target_link_libraries(mac-updater + ${LLVFS_LIBRARIES} + ${CURL_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt new file mode 100644 index 0000000000..1ce41c044b --- /dev/null +++ b/indra/newview/CMakeLists.txt @@ -0,0 +1,1429 @@ +# -*- cmake -*- + +project(viewer) + +include(00-Common) +include(Boost) +include(BuildVersion) +include(DirectX) +include(ELFIO) +include(FMOD) +include(FindOpenGL) +include(LLAudio) +include(LLCharacter) +include(LLCommon) +include(LLImage) +include(LLImageJ2COJ) +include(LLInventory) +include(LLMath) +include(LLMedia) +include(LLMessage) +include(LLPrimitive) +include(LLRender) +include(LLUI) +include(LLVFS) +include(LLWindow) +include(LLXML) +include(LScript) +include(Linking) +include(Mozlib) +include(NDOF) +include(Smartheap) +include(TemplateCheck) +include(UI) +include(UnixInstall) +include(LLKDU) + +include_directories( + ${ELFIO_INCLUDE_DIR} + ${LLAUDIO_INCLUDE_DIRS} + ${LLCHARACTER_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${LLINVENTORY_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMEDIA_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLPRIMITIVE_INCLUDE_DIRS} + ${LLRENDER_INCLUDE_DIRS} + ${LLUI_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLWINDOW_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS}/lscript_compile + ) + +set(viewer_SOURCE_FILES + llagent.cpp + llagentdata.cpp + llagentlanguage.cpp + llagentpilot.cpp + llanimstatelabels.cpp + llappviewer.cpp + llassetuploadresponders.cpp + llaudiosourcevo.cpp + llbbox.cpp + llbox.cpp + llcallbacklist.cpp + llcallingcard.cpp + llcaphttpsender.cpp + llchatbar.cpp + llclassifiedinfo.cpp + llclassifiedstatsresponder.cpp + llcloud.cpp + llcolorscheme.cpp + llcolorswatch.cpp + llcommandhandler.cpp + llcommandlineparser.cpp + llcompass.cpp + llcompilequeue.cpp + llconfirmationmanager.cpp + llconsole.cpp + llcontainerview.cpp + llcubemap.cpp + llcurrencyuimanager.cpp + llcylinder.cpp + lldebugmessagebox.cpp + lldebugview.cpp + lldelayedgestureerror.cpp + lldirpicker.cpp + lldrawable.cpp + lldrawpoolalpha.cpp + lldrawpoolavatar.cpp + lldrawpoolbump.cpp + lldrawpool.cpp + lldrawpoolground.cpp + lldrawpoolsimple.cpp + lldrawpoolsky.cpp + lldrawpoolterrain.cpp + lldrawpooltree.cpp + lldrawpoolwater.cpp + lldrawpoolwlsky.cpp + lldriverparam.cpp + lldynamictexture.cpp + llemote.cpp + lleventinfo.cpp + lleventnotifier.cpp + lleventpoll.cpp + llface.cpp + llfasttimerview.cpp + llfeaturemanager.cpp + llfilepicker.cpp + llfirstuse.cpp + llflexibleobject.cpp + llfloaterabout.cpp + llfloateractivespeakers.cpp + llfloateranimpreview.cpp + llfloaterauction.cpp + llfloateravatarinfo.cpp + llfloateravatarpicker.cpp + llfloateravatartextures.cpp + llfloaterbuildoptions.cpp + llfloaterbump.cpp + llfloaterbuycontents.cpp + llfloaterbuy.cpp + llfloaterbuycurrency.cpp + llfloaterbuyland.cpp + llfloatercamera.cpp + llfloaterchat.cpp + llfloaterchatterbox.cpp + llfloaterclassified.cpp + llfloaterclothing.cpp + llfloatercolorpicker.cpp + llfloatercustomize.cpp + llfloaterdaycycle.cpp + llfloaterdirectory.cpp + llfloatereditui.cpp + llfloaterenvsettings.cpp + llfloaterevent.cpp + llfloaterfriends.cpp + llfloatergesture.cpp + llfloatergodtools.cpp + llfloatergroupinfo.cpp + llfloatergroupinvite.cpp + llfloatergroups.cpp + llfloaterhardwaresettings.cpp + llfloaterhtml.cpp + llfloaterhtmlhelp.cpp + llfloaterhud.cpp + llfloaterimagepreview.cpp + llfloaterinspect.cpp + llfloaterjoystick.cpp + llfloaterlagmeter.cpp + llfloaterland.cpp + llfloaterlandholdings.cpp + llfloaterlandmark.cpp + llfloatermap.cpp + llfloatermute.cpp + llfloaternamedesc.cpp + llfloaternewim.cpp + llfloateropenobject.cpp + llfloaterparcel.cpp + llfloaterpermissionsmgr.cpp + llfloaterpostcard.cpp + llfloaterpostprocess.cpp + llfloaterpreference.cpp + llfloaterproperties.cpp + llfloaterregioninfo.cpp + llfloaterreleasemsg.cpp + llfloaterreporter.cpp + llfloaterscriptdebug.cpp + llfloatersellland.cpp + llfloatersettingsdebug.cpp + llfloatersnapshot.cpp + llfloaterstats.cpp + llfloatertelehub.cpp + llfloatertest.cpp + llfloatertools.cpp + llfloatertopobjects.cpp + llfloatertos.cpp + llfloaterurldisplay.cpp + llfloaterurlentry.cpp + llfloatervoicedevicesettings.cpp + llfloaterwater.cpp + llfloaterwindlight.cpp + llfloaterworldmap.cpp + llfolderview.cpp + llfollowcam.cpp + llframestats.cpp + llframestatview.cpp + llgenepool.cpp + llgesturemgr.cpp + llgivemoney.cpp + llglsandbox.cpp + llglslshader.cpp + llgroupmgr.cpp + llgroupnotify.cpp + llhippo.cpp + llhoverview.cpp + llhudeffectbeam.cpp + llhudeffect.cpp + llhudeffectlookat.cpp + llhudeffectpointat.cpp + llhudeffecttrail.cpp + llhudicon.cpp + llhudmanager.cpp + llhudobject.cpp + llhudrender.cpp + llhudtext.cpp + llhudview.cpp + llimpanel.cpp + llimview.cpp + llinventoryactions.cpp + llinventorybridge.cpp + llinventoryclipboard.cpp + llinventorymodel.cpp + llinventoryview.cpp + lljoystickbutton.cpp + lllandmarklist.cpp + lllogchat.cpp + llmanip.cpp + llmaniprotate.cpp + llmanipscale.cpp + llmaniptranslate.cpp + llmapresponders.cpp + llmediaremotectrl.cpp + llmemoryview.cpp + llmenucommands.cpp + llmimetypes.cpp + llmorphview.cpp + llmoveview.cpp + llmutelist.cpp + llnamebox.cpp + llnameeditor.cpp + llnamelistctrl.cpp + llnetmap.cpp + llnotify.cpp + lloverlaybar.cpp + llpanelaudioprefs.cpp + llpanelaudiovolume.cpp + llpanelavatar.cpp + llpanelclassified.cpp + llpanelcontents.cpp + llpaneldebug.cpp + llpaneldirbrowser.cpp + llpaneldirclassified.cpp + llpaneldirevents.cpp + llpaneldirfind.cpp + llpaneldirgroups.cpp + llpaneldirland.cpp + llpaneldirpeople.cpp + llpaneldirplaces.cpp + llpaneldirpopular.cpp + llpaneldisplay.cpp + llpanelevent.cpp + llpanelface.cpp + llpanelgeneral.cpp + llpanelgroup.cpp + llpanelgroupgeneral.cpp + llpanelgroupinvite.cpp + llpanelgrouplandmoney.cpp + llpanelgroupnotices.cpp + llpanelgrouproles.cpp + llpanelgroupvoting.cpp + llpanelinput.cpp + llpanelinventory.cpp + llpanelland.cpp + llpanellandmedia.cpp + llpanellandobjects.cpp + llpanellandoptions.cpp + llpanellogin.cpp + llpanelmorph.cpp + llpanelmsgs.cpp + llpanelnetwork.cpp + llpanelobject.cpp + llpanelpermissions.cpp + llpanelpick.cpp + llpanelplace.cpp + llpanelvolume.cpp + llpanelweb.cpp + llparcelselection.cpp + llpatchvertexarray.cpp + llpolymesh.cpp + llpolymorph.cpp + llpostprocess.cpp + llprefschat.cpp + llprefsim.cpp + llprefsvoice.cpp + llpreviewanim.cpp + llpreview.cpp + llpreviewgesture.cpp + llpreviewlandmark.cpp + llpreviewnotecard.cpp + llpreviewscript.cpp + llpreviewsound.cpp + llpreviewtexture.cpp + llprogressview.cpp + llregionposition.cpp + llrendersphere.cpp + llremoteparcelrequest.cpp + llsavedsettingsglue.cpp + llselectmgr.cpp + llsky.cpp + llspatialpartition.cpp + llsprite.cpp + llsrv.cpp + llstartup.cpp + llstatbar.cpp + llstatgraph.cpp + llstatusbar.cpp + llstatview.cpp + llstylemap.cpp + llsurface.cpp + llsurfacepatch.cpp + lltexlayer.cpp + lltexturecache.cpp + lltexturectrl.cpp + lltexturefetch.cpp + lltextureview.cpp + lltoolbar.cpp + lltoolbrush.cpp + lltoolcomp.cpp + lltool.cpp + lltooldraganddrop.cpp + lltoolface.cpp + lltoolfocus.cpp + lltoolgrab.cpp + lltoolgun.cpp + lltoolindividual.cpp + lltoolmgr.cpp + lltoolmorph.cpp + lltoolobjpicker.cpp + lltoolpie.cpp + lltoolpipette.cpp + lltoolplacer.cpp + lltoolselect.cpp + lltoolselectland.cpp + lltoolselectrect.cpp + lltoolview.cpp + lltracker.cpp + lltrans.cpp + lluploaddialog.cpp + llurl.cpp + llurldispatcher.cpp + llurlhistory.cpp + llurlsimstring.cpp + llurlwhitelist.cpp + lluserauth.cpp + llvectorperfoptions.cpp + llvelocitybar.cpp + llviewchildren.cpp + llviewerassetstorage.cpp + llvieweraudio.cpp + llviewercamera.cpp + llviewercontrol.cpp + llviewerdisplay.cpp + llviewergenericmessage.cpp + llviewergesture.cpp + llviewerimage.cpp + llviewerimagelist.cpp + llviewerinventory.cpp + llviewerjointattachment.cpp + llviewerjoint.cpp + llviewerjointmesh.cpp + llviewerjointmesh_sse2.cpp + llviewerjointmesh_sse.cpp + llviewerjointmesh_vec.cpp + llviewerjoystick.cpp + llviewerkeyboard.cpp + llviewerlayer.cpp + llviewermedia.cpp + llviewermenu.cpp + llviewermenufile.cpp + llviewermessage.cpp + llviewernetwork.cpp + llviewerobject.cpp + llviewerobjectlist.cpp + llviewerparcelmedia.cpp + llviewerparcelmediaautoplay.cpp + llviewerparcelmgr.cpp + llviewerparceloverlay.cpp + llviewerpartsim.cpp + llviewerpartsource.cpp + llviewerprecompiledheaders.cpp + llviewerregion.cpp + llviewerstats.cpp + llviewertexteditor.cpp + llviewertextureanim.cpp + llviewerthrottle.cpp + llviewervisualparam.cpp + llviewerwindow.cpp + llvlcomposition.cpp + llvlmanager.cpp + llvoavatar.cpp + llvocache.cpp + llvoclouds.cpp + llvograss.cpp + llvoground.cpp + llvoiceclient.cpp + llvoiceremotectrl.cpp + llvoicevisualizer.cpp + llvoinventorylistener.cpp + llvopartgroup.cpp + llvosky.cpp + llvosurfacepatch.cpp + llvotextbubble.cpp + llvotree.cpp + llvovolume.cpp + llvowater.cpp + llvowlsky.cpp + llwatchdog.cpp + llwaterparammanager.cpp + llwaterparamset.cpp + llwearable.cpp + llwearablelist.cpp + llweb.cpp + llwebbrowserctrl.cpp + llwind.cpp + llwlanimator.cpp + llwldaycycle.cpp + llwlparammanager.cpp + llwlparamset.cpp + llworld.cpp + llworldmap.cpp + llworldmapview.cpp + llxmlrpctransaction.cpp + noise.cpp + pipeline.cpp + ) + +if (LINUX) + # We can't set these flags for Darwin, because they get passed to + # the PPC compiler. Ugh. + + set_source_files_properties( + llviewerjointmesh_sse.cpp + PROPERTIES COMPILE_FLAGS "-msse -mfpmath=sse" + ) + set_source_files_properties( + llviewerjointmesh_sse2.cpp + PROPERTIES COMPILE_FLAGS "-msse2 -mfpmath=sse" + ) +endif (LINUX) + +set(viewer_HEADER_FILES + CMakeLists.txt + ViewerInstall.cmake + + llagent.h + llagentdata.h + llagentlanguage.h + llagentpilot.h + llanimstatelabels.h + llappearance.h + llappviewer.h + llassetuploadresponders.h + llaudiosourcevo.h + llbbox.h + llbox.h + llcallbacklist.h + llcallingcard.h + llcaphttpsender.h + llchatbar.h + llclassifiedinfo.h + llclassifiedstatsresponder.h + llcloud.h + llcolorscheme.h + llcolorswatch.h + llcommandhandler.h + llcommandlineparser.h + llcompass.h + llcompilequeue.h + llconfirmationmanager.h + llconsole.h + llcontainerview.h + llcubemap.h + llcurrencyuimanager.h + llcylinder.h + lldebugmessagebox.h + lldebugview.h + lldelayedgestureerror.h + lldirpicker.h + lldrawable.h + lldrawpool.h + lldrawpoolalpha.h + lldrawpoolavatar.h + lldrawpoolbump.h + lldrawpoolclouds.h + lldrawpoolground.h + lldrawpoolsimple.h + lldrawpoolsky.h + lldrawpoolterrain.h + lldrawpooltree.h + lldrawpoolwater.h + lldrawpoolwlsky.h + lldriverparam.h + lldynamictexture.h + llemote.h + lleventinfo.h + lleventnotifier.h + lleventpoll.h + llface.h + llfasttimerview.h + llfeaturemanager.h + llfilepicker.h + llfirstuse.h + llflexibleobject.h + llfloaterabout.h + llfloateractivespeakers.h + llfloateranimpreview.h + llfloaterauction.h + llfloateravatarinfo.h + llfloateravatarpicker.h + llfloateravatartextures.h + llfloaterbuildoptions.h + llfloaterbump.h + llfloaterbuy.h + llfloaterbuycontents.h + llfloaterbuycurrency.h + llfloaterbuyland.h + llfloatercamera.h + llfloaterchat.h + llfloaterchatterbox.h + llfloaterclassified.h + llfloaterclothing.h + llfloatercolorpicker.h + llfloatercustomize.h + llfloaterdaycycle.h + llfloaterdirectory.h + llfloatereditui.h + llfloaterenvsettings.h + llfloaterevent.h + llfloaterfriends.h + llfloatergesture.h + llfloatergodtools.h + llfloatergroupinfo.h + llfloatergroupinvite.h + llfloatergroups.h + llfloaterhardwaresettings.h + llfloaterhtml.h + llfloaterhtmlhelp.h + llfloaterhud.h + llfloaterimagepreview.h + llfloaterinspect.h + llfloaterjoystick.h + llfloaterlagmeter.h + llfloaterland.h + llfloaterlandholdings.h + llfloaterlandmark.h + llfloatermap.h + llfloatermute.h + llfloaternamedesc.h + llfloaternewim.h + llfloateropenobject.h + llfloaterparcel.h + llfloaterpermissionsmgr.h + llfloaterpostcard.h + llfloaterpostprocess.h + llfloaterpreference.h + llfloaterproperties.h + llfloaterregioninfo.h + llfloaterreleasemsg.h + llfloaterreporter.h + llfloaterscriptdebug.h + llfloatersellland.h + llfloatersettingsdebug.h + llfloatersnapshot.h + llfloaterstats.h + llfloatertelehub.h + llfloatertest.h + llfloatertools.h + llfloatertopobjects.h + llfloatertos.h + llfloaterurldisplay.h + llfloaterurlentry.h + llfloatervoicedevicesettings.h + llfloaterwater.h + llfloaterwindlight.h + llfloaterworldmap.h + llfolderview.h + llfollowcam.h + llframestats.h + llframestatview.h + llgenepool.h + llgesturemgr.h + llgivemoney.h + llglslshader.h + llgroupmgr.h + llgroupnotify.h + llhippo.h + llhoverview.h + llhudeffect.h + llhudeffectbeam.h + llhudeffectlookat.h + llhudeffectpointat.h + llhudeffecttrail.h + llhudicon.h + llhudmanager.h + llhudobject.h + llhudrender.h + llhudtext.h + llhudview.h + llimpanel.h + llimview.h + llinventorybridge.h + llinventoryclipboard.h + llinventorymodel.h + llinventoryview.h + lljoystickbutton.h + lllandmarklist.h + lllightconstants.h + lllogchat.h + llmanip.h + llmaniprotate.h + llmanipscale.h + llmaniptranslate.h + llmapresponders.h + llmediaremotectrl.h + llmemoryview.h + llmenucommands.h + llmimetypes.h + llmorphview.h + llmoveview.h + llmutelist.h + llnamebox.h + llnameeditor.h + llnamelistctrl.h + llnetmap.h + llnotify.h + lloverlaybar.h + llpanelaudioprefs.h + llpanelaudiovolume.h + llpanelavatar.h + llpanelclassified.h + llpanelcontents.h + llpaneldebug.h + llpaneldirbrowser.h + llpaneldirclassified.h + llpaneldirevents.h + llpaneldirfind.h + llpaneldirgroups.h + llpaneldirland.h + llpaneldirpeople.h + llpaneldirplaces.h + llpaneldirpopular.h + llpaneldisplay.h + llpanelevent.h + llpanelface.h + llpanelgeneral.h + llpanelgroup.h + llpanelgroupgeneral.h + llpanelgroupinvite.h + llpanelgrouplandmoney.h + llpanelgroupnotices.h + llpanelgrouproles.h + llpanelgroupvoting.h + llpanelinput.h + llpanelinventory.h + llpanelland.h + llpanellandmedia.h + llpanellandobjects.h + llpanellandoptions.h + llpanelLCD.h + llpanellogin.h + llpanelmorph.h + llpanelmsgs.h + llpanelnetwork.h + llpanelobject.h + llpanelpermissions.h + llpanelpick.h + llpanelplace.h + llpanelvolume.h + llpanelweb.h + llparcelselection.h + llpatchvertexarray.h + llpostprocess.h + llpolymesh.h + llpolymorph.h + llprefschat.h + llprefsim.h + llprefsvoice.h + llpreview.h + llpreviewanim.h + llpreviewgesture.h + llpreviewlandmark.h + llpreviewnotecard.h + llpreviewscript.h + llpreviewsound.h + llpreviewtexture.h + llprogressview.h + llregionposition.h + llremoteparcelrequest.h + llrendersphere.h + llresourcedata.h + llsavedsettingsglue.h + llselectmgr.h + llsky.h + llspatialpartition.h + llsprite.h + llsrv.h + llstartup.h + llstatbar.h + llstatgraph.h + llstatusbar.h + llstatview.h + llstylemap.h + llsurface.h + llsurfacepatch.h + lltable.h + lltexlayer.h + lltexturecache.h + lltexturectrl.h + lltexturefetch.h + lltextureview.h + lltool.h + lltoolbar.h + lltoolbrush.h + lltoolcomp.h + lltooldraganddrop.h + lltoolface.h + lltoolfocus.h + lltoolgrab.h + lltoolgun.h + lltoolindividual.h + lltoolmgr.h + lltoolmorph.h + lltoolobjpicker.h + lltoolpie.h + lltoolpipette.h + lltoolplacer.h + lltoolselect.h + lltoolselectland.h + lltoolselectrect.h + lltoolview.h + lltracker.h + lltrans.h + lluiconstants.h + lluploaddialog.h + llurl.h + llurldispatcher.h + llurlhistory.h + llurlsimstring.h + llurlwhitelist.h + lluserauth.h + llvectorperfoptions.h + llvelocitybar.h + llviewchildren.h + llviewerassetstorage.h + llvieweraudio.h + llviewerbuild.h + llviewercamera.h + llviewercontrol.h + llviewerdisplay.h + llviewergenericmessage.h + llviewergesture.h + llviewerimage.h + llviewerimagelist.h + llviewerinventory.h + llviewerjoint.h + llviewerjointattachment.h + llviewerjointmesh.h + llviewerjoystick.h + llviewerkeyboard.h + llviewerlayer.h + llviewermedia.h + llviewermenu.h + llviewermenufile.h + llviewermessage.h + llviewernetwork.h + llviewerobject.h + llviewerobjectlist.h + llviewerparcelmedia.h + llviewerparcelmediaautoplay.h + llviewerparcelmgr.h + llviewerparceloverlay.h + llviewerpartsim.h + llviewerpartsource.h + llviewerprecompiledheaders.h + llviewerregion.h + llviewerstats.h + llviewertexteditor.h + llviewertextureanim.h + llviewerthrottle.h + llviewervisualparam.h + llviewerwindow.h + llvlcomposition.h + llvlmanager.h + llvoavatar.h + llvocache.h + llvoclouds.h + llvograss.h + llvoground.h + llvoiceclient.h + llvoiceremotectrl.h + llvoicevisualizer.h + llvoinventorylistener.h + llvopartgroup.h + llvosky.h + llvosurfacepatch.h + llvotextbubble.h + llvotree.h + llvotreenew.h + llvovolume.h + llvowater.h + llvowlsky.h + llwatchdog.h + llwaterparammanager.h + llwaterparamset.h + llwearable.h + llwearablelist.h + llweb.h + llwebbrowserctrl.h + llwind.h + llwindebug.h + llwlanimator.h + llwldaycycle.h + llwlparammanager.h + llwlparamset.h + llworld.h + llworldmap.h + llworldmapview.h + llxmlrpctransaction.h + macmain.h + noise.h + pipeline.h + randgauss.h + VertexCache.h + VorbisFramework.h + ) + +source_group("CMake Rules" FILES ViewerInstall.cmake) + +if (DARWIN) + LIST(APPEND viewer_SOURCE_FILES llappviewermacosx.cpp) + + find_library(AGL_LIBRARY AGL) + find_library(APPKIT_LIBRARY AppKit) + find_library(COCOA_LIBRARY Cocoa) + find_library(IOKIT_LIBRARY IOKit) + + set(viewer_LIBRARIES + ${COCOA_LIBRARY} + ${AGL_LIBRARY} + ${IOKIT_LIBRARY} + ) + + # Add resource files to the project. + set(viewer_RESOURCE_FILES + secondlife.icns + macview.r + gpu_table.txt + Info-SecondLife.plist + SecondLife.nib/ + # CMake doesn't seem to support Xcode language variants well just yet + English.lproj/InfoPlist.strings + English.lproj/language.txt + German.lproj/language.txt + Japanese.lproj/language.txt + Korean.lproj/language.txt + ) + set_source_files_properties( + ${viewer_RESOURCE_FILES} + PROPERTIES + HEADER_FILE_ONLY TRUE + #MACOSX_PACKAGE_LOCATION Resources #don't do this! this tells cmake to copy the files. + ) + SOURCE_GROUP("Resources" FILES ${viewer_RESOURCE_FILES}) + list(APPEND viewer_SOURCE_FILES ${viewer_RESOURCE_FILES}) +endif (DARWIN) + +if (LINUX) + LIST(APPEND viewer_SOURCE_FILES llappviewerlinux.cpp) + LIST(APPEND CMAKE_EXE_LINKER_FLAGS -Wl,--as-needed) + + set(viewer_LIBRARIES + Xinerama + ) +endif (LINUX) + +if (WINDOWS) + list(APPEND viewer_SOURCE_FILES + llappviewerwin32.cpp + llwindebug.cpp + ) + + list(APPEND viewer_HEADER_FILES + llappviewerwin32.h + llwindebug.h + ) + + # Add resource files to the project. + # viewerRes.rc is the only buildable file, but + # the rest are all dependencies of it. + set(viewer_RESOURCE_FILES + res/arrow.cur + res/arrowcop.cur + res/arrowcopmulti.cur + res/arrowdrag.cur + res/bitmap2.bmp + res/circleandline.cur + res/icon1.ico + res/install_icon.BMP + res/install_icon.ico + res/llarrow.cur + res/llarrowdrag.cur + res/llarrowdragmulti.cur + res/llarrowlocked.cur + res/llgrablocked.cur + res/llno.cur + res/llnolocked.cur + res/lltoolcamera.cur + res/lltoolcreate.cur + res/lltoolfocus.cur + res/lltoolgrab.cur + res/lltoolland.cur + res/lltoolpan.cur + res/lltoolpipette.cur + res/lltoolrotate.cur + res/lltoolscale.cur + res/lltooltranslate.cur + res/lltoolzoomin.cur + res/lltoolzoomout.cur + res/ll_icon.BMP + res/ll_icon.ico + res/loginbackground.bmp + res/resource.h + res/toolbuy.cur + res/toolopen.cur + res/toolpay.cur + res/toolpickobject.cur + res/toolpickobject2.cur + res/toolpickobject3.cur + res/toolpipette.cur + res/toolsit.cur + res/uninstall_icon.BMP + res/uninstall_icon.ico + ) + + set_source_files_properties(${viewer_RESOURCE_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + + set(viewer_RESOURCE_FILES + res/viewerRes.rc + ${viewer_RESOURCE_FILES} + ) + + SOURCE_GROUP("Resource Files" FILES ${viewer_RESOURCE_FILES}) + + list(APPEND viewer_SOURCE_FILES ${viewer_RESOURCE_FILES}) + + find_library(DINPUT_LIBRARY dinput8 ${DIRECTX_LIBRARY_DIR}) + find_library(DXGUID_LIBRARY dxguid ${DIRECTX_LIBRARY_DIR}) + mark_as_advanced( + DINPUT_LIBRARY + DXGUID_LIBRARY + ) + + set(viewer_LIBRARIES + advapi32 + comdlg32 + ${DINPUT_LIBRARY} + ${DXGUID_LIBRARY} + fmodvc + gdi32 + kernel32 + odbc32 + odbccp32 + ole32 + oleaut32 + opengl32 + shell32 + user32 + Vfw32 + winspool + ) + + find_library(INTEL_MEMOPS_LIBRARY + NAMES ll_intel_memops + PATHS + optimized ${ARCH_PREBUILT_DIRS_RELEASE} + debug ${ARCH_PREBUILT_DIRS_DEBUG} + ) + mark_as_advanced(INTEL_MEMOPS_LIBRARY) + + if (INTEL_MEMOPS_LIBRARY) + list(APPEND viewer_LIBRARIES ${INTEL_MEMOPS_LIBRARY}) + endif (INTEL_MEMOPS_LIBRARY) +endif (WINDOWS) + +# Add the xui files. This is handy for searching for xui elements +# from within the IDE +set(viewer_XUI_FILES + skins/xui/en-us/alerts.xml + skins/xui/en-us/floater_about_land.xml + skins/xui/en-us/floater_about.xml + skins/xui/en-us/floater_active_speakers.xml + skins/xui/en-us/floater_animation_preview.xml + skins/xui/en-us/floater_auction.xml + skins/xui/en-us/floater_audio_volume.xml + skins/xui/en-us/floater_avatar_picker.xml + skins/xui/en-us/floater_avatar_textures.xml + skins/xui/en-us/floater_build_options.xml + skins/xui/en-us/floater_bumps.xml + skins/xui/en-us/floater_buy_contents.xml + skins/xui/en-us/floater_buy_currency.xml + skins/xui/en-us/floater_buy_land.xml + skins/xui/en-us/floater_buy_object.xml + skins/xui/en-us/floater_camera.xml + skins/xui/en-us/floater_chat_history.xml + skins/xui/en-us/floater_chatterbox.xml + skins/xui/en-us/floater_choose_group.xml + skins/xui/en-us/floater_clothing.xml + skins/xui/en-us/floater_color_picker.xml + skins/xui/en-us/floater_critical.xml + skins/xui/en-us/floater_customize.xml + skins/xui/en-us/floater_day_cycle_options.xml + skins/xui/en-us/floater_device_settings.xml + skins/xui/en-us/floater_directory.xml + skins/xui/en-us/floater_env_settings.xml + skins/xui/en-us/floater_gesture.xml + skins/xui/en-us/floater_god_tools.xml + skins/xui/en-us/floater_group_info.xml + skins/xui/en-us/floater_hardware_settings.xml + skins/xui/en-us/floater_html.xml + skins/xui/en-us/floater_hud.xml + skins/xui/en-us/floater_image_preview.xml + skins/xui/en-us/floater_import.xml + skins/xui/en-us/floater_im.xml + skins/xui/en-us/floater_inspect.xml + skins/xui/en-us/floater_instant_message_ad_hoc.xml + skins/xui/en-us/floater_instant_message_group.xml + skins/xui/en-us/floater_instant_message.xml + skins/xui/en-us/floater_inventory_item_properties.xml + skins/xui/en-us/floater_inventory_view_finder.xml + skins/xui/en-us/floater_inventory.xml + skins/xui/en-us/floater_joystick.xml + skins/xui/en-us/floater_lagmeter.xml + skins/xui/en-us/floater_land_holdings.xml + skins/xui/en-us/floater_landmark_ctrl.xml + skins/xui/en-us/floater_live_lsleditor.xml + skins/xui/en-us/floater_lsl_guide.xml + skins/xui/en-us/floater_media_browser.xml + skins/xui/en-us/floater_moveview.xml + skins/xui/en-us/floater_mute_object.xml + skins/xui/en-us/floater_mute.xml + skins/xui/en-us/floater_my_friends.xml + skins/xui/en-us/floater_name_description.xml + skins/xui/en-us/floater_new_im.xml + skins/xui/en-us/floater_new_outfit_dialog.xml + skins/xui/en-us/floater_openobject.xml + skins/xui/en-us/floater_pay_object.xml + skins/xui/en-us/floater_pay.xml + skins/xui/en-us/floater_postcard.xml + skins/xui/en-us/floater_post_process.xml + skins/xui/en-us/floater_preferences.xml + skins/xui/en-us/floater_preview_animation.xml + skins/xui/en-us/floater_preview_classified.xml + skins/xui/en-us/floater_preview_embedded_texture.xml + skins/xui/en-us/floater_preview_event.xml + skins/xui/en-us/floater_preview_existing_landmark.xml + skins/xui/en-us/floater_preview_gesture.xml + skins/xui/en-us/floater_preview_notecard_keep_discard.xml + skins/xui/en-us/floater_preview_notecard.xml + skins/xui/en-us/floater_preview_sound.xml + skins/xui/en-us/floater_preview_texture_keep_discard.xml + skins/xui/en-us/floater_preview_texture.xml + skins/xui/en-us/floater_preview_url.xml + skins/xui/en-us/floater_price_for_listing.xml + skins/xui/en-us/floater_profile.xml + skins/xui/en-us/floater_region_info.xml + skins/xui/en-us/floater_report_abuse.xml + skins/xui/en-us/floater_report_bug.xml + skins/xui/en-us/floater_script_debug.xml + skins/xui/en-us/floater_script_ed_panel.xml + skins/xui/en-us/floater_script_preview.xml + skins/xui/en-us/floater_script_queue.xml + skins/xui/en-us/floater_script_search.xml + skins/xui/en-us/floater_select_key.xml + skins/xui/en-us/floater_sell_land.xml + skins/xui/en-us/floater_settings_debug.xml + skins/xui/en-us/floater_sim_release_message.xml + skins/xui/en-us/floater_snapshot.xml + skins/xui/en-us/floater_sound_preview.xml + skins/xui/en-us/floater_telehub.xml + skins/xui/en-us/floater_test.xml + skins/xui/en-us/floater_texture_ctrl.xml + skins/xui/en-us/floater_tools.xml + skins/xui/en-us/floater_top_objects.xml + skins/xui/en-us/floater_tos.xml + skins/xui/en-us/floater_url_entry.xml + skins/xui/en-us/floater_voice_wizard.xml + skins/xui/en-us/floater_water.xml + skins/xui/en-us/floater_wearable_save_as.xml + skins/xui/en-us/floater_windlight_options.xml + skins/xui/en-us/floater_world_map.xml + skins/xui/en-us/menu_inventory.xml + skins/xui/en-us/menu_login.xml + skins/xui/en-us/menu_pie_attachment.xml + skins/xui/en-us/menu_pie_avatar.xml + skins/xui/en-us/menu_pie_land.xml + skins/xui/en-us/menu_pie_object.xml + skins/xui/en-us/menu_pie_self.xml + skins/xui/en-us/menu_slurl.xml + skins/xui/en-us/menu_viewer.xml + skins/xui/en-us/mime_types.xml + skins/xui/en-us/notify.xml + skins/xui/en-us/panel_audio_device.xml + skins/xui/en-us/panel_audio.xml + skins/xui/en-us/panel_avatar_classified.xml + skins/xui/en-us/panel_avatar_pick.xml + skins/xui/en-us/panel_avatar.xml + skins/xui/en-us/panel_bars.xml + skins/xui/en-us/panel_bg_tab.xml + skins/xui/en-us/panel_bg_toolbar.xml + skins/xui/en-us/panel_chat_bar.xml + skins/xui/en-us/panel_classified.xml + skins/xui/en-us/panel_event.xml + skins/xui/en-us/panel_friends.xml + skins/xui/en-us/panel_group_finder.xml + skins/xui/en-us/panel_group_general.xml + skins/xui/en-us/panel_group_invite.xml + skins/xui/en-us/panel_group_land_money.xml + skins/xui/en-us/panel_group_notices.xml + skins/xui/en-us/panel_group_roles.xml + skins/xui/en-us/panel_groups.xml + skins/xui/en-us/panel_group_voting.xml + skins/xui/en-us/panel_group.xml + skins/xui/en-us/panel_land_covenant.xml + skins/xui/en-us/panel_login.xml + skins/xui/en-us/panel_master_volume.xml + skins/xui/en-us/panel_media_controls.xml + skins/xui/en-us/panel_media_remote_expanded.xml + skins/xui/en-us/panel_media_remote.xml + skins/xui/en-us/panel_overlaybar.xml + skins/xui/en-us/panel_place_small.xml + skins/xui/en-us/panel_place.xml + skins/xui/en-us/panel_preferences_audio.xml + skins/xui/en-us/panel_preferences_chat.xml + skins/xui/en-us/panel_preferences_general.xml + skins/xui/en-us/panel_preferences_graphics1.xml + skins/xui/en-us/panel_preferences_im.xml + skins/xui/en-us/panel_preferences_input.xml + skins/xui/en-us/panel_preferences_network.xml + skins/xui/en-us/panel_preferences_popups.xml + skins/xui/en-us/panel_preferences_voice.xml + skins/xui/en-us/panel_preferences_web.xml + skins/xui/en-us/panel_region_covenant.xml + skins/xui/en-us/panel_region_debug.xml + skins/xui/en-us/panel_region_estate.xml + skins/xui/en-us/panel_region_general.xml + skins/xui/en-us/panel_region_terrain.xml + skins/xui/en-us/panel_region_texture.xml + skins/xui/en-us/panel_scrolling_param.xml + skins/xui/en-us/panel_speaker_controls.xml + skins/xui/en-us/panel_status_bar.xml + skins/xui/en-us/panel_toolbar.xml + skins/xui/en-us/panel_top_pick.xml + skins/xui/en-us/panel_voice_controls.xml + skins/xui/en-us/panel_voice_enable.xml + skins/xui/en-us/panel_voice_options.xml + skins/xui/en-us/panel_voice_remote_expanded.xml + skins/xui/en-us/panel_voice_remote.xml + skins/xui/en-us/role_actions.xml + skins/xui/en-us/strings.xml + skins/xui/en-us/teleport_strings.xml + skins/xui/en-us/xui_version.xml + ) + +source_group("XUI Files" FILES ${viewer_XUI_FILES}) + +set_source_files_properties(${viewer_XUI_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND viewer_SOURCE_FILES ${viewer_XUI_FILES}) + +if (FMOD) + set_source_files_properties(llstartup.cpp PROPERTIES COMPILE_FLAGS -DLL_FMOD) + + if (NOT WINDOWS) + set(fmodwrapper_SOURCE_FILES fmodwrapper.cpp) + add_library(fmodwrapper SHARED ${fmodwrapper_SOURCE_FILES}) + set(fmodwrapper_needed_LIBRARIES ${FMOD_LIBRARY}) + if (DARWIN) + list(APPEND fmodwrapper_needed_LIBRARIES ${CARBON_LIBRARY}) + set_target_properties( + fmodwrapper + PROPERTIES + BUILD_WITH_INSTALL_RPATH 1 + INSTALL_NAME_DIR "@executable_path/../Resources" + ) + endif (DARWIN) + set(FMODWRAPPER_LIBRARIES fmodwrapper) + list(APPEND viewer_LIBRARIES fmodwrapper) + target_link_libraries(fmodwrapper ${fmodwrapper_needed_LIBRARIES}) + endif (NOT WINDOWS) +endif (FMOD) + +list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES}) + +set_source_files_properties(${viewer_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +add_executable(secondlife-bin + WIN32 + MACOSX_BUNDLE + ${viewer_SOURCE_FILES} + ) +check_message_template(secondlife-bin) + +if (LLKDU_LIBRARY) + add_dependencies(secondlife-bin ${LLKDU_LIBRARY}) +endif (LLKDU_LIBRARY) + +if (WINDOWS) + if(MSVC71) + set(release_flags "/MAP:Release/secondlife-bin.map /MAPINFO:LINES") + else(MSVC71) + set(release_flags "/MAP:Release/secondlife-bin.map") + endif(MSVC71) + + set_target_properties(secondlife-bin + PROPERTIES + LINK_FLAGS "/debug /NODEFAULTLIB:MSVCRT /SUBSYSTEM:WINDOWS" + LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD" + LINK_FLAGS_RELEASE ${release_flags} + ) + + # sets the 'working directory' for debugging from visual studio. + if (NOT UNATTENDED) + add_custom_command( + TARGET secondlife-bin PRE_BUILD + COMMAND ${CMAKE_SOURCE_DIR}/tools/vstool/vstool.exe + ARGS + --solution + ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.sln + --workingdir + secondlife-bin + ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Setting the secondlife-bin working directory for debugging." + ) + endif (NOT UNATTENDED) + + add_custom_command( + TARGET secondlife-bin PRE_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS + -E + copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/messages/message_template.msg + ${CMAKE_CURRENT_SOURCE_DIR}/app_settings/message_template.msg + COMMENT "Copying message_template.msg to the runtime folder." + ) + + add_custom_command( + TARGET secondlife-bin POST_BUILD + COMMAND ${PYTHON_EXECUTABLE} + ARGS + "${CMAKE_CURRENT_SOURCE_DIR}/postbuild_win32.py" + "${CMAKE_COMMAND} -E copy_if_different" + "${CMAKE_CFG_INTDIR}" + "${CMAKE_CURRENT_BINARY_DIR}" + DEPENDS secondlife-bin + COMMENT "Copying pre-built binaries to development folder." + ) + + if (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts) + add_dependencies(secondlife-bin copy_win_scripts) + endif (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts) + + add_custom_target(package ALL DEPENDS ${CMAKE_CFG_INTDIR}/touched.bat) + add_custom_command( + OUTPUT ${CMAKE_CFG_INTDIR}/touched.bat + COMMAND ${PYTHON_EXECUTABLE} + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --configuration=${CMAKE_CFG_INTDIR} + --channel=${VIEWER_CHANNEL} + --source=${CMAKE_CURRENT_SOURCE_DIR} + --artwork=${ARTWORK_DIR} + --build=${CMAKE_CURRENT_BINARY_DIR} + --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} + --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/touched.bat + DEPENDS secondlife-bin ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ) + add_dependencies(package windows-updater windows-crash-logger) +endif (WINDOWS) + +target_link_libraries(secondlife-bin + ${LLAUDIO_LIBRARIES} + ${LLCHARACTER_LIBRARIES} + ${LLIMAGE_LIBRARIES} + ${LLIMAGEJ2COJ_LIBRARIES} + ${LLINVENTORY_LIBRARIES} + ${LLMEDIA_LIBRARIES} + ${LLMESSAGE_LIBRARIES} + ${LLPRIMITIVE_LIBRARIES} + ${LLRENDER_LIBRARIES} + ${FREETYPE_LIBRARIES} + ${LLUI_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLWINDOW_LIBRARIES} + ${LLXML_LIBRARIES} + ${LSCRIPT_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${viewer_LIBRARIES} + ${BOOST_PROGRAM_OPTIONS_LIBRARY} + ${BOOST_REGEX_LIBRARY} + ${BOOST_SIGNALS_LIBRARY} + ${OPENGL_LIBRARIES} + ${FMODWRAPPER_LIBRARIES} + ${OPENGL_LIBRARIES} + ${MOZLIB_LIBRARIES} + ${SDL_LIBRARY} + ${SMARTHEAP_LIBRARY} + ${UI_LIBRARIES} + ${NDOF_LIBRARY} + ${QUICKTIME_LIBRARY} + ${WINDOWS_LIBRARIES} + ${XMLRPCEPI_LIBRARIES} + ${ZLIB_LIBRARIES} + ${ELFIO_LIBRARIES} + ) + +build_version(viewer) + +set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH + "Path to artwork files.") + +set(VIEWER_CHANNEL "Developer" CACHE STRING + "The name of the channel to use.") + +if (LINUX) + add_custom_command( + OUTPUT secondlife-stripped-globalsyms + COMMAND strip + ARGS --strip-debug -o secondlife-stripped-globalsyms secondlife-bin + DEPENDS secondlife-bin + ) + + add_custom_command( + OUTPUT secondlife-stripped + COMMAND objcopy + ARGS + --keep-global-symbols + ${CMAKE_CURRENT_SOURCE_DIR}/linux_tools/exposed-symbols.txt + secondlife-stripped-globalsyms + secondlife-stripped + DEPENDS + secondlife-stripped-globalsyms + ${CMAKE_CURRENT_SOURCE_DIR}/linux_tools/exposed-symbols.txt + ) + + set(product SecondLife-${ARCH}-${viewer_VERSION}) + + add_custom_command( + OUTPUT ${product}.tar.bz2 + COMMAND ${PYTHON_EXECUTABLE} + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --grid=agni + --channel=${VIEWER_CHANNEL} + --installer_name=${product} + --arch=${ARCH} + --source=${CMAKE_CURRENT_SOURCE_DIR} + --artwork=${ARTWORK_DIR} + --build=${CMAKE_CURRENT_BINARY_DIR} + --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged + --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched + DEPENDS secondlife-stripped ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ) + + if (NOT INSTALL) + add_custom_target(package ALL DEPENDS ${product}.tar.bz2) + add_dependencies(package linux-crash-logger-stripped) + endif (NOT INSTALL) +endif (LINUX) + +if (DARWIN) + set(product "Second Life") + set_target_properties( + secondlife-bin + PROPERTIES + OUTPUT_NAME "${product}" + MACOSX_BUNDLE_INFO_STRING "info string - localize me" + MACOSX_BUNDLE_ICON_FILE "secondlife.icns" + MACOSX_BUNDLE_GUI_IDENTIFIER "Second Life" + MACOSX_BUNDLE_LONG_VERSION_STRING "ververver" + MACOSX_BUNDLE_BUNDLE_NAME "Second Life" + MACOSX_BUNDLE_SHORT_VERSION_STRING "asdf" + MACOSX_BUNDLE_BUNDLE_VERSION "asdf" + MACOSX_BUNDLE_COPYRIGHT "copyright linden lab 2007 - localize me and run me through a legal wringer" + ) + + add_custom_command( + TARGET secondlife-bin POST_BUILD + COMMAND ${PYTHON_EXECUTABLE} + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --actions=copy + --configuration=${CMAKE_CFG_INTDIR} + --source=${CMAKE_CURRENT_SOURCE_DIR} + --artwork=${ARTWORK_DIR} + --build=${CMAKE_CURRENT_BINARY_DIR} + --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app + DEPENDS secondlife-bin ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ) + + add_custom_command( + OUTPUT ${CMAKE_CFG_INTDIR}/.${product}.touched + COMMAND ${PYTHON_EXECUTABLE} + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --configuration=${CMAKE_CFG_INTDIR} + --channel=${VIEWER_CHANNEL} + --source=${CMAKE_CURRENT_SOURCE_DIR} + --artwork=${ARTWORK_DIR} + --build=${CMAKE_CURRENT_BINARY_DIR} + --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app + --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched + DEPENDS secondlife-bin ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ) + + add_custom_target(package DEPENDS "${CMAKE_CFG_INTDIR}/.${product}.touched") +endif (DARWIN) + +if (INSTALL) + include(${CMAKE_CURRENT_SOURCE_DIR}/ViewerInstall.cmake) +endif (INSTALL) diff --git a/indra/newview/ViewerInstall.cmake b/indra/newview/ViewerInstall.cmake new file mode 100644 index 0000000000..55069ad2b5 --- /dev/null +++ b/indra/newview/ViewerInstall.cmake @@ -0,0 +1,28 @@ +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/secondlife-bin + DESTINATION ${APP_BINARY_DIR} + ) + +install(DIRECTORY skins app_settings linux_tools + DESTINATION ${APP_SHARE_DIR} + PATTERN ".svn" EXCLUDE + ) + +find_file(IS_ARTWORK_PRESENT NAMES avatar_lad.xml + PATHS ${VIEWER_DIR}/newview/character) + +if (IS_ARTWORK_PRESENT) + install(DIRECTORY res res-sdl character + DESTINATION ${APP_SHARE_DIR} + PATTERN ".svn" EXCLUDE + ) +else (IS_ARTWORK_PRESENT) + message(STATUS "WARNING: Artwork is not present, and will not be installed") +endif (IS_ARTWORK_PRESENT) + +install(FILES featuretable_linux.txt featuretable_solaris.txt gpu_table.txt + DESTINATION ${APP_SHARE_DIR} + ) + +install(FILES ${SCRIPTS_DIR}/messages/message_template.msg + DESTINATION ${APP_SHARE_DIR}/app_settings + ) diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index 836780d140..fb2fa23400 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -37,10 +37,10 @@ XPStyle on ; add an XP manifest to the installer ;; (these files are in the same place as the nsi template but the python script generates a new nsi file in the ;; application directory so we have to add a path to these include files) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -!include "installers\windows\lang_de.nsi" -!include "installers\windows\lang_en-us.nsi" -!include "installers\windows\lang_ja.nsi" -!include "installers\windows\lang_ko.nsi" +!include "%%SOURCE%%\installers\windows\lang_de.nsi" +!include "%%SOURCE%%\installers\windows\lang_en-us.nsi" +!include "%%SOURCE%%\installers\windows\lang_ja.nsi" +!include "%%SOURCE%%\installers\windows\lang_ko.nsi" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Tweak for different servers/builds (this placeholder is replaced by viewer_manifest.py) @@ -51,8 +51,8 @@ Name ${INSTNAME} SubCaption 0 $(LicenseSubTitleSetup) ; override "license agreement" text BrandingText " " ; bottom of window text -Icon res\install_icon.ico ; our custom icon -UninstallIcon res\uninstall_icon.ico ; our custom icon +Icon %%SOURCE%%\res\install_icon.ico ; our custom icon +UninstallIcon %%SOURCE%%\res\uninstall_icon.ico ; our custom icon WindowIcon on ; show our icon in left corner BGGradient off ; no big background window CRCCheck on ; make sure CRC is OK diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 2c9dec3801..a6173f45df 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -791,12 +791,12 @@ bool LLAppViewer::init() // initWindow(); - #if LL_WINDOWS && LL_LCD_COMPILE +#if LL_LCD_COMPILE // start up an LCD window on a logitech keyboard, if there is one HINSTANCE hInstance = GetModuleHandle(NULL); gLcdScreen = new LLLCD(hInstance); CreateLCDDebugWindows(); - #endif +#endif gGLManager.getGLInfo(gDebugInfo); gGLManager.printGLInfoString(); @@ -983,7 +983,7 @@ bool LLAppViewer::mainLoop() LLFloaterSnapshot::update(); // take snapshots -#if LL_WINDOWS && LL_LCD_COMPILE +#if LL_LCD_COMPILE // update LCD Screen gLcdScreen->UpdateDisplay(); #endif @@ -1239,7 +1239,7 @@ bool LLAppViewer::cleanup() // gDXHardware.cleanup(); //#endif // LL_WINDOWS -#if LL_WINDOWS && LL_LCD_COMPILE +#if LL_LCD_COMPILE // shut down the LCD window on a logitech keyboard, if there is one delete gLcdScreen; gLcdScreen = NULL; diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 753ea1bc6c..cb44e2b1de 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -45,14 +45,7 @@ #if LL_LINUX # include <dlfcn.h> // RTLD_LAZY -# include <execinfo.h> // backtrace - glibc only -# ifndef LL_ELFBIN -# define LL_ELFBIN 1 -# endif // LL_ELFBIN -# if LL_ELFBIN -# include <cxxabi.h> // for symbol demangling -# include "ELFIO.h" // for better backtraces -# endif // LL_ELFBIN +# include <execinfo.h> // backtrace - glibc only #elif LL_SOLARIS # include <sys/types.h> # include <unistd.h> @@ -60,6 +53,13 @@ # include <ucontext.h> #endif +#ifdef LL_ELFBIN +# ifdef __GNUC__ +# include <cxxabi.h> // for symbol demangling +# endif +# include "ELFIO/ELFIO.h" // for better backtraces +#endif + namespace { int gArgC = 0; @@ -338,25 +338,25 @@ void LLAppViewerLinux::handleCrashReporting() if (CRASH_BEHAVIOR_NEVER_SEND != LLAppViewer::instance()->getCrashBehavior()) { // launch the actual crash logger - char* ask_dialog = "-dialog"; + const char* ask_dialog = "-dialog"; if (CRASH_BEHAVIOR_ASK != LLAppViewer::instance()->getCrashBehavior()) ask_dialog = ""; // omit '-dialog' option std::string cmd =gDirUtilp->getAppRODataDir(); cmd += gDirUtilp->getDirDelimiter(); cmd += "linux-crash-logger.bin"; - char* const cmdargv[] = - {(char*)cmd.c_str(), + const char * cmdargv[] = + {cmd.c_str(), ask_dialog, - (char*)"-user", + "-user", (char*)gGridName.c_str(), - (char*)"-name", - (char*)LLAppViewer::instance()->getSecondLifeTitle().c_str(), + "-name", + LLAppViewer::instance()->getSecondLifeTitle().c_str(), NULL}; fflush(NULL); pid_t pid = fork(); if (pid == 0) { // child - execv(cmd.c_str(), cmdargv); /* Flawfinder: ignore */ + execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */ llwarns << "execv failure when trying to start " << cmd << llendl; _exit(1); // avoid atexit() } diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index f21bdc4243..c1e6888478 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -65,7 +65,12 @@ int main( int argc, char **argv ) #endif // Set the working dir to <bundle>/Contents/Resources - (void) chdir(gDirUtilp->getAppRODataDir().c_str()); + if (chdir(gDirUtilp->getAppRODataDir().c_str()) == -1) + { + llwarns << "Could not change directory to " + << gDirUtilp->getAppRODataDir() << ": " << strerror(errno) + << llendl; + } LLAppViewerMacOSX* viewer_app_ptr = new LLAppViewerMacOSX(); diff --git a/indra/newview/lleventinfo.cpp b/indra/newview/lleventinfo.cpp index 0e69891731..91401a048b 100644 --- a/indra/newview/lleventinfo.cpp +++ b/indra/newview/lleventinfo.cpp @@ -41,7 +41,7 @@ LLEventInfo::cat_map LLEventInfo::sCategories; LLEventInfo::LLEventInfo(F32 global_x, F32 global_y, const char* name, U32 id, - S32 unix_time, + time_t unix_time, U32 event_flags) : mName( name ), mID( id ), @@ -91,7 +91,9 @@ void LLEventInfo::unpack(LLMessageSystem *msg) msg->getU32("EventData","Duration",duration); mDuration = duration; - msg->getU32("EventData", "DateUTC", mUnixTime); + U32 date; + msg->getU32("EventData", "DateUTC", date); + mUnixTime = date; msg->getString("EventData", "Desc", MAX_DESC_LENGTH, buffer); mDesc = buffer; diff --git a/indra/newview/lleventinfo.h b/indra/newview/lleventinfo.h index 6d76b0c74d..4d0687f81c 100644 --- a/indra/newview/lleventinfo.h +++ b/indra/newview/lleventinfo.h @@ -44,7 +44,7 @@ class LLEventInfo { public: LLEventInfo() {} - LLEventInfo(F32 global_x, F32 global_y, const char* name, U32 id, S32 unix_time, U32 event_flags); + LLEventInfo(F32 global_x, F32 global_y, const char* name, U32 id, time_t unix_time, U32 event_flags); void unpack(LLMessageSystem *msg); @@ -60,7 +60,7 @@ public: LLUUID mRunByID; LLString mSimName; LLVector3d mPosGlobal; - U32 mUnixTime; // seconds from 1970 + time_t mUnixTime; // seconds from 1970 BOOL mHasCover; U32 mCover; U32 mEventFlags; diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp index d7fe6777e2..3d2bbcd1f5 100644 --- a/indra/newview/lleventnotifier.cpp +++ b/indra/newview/lleventnotifier.cpp @@ -68,7 +68,7 @@ void LLEventNotifier::update() // Check our notifications again and send out updates // if they happen. - U32 alert_time = time_corrected() + 5 * 60; + time_t alert_time = time_corrected() + 5 * 60; en_map::iterator iter; for (iter = mEventNotifications.begin(); iter != mEventNotifications.end();) diff --git a/indra/newview/lleventnotifier.h b/indra/newview/lleventnotifier.h index 1801efeabf..bbd1facf31 100644 --- a/indra/newview/lleventnotifier.h +++ b/indra/newview/lleventnotifier.h @@ -75,14 +75,14 @@ public: //void setEventName(std::string &event_name); U32 getEventID() const { return mEventID; } const std::string &getEventName() const { return mEventName; } - U32 getEventDate() const { return mEventDate; } + time_t getEventDate() const { return mEventDate; } const std::string &getEventDateStr() const { return mEventDateStr; } LLVector3d getEventPosGlobal() const { return mEventPosGlobal; } protected: U32 mEventID; // EventID for this event std::string mEventName; std::string mEventDateStr; - U32 mEventDate; + time_t mEventDate; LLVector3d mEventPosGlobal; }; diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 17e8429616..c24b4c13d9 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -225,7 +225,7 @@ BOOL LLFeatureManager::loadFeatureTables() data_path += gDirUtilp->getDirDelimiter(); data_path += FEATURE_TABLE_FILENAME; - + lldebugs << "Looking for feature table in " << data_path << llendl; char name[MAX_STRING+1]; /*Flawfinder: ignore*/ @@ -252,7 +252,7 @@ BOOL LLFeatureManager::loadFeatureTables() mTableVersion = version; LLFeatureList *flp = NULL; - while (!file.eof()) + while (!file.eof() && file.good()) { char buffer[MAX_STRING]; /*Flawfinder: ignore*/ name[0] = 0; diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index ab85a8c3c1..24b82c370a 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -116,4 +116,4 @@ void LLFloaterCamera::onClose(bool app_quitting) { gSavedSettings.setBOOL("ShowCameraControls", FALSE); } -}
\ No newline at end of file +} diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 1d4801bd35..3aaa14ab73 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -355,7 +355,7 @@ void LLFloaterChat::addChat(const LLChat& chat, chat.mChatType == CHAT_TYPE_DEBUG_MSG && !gSavedSettings.getBOOL("ScriptErrorsAsChat"); -#if LL_WINDOWS && LL_LCD_COMPILE +#if LL_LCD_COMPILE // add into LCD displays if (!invisible_script_debug_chat) { diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index e66d545409..f78da984a9 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -75,14 +75,6 @@ #include "llscrollcontainer.h" #include "llfloaterhardwaresettings.h" -#if LL_WINDOWS -// for Logitech LCD keyboards / speakers -#ifndef LL_LOGITECH_LCD_H -#include "lllogitechlcd.h" -#endif -extern LLLCD *gLcdScreen; -#endif - const S32 PREF_BORDER = 4; const S32 PREF_PAD = 5; const S32 PREF_BUTTON_WIDTH = 70; @@ -174,7 +166,7 @@ LLPreferenceCore::LLPreferenceCore(LLTabContainer* tab_container, LLButton * def mTabContainer->addTabPanel(mPrefsIM->getPanel(), mPrefsIM->getPanel()->getLabel(), FALSE, onTabChanged, mTabContainer); mPrefsIM->getPanel()->setDefaultBtn(default_btn); -#if LL_WINDOWS && LL_LCD_COMPILE +#if LL_LCD_COMPILE // only add this option if we actually have a logitech keyboard / speaker set if (gLcdScreen->Enabled()) @@ -264,7 +256,7 @@ void LLPreferenceCore::apply() LLFloaterHardwareSettings::instance()->apply(); mWebPanel->apply(); -#if LL_WINDOWS && LL_LCD_COMPILE +#if LL_LCD_COMPILE // only add this option if we actually have a logitech keyboard / speaker set if (gLcdScreen->Enabled()) { @@ -291,7 +283,7 @@ void LLPreferenceCore::cancel() LLFloaterHardwareSettings::instance()->cancel(); mWebPanel->cancel(); -#if LL_WINDOWS && LL_LCD_COMPILE +#if LL_LCD_COMPILE // only add this option if we actually have a logitech keyboard / speaker set if (gLcdScreen->Enabled()) { diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 09888ebab0..21ed153920 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -373,7 +373,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) ////////////////// // *TODO: Localize / translate this - time_t time_utc = (time_t)item->getCreationDate(); + time_t time_utc = item->getCreationDate(); if (0 == time_utc) { childSetText("LabelAcquiredDate",getString("unknown")); diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 075ed81a53..c26a8dfc55 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -283,7 +283,7 @@ void LLFolderViewItem::refresh() const char* label = mListener->getDisplayName().c_str(); mLabel = label ? label : ""; setIcon(mListener->getIcon()); - U32 creation_date = mListener->getCreationDate(); + time_t creation_date = mListener->getCreationDate(); if (mCreationDate != creation_date) { mCreationDate = mListener->getCreationDate(); @@ -1745,7 +1745,7 @@ void LLFolderViewFolder::sortBy(U32 order) if (order & LLInventoryFilter::SO_DATE) { - U32 latest = 0; + time_t latest = 0; if (!mItems.empty()) { @@ -2203,9 +2203,9 @@ void LLFolderViewFolder::draw() mExpanderHighlighted = FALSE; } -U32 LLFolderViewFolder::getCreationDate() const +time_t LLFolderViewFolder::getCreationDate() const { - return llmax<U32>(mCreationDate, mSubtreeCreationDate); + return llmax<time_t>(mCreationDate, mSubtreeCreationDate); } @@ -4400,8 +4400,8 @@ bool LLInventorySort::operator()(LLFolderViewItem* a, LLFolderViewItem* b) { // BUG: This is very very slow. The getCreationDate() is log n in number // of inventory items. - U32 first_create = a->getCreationDate(); - U32 second_create = b->getCreationDate(); + time_t first_create = a->getCreationDate(); + time_t second_create = b->getCreationDate(); if (first_create == second_create) { return (LLString::compareDict(a->getLabel(), b->getLabel()) < 0); @@ -4495,8 +4495,8 @@ LLInventoryFilter::LLInventoryFilter(const LLString& name) : mNeedTextRebuild(TRUE) { mFilterOps.mFilterTypes = 0xffffffff; - mFilterOps.mMinDate = 0; - mFilterOps.mMaxDate = U32_MAX; + mFilterOps.mMinDate = time_min(); + mFilterOps.mMaxDate = time_max(); mFilterOps.mHoursAgo = 0; mFilterOps.mShowFolderState = SHOW_NON_EMPTY_FOLDERS; mFilterOps.mPermissions = PERM_NONE; @@ -4524,10 +4524,10 @@ LLInventoryFilter::~LLInventoryFilter() BOOL LLInventoryFilter::check(LLFolderViewItem* item) { - U32 earliest; + time_t earliest; earliest = time_corrected() - mFilterOps.mHoursAgo * 3600; - if (mFilterOps.mMinDate && mFilterOps.mMinDate < earliest) + if (mFilterOps.mMinDate > time_min() && mFilterOps.mMinDate < earliest) { earliest = mFilterOps.mMinDate; } @@ -4570,8 +4570,8 @@ BOOL LLInventoryFilter::isActive() return mFilterOps.mFilterTypes != 0xffffffff || mFilterSubString.size() || mFilterOps.mPermissions != PERM_NONE - || mFilterOps.mMinDate != 0 - || mFilterOps.mMaxDate != U32_MAX + || mFilterOps.mMinDate != time_min() + || mFilterOps.mMaxDate != time_max() || mFilterOps.mHoursAgo != 0; } @@ -4667,7 +4667,7 @@ void LLInventoryFilter::setFilterPermissions(PermissionMask perms) } } -void LLInventoryFilter::setDateRange(U32 min_date, U32 max_date) +void LLInventoryFilter::setDateRange(time_t min_date, time_t max_date) { mFilterOps.mHoursAgo = 0; if (mFilterOps.mMinDate != min_date) @@ -4686,19 +4686,20 @@ void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) { if (sl && !isSinceLogoff()) { - setDateRange(mLastLogoff, U32_MAX); + setDateRange(mLastLogoff, time_max()); setModified(); } if (!sl && isSinceLogoff()) { - setDateRange(0, U32_MAX); + setDateRange(0, time_max()); setModified(); } } BOOL LLInventoryFilter::isSinceLogoff() { - return (mFilterOps.mMinDate == mLastLogoff) && (mFilterOps.mMaxDate == U32_MAX); + return (mFilterOps.mMinDate == mLastLogoff) && + (mFilterOps.mMaxDate == time_max()); } void LLInventoryFilter::setHoursAgo(U32 hours) @@ -4706,11 +4707,11 @@ void LLInventoryFilter::setHoursAgo(U32 hours) if (mFilterOps.mHoursAgo != hours) { // *NOTE: need to cache last filter time, in case filter goes stale - BOOL less_restrictive = (mFilterOps.mMinDate == 0 && mFilterOps.mMaxDate == U32_MAX && hours > mFilterOps.mHoursAgo); - BOOL more_restrictive = (mFilterOps.mMinDate == 0 && mFilterOps.mMaxDate == U32_MAX && hours <= mFilterOps.mHoursAgo); + BOOL less_restrictive = (mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max() && hours > mFilterOps.mHoursAgo); + BOOL more_restrictive = (mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max() && hours <= mFilterOps.mHoursAgo); mFilterOps.mHoursAgo = hours; - mFilterOps.mMinDate = 0; - mFilterOps.mMaxDate = U32_MAX; + mFilterOps.mMinDate = time_min(); + mFilterOps.mMaxDate = time_max(); if (less_restrictive) { setModified(FILTER_LESS_RESTRICTIVE); @@ -5011,7 +5012,7 @@ void LLInventoryFilter::fromLLSD(LLSD& data) if(data.has("min_date") && data.has("max_date")) { - setDateRange((U32)data["min_date"].asInteger(), (U32)data["max_date"].asInteger()); + setDateRange(data["min_date"].asInteger(), data["max_date"].asInteger()); } if(data.has("hours_ago")) diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index f8380fc47e..8a04cc9b9c 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -79,7 +79,7 @@ public: virtual const LLString& getName() const = 0; virtual const LLString& getDisplayName() const = 0; virtual const LLUUID& getUUID() const = 0; - virtual U32 getCreationDate() const = 0; // UTC seconds + virtual time_t getCreationDate() const = 0; // UTC seconds virtual PermissionMask getPermissionMask() const = 0; virtual LLUIImagePtr getIcon() const = 0; virtual LLFontGL::StyleFlags getLabelStyle() const = 0; @@ -198,10 +198,10 @@ public: void setFilterPermissions(PermissionMask perms); PermissionMask getFilterPermissions() const { return mFilterOps.mPermissions; } - void setDateRange(U32 min_date, U32 max_date); + void setDateRange(time_t min_date, time_t max_date); void setDateRangeLastLogoff(BOOL sl); - U32 getMinDate() const { return mFilterOps.mMinDate; } - U32 getMaxDate() const { return mFilterOps.mMaxDate; } + time_t getMinDate() const { return mFilterOps.mMinDate; } + time_t getMaxDate() const { return mFilterOps.mMaxDate; } void setHoursAgo(U32 hours); U32 getHoursAgo() const { return mFilterOps.mHoursAgo; } @@ -246,8 +246,8 @@ protected: struct filter_ops { U32 mFilterTypes; - U32 mMinDate; - U32 mMaxDate; + time_t mMinDate; + time_t mMaxDate; U32 mHoursAgo; EFolderShow mShowFolderState; PermissionMask mPermissions; @@ -464,7 +464,7 @@ public: const char* getLabel() const { return mLabel.c_str(); } // Used for sorting, like getLabel() above. - virtual U32 getCreationDate() const { return mCreationDate; } + virtual time_t getCreationDate() const { return mCreationDate; } LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; } const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; } @@ -555,7 +555,7 @@ protected: F32 mCurHeight; F32 mTargetHeight; F32 mAutoOpenCountdown; - U32 mSubtreeCreationDate; + time_t mSubtreeCreationDate; ETrash mAmTrash; S32 mLastArrangeGeneration; S32 mLastCalculatedWidth; @@ -702,7 +702,7 @@ public: LLString& tooltip_msg); virtual void draw(); - U32 getCreationDate() const; + time_t getCreationDate() const; bool isTrash(); }; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 729165a2a4..e948b64459 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -180,7 +180,7 @@ PermissionMask LLInvFVBridge::getPermissionMask() const } // Folders don't have creation dates. -U32 LLInvFVBridge::getCreationDate() const +time_t LLInvFVBridge::getCreationDate() const { return 0; } @@ -894,7 +894,7 @@ LLString LLItemBridge::getLabelSuffix() const return suffix; } -U32 LLItemBridge::getCreationDate() const +time_t LLItemBridge::getCreationDate() const { LLViewerInventoryItem* item = getItem(); if (item) diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 9fbdd09c40..2646dab96c 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -164,7 +164,7 @@ public: virtual const LLString& getName() const; virtual const LLString& getDisplayName() const; virtual PermissionMask getPermissionMask() const; - virtual U32 getCreationDate() const; + virtual time_t getCreationDate() const; virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; @@ -239,7 +239,7 @@ public: virtual const LLString& getDisplayName() const; virtual LLString getLabelSuffix() const; virtual PermissionMask getPermissionMask() const; - virtual U32 getCreationDate() const; + virtual time_t getCreationDate() const; virtual BOOL isItemRenameable() const; virtual BOOL renameItem(const LLString& new_name); virtual BOOL removeItem(); diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 91e6ef1e05..76a4ec99b1 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -47,7 +47,7 @@ LLString LLLogChat::makeLogFileName(LLString filename) LLString LLLogChat::timestamp(bool withdate) { - U32 utc_time; + time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 71c93c3542..e9a5648b7b 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -445,7 +445,7 @@ void LLMuteList::updateRemove(const LLMute& mute) void notify_automute_callback(const LLUUID& agent_id, const char* first_name, const char* last_name, BOOL is_group, void* user_data) { - U32 temp_data = (U32)user_data; + U32 temp_data = (U32) (uintptr_t) user_data; LLMuteList::EAutoReason reason = (LLMuteList::EAutoReason)temp_data; LLUIString auto_message; diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 4ec8c0763b..fdeb3368e8 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -1229,7 +1229,7 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg, if (amount != 0) { - char* verb; + const char* verb; switch(type) { diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index c493e8f049..724b61481b 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -41,8 +41,8 @@ #include "audioengine.h" -#if LL_FMOD -#include "audioengine_fmod.h" +#ifdef LL_FMOD +# include "audioengine_fmod.h" #endif #include "llares.h" @@ -545,7 +545,7 @@ BOOL idle_startup() if (FALSE == gSavedSettings.getBOOL("NoAudio")) { -#if LL_FMOD +#ifdef LL_FMOD gAudiop = (LLAudioEngine *) new LLAudioEngine_FMOD(); #else gAudiop = NULL; diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 6697b06659..0f65510844 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -255,7 +255,7 @@ void LLStatusBar::refresh() // Get current UTC time, adjusted for the user's clock // being off. - U32 utc_time; + time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 534d19874c..86ef9e95cf 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1056,12 +1056,10 @@ struct lru_data typedef const lru_data* lru_data_ptr; bool operator()(const lru_data_ptr& a, const lru_data_ptr& b) const { - if (a->time > b->time) - return true; - else if (b->time > a->time) - return false; + if(a->time == b->time) + return (a->index < b->index); else - return a->index < b->index; + return (a->time >= b->time); } }; }; diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 8574448dce..47ed30a34b 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1546,7 +1546,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, } LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); - S32 creation_date = time_corrected(); + time_t creation_date = time_corrected(); new_item->setCreationDate(creation_date); if(!item->getPermissions().allowCopyBy(gAgent.getID())) diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index abe0034dc8..f103b9b0bf 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -163,11 +163,13 @@ bool LLURLDispatcherImpl::dispatchRightClick(const std::string& url) // static bool LLURLDispatcherImpl::dispatchHelp(const std::string& url, BOOL right_mouse) { +#if LL_LIBXUL_ENABLED if (matchPrefix(url, SLURL_SL_HELP_PREFIX)) { gViewerHtmlHelp.show(); return true; } +#endif return false; } diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 097b3b1a9d..a3929de5f3 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -68,7 +68,7 @@ LLViewerInventoryItem::LLViewerInventoryItem(const LLUUID& uuid, const LLString& desc, const LLSaleInfo& sale_info, U32 flags, - S32 creation_date_utc) : + time_t creation_date_utc) : LLInventoryItem(uuid, parent_uuid, perm, asset_uuid, type, inv_type, name, desc, sale_info, flags, creation_date_utc), mIsComplete(TRUE) @@ -290,7 +290,7 @@ bool LLViewerInventoryItem::exportFileLocal(LLFILE* fp) const const char* inv_type_str = LLInventoryType::lookup(mInventoryType); if(inv_type_str) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); - fprintf(fp, "\t\tcreation_date\t%d\n", mCreationDate); + fprintf(fp, "\t\tcreation_date\t%d\n", (S32) mCreationDate); fprintf(fp,"\t}\n"); return true; } diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 30e5afdad1..102239099f 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -62,7 +62,7 @@ public: const LLString& desc, const LLSaleInfo& sale_info, U32 flags, - S32 creation_date_utc); + time_t creation_date_utc); // construct a viewer inventory item which has the minimal amount // of information to use in the UI. diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h index 625debb923..82549cb2dd 100644 --- a/indra/newview/llviewerjoystick.h +++ b/indra/newview/llviewerjoystick.h @@ -34,8 +34,6 @@ #include "stdtypes.h" -#define LIB_NDOF (LL_WINDOWS || LL_DARWIN) - #if LIB_NDOF #include "ndofdev_external.h" #else diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index fd2a906edd..060b69db74 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6982,7 +6982,7 @@ void handle_grab_texture(void* data) PERM_NONE, PERM_NONE, next_owner_perm); - S32 creation_date_now = time_corrected(); + time_t creation_date_now = time_corrected(); LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem(item_id, folder_id, diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 391a5ad5cb..477f6c35c1 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4576,7 +4576,7 @@ void container_inventory_arrived(LLViewerObject* object, LLInventoryItem* item = (LLInventoryItem*)(obj); LLUUID item_id; item_id.generate(); - S32 creation_date_utc = time_corrected(); + time_t creation_date_utc = time_corrected(); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item_id, cat_id, @@ -4616,7 +4616,7 @@ void container_inventory_arrived(LLViewerObject* object, LLUUID item_id; item_id.generate(); - S32 creation_date_utc = time_corrected(); + time_t creation_date_utc = time_corrected(); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item_id, category, item->getPermissions(), diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 632526c061..f5ea73f1fc 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -478,7 +478,7 @@ std::string LLViewerRegion::regionFlagsToString(U32 flags) } // *TODO:Translate -char* SIM_ACCESS_STR[] = { "Free Trial", +const char* SIM_ACCESS_STR[] = { "Free Trial", "PG", "Mature", "Offline", @@ -1309,8 +1309,9 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder { LOG_CLASS(BaseCapabilitiesComplete); public: - BaseCapabilitiesComplete(LLViewerRegion* region) - : mRegion(region) + BaseCapabilitiesComplete(LLViewerRegion* region, LLSD requestedCaps) + : mRegion(region), + mRequestedCaps(requestedCaps) { } void error(U32 statusNum, const std::string& reason) @@ -1326,8 +1327,16 @@ public: void result(const LLSD& content) { LLSD::map_const_iterator iter; + for(iter = content.beginMap(); iter != content.endMap(); ++iter) { + if (iter->second.asString().empty()) + { + llwarns << "BaseCapabilitiesComplete::result EMPTY capability " + << iter->first << llendl; + continue; + } + mRegion->setCapability(iter->first, iter->second); LL_DEBUGS2("AppInit", "Capabilities") << "got capability for " << iter->first << LL_ENDL; @@ -1340,6 +1349,21 @@ public: } } + LLSD::array_const_iterator fail; + for (fail = mRequestedCaps.beginArray(); + fail != mRequestedCaps.endArray(); + ++fail) + { + std::string cap = fail->asString(); + + if (mRegion->getCapability(cap).empty() && + !LLViewerRegion::isSpecialCapabilityName(cap)) + { + llwarns << "BaseCapabilitiesComplete::result FAILED to get " + << "capability " << cap << llendl; + } + } + if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState()) { LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED ); @@ -1347,14 +1371,16 @@ public: } static boost::intrusive_ptr<BaseCapabilitiesComplete> build( - LLViewerRegion* region) + LLViewerRegion* region, + LLSD requestedCaps) { return boost::intrusive_ptr<BaseCapabilitiesComplete>( - new BaseCapabilitiesComplete(region)); + new BaseCapabilitiesComplete(region, requestedCaps)); } private: LLViewerRegion* mRegion; + LLSD mRequestedCaps; }; @@ -1409,7 +1435,8 @@ void LLViewerRegion::setSeedCapability(const std::string& url) llinfos << "posting to seed " << url << llendl; - LLHTTPClient::post(url, capabilityNames, BaseCapabilitiesComplete::build(this)); + LLHTTPClient::post(url, capabilityNames, + BaseCapabilitiesComplete::build(this, capabilityNames)); } void LLViewerRegion::setCapability(const std::string& name, const std::string& url) @@ -1430,6 +1457,11 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u } } +bool LLViewerRegion::isSpecialCapabilityName(const std::string &name) +{ + return name == "EventQueueGet" || name == "UntrustedSimulatorMessage"; +} + std::string LLViewerRegion::getCapability(const std::string& name) const { CapabilityMap::const_iterator iter = mCapabilities.find(name); diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 6625e3bdf6..dedeb43523 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -212,6 +212,7 @@ public: void setSeedCapability(const std::string& url); void setCapability(const std::string& name, const std::string& url); std::string getCapability(const std::string& name) const; + static bool isSpecialCapabilityName(const std::string &name); void logActiveCapabilities() const; const LLHost &getHost() const { return mHost; } diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index c97c3d6952..ab0ef9df4a 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -56,8 +56,8 @@ #include "llviewerwindow.h" // *TODO: remove, only used for width/height #include "llworld.h" #include "llfeaturemanager.h" -#if LL_WINDOWS && LL_LCD_COMPILE - #include "lllcd.h" +#if LL_LCD_COMPILE +#include "lllcd.h" #endif @@ -597,7 +597,7 @@ void update_statistics(U32 frame_count) LLViewerImageList::sTextureBits = 0; LLViewerImageList::sTexturePackets = 0; -#if LL_WINDOWS && LL_LCD_COMPILE +#if LL_LCD_COMPILE bool LCDenabled = gLcdScreen->Enabled(); LLViewerStats::getInstance()->setStat(LLViewerStats::ST_LOGITECH_LCD, LCDenabled); #else diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 771f6615cf..aba7d4dac4 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -1244,7 +1244,7 @@ LLString LLViewerTextEditor::getEmbeddedText() LLString LLViewerTextEditor::appendTime(bool prepend_newline) { - U32 utc_time; + time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 5d3487517b..8f675e66e7 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1491,7 +1491,7 @@ BOOL LLViewerWindow::handleDeviceChange(LLWindow *window) // Classes // LLViewerWindow::LLViewerWindow( - char* title, char* name, + const char* title, const char* name, S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth) diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 08b90f05d7..78afaf6cdf 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -68,7 +68,7 @@ public: // // CREATORS // - LLViewerWindow(char* title, char* name, S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth); + LLViewerWindow(const char* title, const char* name, S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth); virtual ~LLViewerWindow(); void initGLDefaults(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8762c4fef8..91c70bd315 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -9030,7 +9030,7 @@ void LLVOAvatar::dumpLocalTextures() { llinfos << "Local Textures:" << llendl; - char* names[] = { + const char* names[] = { "Shirt ", "UpperTatoo", "Pants ", diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 21ba12324c..4d4808cdff 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -39,7 +39,11 @@ #include "llvoavatar.h" #include "llbufferstream.h" #include "llfile.h" -#include "expat/expat.h" +#ifdef LL_STANDALONE +# include "expat.h" +#else +# include "expat/expat.h" +#endif #include "llcallbacklist.h" #include "llviewerregion.h" #include "llviewernetwork.h" // for gGridChoice @@ -58,10 +62,10 @@ #include "llviewerwindow.h" // for base64 decoding -#include "apr-1/apr_base64.h" +#include "apr_base64.h" // for SHA1 hash -#include "apr-1/apr_sha1.h" +#include "apr_sha1.h" // If we are connecting to agni AND the user's last name is "Linden", join this channel instead of looking up the sim name. // If we are connecting to agni and the user's last name is NOT "Linden", disable voice. @@ -1265,12 +1269,18 @@ void LLVoiceClient::stateMachine() if(true) { // Launch the voice daemon - std::string exe_path = gDirUtilp->getAppRODataDir(); + + // *FIX:Mani - Using the executable dir instead + // of mAppRODataDir, the working directory from which the app + // is launched. + //std::string exe_path = gDirUtilp->getAppRODataDir(); + std::string exe_path = gDirUtilp->getExecutableDir(); exe_path += gDirUtilp->getDirDelimiter(); #if LL_WINDOWS exe_path += "SLVoice.exe"; +#elif LL_DARWIN + exe_path += "../Resources/SLVoice"; #else - // This will be the same for mac and linux exe_path += "SLVoice"; #endif // See if the vivox executable exists @@ -1363,7 +1373,7 @@ void LLVoiceClient::stateMachine() } else { - LL_INFOS("Voice") << exe_path << "not found." << LL_ENDL + LL_INFOS("Voice") << exe_path << "not found." << LL_ENDL; } } else diff --git a/indra/newview/llwindebug.cpp b/indra/newview/llwindebug.cpp index ca7c0f26a4..bf6fcd6ccc 100644 --- a/indra/newview/llwindebug.cpp +++ b/indra/newview/llwindebug.cpp @@ -31,8 +31,6 @@ #include "llviewerprecompiledheaders.h" -#ifdef LL_WINDOWS - #include <tchar.h> #include <tlhelp32.h> #include "llwindebug.h" @@ -740,5 +738,3 @@ void LLWinDebug::generateCrashStacks(struct _EXCEPTION_POINTERS *exception_infop LLSDSerialize::toPrettyXML(info, out_file); out_file.close(); } - -#endif diff --git a/indra/newview/res/resource.h b/indra/newview/res/resource.h index 4f2e88f7f2..2268e81e83 100644 --- a/indra/newview/res/resource.h +++ b/indra/newview/res/resource.h @@ -30,7 +30,7 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by newViewRes.rc +// Used by viewerRes.rc // #define IDREMOVE 3 #define IDI_LL_ICON 103 diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc new file mode 100644 index 0000000000..20a572c8e0 --- /dev/null +++ b/indra/newview/res/viewerRes.rc @@ -0,0 +1,288 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#ifdef IDC_STATIC +#undef IDC_STATIC +#endif +#define IDC_STATIC (-1) +#include "winresrc.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +// Commented out because it only compiles if you have MFC installed. +//#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_LL_ICON ICON "ll_icon.ico" +IDI_INSTALL_ICON ICON "install_icon.ico" +IDI_LCD_LL_ICON ICON "icon1.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +CONNECTBOX DIALOGEX 32, 32, 187, 246 +STYLE DS_SETFONT | DS_SETFOREGROUND | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | + WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + CONTROL 149,IDC_STATIC,"Static",SS_BITMAP,0,0,187,246 + EDITTEXT IDC_EDIT_FIRSTNAME,9,180,80,13,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_LASTNAME,98,180,80,13,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_PASSWORD,9,210,80,13,ES_PASSWORD | + ES_AUTOHSCROLL + CONTROL "Remember password",IDC_REMEMBER_PASSWORD,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,9,229,80,10 + DEFPUSHBUTTON "Connect...",IDOK,98,210,80,13 + CONTROL "Full screen",IDC_FULL_SCREEN,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,100,229,50,10 + COMBOBOX IDC_COMBO_SERVER,98,6,84,30,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP +END + +CONNECTBOXIP DIALOG 32, 32, 282, 174 +STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | + WS_VISIBLE +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "First name:",IDC_STATIC_FIRSTNAME,152,24,36,10,NOT + WS_GROUP + EDITTEXT IDC_EDIT_FIRSTNAME,152,37,58,13,ES_AUTOHSCROLL + LTEXT "Last name:",IDC_STATIC_LASTNAME,218,24,38,10,NOT + WS_GROUP + EDITTEXT IDC_EDIT_LASTNAME,218,37,57,13,ES_AUTOHSCROLL + LTEXT "Password:",IDC_STATIC_PASSWORD,152,55,38,10 + EDITTEXT IDC_EDIT_PASSWORD,152,71,123,13,ES_PASSWORD | + ES_AUTOHSCROLL + CONTROL "Remember password for next time",IDC_REMEMBER_PASSWORD, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,84,123,10 + LTEXT "Return to:",IDC_STATIC,152,97,32,8 + CONTROL "Last location",IDC_RADIO_LAST,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,152,109,56,10 + CONTROL "Home",IDC_RADIO_HOME,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,218,109,35,10 + LTEXT "Server:",IDC_STATIC_SERVER,152,119,38,10,NOT WS_GROUP + COMBOBOX IDC_COMBO_SERVER,152,134,88,43,CBS_DROPDOWN | WS_VSCROLL | + WS_TABSTOP + PUSHBUTTON "Quit",IDCANCEL,152,152,50,14 + DEFPUSHBUTTON "Connect...",IDOK,225,152,50,14 + CONTROL 140,IDB_BITMAP1,"Static",SS_BITMAP,8,7,133,157 + LTEXT "Connect to Second Life",IDC_STATIC,152,7,78,8 +END + +SPLASHSCREEN DIALOG 32, 32, 144, 34 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_LL_ICON,IDC_STATIC,7,7,20,20 + LTEXT "Loading Second Life...",666,36,13,91,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + "CONNECTBOX", DIALOG + BEGIN + LEFTMARGIN, 8 + RIGHTMARGIN, 180 + VERTGUIDE, 152 + TOPMARGIN, 7 + BOTTOMMARGIN, 239 + HORZGUIDE, 44 + HORZGUIDE, 57 + HORZGUIDE, 123 + END + + "CONNECTBOXIP", DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 275 + VERTGUIDE, 152 + VERTGUIDE, 218 + TOPMARGIN, 7 + BOTTOMMARGIN, 166 + HORZGUIDE, 12 + HORZGUIDE, 17 + HORZGUIDE, 24 + HORZGUIDE, 50 + HORZGUIDE, 55 + HORZGUIDE, 84 + HORZGUIDE, 105 + HORZGUIDE, 119 + END + + "SPLASHSCREEN", DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 137 + VERTGUIDE, 36 + TOPMARGIN, 7 + BOTTOMMARGIN, 27 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU1 MENU +BEGIN + POPUP "testmenu" + BEGIN + MENUITEM "test", ID_TESTMENU_TEST + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Cursor +// + +TOOLGRAB CURSOR "lltoolgrab.cur" +TOOLLAND CURSOR "lltoolland.cur" +TOOLZOOMIN CURSOR "lltoolzoomin.cur" +TOOLCREATE CURSOR "lltoolcreate.cur" +ARROWDRAG CURSOR "llarrowdrag.cur" +ARROW CURSOR "llarrow.cur" +NOLOCKED CURSOR "llnolocked.cur" +ARROWLOCKED CURSOR "llarrowlocked.cur" +GRABLOCKED CURSOR "llgrablocked.cur" +TOOLROTATE CURSOR "lltoolrotate.cur" +TOOLTRANSLATE CURSOR "lltooltranslate.cur" +TOOLSCALE CURSOR "lltoolscale.cur" +TOOLCAMERA CURSOR "lltoolcamera.cur" +TOOLPAN CURSOR "lltoolpan.cur" +TOOLFOCUS CURSOR "lltoolfocus.cur" +TOOLPICKOBJECT3 CURSOR "toolpickobject3.cur" +ARROWCOPY CURSOR "arrowcop.cur" +ARROWDRAGMULTI CURSOR "llarrowdragmulti.cur" +ARROWCOPYMULTI CURSOR "arrowcopmulti.cur" +TOOLSIT CURSOR "toolsit.cur" +TOOLBUY CURSOR "toolbuy.cur" +TOOLPAY CURSOR "toolpay.cur" +TOOLOPEN CURSOR "toolopen.cur" +TOOLPIPETTE CURSOR "toolpipette.cur" +TOOLPLAY CURSOR "toolplay.cur" +TOOLPAUSE CURSOR "toolpause.cur" +TOOLMEDIAOPEN CURSOR "toolmediaopen.cur" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,19,1,83014 + PRODUCTVERSION 1,19,1,83014 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Linden Lab" + VALUE "FileDescription", "Second Life" + VALUE "FileVersion", "1.19.1.83014" + VALUE "InternalName", "Second Life" + VALUE "LegalCopyright", "Copyright © 2001-2008, Linden Research, Inc." + VALUE "OriginalFilename", "SecondLife.exe" + VALUE "ProductName", "Second Life" + VALUE "ProductVersion", "1.19.1.83014" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP2 BITMAP "bitmap2.bmp" +IDB_LOGIN BITMAP "loginbackground.bmp" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 5d3658b96c..248dda83fb 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -6,7 +6,7 @@ # # $LicenseInfo:firstyear=2006&license=viewergpl$ # -# Copyright (c) 2006-2007, Linden Research, Inc. +# Copyright (c) 2006-2008, Linden Research, Inc. # # Second Life Viewer Source Code # The source code in this file ("Source Code") is provided by Linden Lab @@ -14,12 +14,12 @@ # ("GPL"), unless you have obtained a separate licensing agreement # ("Other License"), formally executed by you and Linden Lab. Terms of # the GPL can be found in doc/GPL-license.txt in this distribution, or -# online at http://secondlife.com/developers/opensource/gplv2 +# online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 # # There are special exceptions to the terms and conditions of the GPL as # it is applied to this Source Code. View the full text of the exception # in the file doc/FLOSS-exception.txt in this software distribution, or -# online at http://secondlife.com/developers/opensource/flossexception +# online at http://secondlifegrid.net/programs/open_source/licensing/flossexception # # By copying, modifying or distributing this software, you acknowledge # that you have read and understood your obligations described above, @@ -39,435 +39,476 @@ sys.path.append(os.path.join(viewer_dir, '../lib/python/indra/util')) from llmanifest import LLManifest, main, proper_windows_path, path_ancestors class ViewerManifest(LLManifest): - def construct(self): - super(ViewerManifest, self).construct() - self.exclude("*.svn*") - self.path(src="../../scripts/messages/message_template.msg", dst="app_settings/message_template.msg") - self.path(src="../../etc/message.xml", dst="app_settings/message.xml") - - if self.prefix(src="app_settings"): - self.exclude("logcontrol.xml") - self.exclude("logcontrol-dev.xml") - self.path("*.pem") - self.path("*.ini") - self.path("*.xml") - self.path("*.vp") - self.path("*.db2") - - # include the entire shaders directory recursively - self.path("shaders") - # ... and the entire windlight directory - self.path("windlight") - self.end_prefix("app_settings") - - if self.prefix(src="character"): - self.path("*.llm") - self.path("*.xml") - self.path("*.tga") - self.end_prefix("character") - - - # Include our fonts - if self.prefix(src="fonts"): - self.path("*.ttf") - self.path("*.txt") - self.end_prefix("fonts") - - # XUI - if self.prefix(src="skins"): - # include the entire textures directory recursively - self.path("textures") - self.path("paths.xml") - self.path("xui/*/*.xml") - self.path('words.*.txt') - - # Local HTML files (e.g. loading screen) - if self.prefix(src="html"): - self.path("*.png") - self.path("*/*/*.html") - self.path("*/*/*.gif") - self.end_prefix("html") - self.end_prefix("skins") - - self.path("releasenotes.txt") - self.path("lsl_guide.html") - self.path("gpu_table.txt") - - def login_channel(self): - """Channel reported for login and upgrade purposes ONLY; used for A/B testing""" - # NOTE: Do not return the normal channel if login_channel is not specified, as - # some code may branch depending on whether or not this is present - return self.args.get('login_channel') - - def channel(self): - return self.args['channel'] - def channel_unique(self): - return self.channel().replace("Second Life", "").strip() - def channel_oneword(self): - return "".join(self.channel_unique().split()) - def channel_lowerword(self): - return self.channel_oneword().lower() - - def flags_list(self): - """ Convenience function that returns the command-line flags for the grid""" - channel_flags = '' - grid_flags = '' - if not self.default_grid(): - if self.default_channel(): - # beta grid viewer - channel_flags = '--settings settings_beta.xml' - grid_flags = "--grid %(grid)s --helperuri http://preview-%(grid)s.secondlife.com/helpers/" % {'grid':self.args['grid']} - - if not self.default_channel(): - # some channel on some grid - channel_flags = '--settings settings_%s.xml --channel "%s"' % (self.channel_lowerword(), self.channel()) - elif self.login_channel(): - # Report a special channel during login, but use default channel elsewhere - channel_flags = '--channel "%s"' % (self.login_channel()) + def construct(self): + super(ViewerManifest, self).construct() + self.exclude("*.svn*") + self.path(src="../../scripts/messages/message_template.msg", dst="app_settings/message_template.msg") + self.path(src="../../etc/message.xml", dst="app_settings/message.xml") + + if self.prefix(src="app_settings"): + self.exclude("logcontrol.xml") + self.exclude("logcontrol-dev.xml") + self.path("*.pem") + self.path("*.ini") + self.path("*.xml") + self.path("*.vp") + self.path("*.db2") + + # include the entire shaders directory recursively + self.path("shaders") + # ... and the entire windlight directory + self.path("windlight") + self.end_prefix("app_settings") + + if self.prefix(src="character"): + self.path("*.llm") + self.path("*.xml") + self.path("*.tga") + self.end_prefix("character") + + + # Include our fonts + if self.prefix(src="fonts"): + self.path("*.ttf") + self.path("*.txt") + self.end_prefix("fonts") + + # XUI + if self.prefix(src="skins"): + # include the entire textures directory recursively + self.path("textures") + self.path("paths.xml") + self.path("xui/*/*.xml") + self.path('words.*.txt') + + # Local HTML files (e.g. loading screen) + if self.prefix(src="html"): + self.path("*.png") + self.path("*/*/*.html") + self.path("*/*/*.gif") + self.end_prefix("html") + self.end_prefix("skins") + + self.path("releasenotes.txt") + self.path("lsl_guide.html") + self.path("gpu_table.txt") + + def login_channel(self): + """Channel reported for login and upgrade purposes ONLY; + used for A/B testing""" + # NOTE: Do not return the normal channel if login_channel + # is not specified, as some code may branch depending on + # whether or not this is present + return self.args.get('login_channel') + + def channel(self): + return self.args['channel'] + def channel_unique(self): + return self.channel().replace("Second Life", "").strip() + def channel_oneword(self): + return "".join(self.channel_unique().split()) + def channel_lowerword(self): + return self.channel_oneword().lower() + + def flags_list(self): + """ Convenience function that returns the command-line flags + for the grid""" + channel_flags = '' + grid_flags = '' + if not self.default_grid(): + if self.default_channel(): + # beta grid viewer + channel_flags = '--settings settings_beta.xml' + grid_flags = "--grid %(grid)s --helperuri http://preview-%(grid)s.secondlife.com/helpers/" % {'grid':self.args['grid']} + + if not self.default_channel(): + # some channel on some grid + channel_flags = '--settings settings_%s.xml --channel "%s"' % (self.channel_lowerword(), self.channel()) + elif self.login_channel(): + # Report a special channel during login, but use default + channel_flags = '--channel "%s"' % (self.login_channel()) - return " ".join((channel_flags, grid_flags)).strip() + return " ".join((channel_flags, grid_flags)).strip() class WindowsManifest(ViewerManifest): - def final_exe(self): - if self.default_channel(): - if self.default_grid(): - return "SecondLife.exe" - else: - return "SecondLifePreview.exe" - else: - return ''.join(self.channel().split()) + '.exe' - - - def construct(self): - super(WindowsManifest, self).construct() - # the final exe is complicated because we're not sure where it's coming from, - # nor do we have a fixed name for the executable - self.path(self.find_existing_file('ReleaseForDownload/Secondlife.exe', 'Secondlife.exe', 'ReleaseNoOpt/newview_noopt.exe'), dst=self.final_exe()) - # need to get the kdu dll from any of the build directories as well - self.path(self.find_existing_file('ReleaseForDownload/llkdu.dll', 'llkdu.dll', '../../libraries/i686-win32/lib_release/llkdu.dll'), dst='llkdu.dll') - self.path(src="licenses-win32.txt", dst="licenses.txt") - - self.path("featuretable.txt") - - # For use in crash reporting (generates minidumps) - self.path("dbghelp.dll") - - # For using FMOD for sound... DJS - self.path("fmod.dll") - - # For textures - if self.prefix(src="../../libraries/i686-win32/lib_release", dst=""): - self.path("openjpeg.dll") - self.end_prefix() - - # Mozilla appears to force a dependency on these files so we need to ship it (CP) - self.path("msvcr71.dll") - self.path("msvcp71.dll") - - # Mozilla runtime DLLs (CP) - if self.prefix(src="../../libraries/i686-win32/lib_release", dst=""): - self.path("freebl3.dll") - self.path("gksvggdiplus.dll") - self.path("js3250.dll") - self.path("nspr4.dll") - self.path("nss3.dll") - self.path("nssckbi.dll") - self.path("plc4.dll") - self.path("plds4.dll") - self.path("smime3.dll") - self.path("softokn3.dll") - self.path("ssl3.dll") - self.path("xpcom.dll") - self.path("xul.dll") - self.end_prefix() - - # Mozilla runtime misc files (CP) - if self.prefix(src="app_settings/mozilla"): - self.path("chrome/*.*") - self.path("components/*.*") - self.path("greprefs/*.*") - self.path("plugins/*.*") - self.path("res/*.*") - self.path("res/*/*") - self.end_prefix() - - # Vivox runtimes - if self.prefix(src="vivox-runtime/i686-win32", dst=""): - self.path("SLVoice.exe") - self.path("SLVoiceAgent.exe") - self.path("libeay32.dll") - self.path("srtp.dll") - self.path("ssleay32.dll") - self.path("tntk.dll") - self.path("alut.dll") - self.path("vivoxsdk.dll") - self.path("ortp.dll") - self.path("wrap_oal.dll") - self.end_prefix() - - # pull in the crash logger and updater from other projects - self.path(src="../win_crash_logger/win_crash_logger.exe", dst="win_crash_logger.exe") - self.path(src="../win_updater/updater.exe", dst="updater.exe") - - def nsi_file_commands(self, install=True): - def wpath(path): - if(path.endswith('/') or path.endswith(os.path.sep)): - path = path[:-1] - path = path.replace('/', '\\') - return path - - result = "" - dest_files = [pair[1] for pair in self.file_list if pair[0] and os.path.isfile(pair[1])] - # sort deepest hierarchy first - dest_files.sort(lambda a,b: cmp(a.count(os.path.sep),b.count(os.path.sep)) or cmp(a,b)) - dest_files.reverse() - out_path = None - for pkg_file in dest_files: - rel_file = os.path.normpath(pkg_file.replace(self.get_dst_prefix()+os.path.sep,'')) - installed_dir = wpath(os.path.join('$INSTDIR', os.path.dirname(rel_file))) - pkg_file = wpath(os.path.normpath(pkg_file)) - if installed_dir != out_path: - if(install): - out_path = installed_dir - result += 'SetOutPath ' + out_path + '\n' - if(install): - result += 'File ' + pkg_file + '\n' - else: - result += 'Delete ' + wpath(os.path.join('$INSTDIR', rel_file)) + '\n' - # at the end of a delete, just rmdir all the directories - if(not install): - deleted_file_dirs = [os.path.dirname(pair[1].replace(self.get_dst_prefix()+os.path.sep,'')) for pair in self.file_list] - # find all ancestors so that we don't skip any dirs that happened to have no non-dir children - deleted_dirs = [] - for d in deleted_file_dirs: - deleted_dirs.extend(path_ancestors(d)) - # sort deepest hierarchy first - deleted_dirs.sort(lambda a,b: cmp(a.count(os.path.sep),b.count(os.path.sep)) or cmp(a,b)) - deleted_dirs.reverse() - prev = None - for d in deleted_dirs: - if d != prev: # skip duplicates - result += 'RMDir ' + wpath(os.path.join('$INSTDIR', os.path.normpath(d))) + '\n' - prev = d - - return result - - def package_finish(self): - # a standard map of strings for replacing in the templates - substitution_strings = { - 'version' : '.'.join(self.args['version']), - 'version_short' : '.'.join(self.args['version'][:-1]), - 'version_dashes' : '-'.join(self.args['version']), - 'final_exe' : self.final_exe(), - 'grid':self.args['grid'], - 'grid_caps':self.args['grid'].upper(), - # escape quotes becase NSIS doesn't handle them well - 'flags':self.flags_list().replace('"', '$\\"'), - 'channel':self.channel(), - 'channel_oneword':self.channel_oneword(), - 'channel_unique':self.channel_unique(), - } - - version_vars = """ - !define INSTEXE "%(final_exe)s" - !define VERSION "%(version_short)s" - !define VERSION_LONG "%(version)s" - !define VERSION_DASHES "%(version_dashes)s" - """ % substitution_strings - if self.default_channel(): - if self.default_grid(): - # release viewer - installer_file = "Second_Life_%(version_dashes)s_Setup.exe" - grid_vars_template = """ - OutFile "%(installer_file)s" - !define INSTFLAGS "%(flags)s" - !define INSTNAME "SecondLife" - !define SHORTCUT "Second Life" - !define URLNAME "secondlife" - Caption "Second Life ${VERSION}" - """ - else: - # beta grid viewer - installer_file = "Second_Life_%(version_dashes)s_(%(grid_caps)s)_Setup.exe" - grid_vars_template = """ - OutFile "%(installer_file)s" - !define INSTFLAGS "%(flags)s" - !define INSTNAME "SecondLife%(grid_caps)s" - !define SHORTCUT "Second Life (%(grid_caps)s)" - !define URLNAME "secondlife%(grid)s" - !define UNINSTALL_SETTINGS 1 - Caption "Second Life %(grid)s ${VERSION}" - """ - else: - # some other channel on some grid - installer_file = "Second_Life_%(version_dashes)s_%(channel_oneword)s_Setup.exe" - grid_vars_template = """ - OutFile "%(installer_file)s" - !define INSTFLAGS "%(flags)s" - !define INSTNAME "SecondLife%(channel_oneword)s" - !define SHORTCUT "%(channel)s" - !define URLNAME "secondlife" - !define UNINSTALL_SETTINGS 1 - Caption "%(channel)s ${VERSION}" - """ - if(self.args.has_key('installer_name')): - installer_file = self.args['installer_name'] - else: - installer_file = installer_file % substitution_strings - substitution_strings['installer_file'] = installer_file - - tempfile = "../secondlife_setup_tmp.nsi" - # the following replaces strings in the nsi template - # it also does python-style % substitution - self.replace_in("installers/windows/installer_template.nsi", tempfile, { - "%%VERSION%%":version_vars, - "%%GRID_VARS%%":grid_vars_template % substitution_strings, - "%%INSTALL_FILES%%":self.nsi_file_commands(True), - "%%DELETE_FILES%%":self.nsi_file_commands(False)}) - - NSIS_path = 'C:\\Program Files\\NSIS\\makensis.exe' - self.run_command('"' + proper_windows_path(NSIS_path) + '" ' + self.dst_path_of(tempfile)) - # self.remove(self.dst_path_of(tempfile)) - self.created_path(installer_file) + def final_exe(self): + if self.default_channel(): + if self.default_grid(): + return "SecondLife.exe" + else: + return "SecondLifePreview.exe" + else: + return ''.join(self.channel().split()) + '.exe' + + + def construct(self): + super(WindowsManifest, self).construct() + # the final exe is complicated because we're not sure where it's coming from, + # nor do we have a fixed name for the executable + self.path(self.find_existing_file('debug/secondlife-bin.exe', 'release/secondlife-bin.exe', 'relwithdebinfo/secondlife-bin.exe'), dst=self.final_exe()) + # need to get the kdu dll from any of the build directories as well + self.path(self.find_existing_file( + # *FIX:Mani we need to add support for packaging specific targets. + #'../llkdu/debug/llkdu.dll', + '../llkdu/release/llkdu.dll', + '../llkdu/relwithdebinfo/llkdu.dll', + '../../libraries/i686-win32/lib/release/llkdu.dll'), + dst='llkdu.dll') + self.path(src="licenses-win32.txt", dst="licenses.txt") + + self.path("featuretable.txt") + + # For use in crash reporting (generates minidumps) + self.path("dbghelp.dll") + + # For using FMOD for sound... DJS + self.path("fmod.dll") + + # For textures + if self.prefix(src="../../libraries/i686-win32/lib/release", dst=""): + self.path("openjpeg.dll") + self.end_prefix() + + # Mozilla appears to force a dependency on these files so we need to ship it (CP) + self.path("msvcr71.dll") + self.path("msvcp71.dll") + + # Mozilla runtime DLLs (CP) + if self.prefix(src="../../libraries/i686-win32/lib/release", dst=""): + self.path("freebl3.dll") + self.path("gksvggdiplus.dll") + self.path("js3250.dll") + self.path("nspr4.dll") + self.path("nss3.dll") + self.path("nssckbi.dll") + self.path("plc4.dll") + self.path("plds4.dll") + self.path("smime3.dll") + self.path("softokn3.dll") + self.path("ssl3.dll") + self.path("xpcom.dll") + self.path("xul.dll") + self.end_prefix() + + # Mozilla runtime misc files (CP) + if self.prefix(src="app_settings/mozilla"): + self.path("chrome/*.*") + self.path("components/*.*") + self.path("greprefs/*.*") + self.path("plugins/*.*") + self.path("res/*.*") + self.path("res/*/*") + self.end_prefix() + + # Vivox runtimes + if self.prefix(src="vivox-runtime/i686-win32", dst=""): + self.path("SLVoice.exe") + self.path("SLVoiceAgent.exe") + self.path("libeay32.dll") + self.path("srtp.dll") + self.path("ssleay32.dll") + self.path("tntk.dll") + self.path("alut.dll") + self.path("vivoxsdk.dll") + self.path("ortp.dll") + self.path("wrap_oal.dll") + self.end_prefix() + + # pull in the crash logger and updater from other projects + self.path(src=self.find_existing_file( + "../win_crash_logger/debug/windows-crash-logger.exe", + "../win_crash_logger/release/windows-crash-logger.exe", + "../win_crash_logger/relwithdebinfo/windows-crash-logger.exe"), + dst="win_crash_logger.exe") + self.path(src=self.find_existing_file( + "../win_updater/debug/windows-updater.exe", + "../win_updater/release/windows-updater.exe", + "../win_updater/relwithdebinfo/windows-updater.exe"), + dst="updater.exe") + + def nsi_file_commands(self, install=True): + def wpath(path): + if path.endswith('/') or path.endswith(os.path.sep): + path = path[:-1] + path = path.replace('/', '\\') + return path + + result = "" + dest_files = [pair[1] for pair in self.file_list if pair[0] and os.path.isfile(pair[1])] + # sort deepest hierarchy first + dest_files.sort(lambda a,b: cmp(a.count(os.path.sep),b.count(os.path.sep)) or cmp(a,b)) + dest_files.reverse() + out_path = None + for pkg_file in dest_files: + rel_file = os.path.normpath(pkg_file.replace(self.get_dst_prefix()+os.path.sep,'')) + installed_dir = wpath(os.path.join('$INSTDIR', os.path.dirname(rel_file))) + pkg_file = wpath(os.path.normpath(pkg_file)) + if installed_dir != out_path: + if install: + out_path = installed_dir + result += 'SetOutPath ' + out_path + '\n' + if install: + result += 'File ' + pkg_file + '\n' + else: + result += 'Delete ' + wpath(os.path.join('$INSTDIR', rel_file)) + '\n' + # at the end of a delete, just rmdir all the directories + if not install: + deleted_file_dirs = [os.path.dirname(pair[1].replace(self.get_dst_prefix()+os.path.sep,'')) for pair in self.file_list] + # find all ancestors so that we don't skip any dirs that happened to have no non-dir children + deleted_dirs = [] + for d in deleted_file_dirs: + deleted_dirs.extend(path_ancestors(d)) + # sort deepest hierarchy first + deleted_dirs.sort(lambda a,b: cmp(a.count(os.path.sep),b.count(os.path.sep)) or cmp(a,b)) + deleted_dirs.reverse() + prev = None + for d in deleted_dirs: + if d != prev: # skip duplicates + result += 'RMDir ' + wpath(os.path.join('$INSTDIR', os.path.normpath(d))) + '\n' + prev = d + + return result + + def package_finish(self): + # a standard map of strings for replacing in the templates + substitution_strings = { + 'version' : '.'.join(self.args['version']), + 'version_short' : '.'.join(self.args['version'][:-1]), + 'version_dashes' : '-'.join(self.args['version']), + 'final_exe' : self.final_exe(), + 'grid':self.args['grid'], + 'grid_caps':self.args['grid'].upper(), + # escape quotes becase NSIS doesn't handle them well + 'flags':self.flags_list().replace('"', '$\\"'), + 'channel':self.channel(), + 'channel_oneword':self.channel_oneword(), + 'channel_unique':self.channel_unique(), + } + + version_vars = """ + !define INSTEXE "%(final_exe)s" + !define VERSION "%(version_short)s" + !define VERSION_LONG "%(version)s" + !define VERSION_DASHES "%(version_dashes)s" + """ % substitution_strings + if self.default_channel(): + if self.default_grid(): + # release viewer + installer_file = "Second_Life_%(version_dashes)s_Setup.exe" + grid_vars_template = """ + OutFile "%(installer_file)s" + !define INSTFLAGS "%(flags)s" + !define INSTNAME "SecondLife" + !define SHORTCUT "Second Life" + !define URLNAME "secondlife" + Caption "Second Life ${VERSION}" + """ + else: + # beta grid viewer + installer_file = "Second_Life_%(version_dashes)s_(%(grid_caps)s)_Setup.exe" + grid_vars_template = """ + OutFile "%(installer_file)s" + !define INSTFLAGS "%(flags)s" + !define INSTNAME "SecondLife%(grid_caps)s" + !define SHORTCUT "Second Life (%(grid_caps)s)" + !define URLNAME "secondlife%(grid)s" + !define UNINSTALL_SETTINGS 1 + Caption "Second Life %(grid)s ${VERSION}" + """ + else: + # some other channel on some grid + installer_file = "Second_Life_%(version_dashes)s_%(channel_oneword)s_Setup.exe" + grid_vars_template = """ + OutFile "%(installer_file)s" + !define INSTFLAGS "%(flags)s" + !define INSTNAME "SecondLife%(channel_oneword)s" + !define SHORTCUT "%(channel)s" + !define URLNAME "secondlife" + !define UNINSTALL_SETTINGS 1 + Caption "%(channel)s ${VERSION}" + """ + if 'installer_name' in self.args: + installer_file = self.args['installer_name'] + else: + installer_file = installer_file % substitution_strings + substitution_strings['installer_file'] = installer_file + + tempfile = "secondlife_setup_tmp.nsi" + # the following replaces strings in the nsi template + # it also does python-style % substitution + self.replace_in("installers/windows/installer_template.nsi", tempfile, { + "%%VERSION%%":version_vars, + "%%SOURCE%%":self.get_src_prefix(), + "%%GRID_VARS%%":grid_vars_template % substitution_strings, + "%%INSTALL_FILES%%":self.nsi_file_commands(True), + "%%DELETE_FILES%%":self.nsi_file_commands(False)}) + + NSIS_path = 'C:\\Program Files\\NSIS\\makensis.exe' + self.run_command('"' + proper_windows_path(NSIS_path) + '" ' + self.dst_path_of(tempfile)) + # self.remove(self.dst_path_of(tempfile)) + self.created_path(self.dst_path_of(installer_file)) + self.package_file = installer_file class DarwinManifest(ViewerManifest): - def construct(self): - # copy over the build result (this is a no-op if run within the xcode script) - self.path("build/" + self.args['configuration'] + "/Second Life.app", dst="") - - if self.prefix(src="", dst="Contents"): # everything goes in Contents - # Expand the tar file containing the assorted mozilla bits into - # <bundle>/Contents/MacOS/ - self.contents_of_tar('mozilla-universal-darwin.tgz', 'MacOS') - - # copy additional libs in <bundle>/Contents/MacOS/ - self.path("../../libraries/universal-darwin/lib_release/libndofdev.dylib", dst="MacOS/libndofdev.dylib") - - # replace the default theme with our custom theme (so scrollbars work). - if self.prefix(src="mozilla-theme", dst="MacOS/chrome"): - self.path("classic.jar") - self.path("classic.manifest") - self.end_prefix("MacOS/chrome") - - # most everything goes in the Resources directory - if self.prefix(src="", dst="Resources"): - super(DarwinManifest, self).construct() - - if self.prefix("cursors_mac"): - self.path("*.tif") - self.end_prefix("cursors_mac") - - self.path("licenses-mac.txt", dst="licenses.txt") - self.path("featuretable_mac.txt") - self.path("secondlife.icns") - - # llkdu dynamic library - self.path("../../libraries/universal-darwin/lib_release/libllkdu.dylib", "libllkdu.dylib") - - # command line arguments for connecting to the proper grid - self.put_in_file(self.flags_list(), 'arguments.txt') - - self.end_prefix("Resources") - - self.end_prefix("Contents") - - # NOTE: the -S argument to strip causes it to keep enough info for - # annotated backtraces (i.e. function names in the crash log). 'strip' with no - # arguments yields a slightly smaller binary but makes crash logs mostly useless. - # This may be desirable for the final release. Or not. - if("package" in self.args['actions'] or - "unpacked" in self.args['actions']): - self.run_command('strip -S "%(viewer_binary)s"' % - { 'viewer_binary' : self.dst_path_of('Contents/MacOS/Second Life')}) - - - def package_finish(self): - channel_standin = 'Second Life' # hah, our default channel is not usable on its own - if not self.default_channel(): - channel_standin = self.channel() - - imagename="SecondLife_" + '_'.join(self.args['version']) - if self.default_channel(): - if not self.default_grid(): - # beta case - imagename = imagename + '_' + self.args['grid'].upper() - else: - # first look, etc - imagename = imagename + '_' + self.channel_oneword().upper() - - sparsename = imagename + ".sparseimage" - finalname = imagename + ".dmg" - # make sure we don't have stale files laying about - self.remove(sparsename, finalname) - - self.run_command('hdiutil create "%(sparse)s" -volname "%(channel)s" -fs HFS+ -type SPARSE -megabytes 300 -layout SPUD' % { - 'sparse':sparsename, - 'channel':channel_standin}) - - # mount the image and get the name of the mount point and device node - hdi_output = self.run_command('hdiutil attach -private "' + sparsename + '"') - devfile = re.search("/dev/disk([0-9]+)[^s]", hdi_output).group(0).strip() - volpath = re.search('HFS\s+(.+)', hdi_output).group(1).strip() - - # Copy everything in to the mounted .dmg - if self.default_channel() and not self.default_grid(): - app_name = "Second Life " + self.args['grid'] - else: - app_name = channel_standin.strip() - - for s,d in {self.get_dst_prefix():app_name + ".app", - "lsl_guide.html":"Linden Scripting Language Guide.html", - "releasenotes.txt":"Release Notes.txt", - "installers/darwin/mac_image_hidden":".hidden", - "installers/darwin/mac_image_background.tga":"background.tga", - "installers/darwin/mac_image_DS_Store":".DS_Store"}.items(): - print "Copying to dmg", s, d - self.copy_action(self.src_path_of(s), os.path.join(volpath, d)) - - # Unmount the image - self.run_command('hdiutil detach -force "' + devfile + '"') - - print "Converting temp disk image to final disk image" - self.run_command('hdiutil convert "%(sparse)s" -format UDZO -imagekey zlib-level=9 -o "%(final)s"' % {'sparse':sparsename, 'final':finalname}) - # get rid of the temp file - self.remove(sparsename) + def construct(self): + # copy over the build result (this is a no-op if run within the xcode script) + self.path(self.args['configuration'] + "/Second Life.app", dst="") + + if self.prefix(src="", dst="Contents"): # everything goes in Contents + # Expand the tar file containing the assorted mozilla bits into + # <bundle>/Contents/MacOS/ + self.contents_of_tar(self.args['source']+'/mozilla-universal-darwin.tgz', 'MacOS') + + self.path("Info-SecondLife.plist", dst="Info.plist") + + # copy additional libs in <bundle>/Contents/MacOS/ + self.path("../../libraries/universal-darwin/lib_release/libndofdev.dylib", dst="MacOS/libndofdev.dylib") + + # replace the default theme with our custom theme (so scrollbars work). + if self.prefix(src="mozilla-theme", dst="MacOS/chrome"): + self.path("classic.jar") + self.path("classic.manifest") + self.end_prefix("MacOS/chrome") + + # most everything goes in the Resources directory + if self.prefix(src="", dst="Resources"): + super(DarwinManifest, self).construct() + + if self.prefix("cursors_mac"): + self.path("*.tif") + self.end_prefix("cursors_mac") + + self.path("licenses-mac.txt", dst="licenses.txt") + self.path("featuretable_mac.txt") + self.path("secondlife.icns") + + # Translations + self.path("English.lproj") + self.path("German.lproj") + self.path("Japanese.lproj") + self.path("Korean.lproj") + + # SLVoice and vivox lols + self.path("vivox-runtime/universal-darwin/libalut.dylib", "libalut.dylib") + self.path("vivox-runtime/universal-darwin/libopenal.dylib", "libopenal.dylib") + self.path("vivox-runtime/universal-darwin/libortp.dylib", "libortp.dylib") + self.path("vivox-runtime/universal-darwin/libvivoxsdk.dylib", "libvivoxsdk.dylib") + self.path("vivox-runtime/universal-darwin/SLVoice", "SLVoice") + self.path("vivox-runtime/universal-darwin/SLVoiceAgent.app", "SLVoiceAgent.app") + + # llkdu dynamic library + self.path("../../libraries/universal-darwin/lib_release/libllkdu.dylib", "libllkdu.dylib") + + #libfmodwrapper.dylib + self.path(self.args['configuration'] + "/libfmodwrapper.dylib", "libfmodwrapper.dylib") + + # command line arguments for connecting to the proper grid + self.put_in_file(self.flags_list(), 'arguments.txt') + + self.end_prefix("Resources") + + self.end_prefix("Contents") + + # NOTE: the -S argument to strip causes it to keep enough info for + # annotated backtraces (i.e. function names in the crash log). 'strip' with no + # arguments yields a slightly smaller binary but makes crash logs mostly useless. + # This may be desirable for the final release. Or not. + if ("package" in self.args['actions'] or + "unpacked" in self.args['actions']): + self.run_command('strip -S "%(viewer_binary)s"' % + { 'viewer_binary' : self.dst_path_of('Contents/MacOS/Second Life')}) + + + def package_finish(self): + channel_standin = 'Second Life' # hah, our default channel is not usable on its own + if not self.default_channel(): + channel_standin = self.channel() + + imagename="SecondLife_" + '_'.join(self.args['version']) + if self.default_channel(): + if not self.default_grid(): + # beta case + imagename = imagename + '_' + self.args['grid'].upper() + else: + # first look, etc + imagename = imagename + '_' + self.channel_oneword().upper() + + sparsename = imagename + ".sparseimage" + finalname = imagename + ".dmg" + # make sure we don't have stale files laying about + self.remove(sparsename, finalname) + + self.run_command('hdiutil create "%(sparse)s" -volname "%(channel)s" -fs HFS+ -type SPARSE -megabytes 300 -layout SPUD' % { + 'sparse':sparsename, + 'channel':channel_standin}) + + # mount the image and get the name of the mount point and device node + hdi_output = self.run_command('hdiutil attach -private "' + sparsename + '"') + devfile = re.search("/dev/disk([0-9]+)[^s]", hdi_output).group(0).strip() + volpath = re.search('HFS\s+(.+)', hdi_output).group(1).strip() + + # Copy everything in to the mounted .dmg + if self.default_channel() and not self.default_grid(): + app_name = "Second Life " + self.args['grid'] + else: + app_name = channel_standin.strip() + + for s,d in {self.get_dst_prefix():app_name + ".app", + "lsl_guide.html":"Linden Scripting Language Guide.html", + "releasenotes.txt":"Release Notes.txt", + "installers/darwin/mac_image_hidden":".hidden", + "installers/darwin/mac_image_background.tga":"background.tga", + "installers/darwin/mac_image_DS_Store":".DS_Store"}.items(): + print "Copying to dmg", s, d + self.copy_action(self.src_path_of(s), os.path.join(volpath, d)) + + # Unmount the image + self.run_command('hdiutil detach -force "' + devfile + '"') + + print "Converting temp disk image to final disk image" + self.run_command('hdiutil convert "%(sparse)s" -format UDZO -imagekey zlib-level=9 -o "%(final)s"' % {'sparse':sparsename, 'final':finalname}) + # get rid of the temp file + self.package_file = finalname + self.remove(sparsename) class LinuxManifest(ViewerManifest): - def construct(self): - super(LinuxManifest, self).construct() - self.path("licenses-linux.txt","licenses.txt") - self.path("res/ll_icon.png","secondlife_icon.png") - if self.prefix("linux_tools", ""): - self.path("client-readme.txt","README-linux.txt") - self.path("client-readme-voice.txt","README-linux-voice.txt") - self.path("wrapper.sh","secondlife") - self.path("handle_secondlifeprotocol.sh") - self.path("register_secondlifeprotocol.sh") - self.end_prefix("linux_tools") - - # Create an appropriate gridargs.dat for this package, denoting required grid. - self.put_in_file(self.flags_list(), 'gridargs.dat') - - - def package_finish(self): - # stripping all the libs removes a few megabytes from the end-user package - for s,d in self.file_list: - if re.search("lib/lib.+\.so.*", d): - self.run_command('strip -S %s' % d) - if re.search("app_settings/mozilla-runtime-.*/lib.+\.so.*", d): - self.run_command('strip %s' % d) - - if(self.args.has_key('installer_name')): - installer_name = self.args['installer_name'] - else: - installer_name = '_'.join('SecondLife_', self.args.get('arch'), *self.args['version']) - if self.default_channel(): - if not self.default_grid(): - installer_name += '_' + self.args['grid'].upper() - else: - installer_name += '_' + self.channel_oneword().upper() + def construct(self): + super(LinuxManifest, self).construct() + self.path("licenses-linux.txt","licenses.txt") + self.path("res/ll_icon.png","secondlife_icon.png") + if self.prefix("linux_tools", dst=""): + self.path("client-readme.txt","README-linux.txt") + self.path("client-readme-voice.txt","README-linux-voice.txt") + self.path("wrapper.sh","secondlife") + self.path("handle_secondlifeprotocol.sh") + self.path("register_secondlifeprotocol.sh") + self.end_prefix("linux_tools") + + # Create an appropriate gridargs.dat for this package, denoting required grid. + self.put_in_file(self.flags_list(), 'gridargs.dat') + + + def package_finish(self): + # stripping all the libs removes a few megabytes from the end-user package + for s,d in self.file_list: + if re.search("lib/lib.+\.so.*", d): + self.run_command('strip -S %s' % d) + if re.search("app_settings/mozilla-runtime-.*/lib.+\.so.*", d): + self.run_command('strip %s' % d) + + if 'installer_name' in self.args: + installer_name = self.args['installer_name'] + else: + installer_name_components = ['SecondLife_', self.args.get('arch')] + installer_name_components.extend(self.args['version']) + installer_name = "_".join(installer_name_components) + if self.default_channel(): + if not self.default_grid(): + installer_name += '_' + self.args['grid'].upper() + else: + installer_name += '_' + self.channel_oneword().upper() # Fix access permissions self.run_command(""" @@ -477,71 +518,84 @@ class LinuxManifest(ViewerManifest): find %(dst)s -type f -perm 0600 | xargs --no-run-if-empty chmod 0644; find %(dst)s -type f -perm 0400 | xargs --no-run-if-empty chmod 0444; true""" % {'dst':self.get_dst_prefix() }) - - # temporarily move directory tree so that it has the right name in the tarfile - self.run_command("mv %(dst)s %(inst)s" % {'dst':self.get_dst_prefix(),'inst':self.src_path_of(installer_name)}) - # --numeric-owner hides the username of the builder for security etc. - self.run_command('tar -C %(dir)s --numeric-owner -cjf %(inst_path)s.tar.bz2 %(inst_name)s' % {'dir':self.get_src_prefix(), 'inst_name': installer_name, 'inst_path':self.src_path_of(installer_name)}) - self.run_command("mv %(inst)s %(dst)s" % {'dst':self.get_dst_prefix(),'inst':self.src_path_of(installer_name)}) + self.package_file = installer_name + '.tar.bz2' + + # temporarily move directory tree so that it has the right + # name in the tarfile + self.run_command("mv %(dst)s %(inst)s" % { + 'dst': self.get_dst_prefix(), + 'inst': self.build_path_of(installer_name)}) + try: + # --numeric-owner hides the username of the builder for + # security etc. + self.run_command('tar -C %(dir)s --numeric-owner -cjf ' + '%(inst_path)s.tar.bz2 %(inst_name)s' % { + 'dir': self.get_build_prefix(), + 'inst_name': installer_name, + 'inst_path':self.build_path_of(installer_name)}) + finally: + self.run_command("mv %(inst)s %(dst)s" % { + 'dst': self.get_dst_prefix(), + 'inst': self.build_path_of(installer_name)}) class Linux_i686Manifest(LinuxManifest): - def construct(self): - super(Linux_i686Manifest, self).construct() - self.path("secondlife-i686-bin-stripped","bin/do-not-directly-run-secondlife-bin") - self.path("../linux_crash_logger/linux-crash-logger-i686-bin-stripped","linux-crash-logger.bin") - self.path("linux_tools/launch_url.sh","launch_url.sh") - if self.prefix("res-sdl"): - self.path("*") - # recurse - self.end_prefix("res-sdl") - - self.path("featuretable_linux.txt") - #self.path("secondlife-i686.supp") - - self.path("app_settings/mozilla-runtime-linux-i686") - - if self.prefix("../../libraries/i686-linux/lib_release_client", "lib"): - self.path("libkdu_v42R.so") - self.path("libfmod-3.75.so") - self.path("libapr-1.so.0") - self.path("libaprutil-1.so.0") - self.path("libdb-4.2.so") - self.path("libcrypto.so.0.9.7") - self.path("libssl.so.0.9.7") - self.path("libstdc++.so.6") - self.path("libuuid.so", "libuuid.so.1") - self.path("libSDL-1.2.so.0") - self.path("libELFIO.so") - self.path("libopenjpeg.so.2") - #self.path("libtcmalloc.so.0") - bugged - #self.path("libstacktrace.so.0") - probably bugged - self.path("libllkdu.so", "../bin/libllkdu.so") # llkdu goes in bin for some reason - self.end_prefix("lib") - - # Vivox runtimes - if self.prefix(src="vivox-runtime/i686-linux", dst=""): - self.path("SLVoice") - self.end_prefix() - if self.prefix(src="vivox-runtime/i686-linux", dst="lib"): - self.path("libopenal.so.1") - self.path("libortp.so") - self.path("libvivoxsdk.so") - self.path("libalut.so") - self.end_prefix("lib") + def construct(self): + super(Linux_i686Manifest, self).construct() + self.path("secondlife-stripped","bin/do-not-directly-run-secondlife-bin") + self.path("../linux_crash_logger/linux-crash-logger-stripped","linux-crash-logger.bin") + self.path("linux_tools/launch_url.sh","launch_url.sh") + if self.prefix("res-sdl"): + self.path("*") + # recurse + self.end_prefix("res-sdl") + + self.path("featuretable_linux.txt") + #self.path("secondlife-i686.supp") + + self.path("app_settings/mozilla-runtime-linux-i686") + + if self.prefix("../../libraries/i686-linux/lib_release_client", dst="lib"): + self.path("libkdu_v42R.so") + self.path("libfmod-3.75.so") + self.path("libapr-1.so.0") + self.path("libaprutil-1.so.0") + self.path("libdb-4.2.so") + self.path("libcrypto.so.0.9.7") + self.path("libssl.so.0.9.7") + self.path("libstdc++.so.6") + self.path("libuuid.so", "libuuid.so.1") + self.path("libSDL-1.2.so.0") + self.path("libELFIO.so") + self.path("libopenjpeg.so.2") + #self.path("libtcmalloc.so.0") - bugged + #self.path("libstacktrace.so.0") - probably bugged + self.path("libllkdu.so", "../bin/libllkdu.so") # llkdu goes in bin for some reason + self.end_prefix("lib") + + # Vivox runtimes + if self.prefix(src="vivox-runtime/i686-linux", dst="bin"): + self.path("SLVoice") + self.end_prefix() + if self.prefix(src="vivox-runtime/i686-linux", dst="lib"): + self.path("libopenal.so.1") + self.path("libortp.so") + self.path("libvivoxsdk.so") + self.path("libalut.so") + self.end_prefix("lib") class Linux_x86_64Manifest(LinuxManifest): - def construct(self): - super(Linux_x86_64Manifest, self).construct() - self.path("secondlife-x86_64-bin-stripped","bin/do-not-directly-run-secondlife-bin") - self.path("../linux_crash_logger/linux-crash-logger-x86_64-bin-stripped","linux-crash-logger.bin") - self.path("linux_tools/launch_url.sh","launch_url.sh") - if self.prefix("res-sdl"): - self.path("*") - # recurse - self.end_prefix("res-sdl") - - self.path("featuretable_linux.txt") - self.path("secondlife-i686.supp") + def construct(self): + super(Linux_x86_64Manifest, self).construct() + self.path("secondlife-stripped","bin/do-not-directly-run-secondlife-bin") + self.path("../linux_crash_logger/linux-crash-logger-stripped","linux-crash-logger.bin") + self.path("linux_tools/launch_url.sh","launch_url.sh") + if self.prefix("res-sdl"): + self.path("*") + # recurse + self.end_prefix("res-sdl") + + self.path("featuretable_linux.txt") + self.path("secondlife-i686.supp") if __name__ == "__main__": - main(srctree=viewer_dir, dsttree=os.path.join(viewer_dir, "packaged")) + main() diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt new file mode 100644 index 0000000000..32579e4fe2 --- /dev/null +++ b/indra/test/CMakeLists.txt @@ -0,0 +1,152 @@ +# -*- cmake -*- + +project (test) + +include(00-Common) +include(LLCommon) +include(LLDatabase) +include(LLInventory) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLXML) +include(Linking) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLDATABASE_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLINVENTORY_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(test_SOURCE_FILES + common.cpp + inventory.cpp + io.cpp + llapp_tut.cpp + llbase64_tut.cpp + llblowfish_tut.cpp + llbuffer_tut.cpp + lldatabase_tut.cpp + lldate_tut.cpp + llerror_tut.cpp + llhost_tut.cpp + llhttpdate_tut.cpp + llhttpclient_tut.cpp + llhttpnode_tut.cpp + llinventoryparcel_tut.cpp + lliohttpserver_tut.cpp + lljoint_tut.cpp + llmime_tut.cpp + llmessageconfig_tut.cpp + llnamevalue_tut.cpp + llpermissions_tut.cpp + llpipeutil.cpp + llquaternion_tut.cpp + llrandom_tut.cpp + llsaleinfo_tut.cpp + llsdmessagebuilder_tut.cpp + llsdmessagereader_tut.cpp + llsd_new_tut.cpp + llsdserialize_tut.cpp + llsdutil_tut.cpp + llservicebuilder_tut.cpp + llstreamtools_tut.cpp + lltemplatemessagebuilder_tut.cpp + lltiming_tut.cpp + lltut.cpp + lluri_tut.cpp + lluuidhashmap_tut.cpp + llxfer_tut.cpp + math.cpp + message_tut.cpp + reflection_tut.cpp + test.cpp + v2math_tut.cpp + v3color_tut.cpp + v3dmath_tut.cpp + v3math_tut.cpp + v4color_tut.cpp + v4coloru_tut.cpp + v4math_tut.cpp + ) + +set(test_HEADER_FILES + CMakeLists.txt + + llpipeutil.h + llsdtraits.h + lltut.h + ) + +if (NOT WINDOWS) + list(APPEND test_SOURCE_FILES + llmessagetemplateparser_tut.cpp + ) +endif (NOT WINDOWS) + +set_source_files_properties(${test_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND test_SOURC_FILES ${test_HEADER_FILES}) + +add_executable(test ${test_SOURCE_FILES}) + +target_link_libraries(test + ${LLDATABASE_LIBRARIES} + ${LLINVENTORY_LIBRARIES} + ${LLMESSAGE_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLXML_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${PTHREAD_LIBRARY} + ${WINDOWS_LIBRARIES} + ) + +if (WINDOWS) + set_target_properties(test + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:MSVCRT" + LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMT" + ) +endif (WINDOWS) + +get_target_property(TEST_EXE test LOCATION) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt + COMMAND ${TEST_EXE} + ARGS + --output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt + --touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt + DEPENDS test + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "C++ unit tests" + ) + +set(test_results ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt) + +if (EXISTS /etc/debian_version_FAIL) + # The Python tests have all kinds of wacky non-portable assumptions + # built in. + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/py_tests_ok.txt + COMMAND ${PYTHON_EXECUTABLE} + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/test.py + --output=${CMAKE_CURRENT_BINARY_DIR}/py_test_results.txt + --touch=${CMAKE_CURRENT_BINARY_DIR}/py_tests_ok.txt + DEPENDS test.py + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Python unit tests" + ) + + list(APPEND test_results ${CMAKE_CURRENT_BINARY_DIR}/py_tests_ok.txt) +endif (EXISTS /etc/debian_version_FAIL) + +add_custom_target(tests_ok ALL DEPENDS ${test_results}) diff --git a/indra/test/io.cpp b/indra/test/io.cpp index 3de1e8edef..3bb8f62ffb 100644 --- a/indra/test/io.cpp +++ b/indra/test/io.cpp @@ -36,7 +36,7 @@ #include <iterator> -#include <apr-1/apr_pools.h> +#include "apr_pools.h" #include "llbuffer.h" #include "llbufferstream.h" @@ -706,6 +706,9 @@ namespace tut template<> template<> void bas_object::test<10>() { +//#if LL_WINDOWS && _MSC_VER >= 1400 +// skip_fail("Fails on VS2005 due to broken LLSDSerialize::fromNotation() parser."); +//#endif const char LOGIN_STREAM[] = "{'method':'login', 'parameter': [ {" "'uri': 'sl-am:kellys.region.siva.lindenlab.com/location?start=url&px=128&py=128&pz=128&lx=0&ly=0&lz=0'}, " "{'version': i1}, {'texture_data': [ '61d724fb-ad79-f637-2186-5cf457560daa', '6e38b9be-b7cc-e77a-8aec-029a42b0b416', " @@ -791,6 +794,9 @@ namespace tut template<> template<> void bas_object::test<12>() { +//#if LL_WINDOWS && _MSC_VER >= 1400 +// skip_fail("Fails on VS2005 due to broken LLSDSerialize::fromNotation() parser."); +//#endif std::string val = "{!'foo':[i1,'hi',{@'bar'#:[$i2%,^'baz'&]*}+]=}"; std::istringstream istr; istr.str(val); @@ -1309,6 +1315,9 @@ namespace tut template<> template<> void rpc_server_object::test<2>() { +//#if LL_WINDOWS && _MSC_VER >= 1400 +// skip_fail("Fails on VS2005 due to broken LLSDSerialize::fromNotation() parser."); +//#endif std::string uri("sl-am:66.150.244.180:12035/location?start=region&px=70.9247&py=254.378&pz=38.7304&lx=-0.043753&ly=-0.999042&lz=0"); std::stringstream stream; stream << "{'task_id':ucc706f2d-0b68-68f8-11a4-f1043ff35ca0}\n{\n\tname\tObject|\n\tpermissions 0\n}"; @@ -1397,6 +1406,9 @@ namespace tut template<> template<> void rpc_server_object::test<3>() { +//#if LL_WINDOWS && _MSC_VER >= 1400 +// skip_fail("Fails on VS2005 due to broken LLSDSerialize::fromNotation() parser."); +//#endif std::string uri("sl-am:66.150.244.180:12035/location?start=region&px=70.9247&py=254.378&pz=38.7304&lx=-0.043753&ly=-0.999042&lz=0"); LLBufferArray buffer; diff --git a/indra/test/llblowfish_tut.cpp b/indra/test/llblowfish_tut.cpp index 3859d6c3b1..3081ac3855 100644 --- a/indra/test/llblowfish_tut.cpp +++ b/indra/test/llblowfish_tut.cpp @@ -93,6 +93,9 @@ namespace tut template<> template<> void blowfish_object::test<1>() { +#if !LL_LINUX + skip_fail("Blowfish only supported on Linux."); +#else LLUUID blank; LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES); @@ -105,11 +108,15 @@ namespace tut dst_len = cipher.requiredEncryptionSpace(8); ensure("encryption space 8", (dst_len == 16) ); +#endif // !LL_LINUX } template<> template<> void blowfish_object::test<2>() { +#if !LL_LINUX + skip_fail("Blowfish only supported on Linux."); +#else LLUUID blank; LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES); @@ -123,12 +130,16 @@ namespace tut result.resize(count); ensure("encrypt null key", matchFile("blowfish.1.bin", result)); +#endif // !LL_LINUX } template<> template<> void blowfish_object::test<3>() { - // same as base64 test id +#if !LL_LINUX + skip_fail("Blowfish only supported on Linux."); +#else + // same as base64 test id LLUUID id("526a1e07-a19d-baed-84c4-ff08a488d15e"); LLBlowfishCipher cipher(&id.mData[0], UUID_BYTES); @@ -142,5 +153,6 @@ namespace tut result.resize(count); ensure("encrypt real key", matchFile("blowfish.2.bin", result)); +#endif // !LL_LINUX } } diff --git a/indra/test/llhttpdate_tut.cpp b/indra/test/llhttpdate_tut.cpp index 1be98250d2..c630e9caf0 100644 --- a/indra/test/llhttpdate_tut.cpp +++ b/indra/test/llhttpdate_tut.cpp @@ -69,24 +69,25 @@ namespace tut time_t sometime; time(&sometime); some_date = LLDate((F64) sometime); - struct tm result; - char expected[255], *actual; + struct tm *result; + char expected[255]; + std::string actual; - gmtime_r((time_t *)&sometime, &result); + result = gmtime(&sometime); /* - std::cout << " seconds: "<< result.tm_sec - << ", minutes: " << result.tm_min - << ", hours: " << result.tm_hour - << ", day of the month: " << result.tm_mday - << ", month: " << result.tm_mon - << ", year: " << result.tm_year - << ", day of the week: " << result.tm_wday - << ", day in the year: " << result.tm_yday - << ", DST: " << result.tm_isdst << std::endl; + std::cout << " seconds: "<< result->tm_sec + << ", minutes: " << result->tm_min + << ", hours: " << result->tm_hour + << ", day of the month: " << result->tm_mday + << ", month: " << result->tm_mon + << ", year: " << result->tm_year + << ", day of the week: " << result->tm_wday + << ", day in the year: " << result->tm_yday + << ", DST: " << result->tm_isdst << std::endl; */ - strftime(expected, 255, "%A, %d %h %Y %H:%M:%S GMT", &result); - actual = (char *) some_date.asRFC1123().c_str(); + strftime(expected, 255, "%A, %d %b %Y %H:%M:%S GMT", result); + actual = some_date.asRFC1123(); // probably not a good idea to use strcmp but this is just a unit test - ensure("Current time in RFC 1123", (strcmp(expected, actual) == 0)); + ensure("Current time in RFC 1123", (strcmp(expected, actual.c_str()) == 0)); } } diff --git a/indra/test/lliohttpserver_tut.cpp b/indra/test/lliohttpserver_tut.cpp index 5ac79e6931..5401d1a8ae 100644 --- a/indra/test/lliohttpserver_tut.cpp +++ b/indra/test/lliohttpserver_tut.cpp @@ -125,7 +125,7 @@ namespace tut pump->addChain(chain, DEFAULT_CHAIN_EXPIRY_SECS); pumpPipe(pump, 10); - if(mResponse && (! timeout)) + if(mResponse.notNull() && (! timeout)) { mResponse->result(mResult); mResponse = NULL; @@ -138,7 +138,7 @@ namespace tut delete pump; apr_pool_destroy(pool); - if(mResponse && timeout) + if(mResponse.notNull() && timeout) { mResponse->result(mResult); mResponse = NULL; diff --git a/indra/test/llmessagetemplateparser_tut.cpp b/indra/test/llmessagetemplateparser_tut.cpp index e2680e315f..690cc26bcf 100644 --- a/indra/test/llmessagetemplateparser_tut.cpp +++ b/indra/test/llmessagetemplateparser_tut.cpp @@ -292,7 +292,7 @@ namespace tut delete message; } - void LLMessageTemplateParserTestObject::test<8>() + template<> template<> void LLMessageTemplateParserTestObject::test<8>() // tests message parsing on RezMultipleAttachmentsFromInv, a possibly-faulty message { std::string message_skel( diff --git a/indra/test/llsdmessagereader_tut.cpp b/indra/test/llsdmessagereader_tut.cpp index 67287d55e2..bee6f8a185 100755 --- a/indra/test/llsdmessagereader_tut.cpp +++ b/indra/test/llsdmessagereader_tut.cpp @@ -33,6 +33,10 @@ #include <tut/tut.h> #include "linden_common.h" #include "lltut.h" +#include "v3dmath.h" +#include "v3math.h" +#include "v4math.h" +#include "llquaternion.h" #include "message.h" #include "llsdmessagereader.h" diff --git a/indra/test/llsdutil_tut.cpp b/indra/test/llsdutil_tut.cpp index 3d0b601b34..e9a7c379bb 100644 --- a/indra/test/llsdutil_tut.cpp +++ b/indra/test/llsdutil_tut.cpp @@ -33,9 +33,15 @@ #include "linden_common.h" #include "lltut.h" +#include "m4math.h" +#include "v2math.h" +#include "v2math.h" #include "v3color.h" +#include "v3math.h" +#include "v3dmath.h" +#include "v4coloru.h" #include "v4math.h" -#include "m4math.h" +#include "llquaternion.h" #include "llsdutil.h" diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp index a9d515dfdc..52d1436761 100644 --- a/indra/test/lltemplatemessagebuilder_tut.cpp +++ b/indra/test/lltemplatemessagebuilder_tut.cpp @@ -64,7 +64,9 @@ namespace tut LL_VERSION_MINOR, LL_VERSION_PATCH, FALSE, - "notasharedsecret"); + "notasharedsecret", + NULL, + false); //init_prehash_data(); init = true; } diff --git a/indra/test/message_tut.cpp b/indra/test/message_tut.cpp index ca0452a9f3..57db6dd97a 100644 --- a/indra/test/message_tut.cpp +++ b/indra/test/message_tut.cpp @@ -35,6 +35,8 @@ #include "lltut.h" #include "llapr.h" +#include "llmessageconfig.h" +#include "llsdserialize.h" #include "llversionserver.h" #include "message.h" #include "message_prehash.h" @@ -56,10 +58,13 @@ namespace tut { struct LLMessageSystemTestData { + std::string mTestConfigDir; + std::string mSep; + LLMessageSystemTestData() { static bool init = false; - if(! init) + if(!init) { ll_init_apr(); //init_prehash_data(); @@ -72,7 +77,25 @@ namespace tut LL_VERSION_MINOR, LL_VERSION_PATCH, FALSE, - "notasharedsecret"); + "notasharedsecret", + NULL, + false); + // generate temp dir + std::ostringstream ostr; +#if LL_WINDOWS + mSep = "\\"; + ostr << "C:" << mSep; +#else + mSep = "/"; + ostr << mSep << "tmp" << mSep; +#endif + LLUUID random; + random.generate(); + ostr << "message-test-" << random; + mTestConfigDir = ostr.str(); + LLFile::mkdir(mTestConfigDir.c_str()); + writeConfigFile(LLSD()); + LLMessageConfig::initClass("simulator", ostr.str()); } ~LLMessageSystemTestData() @@ -80,6 +103,28 @@ namespace tut // not end_messaging_system() delete gMessageSystem; gMessageSystem = NULL; + + // rm contents of temp dir + std::ostringstream ostr; + ostr << mTestConfigDir << mSep << "message.xml"; + int rmfile = LLFile::remove(ostr.str().c_str()); + ensure_equals("rmfile value", rmfile, 0); + + // rm temp dir + int rmdir = LLFile::rmdir(mTestConfigDir.c_str()); + ensure_equals("rmdir value", rmdir, 0); + } + + void writeConfigFile(const LLSD& config) + { + std::ostringstream ostr; + ostr << mTestConfigDir << mSep << "message.xml"; + llofstream file(ostr.str().c_str()); + if (file.is_open()) + { + LLSDSerialize::toPrettyXML(config, file); + } + file.close(); } }; diff --git a/indra/test/test.cpp b/indra/test/test.cpp index f573d53ba8..4a9b2825f2 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -43,8 +43,8 @@ #include "llerrorcontrol.h" #include "lltut.h" -#include <apr-1/apr_pools.h> -#include <apr-1/apr_getopt.h> +#include "apr_pools.h" +#include "apr_getopt.h" // the CTYPE_WORKAROUND is needed for linux dev stations that don't // have the broken libc6 packages needed by our out-of-date static @@ -62,13 +62,14 @@ namespace tut class LLTestCallback : public tut::callback { public: - LLTestCallback(bool verbose_mode) : + LLTestCallback(bool verbose_mode, std::ostream *stream) : mVerboseMode(verbose_mode), mTotalTests(0), mPassedTests(0), mFailedTests(0), mSkippedTests(0), - mSkipedFailTests(0) + mSkippedFailTests(0), + mStream(stream) { } @@ -109,7 +110,7 @@ public: out << "skipped"; break; case tut::test_result::skip_fail: - ++mSkipedFailTests; + ++mSkippedFailTests; out << "skipped known failure"; break; default: @@ -122,34 +123,57 @@ public: { out << ": '" << tr.message << "'"; } + if (mStream) + { + *mStream << out.str() << std::endl; + } + std::cout << out.str() << std::endl; } } void run_completed() { - std::cout << std::endl; - std::cout << "Total Tests: " << mTotalTests << std::endl; - std::cout << "Passed Tests: " << mPassedTests << std::endl; + if (mStream) + { + run_completed_(*mStream); + } + run_completed_(std::cout); + + if (mFailedTests > 0) + { + exit(1); + } + } + +private: + void run_completed_(std::ostream &stream) + { + stream << std::endl; + stream << "Total Tests: " << mTotalTests << std::endl; + stream << "Passed Tests: " << mPassedTests << std::endl; + + stream << std::endl; + stream << "Total Tests: " << mTotalTests << std::endl; + stream << "Passed Tests: " << mPassedTests << std::endl; if (mSkippedTests > 0) { - std::cout << "Skipped Tests: " << mSkippedTests << std::endl; + stream << "Skipped Tests: " << mSkippedTests << std::endl; } - if (mSkipedFailTests > 0) + if (mSkippedFailTests > 0) { - std::cout << "Skipped known failures: " << mSkipedFailTests + stream << "Skipped known failures: " << mSkippedFailTests << std::endl; } if(mFailedTests > 0) { - std::cout << "*********************************" << std::endl; - std::cout << "Failed Tests: " << mFailedTests << std::endl; - std::cout << "Please report or fix the problem." << std::endl; - std::cout << "*********************************" << std::endl; - exit(1); + stream << "*********************************" << std::endl; + stream << "Failed Tests: " << mFailedTests << std::endl; + stream << "Please report or fix the problem." << std::endl; + stream << "*********************************" << std::endl; } } @@ -159,7 +183,8 @@ protected: int mPassedTests; int mFailedTests; int mSkippedTests; - int mSkipedFailTests; + int mSkippedFailTests; + std::ostream *mStream; }; static const apr_getopt_option_t TEST_CL_OPTIONS[] = @@ -168,7 +193,9 @@ static const apr_getopt_option_t TEST_CL_OPTIONS[] = {"list", 'l', 0, "List available test groups."}, {"verbose", 'v', 0, "Verbose output."}, {"group", 'g', 1, "Run test group specified by option argument."}, + {"output", 'o', 1, "Write output to the named file."}, {"skip", 's', 1, "Skip test number specified by option argument. Only works when a specific group is being tested"}, + {"touch", 't', 1, "Touch the given file if all tests succeed"}, {"wait", 'w', 0, "Wait for input before exit."}, {"debug", 'd', 0, "Emit full debug logs."}, {0, 0, 0, 0} @@ -256,6 +283,9 @@ int main(int argc, char **argv) apr_status_t apr_err; const char* opt_arg = NULL; int opt_id = 0; + std::ofstream *output = NULL; + const char *touch = NULL; + while(true) { apr_err = apr_getopt_long(os, TEST_CL_OPTIONS, &opt_id, &opt_arg); @@ -285,6 +315,13 @@ int main(int argc, char **argv) case 'v': verbose_mode = true; break; + case 'o': + output = new std::ofstream; + output->open(opt_arg); + break; + case 't': + touch = opt_arg; + break; case 'w': wait_at_exit = true; break; @@ -301,7 +338,7 @@ int main(int argc, char **argv) } // run the tests - LLTestCallback callback(verbose_mode); + LLTestCallback callback(verbose_mode, output); tut::runner.get().set_callback(&callback); if(test_group.empty()) @@ -319,6 +356,20 @@ int main(int argc, char **argv) std::cin.get(); } + if (output) + { + output->close(); + delete output; + } + + if (touch) + { + std::ofstream s; + s.open(touch); + s << "ok" << std::endl; + s.close(); + } + apr_terminate(); return 0; } diff --git a/indra/tools/vstool/README.txt b/indra/tools/vstool/README.txt new file mode 100644 index 0000000000..e419180031 --- /dev/null +++ b/indra/tools/vstool/README.txt @@ -0,0 +1,9 @@ +VSTool is a command line utility to manipulate VisualStudio settings.
+
+The windows cmake project configuration uses VSTool.exe
+
+A handy upgrade:
+ figure out how to make cmake build this csharp app
+ - or write the app using script (jscript?!?) so it doesn't need to be built.
+
+
diff --git a/indra/tools/vstool/VSTool.csproj b/indra/tools/vstool/VSTool.csproj new file mode 100644 index 0000000000..24f1031f81 --- /dev/null +++ b/indra/tools/vstool/VSTool.csproj @@ -0,0 +1,95 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{96943E2D-1373-4617-A117-D0F997A94919}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>VSTool</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>VSTool</RootNamespace>
+ <RunPostBuildEvent>Always</RunPostBuildEvent>
+ <StartupObject>VSTool.VSToolMain</StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>.\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>.\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="main.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project>
\ No newline at end of file diff --git a/indra/tools/vstool/VSTool.exe b/indra/tools/vstool/VSTool.exe Binary files differnew file mode 100755 index 0000000000..c568c8dd6a --- /dev/null +++ b/indra/tools/vstool/VSTool.exe diff --git a/indra/tools/vstool/VSTool.sln b/indra/tools/vstool/VSTool.sln new file mode 100644 index 0000000000..8859671802 --- /dev/null +++ b/indra/tools/vstool/VSTool.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSTool", "VSTool.csproj", "{96943E2D-1373-4617-A117-D0F997A94919}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {96943E2D-1373-4617-A117-D0F997A94919}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {96943E2D-1373-4617-A117-D0F997A94919}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {96943E2D-1373-4617-A117-D0F997A94919}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {96943E2D-1373-4617-A117-D0F997A94919}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/indra/tools/vstool/main.cs b/indra/tools/vstool/main.cs new file mode 100644 index 0000000000..0cd57b6b84 --- /dev/null +++ b/indra/tools/vstool/main.cs @@ -0,0 +1,529 @@ +// Code about getting running instances visual studio
+// was borrowed from
+// http://www.codeproject.com/KB/cs/automatingvisualstudio.aspx
+
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+using Microsoft.CSharp;
+
+namespace VSTool
+{
+ class ViaCOM
+ {
+ public static object GetProperty(object from_obj, string prop_name)
+ {
+ Type objType = from_obj.GetType();
+ return objType.InvokeMember(
+ prop_name,
+ BindingFlags.GetProperty, null,
+ from_obj,
+ null);
+ }
+
+ public static object SetProperty(object from_obj, string prop_name, object new_value)
+ {
+ object[] args = { new_value };
+ Type objType = from_obj.GetType();
+ return objType.InvokeMember(
+ prop_name,
+ BindingFlags.DeclaredOnly |
+ BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.Instance |
+ BindingFlags.SetProperty,
+ null,
+ from_obj,
+ args);
+ }
+
+ public static object CallMethod(object from_obj, string method_name, params object[] args)
+ {
+ Type objType = from_obj.GetType();
+ return objType.InvokeMember(
+ method_name,
+ BindingFlags.DeclaredOnly |
+ BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.Instance |
+ BindingFlags.InvokeMethod,
+ null,
+ from_obj,
+ args);
+ }
+ };
+
+ /// <summary>
+ /// The main entry point class for VSTool.
+ /// </summary>
+ class VSToolMain
+ {
+ #region Interop imports
+ [DllImport("ole32.dll")]
+ public static extern int GetRunningObjectTable(int reserved, out IRunningObjectTable prot);
+
+ [DllImport("ole32.dll")]
+ public static extern int CreateBindCtx(int reserved, out IBindCtx ppbc);
+ #endregion
+
+ static System.Boolean ignore_case = true;
+
+ static string solution_name = null;
+ static bool use_new_vs = false;
+ static Hashtable projectDict = new Hashtable();
+ static string startup_project = null;
+ static string config = null;
+
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ bool need_save = false;
+
+ parse_command_line(args);
+
+ Console.WriteLine("Opening solution: {0}", solution_name);
+
+ bool found_open_solution = true;
+
+ Console.WriteLine("Looking for existing VisualStudio instance...");
+
+ // Get an instance of the currently running Visual Studio .NET IDE.
+ object dte = null;
+
+ // dte = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.7.1");
+ string full_solution_name = System.IO.Path.GetFullPath(solution_name);
+ if (false == use_new_vs)
+ {
+ dte = GetIDEInstance(full_solution_name);
+ }
+
+ object sol = null;
+
+ if (dte == null)
+ {
+ try
+ {
+ Console.WriteLine(" Didn't find open solution, now opening new VisualStudio instance...");
+ Console.WriteLine(" Reading .sln file version...");
+ string version = GetSolutionVersion(full_solution_name);
+
+ Console.WriteLine(" Opening VS version: {0}...", version);
+ string progid = GetVSProgID(version);
+
+ Type objType = Type.GetTypeFromProgID(progid);
+ dte = System.Activator.CreateInstance(objType);
+
+ Console.WriteLine(" Opening solution...");
+
+ sol = ViaCOM.GetProperty(dte, "Solution");
+ object[] openArgs = {full_solution_name};
+ ViaCOM.CallMethod(sol, "Open", openArgs);
+ }
+ catch( Exception e )
+ {
+ Console.WriteLine(e.Message);
+ Console.WriteLine("Quitting do error opening: {0}", full_solution_name);
+ return;
+ }
+ found_open_solution = false;
+ }
+
+ if (sol == null)
+ {
+ sol = ViaCOM.GetProperty(dte, "Solution");
+ }
+
+ // Walk through all of the projects in the solution
+ // and list the type of each project.
+ foreach(DictionaryEntry p in projectDict)
+ {
+ string project_name = (string)p.Key;
+ string working_dir = (string)p.Value;
+ if(SetProjectWorkingDir(sol, project_name, working_dir))
+ {
+ need_save = true;
+ }
+ }
+
+ if(config != null)
+ {
+ try
+ {
+ object solBuild = ViaCOM.GetProperty(sol, "SolutionBuild");
+ object solCfgs = ViaCOM.GetProperty(solBuild, "SolutionConfigurations");
+ object[] itemArgs = { (object)config };
+ object solCfg = ViaCOM.CallMethod(solCfgs, "Item", itemArgs);
+ ViaCOM.CallMethod(solCfg, "Activate", null);
+ need_save = true;
+ }
+ catch( Exception e )
+ {
+ Console.WriteLine(e.Message);
+ }
+ }
+
+ if (startup_project != null)
+ {
+ try
+ {
+ // You need the 'unique name of the project to set StartupProjects.
+ // find the project by generic name.
+ object prjs = ViaCOM.GetProperty(sol, "Projects");
+ object count = ViaCOM.GetProperty(prjs, "Count");
+ for(int i = 1; i <= (int)count; ++i)
+ {
+ object[] itemArgs = { (object)i };
+ object prj = ViaCOM.CallMethod(prjs, "Item", itemArgs);
+ object prjName = ViaCOM.GetProperty(prj, "Name");
+ if (0 == string.Compare((string)prjName, startup_project, ignore_case))
+ {
+ object solBuild = ViaCOM.GetProperty(sol, "SolutionBuild");
+ ViaCOM.SetProperty(solBuild, "StartupProjects", ViaCOM.GetProperty(prj, "UniqueName"));
+ need_save = true;
+ break;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.Message);
+ }
+ }
+
+ if(need_save)
+ {
+ if(found_open_solution == false)
+ {
+ ViaCOM.CallMethod(sol, "Close", null);
+ }
+ Console.WriteLine("Finished!");
+ }
+ }
+
+ public static bool parse_command_line(string[] args)
+ {
+ string options_desc =
+ "--solution <solution_name> : MSVC solution name. (required)\n" +
+ "--use_new_vs : Ignore running versions of visual studio.\n" +
+ "--workingdir <project> <dir> : Set working dir of a VC project.\n" +
+ "--config <config> : Set the active config for the solution.\n" +
+ "--startup <project> : Set the startup project for the solution.\n";
+
+ try
+ {
+ // Command line param parsing loop.
+ int i = 0;
+ for (; i < args.Length; ++i)
+ {
+ if ("--solution" == args[i])
+ {
+ if (solution_name != null)
+ {
+ throw new ApplicationException("Found second --solution option");
+ }
+ solution_name = args[++i];
+ }
+ else if ("--use_new_vs" == args[i])
+ {
+ use_new_vs = true;
+ }
+
+ else if ("--workingdir" == args[i])
+ {
+ string project_name = args[++i];
+ string working_dir = args[++i];
+ projectDict.Add(project_name, working_dir);
+ }
+ else if ("--config" == args[i])
+ {
+ if (config != null)
+ {
+ throw new ApplicationException("Found second --config option");
+ }
+ config = args[++i];
+ }
+ else if ("--startup" == args[i])
+ {
+ if (startup_project != null)
+ {
+ throw new ApplicationException("Found second --startup option");
+ }
+ startup_project = args[++i];
+ }
+ else
+ {
+ throw new ApplicationException("Found unrecognized token on command line: " + args[i]);
+ }
+ }
+
+ if (solution_name == null)
+ {
+ throw new ApplicationException("The --solution option is required.");
+ }
+ }
+ catch(ApplicationException e)
+ {
+
+ Console.WriteLine("Oops! " + e.Message);
+ Console.Write("Command line:");
+ foreach (string arg in args)
+ {
+ Console.Write(" " + arg);
+ }
+ Console.Write("\n\n");
+ Console.WriteLine("VSTool command line usage");
+ Console.Write(options_desc);
+ throw e;
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// Get the DTE object for the instance of Visual Studio IDE that has
+ /// the specified solution open.
+ /// </summary>
+ /// <param name="solutionFile">The absolute filename of the solution</param>
+ /// <returns>Corresponding DTE object or null if no such IDE is running</returns>
+ public static object GetIDEInstance( string solutionFile )
+ {
+ Hashtable runningInstances = GetIDEInstances( true );
+ IDictionaryEnumerator enumerator = runningInstances.GetEnumerator();
+
+ while ( enumerator.MoveNext() )
+ {
+ try
+ {
+ object ide = enumerator.Value;
+ if (ide != null)
+ {
+ object sol = ViaCOM.GetProperty(ide, "Solution");
+ if (0 == string.Compare((string)ViaCOM.GetProperty(sol, "FullName"), solutionFile, ignore_case))
+ {
+ return ide;
+ }
+ }
+ }
+ catch{}
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Get a table of the currently running instances of the Visual Studio .NET IDE.
+ /// </summary>
+ /// <param name="openSolutionsOnly">Only return instances that have opened a solution</param>
+ /// <returns>A hashtable mapping the name of the IDE in the running object table to the corresponding DTE object</returns>
+ public static Hashtable GetIDEInstances( bool openSolutionsOnly )
+ {
+ Hashtable runningIDEInstances = new Hashtable();
+ Hashtable runningObjects = GetRunningObjectTable();
+
+ IDictionaryEnumerator rotEnumerator = runningObjects.GetEnumerator();
+ while ( rotEnumerator.MoveNext() )
+ {
+ string candidateName = (string) rotEnumerator.Key;
+ if (!candidateName.StartsWith("!VisualStudio.DTE"))
+ continue;
+
+ object ide = rotEnumerator.Value;
+ if (ide == null)
+ continue;
+
+ if (openSolutionsOnly)
+ {
+ try
+ {
+ object sol = ViaCOM.GetProperty(ide, "Solution");
+ string solutionFile = (string)ViaCOM.GetProperty(sol, "FullName");
+ if (solutionFile != String.Empty)
+ {
+ runningIDEInstances[ candidateName ] = ide;
+ }
+ }
+ catch {}
+ }
+ else
+ {
+ runningIDEInstances[ candidateName ] = ide;
+ }
+ }
+ return runningIDEInstances;
+ }
+
+ /// <summary>
+ /// Get a snapshot of the running object table (ROT).
+ /// </summary>
+ /// <returns>A hashtable mapping the name of the object in the ROT to the corresponding object</returns>
+ [STAThread]
+ public static Hashtable GetRunningObjectTable()
+ {
+ Hashtable result = new Hashtable();
+
+ int numFetched = 0;
+ IRunningObjectTable runningObjectTable;
+ IEnumMoniker monikerEnumerator;
+ IMoniker[] monikers = new IMoniker[1];
+
+ GetRunningObjectTable(0, out runningObjectTable);
+ runningObjectTable.EnumRunning(out monikerEnumerator);
+ monikerEnumerator.Reset();
+
+ while (monikerEnumerator.Next(1, monikers, new IntPtr(numFetched)) == 0)
+ {
+ IBindCtx ctx;
+ CreateBindCtx(0, out ctx);
+
+ string runningObjectName;
+ monikers[0].GetDisplayName(ctx, null, out runningObjectName);
+
+ object runningObjectVal;
+ runningObjectTable.GetObject( monikers[0], out runningObjectVal);
+
+ result[ runningObjectName ] = runningObjectVal;
+ }
+
+ return result;
+ }
+
+ public static string GetSolutionVersion(string solutionFullFileName)
+ {
+ string version;
+ System.IO.StreamReader solutionStreamReader = null;
+ string firstLine;
+ string format;
+
+ try
+ {
+ solutionStreamReader = new System.IO.StreamReader(solutionFullFileName);
+ do
+ {
+ firstLine = solutionStreamReader.ReadLine();
+ }
+ while (firstLine == "");
+
+ format = firstLine.Substring(firstLine.LastIndexOf(" ")).Trim();
+
+ switch(format)
+ {
+ case "7.00":
+ version = "VC70";
+ break;
+
+ case "8.00":
+ version = "VC71";
+ break;
+
+ case "9.00":
+ version = "VC80";
+ break;
+
+ case "10.00":
+ version = "VC90";
+ break;
+ default:
+ throw new ApplicationException("Unknown .sln version: " + format);
+ }
+ }
+ finally
+ {
+ if(solutionStreamReader != null)
+ {
+ solutionStreamReader.Close();
+ }
+ }
+
+ return version;
+ }
+
+ public static string GetVSProgID(string version)
+ {
+ string progid = null;
+ switch(version)
+ {
+ case "VC70":
+ progid = "VisualStudio.DTE.7";
+ break;
+
+ case "VC71":
+ progid = "VisualStudio.DTE.7.1";
+ break;
+
+ case "VC80":
+ progid = "VisualStudio.DTE.8.0";
+ break;
+
+ case "VC90":
+ progid = "VisualStudio.DTE.9.0";
+ break;
+ default:
+ throw new ApplicationException("Can't handle VS version: " + version);
+ }
+
+ return progid;
+ }
+
+ public static bool SetProjectWorkingDir(object sol, string project_name, string working_dir)
+ {
+ bool made_change = false;
+ Console.WriteLine("Looking for project {0}...", project_name);
+ try
+ {
+ object prjs = ViaCOM.GetProperty(sol, "Projects");
+ object count = ViaCOM.GetProperty(prjs, "Count");
+ for(int i = 1; i <= (int)count; ++i)
+ {
+ object[] prjItemArgs = { (object)i };
+ object prj = ViaCOM.CallMethod(prjs, "Item", prjItemArgs);
+ string name = (string)ViaCOM.GetProperty(prj, "Name");
+ if (0 == string.Compare(name, project_name, ignore_case))
+ {
+ Console.WriteLine("Found project: {0}", project_name);
+ Console.WriteLine("Setting working directory");
+
+ string full_project_name = (string)ViaCOM.GetProperty(prj, "FullName");
+ Console.WriteLine(full_project_name);
+
+ // *NOTE:Mani Thanks to incompatibilities between different versions of the
+ // VCProjectEngine.dll assembly, we can't cast the objects recevied from the DTE to
+ // the VCProjectEngine types from a different version than the one built
+ // with. ie, VisualStudio.DTE.7.1 objects can't be converted in a project built
+ // in VS 8.0. To avoid this problem, we can use the com object interfaces directly,
+ // with out the type casting. Its tedious code, but it seems to work.
+
+ // oCfgs should be assigned to a 'Project.Configurations' collection.
+ object oCfgs = ViaCOM.GetProperty(ViaCOM.GetProperty(prj, "Object"), "Configurations");
+
+ // oCount will be assigned to the number of configs present in oCfgs.
+ object oCount = ViaCOM.GetProperty(oCfgs, "Count");
+
+ for (int cfgIndex = 1; cfgIndex <= (int)oCount; ++cfgIndex)
+ {
+ object[] itemArgs = {(object)cfgIndex};
+ object oCfg = ViaCOM.CallMethod(oCfgs, "Item", itemArgs);
+ object oDebugSettings = ViaCOM.GetProperty(oCfg, "DebugSettings");
+ ViaCOM.SetProperty(oDebugSettings, "WorkingDirectory", (object)working_dir);
+ }
+
+ break;
+ }
+ }
+ made_change = true;
+ }
+ catch( Exception e )
+ {
+ Console.WriteLine(e.Message);
+ Console.WriteLine("Failed settings working dir for project, {0}.", project_name);
+ }
+
+ return made_change;
+ }
+ }
+}
diff --git a/indra/win_crash_logger/CMakeLists.txt b/indra/win_crash_logger/CMakeLists.txt new file mode 100644 index 0000000000..9be6c5c5bf --- /dev/null +++ b/indra/win_crash_logger/CMakeLists.txt @@ -0,0 +1,65 @@ +# -*- cmake -*- + +project(win_crash_logger) + +include(00-Common) +include(LLCommon) +include(LLCrashLogger) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLWindow) +include(LLXML) +include(Linking) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLCRASHLOGGER_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLWINDOW_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ) + +set(win_crash_logger_SOURCE_FILES + win_crash_logger.cpp + llcrashloggerwindows.cpp + ) + +set(win_crash_logger_HEADER_FILES + CMakeLists.txt + + llcrashloggerwindows.h + resource.h + StdAfx.h + win_crash_logger.h + ) + +set_source_files_properties(${win_crash_logger_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND win_crash_logger_SOURCE_FILES ${win_crash_logger_HEADER_FILES}) + +find_library(DXGUID_LIBRARY dxguid ${DIRECTX_LIBRARY_DIR}) + +add_executable(windows-crash-logger WIN32 ${win_crash_logger_SOURCE_FILES}) + +target_link_libraries(windows-crash-logger + ${LLCRASHLOGGER_LIBRARIES} + ${LLWINDOW_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLXML_LIBRARIES} + ${LLMESSAGE_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${WINDOWS_LIBRARIES} + ${DXGUID_LIBRARY} + ) + +if (WINDOWS) + set_target_properties(windows-crash-logger + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:MSVCRT" + LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD" + ) +endif (WINDOWS) diff --git a/indra/win_crash_logger/llcrashloggerwindows.cpp b/indra/win_crash_logger/llcrashloggerwindows.cpp index e6d859a08a..b09821977d 100644 --- a/indra/win_crash_logger/llcrashloggerwindows.cpp +++ b/indra/win_crash_logger/llcrashloggerwindows.cpp @@ -341,7 +341,7 @@ bool LLCrashLoggerWindows::mainLoop() ShowWindow(gHwndReport, SW_SHOW ); MSG msg; - msg.wParam = 0; + memset(&msg, 0, sizeof(msg)); while (!LLApp::isQuitting() && GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); diff --git a/indra/win_updater/CMakeLists.txt b/indra/win_updater/CMakeLists.txt new file mode 100644 index 0000000000..6379d7c59b --- /dev/null +++ b/indra/win_updater/CMakeLists.txt @@ -0,0 +1,30 @@ +# -*- cmake -*- + +project(win_updater) + +include(00-Common) +include(LLCommon) +include(Linking) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ) + +set(win_updater_SOURCE_FILES updater.cpp) + +set(win_updater_HEADER_FILES CMakeLists.txt) + +set_source_files_properties(${win_updater_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND win_updater_SOURCE_FILES ${win_updater_HEADER_FILES}) + +add_executable(windows-updater WIN32 ${win_updater_SOURCE_FILES}) + +target_link_libraries(windows-updater wininet) + +set_target_properties(windows-updater + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:MSVCRT" + LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;MSVCRTD\"" + ) diff --git a/scripts/build_version.py b/scripts/build_version.py new file mode 100755 index 0000000000..4bef290b7d --- /dev/null +++ b/scripts/build_version.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# +# Print the build information embedded in a header file. +# +# Expects to be invoked from the command line with a file name and a +# list of directories to search. The file name will be one of the +# following: +# +# llversionserver.h +# llversionviewer.h +# +# The directory list that follows will include indra/llcommon, where +# these files live. + +import errno, os, re + +def get_version(filename): + fp = open(filename) + data = fp.read() + fp.close() + + vals = {} + m = re.search('const S32 LL_VERSION_MAJOR = (\d+);', data) + vals['major'] = m.group(1) + m = re.search('const S32 LL_VERSION_MINOR = (\d+);', data) + vals['minor'] = m.group(1) + m = re.search('const S32 LL_VERSION_PATCH = (\d+);', data) + vals['patch'] = m.group(1) + m = re.search('const S32 LL_VERSION_BUILD = (\d+);', data) + vals['build'] = m.group(1) + + return "%(major)s.%(minor)s.%(patch)s.%(build)s" % vals + +if __name__ == '__main__': + import sys + + try: + for path in sys.argv[2:]: + name = os.path.join(path, sys.argv[1]) + try: + print get_version(name) + break + except OSError, err: + if err.errno != errno.ENOENT: + raise + else: + print >> sys.stderr, 'File not found:', sys.argv[1] + sys.exit(1) + except AttributeError: + print >> sys.stderr, 'Error: malformatted file: ', name + sys.exit(1) + except IndexError: + print >> sys.stderr, ('Usage: %s llversion[...].h [directories]' % + sys.argv[0]) diff --git a/scripts/install.py b/scripts/install.py new file mode 100755 index 0000000000..7421d697f6 --- /dev/null +++ b/scripts/install.py @@ -0,0 +1,700 @@ +#!/usr/bin/env python +"""\ +@file install.py +@author Phoenix +@date 2008-01-27 +@brief Install files into an indra checkout. + +Install files as specified by: +https://wiki.lindenlab.com/wiki/User:Phoenix/Library_Installation + + +$LicenseInfo:firstyear=2007&license=mit$ + +Copyright (c) 2007, Linden Research, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +$/LicenseInfo$ +""" + +import copy +import errno +import md5 +import optparse +import os +import pprint +import sys +import tarfile +import urllib +import urlparse + +from sets import Set as set, ImmutableSet as frozenset + +# Locate -our- python library relative to our install location. +from os.path import realpath, dirname, join + +# Walk back to checkout base directory +base_dir = dirname(dirname(realpath(__file__))) +# Walk in to libraries directory +lib_dir = join(join(join(base_dir, 'indra'), 'lib'), 'python') + +if lib_dir not in sys.path: + sys.path.insert(0, lib_dir) + +from indra.base import llsd +from indra.util import helpformatter + +class InstallFile(object): + "This is just a handy way to throw around details on a file in memory." + def __init__(self, pkgname, url, md5sum, cache_dir, platform_path): + self.pkgname = pkgname + self.url = url + self.md5sum = md5sum + filename = urlparse.urlparse(url)[2].split('/')[-1] + self.filename = os.path.join(cache_dir, filename) + self.platform_path = platform_path + + def __str__(self): + return "ifile{%s:%s}" % (self.pkgname, self.url) + + def _is_md5_match(self): + hasher = md5.new(file(self.filename).read()) + if hasher.hexdigest() == self.md5sum: + return True + return False + + def is_match(self, platform): + """@brief Test to see if this ifile is part of platform +@param platform The target platform. Eg, win32 or linux/i686/gcc/3.3 +@return Returns True if the ifile is in the platform. + """ + if self.platform_path == 'common': + return True + req_platform_path = platform.split('/') + #print "platform:",req_platform_path + #print "path:",self.platform_path + # to match, every path part much match + match_count = min(len(req_platform_path), len(self.platform_path)) + for ii in range(0, match_count): + if req_platform_path[ii] != self.platform_path[ii]: + return False + #print "match!" + return True + + + def fetch_local(self): + print "Looking for:",self.filename + if not os.path.exists(self.filename): + print "not there -- fetching" + elif self.md5sum and not self._is_md5_match(): + print "Found, but md5 does not match." + os.remove(self.filename) + else: + print "Found matching package" + return + print "Downloading",self.url,"to local file",self.filename + urllib.urlretrieve(self.url, self.filename) + if self.md5sum and not self._is_md5_match(): + raise RuntimeError("Error matching md5 for %s" % self.url) + +class LicenseDefinition(object): + def __init__(self, definition): + #probably looks like: + # { text : ..., + # url : ... + # blessed : ... + # } + self._definition = definition + + +class BinaryDefinition(object): + def __init__(self, definition): + #probably looks like: + # { packages : {platform...}, + # copyright : ... + # license : ... + # description: ... + # } + self._definition = definition + + def _ifiles_from(self, tree, pkgname, cache_dir): + return self._ifiles_from_path(tree, pkgname, cache_dir, []) + + def _ifiles_from_path(self, tree, pkgname, cache_dir, path): + ifiles = [] + if tree.has_key('url'): + ifiles.append(InstallFile( + pkgname, + tree['url'], + tree.get('md5sum', None), + cache_dir, + path)) + else: + for key in tree: + platform_path = copy.copy(path) + platform_path.append(key) + ifiles.extend( + self._ifiles_from_path( + tree[key], + pkgname, + cache_dir, + platform_path)) + return ifiles + + def ifiles(self, pkgname, platform, cache_dir): + """@brief return a list of appropriate InstallFile instances to install +@param pkgname The name of the package to be installed, eg 'tut' +@param platform The target platform. Eg, win32 or linux/i686/gcc/3.3 +@param cache_dir The directory to cache downloads. +@return Returns a list of InstallFiles which are part of this install + """ + if 'packages' not in self._definition: + return [] + all_ifiles = self._ifiles_from( + self._definition['packages'], + pkgname, + cache_dir) + if platform == 'all': + return all_ifiles + return [ifile for ifile in all_ifiles if ifile.is_match(platform)] + +class InstalledPackage(object): + def __init__(self, definition): + # looks like: + # { url1 : [file1,file2,...], + # url2 : [file1,file2,...],... + # } + self._installed = {} + for url in definition: + self._installed[url] = definition[url] + + def urls(self): + return self._installed.keys() + + def files_in(self, url): + return self._installed[url] + + def remove(self, url): + self._installed.pop(url) + + def add_files(self, url, files): + self._installed[url] = files + +class Installer(object): + def __init__(self, install_filename, installed_filename, dryrun): + self._install_filename = install_filename + self._install_changed = False + self._installed_filename = installed_filename + self._installed_changed = False + self._dryrun = dryrun + self._binaries = {} + self._licenses = {} + self._installed = {} + self.load() + + def load(self): + if os.path.exists(self._install_filename): + install = llsd.parse(file(self._install_filename).read()) + try: + for name in install['binaries']: + self._binaries[name] = BinaryDefinition( + install['binaries'][name]) + except KeyError: + pass + try: + for name in install['licenses']: + self._licenses[name] = LicenseDefinition(install['licenses'][name]) + except KeyError: + pass + if os.path.exists(self._installed_filename): + installed = llsd.parse(file(self._installed_filename).read()) + try: + bins = installed['binaries'] + for name in bins: + self._installed[name] = InstalledPackage(bins[name]) + except KeyError: + pass + + def _write(self, filename, state): + print "Writing state to",filename + if not self._dryrun: + file(filename, 'w').write(llsd.format_xml(state)) + + def save(self): + if self._install_changed: + state = {} + state['licenses'] = {} + for name in self._licenses: + state['licenses'][name] = self._licenses[name]._definition + #print "self._binaries:",self._binaries + state['binaries'] = {} + for name in self._binaries: + state['binaries'][name] = self._binaries[name]._definition + self._write(self._install_filename, state) + if self._installed_changed: + state = {} + state['binaries'] = {} + bin = state['binaries'] + for name in self._installed: + #print "installed:",name,self._installed[name]._installed + bin[name] = self._installed[name]._installed + self._write(self._installed_filename, state) + + def is_license_info_valid(self): + valid = True + for bin in self._binaries: + binary = self._binaries[bin]._definition + if not binary.has_key('license'): + valid = False + print >>sys.stderr, "No license info for binary", bin + '.' + continue + if binary['license'] not in self._licenses: + valid = False + lic = binary['license'] + print >>sys.stderr, "Missing license info for '" + lic + "'", + print >>sys.stderr, 'in binary', bin + '.' + return valid + + def detail_binary(self, name): + "Return a binary definition detail" + try: + detail = self._binaries[name]._definition + return detail + except KeyError: + return None + + def _update_field(self, binary, field): + """Given a block and a field name, add or update it. + @param binary[in,out] a dict containing all the details about a binary. + @param field the name of the field to update. + """ + if binary.has_key(field): + print "Update value for '" + field + "'" + print "(Leave blank to keep current value)" + print "Current Value: '" + binary[field] + "'" + else: + print "Specify value for '" + field + "'" + value = raw_input("Enter New Value: ") + if binary.has_key(field) and not value: + pass + elif value: + binary[field] = value + + def _add_package(self, binary): + """Add an url for a platform path to the binary. + @param binary[in,out] a dict containing all the details about a binary.""" + print """\ +Please enter a new package location and url. Some examples: +common -- specify a package for all platforms +linux -- specify a package for all arch and compilers on linux +darwin/universal -- specify a mac os x universal +win32/i686/vs/2003 -- specify a windows visual studio 2003 package""" + target = raw_input("Package path: ") + url = raw_input("Package URL: ") + md5sum = raw_input("Package md5: ") + path = target.split('/') + if not binary.has_key('packages'): + binary['packages'] = {} + update = binary['packages'] + for child in path: + if not update.has_key(child): + update[child] = {} + parent = update + update = update[child] + parent[child]['url'] = llsd.uri(url) + parent[child]['md5sum'] = md5sum + + def adopt_binary(self, name): + "Interactively pull a new binary into the install" + if not self._binaries.has_key(name): + print "Adding binary '" + name + "'." + self._binaries[name] = BinaryDefinition({}) + else: + print "Updating binary '" + name + "'." + binary = self._binaries[name]._definition + for field in ('copyright', 'license', 'description'): + self._update_field(binary, field) + self._add_package(binary) + print "Adopted binary '" + name + "':" + pprint.pprint(self._binaries[name]) + self._install_changed = True + return True + + def orphan_binary(self, name): + self._binaries.pop(name) + self._install_changed = True + + def add_license(self, name, text, url): + if self._licenses.has_key(name): + print "License '" + name + "' being overwritten." + definition = {} + if url: + definition['url'] = url + if not url and text is None: + print "Please enter license text. End input with EOF (^D)." + text = sys.stdin.read() + definition['text'] = text + self._licenses[name] = LicenseDefinition(definition) + self._install_changed = True + return True + + def remove_license(self, name): + self._licenses.pop(name) + self._install_changed = True + + def _determine_install_set(self, ifiles): + """@brief determine what to install +@param ifiles A list of InstallFile instances which are necessary for this install +@return Returns the tuple (ifiles to install, ifiles to remove)""" + installed_list = [] + for package in self._installed: + installed_list.extend(self._installed[package].urls()) + installed_set = set(installed_list) + #print "installed_set:",installed_set + install_list = [ifile.url for ifile in ifiles] + install_set = set(install_list) + #print "install_set:",install_set + remove_set = installed_set.difference(install_set) + to_remove = [ifile for ifile in ifiles if ifile.url in remove_set] + #print "to_remove:",to_remove + install_set = install_set.difference(installed_set) + to_install = [ifile for ifile in ifiles if ifile.url in install_set] + #print "to_install:",to_install + return to_install, to_remove + + def _build_ifiles(self, platform, cache_dir): + """@brief determine what files to install and remove +@param platform The target platform. Eg, win32 or linux/i686/gcc/3.3 +@param cache_dir The directory to cache downloads. +@return Returns the tuple (ifiles to install, ifiles to remove)""" + ifiles = [] + for bin in self._binaries: + ifiles.extend(self._binaries[bin].ifiles(bin, platform, cache_dir)) + return self._determine_install_set(ifiles) + + def _remove(self, to_remove): + remove_file_list = [] + for ifile in to_remove: + remove_file_list.extend( + self._installed[ifile.pkgname].files_in(ifile.url)) + self._installed[ifile.pkgname].remove(ifile.url) + self._installed_changed = True + for filename in remove_file_list: + print "rm",filename + if not self._dryrun: + os.remove(filename) + + def _install(self, to_install, install_dir): + for ifile in to_install: + tar = tarfile.open(ifile.filename, 'r') + print "Extracting",ifile.filename,"to destination",install_dir + if not self._dryrun: + # *NOTE: try to call extractall, which first appears + # in python 2.5. Phoenix 2008-01-28 + try: + tar.extractall(path=install_dir) + except AttributeError: + _extractall(tar, path=install_dir) + if self._installed.has_key(ifile.pkgname): + self._installed[ifile.pkgname].add_files(ifile.url, tar.getnames()) + else: + # *HACK: this understands the installed package syntax. + definition = { ifile.url : tar.getnames() } + self._installed[ifile.pkgname] = InstalledPackage(definition) + self._installed_changed = True + + def do_install(self, platform, install_dir, cache_dir): + """@brief Do the installation for for the platform. +@param platform The target platform. Eg, win32 or linux/i686/gcc/3.3 +@param install_dir The root directory to install into. Created if missing. +@param cache_dir The directory to cache downloads. Created if missing.""" + if not self._binaries: + raise RuntimeError("No binaries to install. Please add them.") + _mkdir(install_dir) + _mkdir(cache_dir) + to_install, to_remove = self._build_ifiles(platform, cache_dir) + + # we do this in multiple steps reduce the likelyhood to have a + # bad install. + for ifile in to_install: + ifile.fetch_local() + self._remove(to_remove) + self._install(to_install, install_dir) + + +# +# *NOTE: PULLED FROM PYTHON 2.5 tarfile.py Phoenix 2008-01-28 +# +def _extractall(tar, path=".", members=None): + """Extract all members from the archive to the current working + directory and set owner, modification time and permissions on + directories afterwards. `path' specifies a different directory + to extract to. `members' is optional and must be a subset of the + list returned by getmembers(). + """ + directories = [] + + if members is None: + members = tar + + for tarinfo in members: + if tarinfo.isdir(): + # Extract directory with a safe mode, so that + # all files below can be extracted as well. + try: + os.makedirs(os.path.join(path, tarinfo.name), 0777) + except EnvironmentError: + pass + directories.append(tarinfo) + else: + tar.extract(tarinfo, path) + + # Reverse sort directories. + directories.sort(lambda a, b: cmp(a.name, b.name)) + directories.reverse() + + # Set correct owner, mtime and filemode on directories. + for tarinfo in directories: + path = os.path.join(path, tarinfo.name) + try: + tar.chown(tarinfo, path) + tar.utime(tarinfo, path) + tar.chmod(tarinfo, path) + except tarfile.ExtractError, e: + if tar.errorlevel > 1: + raise + else: + tar._dbg(1, "tarfile: %s" % e) + + +def _mkdir(directory): + "Safe, repeatable way to make a directory." + try: + os.makedirs(directory) + except OSError, e: + if e[0] != errno.EEXIST: + raise + +def _get_platform(): + "Return appropriate platform packages for the environment." + platform_map = { + 'darwin': 'darwin', + 'linux2': 'linux', + 'win32' : 'win32', + 'cygwin' : 'win32', + 'solaris' : 'solaris' + } + return platform_map[sys.platform] + +def main(): + parser = optparse.OptionParser( + usage="usage: %prog [options]", + formatter = helpformatter.Formatter(), + description="""This script fetches and installs binary packages. + +The process is to open and read an install manifest file which specifies +what files should be installed. For each file in the manifest: + * make sure it has a license + * check the installed version + ** if not installed and needs to be, download and install + ** if installed version differs, download & install + +When specifying a platform, you can specify 'all' to install all +packages, or any platform of the form: + +OS[/arch[/compiler[/compiler_version]]] + +Where the supported values for each are: +OS: darwin, linux, win32, solaris +arch: i686, x86_64, ppc, universal +compiler: vs, gcc +compiler_version: 2003, 2005, 2008, 3.3, 3.4, 4.0, etc. + +No checks are made to ensure a valid combination of platform +parts. Some exmples of valid platforms: + +win32 +win32/i686/vs/2005 +linux/x86_64/gcc/3.3 +linux/x86_64/gcc/4.0 +darwin/universal/gcc/4.0 +""") + parser.add_option( + '--dry-run', + action='store_true', + default=False, + dest='dryrun', + help='Do not actually install files. Downloads will still happen.') + parser.add_option( + '--install-manifest', + type='string', + default=join(base_dir, 'install.xml'), + dest='install_filename', + help='The file used to describe what should be installed.') + parser.add_option( + '--installed-manifest', + type='string', + default=join(base_dir, 'installed.xml'), + dest='installed_filename', + help='The file used to record what is installed.') + parser.add_option( + '-p', '--platform', + type='string', + default=_get_platform(), + dest='platform', + help="""Override the automatically determined platform. \ +You can specify 'all' to do a complete installation of all binaries.""") + parser.add_option( + '--cache-dir', + type='string', + default=join(base_dir, '.install.cache'), + dest='cache_dir', + help='Where to download files.') + parser.add_option( + '--install-dir', + type='string', + default=base_dir, + dest='install_dir', + help='Where to unpack the installed files.') + parser.add_option( + '--skip-license-check', + action='store_false', + default=True, + dest='check_license', + help="Do not perform the license check.") + parser.add_option( + '--add-license', + type='string', + default=None, + dest='new_license', + help="""Add a license to the install file. Argument is the name of \ +license. Specify --license-url if the license is remote or specify \ +--license-text, otherwse the license text will be read from standard \ +input.""") + parser.add_option( + '--remove-license', + type='string', + default=None, + dest='remove_license', + help="Remove a named license.") + parser.add_option( + '--license-url', + type='string', + default=None, + dest='license_url', + help="""Put the specified url into an added license. \ +Ignored if --add-license is not specified.""") + parser.add_option( + '--license-text', + type='string', + default=None, + dest='license_text', + help="""Put the text into an added license. \ +Ignored if --add-license is not specified.""") + parser.add_option( + '--orphan', + type='string', + default=None, + dest='orphan', + help="Remove a binary from the install file.") + parser.add_option( + '--adopt', + type='string', + default=None, + dest='adopt', + help="""Add a binary into the install file. Argument is the name of \ +the binary to add.""") + parser.add_option( + '--list', + action='store_true', + default=False, + dest='list_binaries', + help="List the binaries in the install manifest") + parser.add_option( + '--details', + type='string', + default=None, + dest='detail_binary', + help="Get detailed information on specified binary.") + options, args = parser.parse_args() + + + installer = Installer( + options.install_filename, + options.installed_filename, + options.dryrun) + + # + # Handle the queries for information + # + if options.list_binaries: + print "binary list:",installer._binaries.keys() + return 0 + if options.detail_binary: + detail = installer.detail_binary(options.detail_binary) + if detail: + print "Detail on binary",options.detail_binary+":" + pprint.pprint(detail) + else: + print "Bianry '"+options.detail_binary+"' not found in", + print "install file." + return 0 + + # + # Handle updates -- can only do one of these + # *TODO: should this change the command line syntax? + # + if options.new_license: + if not installer.add_license( + options.new_license, + options.license_text, + options.license_url): + return 1 + elif options.remove_license: + installer.remove_license(options.remove_license) + elif options.orphan: + installer.orphan_binary(options.orphan) + elif options.adopt: + if not installer.adopt_binary(options.adopt): + return 1 + else: + if options.check_license: + if not installer.is_license_info_valid(): + print >>sys.stderr, 'Please add or correct the license', + print >>sys.stderr, 'information in', + print >>sys.stderr, options.install_filename + '.' + print >>sys.stderr, "You can also use the --add-license", + print >>sys.stderr, "option. See", sys.argv[0], "--help" + return 1 + + # *TODO: check against a list of 'known good' licenses. + # *TODO: check for urls which conflict -- will lead to + # problems. + + installer.do_install( + options.platform, + options.install_dir, + options.cache_dir) + + # save out any changes + installer.save() + return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/scripts/update_version_files.py b/scripts/update_version_files.py index 077120127b..95ff19c65b 100755 --- a/scripts/update_version_files.py +++ b/scripts/update_version_files.py @@ -100,7 +100,7 @@ re_map['indra/llcommon/llversionserver.h'] = \ 'const S32 LL_VERSION_BUILD = %(SERVER_VER_BUILD)s;'), ('const char \* const LL_CHANNEL = "(.+)";', 'const char * const LL_CHANNEL = "%(SERVER_CHANNEL)s";')) -re_map['indra/newview/res/newViewRes.rc'] = \ +re_map['indra/newview/res/viewerRes.rc'] = \ (('FILEVERSION [0-9,]+', 'FILEVERSION %(VER_MAJOR)s,%(VER_MINOR)s,%(VER_PATCH)s,%(VER_BUILD)s'), ('PRODUCTVERSION [0-9,]+', |