Skip to content

Commit

Permalink
x11-misc/j4-dmenu-desktop: new package
Browse files Browse the repository at this point in the history
Closes: gentoo#6933
Package-Manager: Portage-2.3.19, Repoman-2.3.6
  • Loading branch information
diogocp authored and mgorny committed Mar 3, 2018
1 parent bb7866e commit 1119b23
Show file tree
Hide file tree
Showing 4 changed files with 249 additions and 0 deletions.
1 change: 1 addition & 0 deletions x11-misc/j4-dmenu-desktop/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST j4-dmenu-desktop-r2.16.tar.gz 32553 BLAKE2B c1c7f0f2a59421b2e244a8f65251b296ad44ae37c10cbffb62bdefb168b6104e3d89c0a43b74feaf0afcc52ac78c8d46204ed397f131e526c447379b066b9b88 SHA512 d5bb0902d4bdc474fa20bc9d8f79de90a92bb4941f0d325dfcfaa1347ea3ad355b87da8194bc3f654970e9ab8848e6ecb5093f3c75fbaa8dbc40199fe6ea2837
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
From 210926d23d0f40277b549ca490f876f93c3ffb6d Mon Sep 17 00:00:00 2001
From: Diogo Pereira <[email protected]>
Date: Wed, 24 Jan 2018 16:44:03 +0000
Subject: [PATCH 1/3] CMake: simplify GCC version check

---
CMakeLists.txt | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 392db54..78a71c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,21 +2,9 @@ cmake_minimum_required(VERSION 2.8)

project(j4-dmenu)

-exec_program(
- ${CMAKE_CXX_COMPILER}
- ARGS --version
- OUTPUT_VARIABLE _compiler_output
- )
-string(REGEX REPLACE "(\n.*$)" "" cxx_compiler_version "${_compiler_output}")
-string(REGEX REPLACE "([^0-9.])|([0-9.][^0-9.])" "" cxx_compiler_version "${cxx_compiler_version}")
-
-if(CMAKE_COMPILER_IS_GNUCXX)
- if(${cxx_compiler_version} VERSION_LESS "4.7.0")
- set(CXX_OPT "-std=c++0x")
- else()
- set(CXX_OPT "-std=c++11")
- endif()
-elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
+ set(CXX_OPT "-std=c++0x")
+else()
set(CXX_OPT "-std=c++11")
endif()


From e6e05d0170554246118c2dffe5395a982e1af250 Mon Sep 17 00:00:00 2001
From: Diogo Pereira <[email protected]>
Date: Wed, 24 Jan 2018 16:53:39 +0000
Subject: [PATCH 2/3] CMake: clean up and reorder CMAKE_CXX_FLAGS

---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 78a71c0..1b3f2b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ else()
set(CXX_OPT "-std=c++11")
endif()

-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_OPT} ${CXX_OPT} -Wall -pedantic -Wextra -O2")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_OPT} -Wall -Wextra -pedantic -O2")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")

if(NOT DEFINED NO_TESTS)

From 7be5116d0d6d80522517a58bb6e45ca1cdcd9612 Mon Sep 17 00:00:00 2001
From: Diogo Pereira <[email protected]>
Date: Wed, 24 Jan 2018 17:51:28 +0000
Subject: [PATCH 3/3] CMake: add option to disable downloading Catch

---
CMakeLists.txt | 90 ++++++++++++++++++++++++++++++----------------------------
1 file changed, 47 insertions(+), 43 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b3f2b0..17605e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 2.8)

project(j4-dmenu)

+option(WITH_TESTS "Build and run tests" ON)
+option(WITH_GIT_CATCH "Use a Git checkout of Catch to build the tests" ON)
+
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
set(CXX_OPT "-std=c++0x")
else()
@@ -11,53 +14,54 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_OPT} -Wall -Wextra -pedantic -O2")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")

