diff options
-rw-r--r-- | CMakeLists.txt | 22 | ||||
-rw-r--r-- | cmake/InstallHelpers.cmake | 18 | ||||
-rw-r--r-- | neovim.rb | 45 |
3 files changed, 36 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b26b57e20..b74785cc2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,16 +76,32 @@ if(TRAVIS_CI_BUILD) add_definitions(-Werror) endif() -add_definitions(-DINCLUDE_GENERATED_DECLARATIONS) +if(CMAKE_COMPILER_IS_GNUCC) + include(CheckCCompilerFlag) + check_c_compiler_flag(-Og HAS_OG_FLAG) +else() + set(HAS_OG_FLAG 0) +endif() + +# Set custom build flags for RelWithDebInfo. +# -DNDEBUG purposely omitted because we want assertions. +if(HAS_OG_FLAG) + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Og -g" + CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE) +else() + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" + CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE) +endif() -add_definitions(-DHAVE_CONFIG_H) if(CMAKE_BUILD_TYPE MATCHES Debug) - # cmake automatically appends -g to the compiler flags set(DEBUG 1) else() set(DEBUG 0) endif() +add_definitions(-DINCLUDE_GENERATED_DECLARATIONS) +add_definitions(-DHAVE_CONFIG_H) + if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Linux") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") diff --git a/cmake/InstallHelpers.cmake b/cmake/InstallHelpers.cmake index a23bf63ab3..763b2a092c 100644 --- a/cmake/InstallHelpers.cmake +++ b/cmake/InstallHelpers.cmake @@ -22,19 +22,21 @@ function(create_install_dir_with_perms) install(CODE " - if(ENV{DESTDIR}) - # TODO(fwalch): Is this branch ever taken (#1381, #1387)? - set(PREFIX \$ENV{DESTDIR}/\${CMAKE_INSTALL_PREFIX}) - else() - set(PREFIX \${CMAKE_INSTALL_PREFIX}) + if(DEFINED ENV{DESTDIR} AND NOT IS_ABSOLUTE \${CMAKE_INSTALL_PREFIX}) + message(FATAL_ERROR \"Install prefix must be absolute when using DESTDIR\") endif() - set(_current_dir \"\${PREFIX}/${_install_dir_DESTINATION}\") + set(_current_dir \"\${CMAKE_INSTALL_PREFIX}/${_install_dir_DESTINATION}\") set(_dir_permissions \"${_install_dir_DIRECTORY_PERMISSIONS}\") set(_parent_dirs) - while(NOT EXISTS \${_current_dir}) + set(_prev_dir) + + # Explicitly prepend DESTDIR when using EXISTS. + # file(INSTALL ...) implicitly respects DESTDIR, but EXISTS does not. + while(NOT EXISTS \$ENV{DESTDIR}\${_current_dir} AND NOT \${_prev_dir} STREQUAL \${_current_dir}) list(APPEND _parent_dirs \${_current_dir}) + set(_prev_dir \${_current_dir}) get_filename_component(_current_dir \${_current_dir} PATH) endwhile() @@ -47,6 +49,8 @@ function(create_install_dir_with_perms) # 3.0.2. foreach(_current_dir \${_parent_dirs}) if(NOT IS_DIRECTORY \${_current_dir}) + # file(INSTALL ...) implicitly respects DESTDIR, so there's no need to + # prepend it here. file(INSTALL DESTINATION \${_current_dir} TYPE DIRECTORY DIR_PERMISSIONS \${_dir_permissions} @@ -1,42 +1,9 @@ -require "formula" +odie <<-EOS.undent -class Neovim < Formula - homepage "http://neovim.org" - head "https://github.com/neovim/neovim.git" + Whoops, the neovim Homebrew Formula has moved! Please instead run: - depends_on "cmake" => :build - depends_on "libtool" => :build - depends_on "automake" => :build - depends_on "autoconf" => :build + brew tap neovim/homebrew-neovim + brew install --HEAD neovim - resource "libuv" do - url "https://github.com/joyent/libuv/archive/v0.11.28.tar.gz" - sha1 "3b70b65467ee693228b8b8385665a52690d74092" - end - - resource "msgpack" do - url "https://github.com/msgpack/msgpack-c/archive/ecf4b09acd29746829b6a02939db91dfdec635b4.tar.gz" - sha1 "c160ff99f20d9d0a25bea0a57f4452f1c9bde370" - end - - resource "luajit" do - url "http://luajit.org/download/LuaJIT-2.0.3.tar.gz" - sha1 "2db39e7d1264918c2266b0436c313fbd12da4ceb" - end - - resource "luarocks" do - url "https://github.com/keplerproject/luarocks/archive/0587afbb5fe8ceb2f2eea16f486bd6183bf02f29.tar.gz" - sha1 "61a894fd5d61987bf7e7f9c3e0c5de16ba4b68c4" - end - - def install - ENV["GIT_DIR"] = cached_download/".git" if build.head? - ENV.deparallelize - - resources.each do |r| - r.stage(target=buildpath/".deps/build/src/#{r.name}") - end - - system "make", "CMAKE_BUILD_TYPE=RelWithDebInfo", "CMAKE_EXTRA_FLAGS=\"-DCMAKE_INSTALL_PREFIX:PATH=#{prefix}\"", "install" - end -end + Thanks! +EOS |