From dd718e3cdbca6116e381f331c749ac675f77b590 Mon Sep 17 00:00:00 2001 From: George Hilliard Date: Sun, 4 Aug 2019 22:39:10 -0500 Subject: [PATCH] Package and add fortune-mod You deserve a cookie! --- Config.in | 3 ++ .../thirtythreeforty_businesscard_defconfig | 3 ++ package/fortune-mod/0001-host-strfile.patch | 11 +++++ package/fortune-mod/0002-custom-cookies.patch | 20 ++++++++ .../fortune-mod/0003-fortune-in-usr-bin.patch | 13 +++++ package/fortune-mod/Config.in | 32 +++++++++++++ package/fortune-mod/fortune-mod.mk | 47 +++++++++++++++++++ package/librecode/Config.in | 8 ++++ package/librecode/librecode.mk | 15 ++++++ 9 files changed, 152 insertions(+) create mode 100644 package/fortune-mod/0001-host-strfile.patch create mode 100644 package/fortune-mod/0002-custom-cookies.patch create mode 100644 package/fortune-mod/0003-fortune-in-usr-bin.patch create mode 100644 package/fortune-mod/Config.in create mode 100644 package/fortune-mod/fortune-mod.mk create mode 100644 package/librecode/Config.in create mode 100644 package/librecode/librecode.mk diff --git a/Config.in b/Config.in index ce8e5c2..fd2e243 100644 --- a/Config.in +++ b/Config.in @@ -1,5 +1,8 @@ source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/sunxi-tools-f1c100s/Config.in.host" source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/sunxi-tools-f1c100s/Config.in" source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/2048/Config.in" +source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/fortune-mod/Config.in" source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/robotfindskitten/Config.in" source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/rogue/Config.in" + +source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/librecode/Config.in" diff --git a/configs/thirtythreeforty_businesscard_defconfig b/configs/thirtythreeforty_businesscard_defconfig index a8e79d2..1376853 100644 --- a/configs/thirtythreeforty_businesscard_defconfig +++ b/configs/thirtythreeforty_businesscard_defconfig @@ -4,6 +4,7 @@ BR2_CCACHE=y BR2_SHARED_STATIC_LIBS=y BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_BUSINESSCARD_PATH)/patches" BR2_KERNEL_HEADERS_5_1=y +BR2_TOOLCHAIN_BUILDROOT_WCHAR=y # BR2_UCLIBC_INSTALL_UTILS is not set BR2_GCC_VERSION_8_X=y BR2_TOOLCHAIN_BUILDROOT_CXX=y @@ -63,5 +64,7 @@ BR2_PACKAGE_HOST_MTD=y BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_SUNXI_TOOLS_F1C100S=y BR2_PACKAGE_2048=y +BR2_PACKAGE_FORTUNE_MOD=y +BR2_PACKAGE_FORTUNE_MOD_COOKIES="computers;humorists;linuxcookie;literature;pratchett;startrek;wisdom" BR2_PACKAGE_ROBOTFINDSKITTEN=y BR2_PACKAGE_ROGUE=y diff --git a/package/fortune-mod/0001-host-strfile.patch b/package/fortune-mod/0001-host-strfile.patch new file mode 100644 index 0000000..ae39287 --- /dev/null +++ b/package/fortune-mod/0001-host-strfile.patch @@ -0,0 +1,11 @@ +diff --git a/fortune-mod/datfiles/CMakeLists.txt b/fortune-mod/datfiles/CMakeLists.txt +index 00aa838..aa23f4c 100644 +--- a/fortune-mod/datfiles/CMakeLists.txt ++++ b/fortune-mod/datfiles/CMakeLists.txt +@@ -1,4 +1,5 @@ +-SET (_strfile "${CMAKE_CURRENT_BINARY_DIR}/../strfile") ++SET(STRFILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/../strfile" CACHE STRING "Use host strfile (for cross compilation)") ++SET (_strfile "${STRFILE_PATH}") + FOREACH(c ${COOKIES}) + SET(TARGET_NAME "cookie__${c}") + SET(DEST "${c}.dat") diff --git a/package/fortune-mod/0002-custom-cookies.patch b/package/fortune-mod/0002-custom-cookies.patch new file mode 100644 index 0000000..9590809 --- /dev/null +++ b/package/fortune-mod/0002-custom-cookies.patch @@ -0,0 +1,20 @@ +diff --git a/fortune-mod/CMakeLists.txt b/fortune-mod/CMakeLists.txt +index dbe120d..cc272b8 100644 +--- a/fortune-mod/CMakeLists.txt ++++ b/fortune-mod/CMakeLists.txt +@@ -261,6 +261,7 @@ SET (COOKIES + paradoxum + zippy + debian ++ CACHE STRING "Cookies to include" + ) + + SET (OFFENSIVE_COOKIES +@@ -290,6 +291,7 @@ SET (OFFENSIVE_COOKIES + songs-poems + vulgarity + zippy ++ CACHE STRING "Offensive cookies to include" + ) + + ADD_SUBDIRECTORY("datfiles") diff --git a/package/fortune-mod/0003-fortune-in-usr-bin.patch b/package/fortune-mod/0003-fortune-in-usr-bin.patch new file mode 100644 index 0000000..0485c13 --- /dev/null +++ b/package/fortune-mod/0003-fortune-in-usr-bin.patch @@ -0,0 +1,13 @@ +diff --git a/fortune-mod/CMakeLists.txt b/fortune-mod/CMakeLists.txt +index dbe120d..cf36ad0 100644 +--- a/fortune-mod/CMakeLists.txt ++++ b/fortune-mod/CMakeLists.txt +@@ -152,7 +152,7 @@ ENDMACRO() + my_exe( + "fortune" + "fortune/fortune.c" +- "games" ++ "bin" + ) + + my_exe( diff --git a/package/fortune-mod/Config.in b/package/fortune-mod/Config.in new file mode 100644 index 0000000..92613fd --- /dev/null +++ b/package/fortune-mod/Config.in @@ -0,0 +1,32 @@ +config BR2_PACKAGE_FORTUNE_MOD + bool "fortune-mod" + select BR2_PACKAGE_LIBRECODE + help + The Fortune Cookie Program from BSD games + + https://www.shlomifish.org/open-source/projects/fortune-mod/ + +if BR2_PACKAGE_FORTUNE_MOD + +config BR2_PACKAGE_FORTUNE_MOD_COOKIES + string "fortune cookie files" + help + Specify which fortunes to include in a semicolon-separated list. + If empty, include them all. + +config BR2_PACKAGE_FORTUNE_MOD_OFFENSIVE + bool "offensive cookies" + help + Enable potentially-offensive cookies. + +if BR2_PACKAGE_FORTUNE_MOD_OFFENSIVE + +config BR2_PACKAGE_FORTUNE_MOD_OCOOKIES + string "offensive fortune cookie files" + help + Specify which offensive fortunes to include in a semicolon-separated + list. If empty, include them all. + +endif + +endif diff --git a/package/fortune-mod/fortune-mod.mk b/package/fortune-mod/fortune-mod.mk new file mode 100644 index 0000000..19de1a5 --- /dev/null +++ b/package/fortune-mod/fortune-mod.mk @@ -0,0 +1,47 @@ +################################################################################ +# +# fortune-mod +# +################################################################################ + +FORTUNE_MOD_VERSION = 2.10.0 +FORTUNE_MOD_SITE = https://github.com/shlomif/fortune-mod/archive +FORTUNE_MOD_LICENSE = GPL-2.0 +FORTUNE_MOD_LICENSE_FILES = COPYING +FORTUNE_MOD_DEPENDENCIES = host-fortune-mod librecode +FORTUNE_MOD_SUBDIR = fortune-mod +FORTUNE_MOD_SUPPORTS_IN_SOURCE_BUILD = NO + +# This is a hack... fortune's build is mostly sane, but unfortunately it builds +# a helper tool, strfile, during build. CMake cannot cope with two toolchains. +# So, we build once for the host (it will install a bunch of fortunes into the +# host sysroot, but no matter). Then, to build the target, we patch the CMake +# very slightly to allow us to specify STRFILE_PATH, and give it the strfile we +# built earlier. + +FORTUNE_MOD_CONF_OPTS += \ + -DLOCALDIR=/usr/share/fortune/ \ + -DCOOKIEDIR=/usr/share/fortune/ \ + -DSTRFILE_PATH=$(HOST_DIR)/bin/strfile \ + +ifneq ($(BR2_PACKAGE_FORTUNE_MOD_COOKIES),) + # Do not double quote; Kconfig does that for us + FORTUNE_MOD_CONF_OPTS += -DCOOKIES=$(BR2_PACKAGE_FORTUNE_MOD_COOKIES) +endif + +ifeq ($(BR2_PACKAGE_FORTUNE_MOD_OFFENSIVE),y) + FORTUNE_MOD_CONF_OPTS += \ + -DLOCALODIR=/usr/share/fortune/off/ \ + -DOCOOKIEDIR=/usr/share/fortune/off/ \ + +ifneq ($(BR2_PACKAGE_FORTUNE_MOD_OCOOKIES),) + # Do not double quote; Kconfig does that for us + FORTUNE_MOD_CONF_OPTS += -DOFFENSIVE_COOKIES=$(BR2_PACKAGE_FORTUNE_MOD_OCOOKIES) +endif + +else + FORTUNE_MOD_CONF_OPTS += -DNO_OFFENSIVE=ON +endif + +$(eval $(cmake-package)) +$(eval $(host-cmake-package)) diff --git a/package/librecode/Config.in b/package/librecode/Config.in new file mode 100644 index 0000000..913a3a4 --- /dev/null +++ b/package/librecode/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_LIBRECODE + bool "librecode" + depends on BR2_USE_WCHAR + select BR2_PACKAGE_LIBICONV + help + Converts files between various character sets and usages + + https://github.com/rrthomas/recode diff --git a/package/librecode/librecode.mk b/package/librecode/librecode.mk new file mode 100644 index 0000000..dda55c1 --- /dev/null +++ b/package/librecode/librecode.mk @@ -0,0 +1,15 @@ +################################################################################ +# +# librecode +# +################################################################################ + +LIBRECODE_VERSION = 3.7.1 +LIBRECODE_SITE = https://github.com/rrthomas/recode/releases/download/v$(LIBRECODE_VERSION) +LIBRECODE_SOURCE = recode-$(LIBRECODE_VERSION).tar.gz +LIBRECODE_LICENSE = LGPL-3.0 +LIBRECODE_LICENSE_FILES = COPYING +LIBRECODE_INSTALL_STAGING = YES +LIBRECODE_DEPENDENCIES = libiconv + +$(eval $(autotools-package))