-if(NOT DEFINED NO_TESTS)
- include(ExternalProject)
-
- ExternalProject_Add(
- catch
- PREFIX ${CMAKE_BINARY_DIR}/catch
- GIT_TAG Catch1.x
- GIT_REPOSITORY https://github.com/catchorg/Catch2
- TIMEOUT 10
- UPDATE_COMMAND git pull
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
- LOG_DOWNLOAD ON
- )
-
- # Expose required variable (CATCH_INCLUDE_DIR) to parent scope
- ExternalProject_Get_Property(catch source_dir)
- set(CATCH_INCLUDE_DIR ${source_dir}/include CACHE INTERNAL "Path to include folder for Catch")
-
- # Includes Catch in the project:
- #add_subdirectory(${EXT_PROJECTS_DIR}/catch)
- include_directories(${CATCH_INCLUDE_DIR} ${COMMON_INCLUDES})
-
- add_definitions(-DTEST_FILES="${CMAKE_CURRENT_SOURCE_DIR}/test_files/")
-
+if(WITH_TESTS)
enable_testing(true)
-
add_test(
- NAME j4-dmenu-tests
- COMMAND j4-dmenu-tests
- )
-
+ NAME j4-dmenu-tests
+ COMMAND j4-dmenu-tests
+ )
add_executable(
- j4-dmenu-tests
- src/Test.cc
- src/TestApplication.cc
- src/TestApplicationRunner.cc
- src/TestSearchPath.cc
- src/TestLocaleSuffixes.cc
- src/TestFileFinder.cc
- src/TestFormatters.cc
- )
-
- add_dependencies(j4-dmenu-tests catch)
-endif(NOT DEFINED NO_TESTS)
+ j4-dmenu-tests
+ src/Test.cc
+ src/TestApplication.cc
+ src/TestApplicationRunner.cc
+ src/TestSearchPath.cc
+ src/TestLocaleSuffixes.cc
+ src/TestFileFinder.cc
+ src/TestFormatters.cc
+ )
+ add_definitions(-DTEST_FILES="${CMAKE_CURRENT_SOURCE_DIR}/test_files/")

+ if(WITH_GIT_CATCH)
+ include(ExternalProject)
+ ExternalProject_Add(
+ catch
+ PREFIX ${CMAKE_BINARY_DIR}/catch
+ GIT_TAG Catch1.x
+ GIT_REPOSITORY https://github.com/catchorg/Catch2
+ TIMEOUT 10
+ UPDATE_COMMAND git pull
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ LOG_DOWNLOAD ON
+ )
+ add_dependencies(j4-dmenu-tests catch)
+
+ # Expose required variable (CATCH_INCLUDE_DIR) to parent scope
+ ExternalProject_Get_Property(catch source_dir)
+ set(CATCH_INCLUDE_DIR ${source_dir}/include CACHE INTERNAL "Path to include folder for Catch")
+ else()
+ # Use system-installed version of Catch
+ find_path(CATCH_INCLUDE_DIR catch.hpp PATH_SUFFIXES catch)
+ if(NOT CATCH_INCLUDE_DIR)
+ message(FATAL_ERROR "Catch include directory not found")
+ endif()
+ endif(WITH_GIT_CATCH)
+
+ # Include Catch in the project
+ include_directories(${CATCH_INCLUDE_DIR} ${COMMON_INCLUDES})
+endif(WITH_TESTS)

add_executable(
j4-dmenu-desktop
44 changes: 44 additions & 0 deletions x11-misc/j4-dmenu-desktop/j4-dmenu-desktop-2.16.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit cmake-utils

MY_PV="r${PV}"
MY_P="${PN}-${MY_PV}"

DESCRIPTION="A fast desktop menu"
HOMEPAGE="https://github.com/enkore/j4-dmenu-desktop"
SRC_URI="https://github.com/enkore/j4-dmenu-desktop/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz"

LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="test"

DEPEND="test? ( <dev-cpp/catch-2 )"
RDEPEND="x11-misc/dmenu"

S="${WORKDIR}/${MY_P}"

# Merged upstream; remove in next version bump
PATCHES=( "${FILESDIR}/${P}_system_catch.patch" )

src_prepare() {
cmake-utils_src_prepare
sed -i -e "s/-pedantic -O2//" CMakeLists.txt || die "sed failed"
}

src_configure() {
local mycmakeargs=(
-DWITH_TESTS=$(usex test)
-DWITH_GIT_CATCH=no
)
cmake-utils_src_configure
}

src_install() {
cmake-utils_src_install
doman "j4-dmenu-desktop.1"
}
21 changes: 21 additions & 0 deletions x11-misc/j4-dmenu-desktop/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>Diogo Pereira</name>
</maintainer>
<maintainer type="project">
<email>[email protected]</email>
<name>Proxy Maintainers</name>
</maintainer>
<longdescription lang="en">
j4-dmenu-desktop is a replacement for i3-dmenu-desktop. Its purpose is
to find .desktop files and offer you a menu to start an application
using dmenu. You can also execute shell commands using it.
</longdescription>
<upstream>
<remote-id type="github">enkore/j4-dmenu-desktop</remote-id>
<bugs-to>https://github.com/enkore/j4-dmenu-desktop/issues</bugs-to>
</upstream>
</pkgmetadata>

0 comments on commit 1119b23

Please sign in to comment.