diff --git a/ports/freeglut/CONTROL b/ports/freeglut/CONTROL index c6f595c2f2..15b0ac2e37 100644 --- a/ports/freeglut/CONTROL +++ b/ports/freeglut/CONTROL @@ -1,3 +1,3 @@ Source: freeglut -Version: 3.0.0-5 +Version: 3.0.0-6 Description: Open source implementation of GLUT with source and binary backwards compatibility. diff --git a/ports/freeglut/macOS_Xquartz.patch b/ports/freeglut/macOS_Xquartz.patch new file mode 100644 index 0000000000..423b3b9018 --- /dev/null +++ b/ports/freeglut/macOS_Xquartz.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f68b27f..4339858 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,6 +220,16 @@ ENDIF() + IF(FREEGLUT_GLES) + ADD_DEFINITIONS(-DFREEGLUT_GLES) + LIST(APPEND LIBS GLESv2 GLESv1_CM EGL) ++ELSEIF(APPLE) ++ # on OSX FindOpenGL uses framework version of OpenGL, but we need X11 version ++ FIND_PATH(GLX_INCLUDE_DIR GL/glx.h ++ PATHS /opt/X11/include /usr/X11/include /usr/X11R6/include) ++ FIND_LIBRARY(OPENGL_gl_LIBRARY GL ++ PATHS /opt/X11/lib /usr/X11/lib /usr/X11R6/lib) ++ FIND_LIBRARY(OPENGL_glu_LIBRARY GLU ++ PATHS /opt/X11/lib /usr/X11/lib /usr/X11R6/lib) ++ LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) ++ INCLUDE_DIRECTORIES(${GLX_INCLUDE_DIR}) + ELSE() + FIND_PACKAGE(OpenGL REQUIRED) + LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) diff --git a/ports/freeglut/portfile.cmake b/ports/freeglut/portfile.cmake index 24d022b177..1659c002de 100644 --- a/ports/freeglut/portfile.cmake +++ b/ports/freeglut/portfile.cmake @@ -1,22 +1,23 @@ include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/freeglut-3.0.0) vcpkg_download_distfile(ARCHIVE - URLS "https://sourceforge.net/projects/freeglut/files/freeglut/3.0.0/freeglut-3.0.0.tar.gz/download" + URLS "http://downloads.sourceforge.net/project/freeglut/freeglut/3.0.0/freeglut-3.0.0.tar.gz" FILENAME "freeglut-3.0.0.tar.gz" SHA512 9c45d5b203b26a7ff92331b3e080a48e806c92fbbe7c65d9262dd18c39cd6efdad8a795a80f499a2d23df84b4909dbd7c1bab20d7dd3555d3d88782ce9dd15b0 ) -vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} + PATCHES + use_targets_to_export_x11_dependency.patch + macOS_Xquartz.patch +) if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - message("Freeglut currently requires the following libraries from the system package manager:\n opengl\n glu\n libx11\n\nThese can be installed on Ubuntu systems via apt-get install libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev") + message("Freeglut currently requires the following libraries from the system package manager:\n opengl\n glu\n libx11\n\nThese can be installed on Ubuntu systems via apt-get install libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev\nOn macOS Xquartz is required.") endif() -# disable debug suffix, because FindGLUT.cmake from CMake 3.8 doesn't support it -file(READ ${SOURCE_PATH}/CMakeLists.txt FREEGLUT_CMAKELISTS) -string(REPLACE "SET( CMAKE_DEBUG_POSTFIX \"d\" )" - "\#SET( CMAKE_DEBUG_POSTFIX \"d\" )" FREEGLUT_CMAKELISTS "${FREEGLUT_CMAKELISTS}") -file(WRITE ${SOURCE_PATH}/CMakeLists.txt "${FREEGLUT_CMAKELISTS}") - if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(FREEGLUT_STATIC OFF) set(FREEGLUT_DYNAMIC ON) @@ -27,8 +28,10 @@ endif() # Patch header file(READ ${SOURCE_PATH}/include/GL/freeglut_std.h FREEGLUT_STDH) -string(REGEX REPLACE "\"freeglut[_a-z]+.lib\"" +string(REGEX REPLACE "\"freeglut_static.lib\"" "\"freeglut.lib\"" FREEGLUT_STDH "${FREEGLUT_STDH}") +string(REGEX REPLACE "\"freeglut_staticd.lib\"" + "\"freeglutd.lib\"" FREEGLUT_STDH "${FREEGLUT_STDH}") file(WRITE ${SOURCE_PATH}/include/GL/freeglut_std.h "${FREEGLUT_STDH}") vcpkg_configure_cmake( @@ -46,7 +49,7 @@ vcpkg_install_cmake() if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") file(RENAME ${CURRENT_PACKAGES_DIR}/lib/freeglut_static.lib ${CURRENT_PACKAGES_DIR}/lib/freeglut.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/freeglut_static.lib ${CURRENT_PACKAGES_DIR}/debug/lib/freeglut.lib) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/freeglut_staticd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/freeglutd.lib) endif() endif() diff --git a/ports/freeglut/use_targets_to_export_x11_dependency.patch b/ports/freeglut/use_targets_to_export_x11_dependency.patch new file mode 100644 index 0000000000..9933efd44e --- /dev/null +++ b/ports/freeglut/use_targets_to_export_x11_dependency.patch @@ -0,0 +1,29 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0d3260b..edf034a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -257,8 +257,6 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC) + INCLUDE(CheckIncludeFiles) + IF(UNIX AND NOT(ANDROID OR BLACKBERRY)) + FIND_PACKAGE(X11 REQUIRED) +- INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR}) +- LIST(APPEND LIBS ${X11_LIBRARIES}) + IF(X11_Xrandr_FOUND) + SET(HAVE_X11_EXTENSIONS_XRANDR_H TRUE) + LIST(APPEND LIBS ${X11_Xrandr_LIB}) +@@ -339,9 +337,15 @@ ENDIF() + + IF(FREEGLUT_BUILD_SHARED_LIBS) + ADD_LIBRARY(freeglut SHARED ${FREEGLUT_SRCS}) ++ IF(UNIX AND NOT(ANDROID OR BLACKBERRY)) ++ TARGET_LINK_LIBRARIES(freeglut PRIVATE X11::X11) ++ ENDIF() + ENDIF() + IF(FREEGLUT_BUILD_STATIC_LIBS) + ADD_LIBRARY(freeglut_static STATIC ${FREEGLUT_SRCS}) ++ IF(UNIX AND NOT(ANDROID OR BLACKBERRY)) ++ TARGET_LINK_LIBRARIES(freeglut_static PRIVATE X11::X11) ++ ENDIF() + ENDIF() + +