diff options
Diffstat (limited to 'gnu/packages/patches')
28 files changed, 1148 insertions, 1371 deletions
diff --git a/gnu/packages/patches/benchmark-unbundle-googletest.patch b/gnu/packages/patches/benchmark-unbundle-googletest.patch deleted file mode 100644 index 4dce8f59f1..0000000000 --- a/gnu/packages/patches/benchmark-unbundle-googletest.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 5eb306618196ea78b8c9390e22ea2edce20760fe Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= <boskovits@gmail.com> -Date: Fri, 14 Jun 2019 22:15:49 +0200 -Subject: [PATCH] Remove googletest lookup from build system. - ---- - cmake/GoogleTest.cmake | 18 +++++++++--------- - cmake/GoogleTest.cmake.in | 12 ++++++------ - 2 files changed, 15 insertions(+), 15 deletions(-) - -diff --git a/cmake/GoogleTest.cmake b/cmake/GoogleTest.cmake -index fb7c6be..a6c473b 100644 ---- a/cmake/GoogleTest.cmake -+++ b/cmake/GoogleTest.cmake -@@ -27,15 +27,15 @@ endif() - # settings on Windows - set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - --include(${GOOGLETEST_PREFIX}/googletest-paths.cmake) -+#include(${GOOGLETEST_PREFIX}/googletest-paths.cmake) - - # Add googletest directly to our build. This defines - # the gtest and gtest_main targets. --add_subdirectory(${GOOGLETEST_SOURCE_DIR} -- ${GOOGLETEST_BINARY_DIR} -- EXCLUDE_FROM_ALL) -- --set_target_properties(gtest PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest,INTERFACE_INCLUDE_DIRECTORIES>) --set_target_properties(gtest_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest_main,INTERFACE_INCLUDE_DIRECTORIES>) --set_target_properties(gmock PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock,INTERFACE_INCLUDE_DIRECTORIES>) --set_target_properties(gmock_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock_main,INTERFACE_INCLUDE_DIRECTORIES>) -+#add_subdirectory(${GOOGLETEST_SOURCE_DIR} -+# ${GOOGLETEST_BINARY_DIR} -+# EXCLUDE_FROM_ALL) -+ -+#set_target_properties(gtest PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest,INTERFACE_INCLUDE_DIRECTORIES>) -+#set_target_properties(gtest_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest_main,INTERFACE_INCLUDE_DIRECTORIES>) -+#set_target_properties(gmock PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock,INTERFACE_INCLUDE_DIRECTORIES>) -+#set_target_properties(gmock_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock_main,INTERFACE_INCLUDE_DIRECTORIES>) -diff --git a/cmake/GoogleTest.cmake.in b/cmake/GoogleTest.cmake.in -index 28818ee..13b0888 100644 ---- a/cmake/GoogleTest.cmake.in -+++ b/cmake/GoogleTest.cmake.in -@@ -31,7 +31,7 @@ if(EXISTS "${GOOGLETEST_PATH}" AND IS_DIRECTORY "${GOOGLETEST_PATH}" - ) - else() - if(NOT ALLOW_DOWNLOADING_GOOGLETEST) -- message(SEND_ERROR "Did not find Google Test sources! Either pass correct path in GOOGLETEST_PATH, or enable ALLOW_DOWNLOADING_GOOGLETEST, or disable BENCHMARK_ENABLE_GTEST_TESTS / BENCHMARK_ENABLE_TESTING.") -+ message(WARNING "Did not find Google Test sources! Either pass correct path in GOOGLETEST_PATH, or enable ALLOW_DOWNLOADING_GOOGLETEST, or disable BENCHMARK_ENABLE_GTEST_TESTS / BENCHMARK_ENABLE_TESTING.") - else() - message(WARNING "Did not find Google Test sources! Fetching from web...") - ExternalProject_Add( -@@ -51,8 +51,8 @@ else() - endif() - endif() - --ExternalProject_Get_Property(googletest SOURCE_DIR BINARY_DIR) --file(WRITE googletest-paths.cmake --"set(GOOGLETEST_SOURCE_DIR \"${SOURCE_DIR}\") --set(GOOGLETEST_BINARY_DIR \"${BINARY_DIR}\") --") -+#ExternalProject_Get_Property(googletest SOURCE_DIR BINARY_DIR) -+#file(WRITE googletest-paths.cmake -+#"set(GOOGLETEST_SOURCE_DIR \"${SOURCE_DIR}\") -+#set(GOOGLETEST_BINARY_DIR \"${BINARY_DIR}\") -+#") --- -2.22.0 - diff --git a/gnu/packages/patches/bsd-games-2.17-64bit.patch b/gnu/packages/patches/bsd-games-2.17-64bit.patch new file mode 100644 index 0000000000..e286c1c531 --- /dev/null +++ b/gnu/packages/patches/bsd-games-2.17-64bit.patch @@ -0,0 +1,43 @@ +David Leverton writes about adventure/crc.c: + +The 'adventure' game from the games-misc/bsd-games-2.13 package crashes +when saving the game on AMD64 (and probably other 64-bit systems, but I +haven't checked). Find attached to fix this. + +http://bugs.gentoo.org/show_bug.cgi?id=77032 + + +About utmpentry.c: + +the utmpx structure defines the ut_tv member a little differently on +64bit hosts so that a 32bit and 64bit structure can be shared. So the +ut_tv is a custom 32bit structure rather than the native 64bit timeval +structure. Work around is to assign the submembers instead. + +http://bugs.gentoo.org/show_bug.cgi?id=102667 + +--- bsd-games/adventure/crc.c ++++ bsd-games/adventure/crc.c +@@ -134,7 +134,8 @@ + if (step >= sizeof(crctab) / sizeof(crctab[0])) + step = 0; + } +- crcval = (crcval << 8) ^ crctab[i]; ++ /* Mask to 32 bits. */ ++ crcval = ((crcval << 8) ^ crctab[i]) & 0xffffffff; + } +- return crcval & 0xffffffff; /* Mask to 32 bits. */ ++ return crcval; + } +--- bsd-games/dm/utmpentry.c ++++ bsd-games/dm/utmpentry.c +@@ -291,7 +291,8 @@ + e->line[sizeof(e->line) - 1] = '\0'; + (void)strncpy(e->host, up->ut_host, sizeof(up->ut_host)); + e->name[sizeof(e->host) - 1] = '\0'; +- e->tv = up->ut_tv; ++ e->tv.tv_sec = up->ut_tv.tv_sec; ++ e->tv.tv_usec = up->ut_tv.tv_usec; + adjust_size(e); + } + #endif diff --git a/gnu/packages/patches/bsd-games-add-configure-config.patch b/gnu/packages/patches/bsd-games-add-configure-config.patch new file mode 100644 index 0000000000..d8636addb6 --- /dev/null +++ b/gnu/packages/patches/bsd-games-add-configure-config.patch @@ -0,0 +1,22 @@ +Remove a few 'setenv's from the definition. + +diff -Naur bsd-games-2.17/config.params bsd-games-patch/config.params +--- bsd-games-2.17/config.params 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/config.params 2020-04-22 20:49:40.809695248 +0700 +@@ -0,0 +1,16 @@ ++bsd_games_cfg_do_chown=n ++bsd_games_cfg_non_interactive=y ++ ++# Fix some man-pages: cfscores, morse, ppt, rot13, snscore, teachgammon. ++bsd_games_cfg_use_dot_so=syml ++ ++# Don't build some games: ++# Countmail require some BSD-package called `from`. ++# DM is a toy to restrict access to bsd-games. ++# Fortune seems to be already packaged (fortune-mod). ++# Wargames isn't convenient as a game launcher. ++bsd_games_cfg_no_build_dirs="countmail dm fortune wargames" ++ ++# Those are substitute*'d with GNU miscfiles. ++bsd_games_cfg_hangman_wordsfile=WORD_LIST ++bsd_games_cfg_dictionary_src=WORD_LIST diff --git a/gnu/packages/patches/bsd-games-add-wrapper.patch b/gnu/packages/patches/bsd-games-add-wrapper.patch new file mode 100644 index 0000000000..ad3b1a9860 --- /dev/null +++ b/gnu/packages/patches/bsd-games-add-wrapper.patch @@ -0,0 +1,251 @@ +As we cannot install outside the Store, and those games do not create the +needed writable files on their own, we need a wrapper script. + +diff -Naur bsd-games-2.17/atc/Makefrag bsd-games-patch/atc/Makefrag +--- bsd-games-2.17/atc/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/atc/Makefrag 2020-04-23 20:24:04.446176222 +0700 +@@ -47,7 +47,8 @@ + mv atc/lex.yy.c $@ + + atc_install: atc_all +- $(INSTALL_SCORE_GAME) atc/atc $(INSTALL_PREFIX)$(GAMESDIR)/atc ++ $(INSTALL_SCORE_GAME) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/atc ++ $(INSTALL_SCORE_GAME) atc/atc $(INSTALL_PREFIX)$(GAMESDIR)/.atc-real + $(HIDE_GAME) atc + $(INSTALL_SCORE_FILE) $(ATC_SCOREFILE) + $(INSTALL_MANUAL) atc/atc.6 +diff -Naur bsd-games-2.17/battlestar/Makefrag bsd-games-patch/battlestar/Makefrag +--- bsd-games-2.17/battlestar/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/battlestar/Makefrag 2020-04-23 20:24:04.482175771 +0700 +@@ -32,7 +32,8 @@ + battlestar_all: battlestar/battlestar battlestar/battlestar.6 + + battlestar_install: battlestar_all +- $(INSTALL_SCORE_GAME) battlestar/battlestar $(INSTALL_PREFIX)$(GAMESDIR)/battlestar ++ $(INSTALL_SCORE_GAME) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/battlestar ++ $(INSTALL_SCORE_GAME) battlestar/battlestar $(INSTALL_PREFIX)$(GAMESDIR)/.battlestar-real + $(HIDE_GAME) battlestar + $(INSTALL_MANUAL) battlestar/battlestar.6 + $(INSTALL_SCORE_FILE) $(BATTLESTAR_SCOREFILE) +diff -Naur bsd-games-2.17/canfield/canfield/Makefrag bsd-games-patch/canfield/canfield/Makefrag +--- bsd-games-2.17/canfield/canfield/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/canfield/canfield/Makefrag 2020-04-23 20:24:04.522175270 +0700 +@@ -31,7 +31,8 @@ + canfield_canfield_all: canfield/canfield/canfield canfield/canfield/canfield.6 + + canfield_canfield_install: canfield_canfield_all +- $(INSTALL_SCORE_GAME) canfield/canfield/canfield $(INSTALL_PREFIX)$(GAMESDIR)/canfield ++ $(INSTALL_SCORE_GAME) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/canfield ++ $(INSTALL_SCORE_GAME) canfield/canfield/canfield $(INSTALL_PREFIX)$(GAMESDIR)/.canfield-real + $(HIDE_GAME) canfield + $(INSTALL_MANUAL) canfield/canfield/canfield.6 + $(INSTALL_SCORE_FILE) $(CANFIELD_SCOREFILE) +diff -ur bsd-games-2.17.orig/canfield/cfscores/Makefrag bsd-games-2.17/canfield/cfscores/Makefrag +--- bsd-games-2.17.orig/canfield/cfscores/Makefrag 1970-01-01 07:00:01.000000000 +0700 ++++ bsd-games-2.17/canfield/cfscores/Makefrag 2020-08-06 12:20:10.592076477 +0700 +@@ -32,6 +32,7 @@ + canfield_cfscores_all: canfield/cfscores/cfscores + + canfield_cfscores_install: canfield_cfscores_all +- $(INSTALL_BINARY) canfield/cfscores/cfscores $(INSTALL_PREFIX)$(GAMESDIR)/cfscores ++ $(INSTALL_BINARY) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/cfscores ++ $(INSTALL_BINARY) canfield/cfscores/cfscores $(INSTALL_PREFIX)$(GAMESDIR)/.cfscores-real + $(HIDE_GAME) cfscores + $(INSTALL_MANUAL) canfield.6 cfscores.6 +diff -Naur bsd-games-2.17/cribbage/Makefrag bsd-games-patch/cribbage/Makefrag +--- bsd-games-2.17/cribbage/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/cribbage/Makefrag 2020-04-23 20:24:04.534175120 +0700 +@@ -31,7 +31,8 @@ + cribbage_all: cribbage/cribbage cribbage/cribbage.n cribbage/cribbage.6 + + cribbage_install: cribbage_all +- $(INSTALL_SCORE_GAME) cribbage/cribbage $(INSTALL_PREFIX)$(GAMESDIR)/cribbage ++ $(INSTALL_SCORE_GAME) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/cribbage ++ $(INSTALL_SCORE_GAME) cribbage/cribbage $(INSTALL_PREFIX)$(GAMESDIR)/.cribbage-real + $(HIDE_GAME) cribbage + $(INSTALL_DATA) cribbage/cribbage.n $(INSTALL_PREFIX)$(CRIBBAGE_INSTRFILE) + $(INSTALL_SCORE_FILE) $(CRIBBAGE_SCOREFILE) +diff -Naur bsd-games-2.17/hack/Makefrag bsd-games-patch/hack/Makefrag +--- bsd-games-2.17/hack/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/hack/Makefrag 2020-04-23 20:24:04.590174419 +0700 +@@ -53,7 +53,8 @@ + hack/hack.zap.d hack/rnd.d: hack/hack.onames.h + + hack_install: hack_all +- $(INSTALL_SCORE_GAME) hack/hack $(INSTALL_PREFIX)$(GAMESDIR)/hack ++ $(INSTALL_SCORE_GAME) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/hack ++ $(INSTALL_SCORE_GAME) hack/hack $(INSTALL_PREFIX)$(GAMESDIR)/.hack-real + $(HIDE_GAME) hack + $(INSTALL_HACK_DIR) $(INSTALL_PREFIX)$(HACK_DIR) + set -e; for f in data help hh rumors; do $(INSTALL_DATA) hack/$$f $(INSTALL_PREFIX)$(HACK_DIR)/$$f; done +diff -Naur bsd-games-2.17/phantasia/Makefrag bsd-games-patch/phantasia/Makefrag +--- bsd-games-2.17/phantasia/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/phantasia/Makefrag 2020-04-23 20:24:04.650173667 +0700 +@@ -38,7 +38,8 @@ + touch phantasia/scorefiles.stamp + + phantasia_install: phantasia_all +- $(INSTALL_SCORE_GAME) phantasia/phantasia $(INSTALL_PREFIX)$(GAMESDIR)/phantasia ++ $(INSTALL_SCORE_GAME) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/phantasia ++ $(INSTALL_SCORE_GAME) phantasia/phantasia $(INSTALL_PREFIX)$(GAMESDIR)/.phantasia-real + $(HIDE_GAME) phantasia + (set -e; for f in $(phantasia_VFILES1); do \ + cp phantasia/$$f $(INSTALL_PREFIX)$(PHANTASIA_DIR)/$$f; \ +diff -Naur bsd-games-2.17/robots/Makefrag bsd-games-patch/robots/Makefrag +--- bsd-games-2.17/robots/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/robots/Makefrag 2020-04-23 20:24:04.702173016 +0700 +@@ -32,7 +32,8 @@ + robots_all: robots/robots robots/robots.6 + + robots_install: robots_all +- $(INSTALL_SCORE_GAME) robots/robots $(INSTALL_PREFIX)$(GAMESDIR)/robots ++ $(INSTALL_SCORE_GAME) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/robots ++ $(INSTALL_SCORE_GAME) robots/robots $(INSTALL_PREFIX)$(GAMESDIR)/.robots-real + $(HIDE_GAME) robots + $(INSTALL_SCORE_FILE) $(ROBOTS_SCOREFILE) + $(INSTALL_MANUAL) robots/robots.6 +diff -Naur bsd-games-2.17/sail/Makefrag bsd-games-patch/sail/Makefrag +--- bsd-games-2.17/sail/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/sail/Makefrag 2020-04-23 20:24:04.710172917 +0700 +@@ -31,7 +31,8 @@ + sail_all: sail/sail sail/sail.6 + + sail_install: sail_all +- $(INSTALL_SCORE_GAME) sail/sail $(INSTALL_PREFIX)$(GAMESDIR)/sail ++ $(INSTALL_SCORE_GAME) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/sail ++ $(INSTALL_SCORE_GAME) sail/sail $(INSTALL_PREFIX)$(GAMESDIR)/.sail-real + $(HIDE_GAME) sail + $(INSTALL_SCORE_FILE) $(SAIL_SCOREFILE) + $(INSTALL_SAIL_DIR) $(INSTALL_PREFIX)$(SAIL_DIR) +diff -Naur bsd-games-2.17/snake/snake/Makefrag bsd-games-patch/snake/snake/Makefrag +--- bsd-games-2.17/snake/snake/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/snake/snake/Makefrag 2020-04-23 20:24:04.722172766 +0700 +@@ -31,7 +31,8 @@ + snake_snake_all: snake/snake/snake snake/snake/snake.6 + + snake_snake_install: snake_snake_all +- $(INSTALL_SCORE_GAME) snake/snake/snake $(INSTALL_PREFIX)$(GAMESDIR)/snake ++ $(INSTALL_SCORE_GAME) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/snake ++ $(INSTALL_SCORE_GAME) snake/snake/snake $(INSTALL_PREFIX)$(GAMESDIR)/.snake-real + $(HIDE_GAME) snake + $(INSTALL_SCORE_FILE) $(SNAKE_SCOREFILE) + $(INSTALL_SCORE_FILE) $(SNAKE_RAWSCOREFILE) +--- bsd-games-2.17.orig/snake/snscore/Makefrag 1970-01-01 07:00:01.000000000 +0700 ++++ bsd-games-2.17/snake/snscore/Makefrag 2020-08-06 12:33:09.636089394 +0700 +@@ -32,6 +32,7 @@ + snake_snscore_all: snake/snscore/snscore + + snake_snscore_install: snake_snscore_all +- $(INSTALL_BINARY) snake/snscore/snscore $(INSTALL_PREFIX)$(GAMESDIR)/snscore ++ $(INSTALL_BINARY) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/snscore ++ $(INSTALL_BINARY) snake/snscore/snscore $(INSTALL_PREFIX)$(GAMESDIR)/.snscore-real + $(HIDE_GAME) snscore + $(INSTALL_MANUAL) snake.6 snscore.6 +diff -Naur bsd-games-2.17/tetris/Makefrag bsd-games-patch/tetris/Makefrag +--- bsd-games-2.17/tetris/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/tetris/Makefrag 2020-04-23 20:24:04.734172616 +0700 +@@ -32,7 +32,8 @@ + tetris_all: tetris/tetris tetris/tetris.6 + + tetris_install: tetris_all +- $(INSTALL_SCORE_GAME) tetris/tetris $(INSTALL_PREFIX)$(GAMESDIR)/tetris-bsd ++ $(INSTALL_SCORE_GAME) wrapper $(INSTALL_PREFIX)$(GAMESDIR)/tetris-bsd ++ $(INSTALL_SCORE_GAME) tetris/tetris $(INSTALL_PREFIX)$(GAMESDIR)/.tetris-bsd-real + $(HIDE_GAME) tetris-bsd + $(INSTALL_SCORE_FILE) $(TETRIS_SCOREFILE) + ln -f tetris/tetris.6 tetris/tetris-bsd.6 +diff -Naur bsd-games-2.17/wrapper bsd-games-patch/wrapper +--- bsd-games-2.17/wrapper 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/wrapper 2020-04-23 20:24:37.153766719 +0700 +@@ -0,0 +1,91 @@ ++#!/bin/sh ++# This file works around limitations of our read-only Store. ++ ++set -e ++ ++check_empty_files () { ++ # those start empty ++ for f in ${@} ++ do ++ if [[ ! -f ${f} ]] ++ then ++ touch ${f} ++ echo "$(pwd)/${f} RESTORED" ++ fi ++ done ++} ++check_data_files () { ++ # those start with some initial data ++ for f in ${@} ++ do ++ if [[ ! -f ${f} ]] ++ then ++ cp STATIC_DATA/${game}/${f} ${f} ++ chmod u+w ${f} ++ echo "$(pwd)/${f} RESTORED" ++ fi ++ done ++} ++visit_dir () { ++ mkdir -p ${1} ++ cd ${1} ++} ++exit_with_variable_error () { ++ variables="${1}${2:+ or ${2}}" ++ echo "Guix: Please set up the ${variables} variable." ++ echo "Examples:" ++ echo " export ${1}=/var/multiplayer" ++ echo " export ${2:-${1}}=~/.local/share/bsd-games" ++ echo "You can place this in ~/.bashrc or a similar file for Your shell." ++ echo "For multiplayer this directory should be writable for all players." ++ exit 1 ++} ++ ++game=$(basename $0) ++if [[ ${game} == "hack" ]] ++then ++ if [[ -n ${HACKDIR} ]]; then visit_dir "${HACKDIR}" ++ elif [[ -n ${BSD_GAMES_DIR} ]]; then visit_dir "${BSD_GAMES_DIR}/hack" ++ else exit_with_variable_error "HACKDIR" "BSD_GAMES_DIR" ++ fi ++else ++ if [[ -n ${BSD_GAMES_DIR} ]]; then visit_dir "${BSD_GAMES_DIR}" ++ else exit_with_variable_error "BSD_GAMES_DIR" ++ fi ++fi ++ ++case ${game} in ++ ### Games with score-files ++ atc) ++ check_empty_files "atc_score";; ++ battlestar) ++ check_empty_files "battlestar.log";; ++ canfield) ++ check_empty_files "cfscores";; ++ cribbage) ++ check_empty_files "criblog";; ++ robots) ++ check_empty_files "robots_roll";; ++ snake) ++ check_empty_files "snakerawscores" "snake.log";; ++ tetris) ++ check_empty_files "tetris-bsd.scores";; ++ ### Games with saved state ++ hack) ++ check_empty_files "record" "perm" ++ check_data_files "data" "help" "hh" "rumors" ++ visit_dir "save" ++ cd ../../;; ++ phantasia) ++ visit_dir "phantasia" ++ check_empty_files "characs" "gold" "lastdead"\ ++ "mess" "motd" "scoreboard" "void" ++ check_data_files "monsters" ++ cd ../;; ++ sail) ++ visit_dir "sail" ++ check_empty_files "log" "syncfile" ++ cd ../;; ++esac ++ ++exec .${game}-real ${@} diff --git a/gnu/packages/patches/bsd-games-bad-ntohl-cast.patch b/gnu/packages/patches/bsd-games-bad-ntohl-cast.patch new file mode 100644 index 0000000000..caadfa5054 --- /dev/null +++ b/gnu/packages/patches/bsd-games-bad-ntohl-cast.patch @@ -0,0 +1,22 @@ +diff --git a/hunt/hunt/playit.c b/hunt/hunt/playit.c +index 9acf86e..881a4e7 100644 +--- a/hunt/hunt/playit.c ++++ b/hunt/hunt/playit.c +@@ -114,7 +114,7 @@ playit() + bad_con(); + /* NOTREACHED */ + } +- if (ntohl(version) != (unsigned long)HUNT_VERSION) { ++ if (ntohl(version) != (uint32_t)HUNT_VERSION) { + bad_ver(); + /* NOTREACHED */ + } +@@ -649,7 +649,7 @@ do_message() + bad_con(); + /* NOTREACHED */ + } +- if (ntohl(version) != (unsigned long)HUNT_VERSION) { ++ if (ntohl(version) != (uint32_t)HUNT_VERSION) { + bad_ver(); + /* NOTREACHED */ + } diff --git a/gnu/packages/patches/bsd-games-dont-install-empty-files.patch b/gnu/packages/patches/bsd-games-dont-install-empty-files.patch new file mode 100644 index 0000000000..4ee0578177 --- /dev/null +++ b/gnu/packages/patches/bsd-games-dont-install-empty-files.patch @@ -0,0 +1,87 @@ +Those games rely on user to provide the files to write scores in. +Those score-files are initially empty. Anyway, the Store is read-only. +So we do not install those empty files. + +diff -Naur bsd-games-2.17/install-score.in bsd-games-patch/install-score.in +--- bsd-games-2.17/install-score.in 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/install-score.in 2020-04-22 21:41:47.810544804 +0700 +@@ -1,45 +0,0 @@ +-# install-score.in - install a score file +-# +-# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers. +-# All rights reserved. +-# +-# Redistribution and use in source and binary forms, with or without +-# modification, are permitted provided that the following conditions +-# are met: +-# 1. Redistributions of source code must retain the above copyright +-# notice, this list of conditions and the following disclaimer. +-# 2. Redistributions in binary form must reproduce the above copyright +-# notice, this list of conditions and the following disclaimer in the +-# documentation and/or other materials provided with the distribution. +-# 3. The name of the author may not be used to endorse or promote products +-# derived from this software without specific prior written permission. +-# +-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-# SUCH DAMAGE. +- +-set -e +- +-if [ "$1" = "-p" ]; then +- scorefile="@install_prefix@$2" +- perms=@vardata_perms_priv@ +-else +- scorefile="@install_prefix@$1" +- perms=@vardata_perms@ +-fi +- +-mkdir -p "$(dirname "$scorefile")" +- +-test -e "$scorefile" || touch "$scorefile" +-if [ @do_chown@ = y ]; then +- chown @vardata_owner@:@vardata_group@ "$scorefile" +-fi +-chmod "$perms" "$scorefile" +diff -Naur bsd-games-2.17/phantasia/Makefrag bsd-games-patch/phantasia/Makefrag +--- bsd-games-2.17/phantasia/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/phantasia/Makefrag 2020-04-22 21:26:00.162409464 +0700 +@@ -27,9 +27,8 @@ + # SUCH DAMAGE. + + phantasia_DIRS := $(GAMESDIR) $(MAN6DIR) $(PHANTASIA_DIR) +-phantasia_VFILES1 := gold lastdead mess monsters motd void +-phantasia_VFILES2 := scoreboard characs +-phantasia_CLEANFILES := $(phantasia_VFILES1) $(phantasia_VFILES2) scorefiles.stamp ++phantasia_VFILES1 := monsters ++phantasia_CLEANFILES := $(phantasia_VFILES1) scorefiles.stamp + + phantasia_all: phantasia/phantasia phantasia/phantasia.6 phantasia/scorefiles.stamp + +@@ -43,9 +42,4 @@ + (set -e; for f in $(phantasia_VFILES1); do \ + cp phantasia/$$f $(INSTALL_PREFIX)$(PHANTASIA_DIR)/$$f; \ + $(INSTALL_SCORE_FILE) $(PHANTASIA_DIR)/$$f; done) +- (set -e; for f in $(phantasia_VFILES2); do \ +- if [ ! -e $(PHANTASIA_DIR)/$$f ]; then \ +- cp phantasia/$$f $(INSTALL_PREFIX)$(PHANTASIA_DIR)/$$f; fi; done; \ +- $(INSTALL_SCORE_FILE) $(PHANTASIA_DIR)/scoreboard; \ +- $(INSTALL_SCORE_FILE) -p $(PHANTASIA_DIR)/characs) + $(INSTALL_MANUAL) phantasia/phantasia.6 +diff -Naur bsd-games-2.17/sail/Makefrag bsd-games-patch/sail/Makefrag +--- bsd-games-2.17/sail/Makefrag 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/sail/Makefrag 2020-04-22 21:26:48.701801676 +0700 +@@ -34,5 +34,4 @@ + $(INSTALL_SCORE_GAME) sail/sail $(INSTALL_PREFIX)$(GAMESDIR)/sail + $(HIDE_GAME) sail + $(INSTALL_SCORE_FILE) $(SAIL_SCOREFILE) +- $(INSTALL_SAIL_DIR) $(INSTALL_PREFIX)$(SAIL_DIR) + $(INSTALL_MANUAL) sail/sail.6 diff --git a/gnu/packages/patches/bsd-games-gamescreen.h.patch b/gnu/packages/patches/bsd-games-gamescreen.h.patch new file mode 100644 index 0000000000..d3c6b4ae50 --- /dev/null +++ b/gnu/packages/patches/bsd-games-gamescreen.h.patch @@ -0,0 +1,14 @@ +--- a/dab/gamescreen.h 2004-01-02 23:34:51.000000000 +0530 ++++ b/dab/gamescreen.h 2008-07-31 23:45:19.000000000 +0530 +@@ -70,9 +70,9 @@ + virtual void redraw(void) = 0; // Refresh + virtual int getinput(void) = 0; // Get user input + virtual void bell(void) = 0; // Beep +- virtual void score(size_t p, const PLAYER& p) = 0; // Post current score +- virtual void games(size_t p, const PLAYER& p) = 0; // Post games won +- virtual void total(size_t p, const PLAYER& p) = 0; // Post total score ++ virtual void score(size_t, const PLAYER&) = 0; // Post current score ++ virtual void games(size_t, const PLAYER&) = 0; // Post games won ++ virtual void total(size_t, const PLAYER&) = 0; // Post total score + virtual void ties(const PLAYER& p) = 0; // Post tie games + }; diff --git a/gnu/packages/patches/bsd-games-getline.patch b/gnu/packages/patches/bsd-games-getline.patch new file mode 100644 index 0000000000..d7c0b4034d --- /dev/null +++ b/gnu/packages/patches/bsd-games-getline.patch @@ -0,0 +1,194 @@ +diff -Naur bsd-games-2.17/boggle/boggle/bog.c bsd-games-2.17.1/boggle/boggle/bog.c +--- bsd-games-2.17/boggle/boggle/bog.c 2004-12-07 07:34:21.000000000 -0600 ++++ bsd-games-2.17.1/boggle/boggle/bog.c 2010-05-22 10:51:23.000000000 -0500 +@@ -336,7 +336,7 @@ + } + + while (1) { +- if (getline(buf) == NULL) { ++ if (boggle_getline(buf) == NULL) { + if (feof(stdin)) + clearerr(stdin); + break; +diff -Naur bsd-games-2.17/boggle/boggle/extern.h bsd-games-2.17.1/boggle/boggle/extern.h +--- bsd-games-2.17/boggle/boggle/extern.h 2004-01-27 14:52:07.000000000 -0600 ++++ bsd-games-2.17.1/boggle/boggle/extern.h 2010-05-22 10:51:23.000000000 -0500 +@@ -43,7 +43,7 @@ + long dictseek(FILE *, long, int); + void findword(void); + void flushin(FILE *); +-char *getline(char *); ++char *boggle_getline(char *); + void getword(char *); + int help(void); + int inputch(void); +diff -Naur bsd-games-2.17/boggle/boggle/mach.c bsd-games-2.17.1/boggle/boggle/mach.c +--- bsd-games-2.17/boggle/boggle/mach.c 2004-12-07 07:34:21.000000000 -0600 ++++ bsd-games-2.17.1/boggle/boggle/mach.c 2010-05-22 10:51:23.000000000 -0500 +@@ -168,7 +168,7 @@ + * - doesn't accept words longer than MAXWORDLEN or containing caps + */ + char * +-getline(q) ++boggle_getline(q) + char *q; + { + int ch, done; +diff -Naur bsd-games-2.17/cribbage/cribbage.h bsd-games-2.17.1/cribbage/cribbage.h +--- bsd-games-2.17/cribbage/cribbage.h 2004-02-08 16:29:14.000000000 -0600 ++++ bsd-games-2.17.1/cribbage/cribbage.h 2010-05-22 10:51:23.000000000 -0500 +@@ -77,7 +77,7 @@ + int fifteens(const CARD [], int); + void game(void); + void gamescore(void); +-char *getline(void); ++char *cribbage_getline(void); + int getuchar(void); + int incard(CARD *); + int infrom(const CARD [], int, const char *); +diff -Naur bsd-games-2.17/cribbage/crib.c bsd-games-2.17.1/cribbage/crib.c +--- bsd-games-2.17/cribbage/crib.c 2004-01-27 14:52:07.000000000 -0600 ++++ bsd-games-2.17.1/cribbage/crib.c 2010-05-22 10:51:23.000000000 -0500 +@@ -221,7 +221,7 @@ + if (!rflag) { /* player cuts deck */ + msg(quiet ? "Cut for crib? " : + "Cut to see whose crib it is -- low card wins? "); +- getline(); ++ cribbage_getline(); + } + i = (rand() >> 4) % CARDS; /* random cut */ + do { /* comp cuts deck */ +@@ -397,7 +397,7 @@ + if (!rflag) { /* random cut */ + msg(quiet ? "Cut the deck? " : + "How many cards down do you wish to cut the deck? "); +- getline(); ++ cribbage_getline(); + } + i = (rand() >> 4) % (CARDS - pos); + turnover = deck[i + pos]; +diff -Naur bsd-games-2.17/cribbage/io.c bsd-games-2.17.1/cribbage/io.c +--- bsd-games-2.17/cribbage/io.c 2004-12-07 07:34:21.000000000 -0600 ++++ bsd-games-2.17.1/cribbage/io.c 2010-05-22 10:51:23.000000000 -0500 +@@ -245,7 +245,7 @@ + + retval = FALSE; + rnk = sut = EMPTY; +- if (!(line = getline())) ++ if (!(line = cribbage_getline())) + goto gotit; + p = p1 = line; + while (*p1 != ' ' && *p1 != '\0') +@@ -346,7 +346,7 @@ + + for (sum = 0;;) { + msg(prompt); +- if (!(p = getline()) || *p == '\0') { ++ if (!(p = cribbage_getline()) || *p == '\0') { + msg(quiet ? "Not a number" : + "That doesn't look like a number"); + continue; +@@ -528,12 +528,12 @@ + } + + /* +- * getline: ++ * cribbage_getline: + * Reads the next line up to '\n' or EOF. Multiple spaces are + * compressed to one space; a space is inserted before a ',' + */ + char * +-getline() ++cribbage_getline() + { + char *sp; + int c, oy, ox; +diff -Naur bsd-games-2.17/gomoku/bdisp.c bsd-games-2.17.1/gomoku/bdisp.c +--- bsd-games-2.17/gomoku/bdisp.c 2003-12-16 20:47:37.000000000 -0600 ++++ bsd-games-2.17.1/gomoku/bdisp.c 2010-05-22 10:51:23.000000000 -0500 +@@ -241,7 +241,7 @@ + } + + int +-getline(buf, size) ++gomoku_getline(buf, size) + char *buf; + int size; + { +diff -Naur bsd-games-2.17/gomoku/gomoku.h bsd-games-2.17.1/gomoku/gomoku.h +--- bsd-games-2.17/gomoku/gomoku.h 2004-01-27 14:52:07.000000000 -0600 ++++ bsd-games-2.17.1/gomoku/gomoku.h 2010-05-22 10:51:23.000000000 -0500 +@@ -263,7 +263,7 @@ + + void bdinit(struct spotstr *); + void init_overlap(void); +-int getline(char *, int); ++int gomoku_getline(char *, int); + void ask(const char *); + void dislog(const char *); + void bdump(FILE *); +diff -Naur bsd-games-2.17/gomoku/main.c bsd-games-2.17.1/gomoku/main.c +--- bsd-games-2.17/gomoku/main.c 2004-01-27 14:52:07.000000000 -0600 ++++ bsd-games-2.17.1/gomoku/main.c 2010-05-22 10:51:23.000000000 -0500 +@@ -155,7 +155,7 @@ + if (inputfp == NULL && test == 0) { + for (;;) { + ask("black or white? "); +- getline(buf, sizeof(buf)); ++ gomoku_getline(buf, sizeof(buf)); + if (buf[0] == 'b' || buf[0] == 'B') { + color = BLACK; + break; +@@ -172,7 +172,7 @@ + } + } else { + setbuf(stdout, 0); +- getline(buf, sizeof(buf)); ++ gomoku_getline(buf, sizeof(buf)); + if (strcmp(buf, "black") == 0) + color = BLACK; + else if (strcmp(buf, "white") == 0) +@@ -244,7 +244,7 @@ + getinput: + if (interactive) + ask("move? "); +- if (!getline(buf, sizeof(buf))) { ++ if (!gomoku_getline(buf, sizeof(buf))) { + curmove = RESIGN; + break; + } +@@ -256,7 +256,7 @@ + FILE *fp; + + ask("save file name? "); +- (void)getline(buf, sizeof(buf)); ++ (void)gomoku_getline(buf, sizeof(buf)); + if ((fp = fopen(buf, "w")) == NULL) { + glog("cannot create save file"); + goto getinput; +@@ -309,14 +309,14 @@ + if (i != RESIGN) { + replay: + ask("replay? "); +- if (getline(buf, sizeof(buf)) && ++ if (gomoku_getline(buf, sizeof(buf)) && + (buf[0] == 'y' || buf[0] == 'Y')) + goto again; + if (strcmp(buf, "save") == 0) { + FILE *fp; + + ask("save file name? "); +- (void)getline(buf, sizeof(buf)); ++ (void)gomoku_getline(buf, sizeof(buf)); + if ((fp = fopen(buf, "w")) == NULL) { + glog("cannot create save file"); + goto replay; +@@ -367,7 +367,7 @@ + quit(); + top: + ask("cmd? "); +- if (!getline(fmtbuf, sizeof(fmtbuf))) ++ if (!gomoku_getline(fmtbuf, sizeof(fmtbuf))) + quit(); + switch (*fmtbuf) { + case '\0': diff --git a/gnu/packages/patches/bsd-games-null-check.patch b/gnu/packages/patches/bsd-games-null-check.patch new file mode 100644 index 0000000000..ba977c95bf --- /dev/null +++ b/gnu/packages/patches/bsd-games-null-check.patch @@ -0,0 +1,24 @@ +diff --git a/hunt/hunt/hunt.c b/hunt/hunt/hunt.c +index 11f4c44..28321bc 100644 +--- a/hunt/hunt/hunt.c ++++ b/hunt/hunt/hunt.c +@@ -394,7 +394,8 @@ broadcast_vec(s, vector) + + vec_cnt = 0; + for (ip = ifp; ip; ip = ip->ifa_next) +- if ((ip->ifa_addr->sa_family == AF_INET) && ++ if (ip->ifa_addr && ++ (ip->ifa_addr->sa_family == AF_INET) && + (ip->ifa_flags & IFF_BROADCAST)) + vec_cnt++; + +@@ -405,7 +406,8 @@ broadcast_vec(s, vector) + + vec_cnt = 0; + for (ip = ifp; ip; ip = ip->ifa_next) +- if ((ip->ifa_addr->sa_family == AF_INET) && ++ if (ip->ifa_addr && ++ (ip->ifa_addr->sa_family == AF_INET) && + (ip->ifa_flags & IFF_BROADCAST)) + memcpy(&(*vector)[vec_cnt++], ip->ifa_broadaddr, + sizeof(struct sockaddr_in)); diff --git a/gnu/packages/patches/bsd-games-number.c-and-test.patch b/gnu/packages/patches/bsd-games-number.c-and-test.patch new file mode 100644 index 0000000000..1cf5ba2822 --- /dev/null +++ b/gnu/packages/patches/bsd-games-number.c-and-test.patch @@ -0,0 +1,183 @@ +Arch's patch, and a fix for the "number" game's test. +--- bsdgames-2.17.orig/number/number.c ++++ bsdgames-2.17/number/number.c +@@ -78,9 +78,9 @@ + + void convert(char *); + int main(int, char *[]); +-int number(const char *, int); +-void pfract(int); +-int unit(int, const char *); ++int number(const char *, int, int *); ++void pfract(int, int); ++int unit(int, const char *, int *); + void usage(void) __attribute__((__noreturn__)); + + int lflag; +@@ -131,7 +131,7 @@ + convert(line) + char *line; + { +- int flen, len, rval; ++ int flen, len, rval, singular; + char *p, *fraction; + + flen = 0; +@@ -174,7 +174,7 @@ + --len; + } + +- rval = len > 0 ? unit(len, line) : 0; ++ rval = len > 0 ? unit(len, line, &singular) : 0; + if (fraction != NULL && flen != 0) + for (p = fraction; *p != '\0'; ++p) + if (*p != '0') { +@@ -182,10 +182,10 @@ + (void)printf("%sand%s", + lflag ? " " : "", + lflag ? " " : "\n"); +- if (unit(flen, fraction)) { ++ if (unit(flen, fraction, &singular)) { + if (lflag) + (void)printf(" "); +- pfract(flen); ++ pfract(flen, singular); + rval = 1; + } + break; +@@ -197,9 +197,10 @@ + } + + int +-unit(len, p) ++unit(len, p, singular) + int len; + const char *p; ++ int *singular; + { + int off, rval; + +@@ -208,7 +209,7 @@ + if (len % 3) { + off = len % 3; + len -= off; +- if (number(p, off)) { ++ if (number(p, off, singular)) { + rval = 1; + (void)printf(" %s%s", + name3[len / 3], lflag ? " " : ".\n"); +@@ -217,14 +218,16 @@ + } + for (; len > 3; p += 3) { + len -= 3; +- if (number(p, 3)) { ++ if (number(p, 3, singular)) { + rval = 1; + (void)printf(" %s%s", + name3[len / 3], lflag ? " " : ".\n"); + } + } + } +- if (number(p, len)) { ++ if (number(p, len, singular)) { ++ if (rval) ++ *singular = 0; + if (!lflag) + (void)printf(".\n"); + rval = 1; +@@ -233,17 +236,20 @@ + } + + int +-number(p, len) ++number(p, len, singular) + const char *p; + int len; ++ int *singular; + { + int val, rval; + + rval = 0; ++ *singular = 1; + switch (len) { + case 3: + if (*p != '0') { + rval = 1; ++ *singular = 0; + (void)printf("%s hundred", name1[*p - '0']); + } + ++p; +@@ -262,33 +268,42 @@ + } + rval = 1; + } ++ if (val != 1) ++ *singular = 0; + break; + case 1: + if (*p != '0') { + rval = 1; + (void)printf("%s", name1[*p - '0']); + } ++ if (*p != '1') ++ *singular = 0; + } + return (rval); + } + + void +-pfract(len) ++pfract(len, singular) + int len; ++ int singular; + { + static const char *const pref[] = { "", "ten-", "hundred-" }; + + switch(len) { + case 1: +- (void)printf("tenths.\n"); ++ (void)printf("tenth"); + break; + case 2: +- (void)printf("hundredths.\n"); ++ (void)printf("hundredth"); + break; + default: +- (void)printf("%s%sths.\n", pref[len % 3], name3[len / 3]); ++ (void)printf("%s%sth", pref[len % 3], name3[len / 3]); + break; + } ++ if (!singular) { ++ printf("s"); ++ } ++ printf(".\n"); + } + + void +diff -Naur bsd-games-2.17/tests/number.-0.1 bsd-games-patch/tests/number.-0.1 +--- bsd-games-2.17/tests/number.-0.1 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/tests/number.-0.1 2020-04-17 15:14:27.831098084 +0700 +@@ -1,3 +1,3 @@ + minus + one. +-tenths. ++tenth. +diff -Naur bsd-games-2.17/tests/number.-0.2 bsd-games-patch/tests/number.-0.2 +--- bsd-games-2.17/tests/number.-0.2 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/tests/number.-0.2 2020-04-17 15:20:48.162336279 +0700 +@@ -0,0 +1,3 @@ ++minus ++two. ++tenths. +diff -Naur bsd-games-2.17/tests/number.test bsd-games-patch/tests/number.test +--- bsd-games-2.17/tests/number.test 1970-01-01 07:00:00.000000000 +0700 ++++ bsd-games-patch/tests/number.test 2020-04-17 15:20:22.774654155 +0700 +@@ -36,6 +36,8 @@ + testno 1 + number/number -- -0.1 >test.out 2>&1 || failtest + compare test.out tests/number.-0.1 ++number/number -- -0.2 >test.out 2>&1 || failtest ++compare test.out tests/number.-0.2 + rm -f test.out + + testno 2 diff --git a/gnu/packages/patches/bsd-games-prevent-name-collisions.patch b/gnu/packages/patches/bsd-games-prevent-name-collisions.patch new file mode 100644 index 0000000000..855ce59131 --- /dev/null +++ b/gnu/packages/patches/bsd-games-prevent-name-collisions.patch @@ -0,0 +1,13 @@ +There is already a "fish" shell. +diff -ur bsd-games-2.17.orig/fish/Makefrag bsd-games-2.17/fish/Makefrag +--- bsd-games-2.17.orig/fish/Makefrag 1970-01-01 07:00:01.000000000 +0700 ++++ bsd-games-2.17/fish/Makefrag 2020-08-06 19:18:43.204492847 +0700 +@@ -31,7 +31,7 @@ + fish_all: fish/fish fish/fish.instr fish/fish.6 + + fish_install: fish_all +- $(INSTALL_BINARY) fish/fish $(INSTALL_PREFIX)$(GAMESDIR)/fish ++ $(INSTALL_BINARY) fish/fish $(INSTALL_PREFIX)$(GAMESDIR)/fish-game + $(HIDE_GAME) fish + $(INSTALL_DATA) fish/fish.instr $(INSTALL_PREFIX)$(FISH_INSTRFILE) + $(INSTALL_MANUAL) fish/fish.6 diff --git a/gnu/packages/patches/bsd-games-stdio.h.patch b/gnu/packages/patches/bsd-games-stdio.h.patch new file mode 100644 index 0000000000..1c3a402042 --- /dev/null +++ b/gnu/packages/patches/bsd-games-stdio.h.patch @@ -0,0 +1,14 @@ +diff -ru a/include/stdio.h b/include/stdio.h +--- a/include/stdio.h 2000-08-04 10:24:39.000000000 +1000 ++++ b/include/stdio.h 2005-06-18 14:26:35.000000000 +1000 +@@ -34,6 +34,10 @@ + #include <bsd-games.h> + #include_next <stdio.h> + ++__BEGIN_DECLS ++ + #ifndef HAVE_fgetln + extern char *fgetln(FILE *stream, size_t *len); + #endif ++ ++__END_DECLS diff --git a/gnu/packages/patches/farstream-make.patch b/gnu/packages/patches/farstream-make.patch new file mode 100644 index 0000000000..6c1e9e7119 --- /dev/null +++ b/gnu/packages/patches/farstream-make.patch @@ -0,0 +1,39 @@ +This patch comes from upstream: +https://gitlab.freedesktop.org/farstream/farstream/-/merge_requests/4 + +From 54987d445ea714b467d901b7daf8c09ed0644189 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray <debarshir@freedesktop.org> +Date: Thu, 12 Mar 2020 14:07:23 +0100 +Subject: [PATCH] build: Adapt to backwards incompatible change in GNU Make 4.3 + +GNU Make 4.3 has a backwards incompatible change affecting the use of +number signs or hashes (ie., #) inside function invocations. See: +https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html + +In this case, it would expand the '\#' in the '\n\#include \"$(h)\"' +argument to the foreach call to '\#', not '#'. This would lead to +spurious backslashes in front of the '#include' directives in the +generated fs-enumtypes.c file. + +Spotted by Ernestas Kulik. +--- + common-modified/gst-glib-gen.mak | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/common-modified/gst-glib-gen.mak b/common-modified/gst-glib-gen.mak +index 14f1ba37..2247a41c 100644 +--- a/common-modified/gst-glib-gen.mak ++++ b/common-modified/gst-glib-gen.mak +@@ -6,7 +6,8 @@ + #glib_gen_prefix=gst_color_balance + #glib_gen_basename=colorbalance + +-enum_headers=$(foreach h,$(glib_enum_headers),\n\#include \"$(h)\") ++hash:=\# ++enum_headers=$(foreach h,$(glib_enum_headers),\n$(hash)include \"$(h)\") + + # these are all the rules generating the relevant files + $(glib_gen_basename)-enumtypes.h: $(glib_enum_headers) +-- +GitLab + diff --git a/gnu/packages/patches/gdb-hurd.patch b/gnu/packages/patches/gdb-hurd.patch deleted file mode 100644 index 0af8d4dc28..0000000000 --- a/gnu/packages/patches/gdb-hurd.patch +++ /dev/null @@ -1,69 +0,0 @@ -Taken from upstream, removed ChangeLog. - -From 6930bffe3373690b3431d6291f9f7c116d6a1ec4 Mon Sep 17 00:00:00 2001 -From: Samuel Thibault <samuel.thibault@ens-lyon.org> -Date: Sat, 30 May 2020 18:35:59 +0000 -Subject: [PATCH] hurd: fix gnu_debug_flag type -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fixes - -../../gdb/gnu-nat.c:96:6: error: conflicting declaration ‘bool gnu_debug_flag’ - 96 | bool gnu_debug_flag = false; -../../gdb/gnu-nat.c: In function ‘void _initialize_gnu_nat()’: -../../gdb/gnu-nat.c:3511:7: error: cannot - -gdb/ChangeLog: - - * gnu-nat.h (gnu_debug_flag): Set type to bool. ---- - gdb/ChangeLog | 4 ++++ - gdb/gnu-nat.h | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h -index 77c57817b2..766f716587 100644 ---- a/gdb/gnu-nat.h -+++ b/gdb/gnu-nat.h -@@ -111,7 +111,7 @@ extern char *proc_string (struct proc *proc); - __proc_pid (__proc), __proc->tid, \ - host_address_to_string (__proc) , ##args); } while (0) - --extern int gnu_debug_flag; -+extern bool gnu_debug_flag; - - #define debug(msg, args...) \ - do { if (gnu_debug_flag) \ --- -Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org -Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com - -commit 366f550a593c7e6bae3699a4b6d65fe937af5603 -Author: Samuel Thibault <samuel.thibault@ens-lyon.org> -Date: Sat May 30 18:41:30 2020 +0000 - - hurd: add missing include - - Fixes - - ../../gdb/gnu-nat.c:2522:14: error: ‘target_gdbarch’ was not declared in this scope; did you mean ‘target_detach’? - 2522 | paddress (target_gdbarch (), memaddr), pulongest (len), - - gdb/Changelog: - - * gnu-nat.c: Include "gdbarch.h". - -diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c -index 3b438a9a43..9b93488b41 100644 ---- a/gdb/gnu-nat.c -+++ b/gdb/gnu-nat.c -@@ -64,6 +64,7 @@ extern "C" - #include "language.h" - #include "target.h" - #include "gdbsupport/gdb_wait.h" -+#include "gdbarch.h" - #include "gdbcmd.h" - #include "gdbcore.h" - #include "gdbthread.h" diff --git a/gnu/packages/patches/icecat-makeicecat.patch b/gnu/packages/patches/icecat-makeicecat.patch index c90950d5ef..e0cdde61ec 100644 --- a/gnu/packages/patches/icecat-makeicecat.patch +++ b/gnu/packages/patches/icecat-makeicecat.patch @@ -25,7 +25,7 @@ index 8be2362..48716f2 100755 -wget -N https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FFVERSION}esr/source/firefox-${FFVERSION}esr.source.tar.xz.asc -gpg --recv-keys --keyserver keyserver.ubuntu.com 14F26682D0916CDD81E37B6D61B7B526D98F0353 -gpg --verify firefox-${FFVERSION}esr.source.tar.xz.asc --echo -n 5fd27d67689fe60803022035e556146d2dbce5e53d21c14d026fc31dd2e45be9 firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c - +-echo -n 8e3cf0bbf1062768134db2eb10ab774731ca5ec6694b65def82234bb0a9170fc firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c - - -echo Extracting Firefox tarball -tar -xf firefox-${FFVERSION}esr.source.tar.xz @@ -37,7 +37,7 @@ index 8be2362..48716f2 100755 +# wget -N https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FFVERSION}esr/source/firefox-${FFVERSION}esr.source.tar.xz.asc +# gpg --recv-keys --keyserver keyserver.ubuntu.com 14F26682D0916CDD81E37B6D61B7B526D98F0353 +# gpg --verify firefox-${FFVERSION}esr.source.tar.xz.asc -+# echo -n 5fd27d67689fe60803022035e556146d2dbce5e53d21c14d026fc31dd2e45be9 firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c - ++# echo -n 8e3cf0bbf1062768134db2eb10ab774731ca5ec6694b65def82234bb0a9170fc firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c - +# +# echo Extracting Firefox tarball +# tar -xf firefox-${FFVERSION}esr.source.tar.xz diff --git a/gnu/packages/patches/kpackage-fix-KF5PackageMacros.cmake.patch b/gnu/packages/patches/kpackage-fix-KF5PackageMacros.cmake.patch new file mode 100644 index 0000000000..d677f19a70 --- /dev/null +++ b/gnu/packages/patches/kpackage-fix-KF5PackageMacros.cmake.patch @@ -0,0 +1,25 @@ +From 668010ebc9fd84d9dc60f90b9a4ebf3c7054977f Mon Sep 17 00:00:00 2001 +From: Hartmut Goebel <h.goebel@crazy-compilers.com> +Date: Sun, 25 Oct 2020 20:11:13 +0000 +Subject: [PATCH] Fix build errors if PREFIX is different from ECM's PREFIX. + +See <https://bugs.kde.org/424483> for details. +--- + KF5PackageMacros.cmake | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/KF5PackageMacros.cmake b/KF5PackageMacros.cmake +index f4c1d1d..acd3798 100644 +--- a/KF5PackageMacros.cmake ++++ b/KF5PackageMacros.cmake +@@ -1,6 +1,5 @@ + +-find_package(ECM 1.6.0 CONFIG REQUIRED) +-include(${ECM_KDE_MODULE_DIR}/KDEInstallDirs.cmake) ++include(KDEInstallDirs) + + set(KPACKAGE_RELATIVE_DATA_INSTALL_DIR "kpackage") + +-- +GitLab + diff --git a/gnu/packages/patches/netcdf-date-time.patch b/gnu/packages/patches/netcdf-date-time.patch index a4e7925aa1..0bdfc55299 100644 --- a/gnu/packages/patches/netcdf-date-time.patch +++ b/gnu/packages/patches/netcdf-date-time.patch @@ -3,9 +3,9 @@ @@ -13,7 +13,7 @@ #endif - /* Tell the user the version of netCDF. */ + /** @internal The version string for the library, used by + * nc_inq_libvers(). */ -static const char nc_libvers[] = PACKAGE_VERSION " of "__DATE__" "__TIME__" $"; -+static const char nc_libvers[] = PACKAGE_VERSION" $"; ++static const char nc_libvers[] = PACKAGE_VERSION " $"; /** - \defgroup lib_version Library Version diff --git a/gnu/packages/patches/netcdf-tst_h_par.patch b/gnu/packages/patches/netcdf-tst_h_par.patch deleted file mode 100644 index ac14a4c0a2..0000000000 --- a/gnu/packages/patches/netcdf-tst_h_par.patch +++ /dev/null @@ -1,21 +0,0 @@ -From a83702834938b23cc2e843589aa223e2024a7e6f Mon Sep 17 00:00:00 2001 -From: Orion Poplawski <orion@cora.nwra.com> -Date: Tue, 29 Nov 2016 11:48:01 -0700 -Subject: [PATCH] Add missing #include "err_macros.h" to tst_h_par.c - ---- - h5_test/tst_h_par.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/h5_test/tst_h_par.c b/h5_test/tst_h_par.c -index c3da7f4..a419d55 100644 ---- a/h5_test/tst_h_par.c -+++ b/h5_test/tst_h_par.c -@@ -11,6 +11,7 @@ - $Id: tst_h_par.c,v 1.15 2010/05/25 13:53:04 ed Exp $ - */ - #include <nc_tests.h> -+#include "err_macros.h" - #include <hdf5.h> - - /* Defining USE_MPE causes the MPE trace library to be used (and you diff --git a/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch b/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch deleted file mode 100644 index fd9a4c9401..0000000000 --- a/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch +++ /dev/null @@ -1,283 +0,0 @@ -From bc3b353cb2f26cf10aa5c5caebddf6d3d5b1e318 Mon Sep 17 00:00:00 2001 -From: Julien Lepiller <julien@lepiller.eu> -Date: Fri, 21 Sep 2018 22:31:29 +0200 -Subject: [PATCH] fix camlp4 in another directory - ---- - Makefile | 11 ++++++----- - configure | 13 ++++++++++++- - tests/Makefile | 2 +- - tests/camlp4-comments/Makefile | 2 +- - tests/camlp4-exclude-file/Makefile | 2 +- - tests/camlp4-exclude/Makefile | 2 +- - tests/camlp4-instrument-fast/Makefile | 2 +- - tests/camlp4-instrument/Makefile | 2 +- - tests/combine-expr/Makefile | 2 +- - tests/ppx-comments/Makefile | 2 +- - tests/ppx-exclude-file/Makefile | 2 +- - tests/ppx-exclude/Makefile | 2 +- - tests/ppx-instrument-fast/Makefile | 2 +- - tests/ppx-instrument/Makefile | 2 +- - tests/report/Makefile | 2 +- - 15 files changed, 31 insertions(+), 19 deletions(-) - -diff --git a/Makefile b/Makefile -index b0980ee..6697922 100644 ---- a/Makefile -+++ b/Makefile -@@ -25,7 +25,7 @@ PATH_BUILD=$(PATH_BASE)/_build - PATH_OCAMLDOC=$(PATH_BASE)/ocamldoc - PATH_SRC=$(PATH_BASE)/src - PATH_TESTS=$(PATH_BASE)/tests --PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect -+PATH_INSTALL=$(PREFIX)/lib/ocaml/bisect - - - # DEFINITIONS -@@ -33,7 +33,8 @@ PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect - PROJECT_NAME=bisect - OCAMLBUILD=ocamlbuild - OCAMLBUILD_ENV=WARNINGS=$(WARNINGS) PATH_OCAML_PREFIX=$(PATH_OCAML_PREFIX) --OCAMLBUILD_FLAGS=-classic-display -no-links -+CAMLP4_INCLUDE=$(shell test -z $(CAMLP4_LIBDIR) || echo "-cflags -I,$(CAMLP4_LIBDIR)") -+OCAMLBUILD_FLAGS=-classic-display -no-links $(CAMLP4_INCLUDE) - MODULES_ODOCL=$(PROJECT_NAME).odocl - MODULES_MLPACK=$(PROJECT_NAME).mlpack - MODULES_MLPACK_PP=$(PROJECT_NAME)_pp.mlpack -@@ -80,11 +81,11 @@ veryclean: clean - rm -f $(PATH_OCAMLDOC)/*.html $(PATH_OCAMLDOC)/*.css - - install: FORCE -- cp $(PATH_BUILD)/src/report/report.byte $(PATH_OCAML_PREFIX)/bin/bisect-report; \ -+ cp $(PATH_BUILD)/src/report/report.byte $(PREFIX)/bin/bisect-report; \ - if [ "$(PPX)" = "TRUE" ]; then \ -- cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PATH_OCAML_PREFIX)/bin; \ -+ cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PREFIX)/bin; \ - fi; \ -- (which ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PATH_OCAML_PREFIX)/bin/bisect-report.opt || true); \ -+ (which ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PREFIX)/bin/bisect-report.opt || true); \ - if [ -x "$(PATH_OCAMLFIND)" ]; then \ - $(PATH_OCAMLFIND) query $(PROJECT_NAME) && $(PATH_OCAMLFIND) remove $(PROJECT_NAME) || true; \ - $(PATH_OCAMLFIND) install $(PROJECT_NAME) META -optional \ -diff --git a/configure b/configure -index bb7ebf4..43ef46b 100755 ---- a/configure -+++ b/configure -@@ -21,7 +21,9 @@ - # default values - ocamlbuild=`which ocamlbuild || echo '/usr/local/bin/ocamlbuild'` - bin_path=`dirname $ocamlbuild` -+prefix='' - ocaml_prefix=`dirname $bin_path` -+camlp4_prefix=`dirname $(dirname $(which camlp4of))` - ocamlfind=`which ocamlfind 2> /dev/null || echo ''` - native_dynlink='TRUE' - devel='FALSE' -@@ -32,8 +34,12 @@ ppx='FALSE' - while [ $# -gt 0 ] - do - case "$1" in -+ -prefix) -+ prefix="$2"; shift;; - -ocaml-prefix) - ocaml_prefix="$2"; shift;; -+ -camlp4-prefix) -+ camlp4_prefix="$2"; shift;; - -ocamlfind) - ocamlfind="$2"; shift;; - -no-native-dynlink) -@@ -45,7 +51,7 @@ do - -ppx) - ppx='TRUE';; - *) -- echo "usage: $0 [-ocaml-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]"; -+ echo "usage: $0 [-prefix <path>] [-ocaml-prefix <path>] [-camlp4-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]"; - exit 1;; - esac - shift -@@ -57,6 +63,9 @@ if [ "$no_camlp4" = "TRUE" -a "$ppx" = "FALSE" ]; then - exit 1 - fi - -+# prefix default value -+test -z $prefix && prefix=$ocaml_prefix -+ - # make options - make_quiet=`make -f - <<EOF - default: gnumake -@@ -66,7 +75,9 @@ EOF` - - # file creation - echo "# timestamp: `date`" > Makefile.config -+echo "PREFIX=$prefix" >> Makefile.config - echo "PATH_OCAML_PREFIX=$ocaml_prefix" >> Makefile.config -+echo "PATH_CAMLP4_PREFIX=$camlp4_prefix" >> Makefile.config - echo "PATH_OCAMLFIND=$ocamlfind" >> Makefile.config - echo "NATIVE_DYNLINK=$native_dynlink" >> Makefile.config - echo "WARNINGS=$devel" >> Makefile.config -diff --git a/tests/Makefile b/tests/Makefile -index 1aba27f..9642323 100644 ---- a/tests/Makefile -+++ b/tests/Makefile -@@ -41,7 +41,7 @@ one: FORCE - else \ - echo "Running tests for '$(NAME)'..." | tee -a _log; \ - (cd $(NAME) && \ -- $(MAKE) PATH_OCAML_BIN=$(PATH_OCAML_PREFIX)/bin \ -+ $(MAKE) PATH_OCAML_BIN=$(PATH_OCAML_PREFIX)/bin PATH_CAMLP4_PREFIX=$(PATH_CAMLP4_PREFIX) \ - COMPILER=ocamlc EXECUTABLE=bytecode RUN=./ LIB_EXT=cma EXE_SUFFIX='' \ - REPORT=../../_build/src/report/report.byte && \ - cd ..) || echo '*** error' >> _log; \ -diff --git a/tests/camlp4-comments/Makefile b/tests/camlp4-comments/Makefile -index 33fca72..a918118 100644 ---- a/tests/camlp4-comments/Makefile -+++ b/tests/camlp4-comments/Makefile -@@ -2,7 +2,7 @@ default: - @rm -fr *.result *.cmp - @for file in *.ml; do \ - echo " testing '$$file' ..."; \ -- $(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \ -+ $(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \ - diff -q $$file.reference $$file.result || exit 1; \ - done - @rm -fr *.result *.cmp -diff --git a/tests/camlp4-exclude-file/Makefile b/tests/camlp4-exclude-file/Makefile -index ab13983..e2520fa 100644 ---- a/tests/camlp4-exclude-file/Makefile -+++ b/tests/camlp4-exclude-file/Makefile -@@ -2,7 +2,7 @@ default: - @rm -fr *.result *.cmp - @for file in *.ml; do \ - echo " testing '$$file' ..."; \ -- $(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude-file exclusions -o $$file.result; \ -+ $(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude-file exclusions -o $$file.result; \ - diff -q $$file.reference $$file.result || exit 1; \ - done - @rm -fr *.result *.cmp -diff --git a/tests/camlp4-exclude/Makefile b/tests/camlp4-exclude/Makefile -index 18aada4..d71a7bc 100644 ---- a/tests/camlp4-exclude/Makefile -+++ b/tests/camlp4-exclude/Makefile -@@ -2,7 +2,7 @@ default: - @rm -fr *.result *.cmp - @for file in *.ml; do \ - echo " testing '$$file' ..."; \ -- $(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude 'f.*' -o $$file.result; \ -+ $(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude 'f.*' -o $$file.result; \ - diff -q $$file.reference $$file.result || exit 1; \ - done - @rm -fr *.result *.cmp -diff --git a/tests/camlp4-instrument-fast/Makefile b/tests/camlp4-instrument-fast/Makefile -index f60767f..8506e38 100644 ---- a/tests/camlp4-instrument-fast/Makefile -+++ b/tests/camlp4-instrument-fast/Makefile -@@ -2,7 +2,7 @@ default: - @rm -fr *.result *.cmp - @for file in *.ml; do \ - echo " testing '$$file' ..."; \ -- $(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo -mode fast $$file -o $$file.result; \ -+ $(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo -mode fast $$file -o $$file.result; \ - diff -q $$file.reference $$file.result || exit 1; \ - done - @rm -fr *.result *.cmp -diff --git a/tests/camlp4-instrument/Makefile b/tests/camlp4-instrument/Makefile -index 33fca72..a918118 100644 ---- a/tests/camlp4-instrument/Makefile -+++ b/tests/camlp4-instrument/Makefile -@@ -2,7 +2,7 @@ default: - @rm -fr *.result *.cmp - @for file in *.ml; do \ - echo " testing '$$file' ..."; \ -- $(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \ -+ $(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \ - diff -q $$file.reference $$file.result || exit 1; \ - done - @rm -fr *.result *.cmp -diff --git a/tests/combine-expr/Makefile b/tests/combine-expr/Makefile -index 46ae9eb..e8e2af2 100644 ---- a/tests/combine-expr/Makefile -+++ b/tests/combine-expr/Makefile -@@ -1,4 +1,4 @@ --COMPILE_FLAGS=-I ../../_build -pp '$(PATH_OCAML_BIN)/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS) -+COMPILE_FLAGS=-I ../../_build -pp '$(PATH_CAMLP4_PREFIX)/bin/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS) - - default: clean compile run report - -diff --git a/tests/ppx-comments/Makefile b/tests/ppx-comments/Makefile -index f8c645a..667526f 100644 ---- a/tests/ppx-comments/Makefile -+++ b/tests/ppx-comments/Makefile -@@ -2,7 +2,7 @@ default: - @rm -fr *.result *.cm* - @for file in *.ml; do \ - echo " testing '$$file' ..."; \ -- $(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \ -+ $(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \ - diff -q $$file.reference $$file.result || exit 1; \ - done - @rm -fr *.result *.cm* -diff --git a/tests/ppx-exclude-file/Makefile b/tests/ppx-exclude-file/Makefile -index a575a77..0dd1a20 100644 ---- a/tests/ppx-exclude-file/Makefile -+++ b/tests/ppx-exclude-file/Makefile -@@ -2,7 +2,7 @@ default: - @rm -fr *.result *.cm* - @for file in *.ml; do \ - echo " testing '$$file' ..."; \ -- $(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -exclude-file exclusions' -dsource $$file 2> $$file.result; \ -+ $(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -exclude-file exclusions' -dsource $$file 2> $$file.result; \ - diff -q $$file.reference $$file.result || exit 1; \ - done - @rm -fr *.result *.cm* -diff --git a/tests/ppx-exclude/Makefile b/tests/ppx-exclude/Makefile -index a517af4..f502a42 100644 ---- a/tests/ppx-exclude/Makefile -+++ b/tests/ppx-exclude/Makefile -@@ -2,7 +2,7 @@ default: - @rm -fr *.result *.cm* - @for file in *.ml; do \ - echo " testing '$$file' ..."; \ -- $(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx "../../_build/src/syntax/bisect_ppx.byte -exclude 'f.*'" -dsource $$file 2> $$file.result; \ -+ $(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx "../../_build/src/syntax/bisect_ppx.byte -exclude 'f.*'" -dsource $$file 2> $$file.result; \ - diff -q $$file.reference $$file.result || exit 1; \ - done - @rm -fr *.result *.cm* -diff --git a/tests/ppx-instrument-fast/Makefile b/tests/ppx-instrument-fast/Makefile -index da78bb6..1195988 100644 ---- a/tests/ppx-instrument-fast/Makefile -+++ b/tests/ppx-instrument-fast/Makefile -@@ -2,7 +2,7 @@ default: - @rm -fr *.result *.cm* - @for file in *.ml; do \ - echo " testing '$$file' ..."; \ -- $(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -mode fast' -dsource $$file 2> $$file.result; \ -+ $(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -mode fast' -dsource $$file 2> $$file.result; \ - diff -q $$file.reference $$file.result || exit 1; \ - done - @rm -fr *.result *.cm* -diff --git a/tests/ppx-instrument/Makefile b/tests/ppx-instrument/Makefile -index f8c645a..667526f 100644 ---- a/tests/ppx-instrument/Makefile -+++ b/tests/ppx-instrument/Makefile -@@ -2,7 +2,7 @@ default: - @rm -fr *.result *.cm* - @for file in *.ml; do \ - echo " testing '$$file' ..."; \ -- $(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \ -+ $(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \ - diff -q $$file.reference $$file.result || exit 1; \ - done - @rm -fr *.result *.cm* -diff --git a/tests/report/Makefile b/tests/report/Makefile -index a7ffe44..a968bf9 100644 ---- a/tests/report/Makefile -+++ b/tests/report/Makefile -@@ -1,4 +1,4 @@ --COMPILE_FLAGS=-I ../../_build -pp '$(PATH_OCAML_BIN)/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS) -+COMPILE_FLAGS=-I ../../_build -pp '$(PATH_CAMLP4_PREFIX)/bin/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS) - XMLLINT=$(shell which xmllint) - - default: clean compile run report --- -2.18.0 - diff --git a/gnu/packages/patches/openocd-nrf52.patch b/gnu/packages/patches/openocd-nrf52.patch deleted file mode 100644 index 0ec4348cb4..0000000000 --- a/gnu/packages/patches/openocd-nrf52.patch +++ /dev/null @@ -1,827 +0,0 @@ -This patch adds support for nRF52 series devices. It is patchset 7 from -<http://openocd.zylin.com/#/c/3511/>, which has been tested, but not -merged yet in master. - -From: Michael Dietz <mjdietzx@gmail.com> -Date: Mon, 30 May 2016 12:50:44 +0000 (-0700) -Subject: Added support for nRF52 Series Devices. -X-Git-Url: http://openocd.zylin.com/gitweb?p=openocd.git;a=commitdiff_plain;h=9ba15633e221d9d72e320372ba8f49d3f30d4bce - -Added support for nRF52 Series Devices. - -Both nrf52.c and nrf52.cfg are based off of previous nRF51 files. -- Some possible race conditions with NVMC have been fixed in nRF52.c -- Removed nrf51_get_probed_chip_if_halted() as the core does not have to be halted to perform operations where it is called. -- Only registers that are needed by openOCD are defined, some registers in nRF51 don't exist in nRF52 and are removed. -- Some all around cleanup has been done. -- The protection mechanism is completely different on nRF52 and this has not been implemented yet - just prints a warning and returns for now. - -Change-Id: I4dd42c86f33f450709bb981806c2655f04aa6201 -Signed-off-by: Michael Dietz <mjdietzx@gmail.com> ---- - -diff --git a/src/flash/nor/Makefile.am b/src/flash/nor/Makefile.am -index 727e4f2..839667c 100644 ---- a/src/flash/nor/Makefile.am -+++ b/src/flash/nor/Makefile.am -@@ -36,6 +36,7 @@ NOR_DRIVERS = \ - %D%/niietcm4.c \ - %D%/non_cfi.c \ - %D%/nrf51.c \ -+ %D%/nrf52.c \ - %D%/numicro.c \ - %D%/ocl.c \ - %D%/pic32mx.c \ -diff --git a/src/flash/nor/drivers.c b/src/flash/nor/drivers.c -index 56a5cb2..071273e 100644 ---- a/src/flash/nor/drivers.c -+++ b/src/flash/nor/drivers.c -@@ -48,6 +48,7 @@ extern struct flash_driver mdr_flash; - extern struct flash_driver mrvlqspi_flash; - extern struct flash_driver niietcm4_flash; - extern struct flash_driver nrf51_flash; -+extern struct flash_driver nrf52_flash; - extern struct flash_driver numicro_flash; - extern struct flash_driver ocl_flash; - extern struct flash_driver pic32mx_flash; -@@ -100,6 +101,7 @@ static struct flash_driver *flash_drivers[] = { - &mrvlqspi_flash, - &niietcm4_flash, - &nrf51_flash, -+ &nrf52_flash, - &numicro_flash, - &ocl_flash, - &pic32mx_flash, -diff --git a/src/flash/nor/nrf52.c b/src/flash/nor/nrf52.c -new file mode 100644 -index 0000000..7f2bd35 ---- /dev/null -+++ b/src/flash/nor/nrf52.c -@@ -0,0 +1,733 @@ -+/*************************************************************************** -+ * Copyright (C) 2013 Synapse Product Development * -+ * Andrey Smirnov <andrew.smironv@gmail.com> * -+ * Angus Gratton <gus@projectgus.com> * -+ * Erdem U. Altunyurt <spamjunkeater@gmail.com> * -+ * * -+ * This program is free software; you can redistribute it and/or modify * -+ * it under the terms of the GNU General Public License as published by * -+ * the Free Software Foundation; either version 2 of the License, or * -+ * (at your option) any later version. * -+ * * -+ * This program is distributed in the hope that it will be useful, * -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of * -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -+ * GNU General Public License for more details. * -+ * * -+ * You should have received a copy of the GNU General Public License * -+ * along with this program. If not, see <http://www.gnu.org/licenses/>. * -+ ***************************************************************************/ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include <stdlib.h> -+ -+#include "imp.h" -+#include <target/algorithm.h> -+#include <target/armv7m.h> -+#include <helper/types.h> -+ -+/* nRF52 Register addresses used by openOCD. */ -+#define NRF52_FLASH_BASE_ADDR (0x0) -+ -+#define NRF52_FICR_BASE_ADDR (0x10000000) -+#define NRF52_FICR_CODEPAGESIZE_ADDR (NRF52_FICR_BASE_ADDR | 0x010) -+#define NRF52_FICR_CODESIZE_ADDR (NRF52_FICR_BASE_ADDR | 0x014) -+ -+#define NRF52_UICR_BASE_ADDR (0x10001000) -+ -+#define NRF52_NVMC_BASE_ADDR (0x4001E000) -+#define NRF52_NVMC_READY_ADDR (NRF52_NVMC_BASE_ADDR | 0x400) -+#define NRF52_NVMC_CONFIG_ADDR (NRF52_NVMC_BASE_ADDR | 0x504) -+#define NRF52_NVMC_ERASEPAGE_ADDR (NRF52_NVMC_BASE_ADDR | 0x508) -+#define NRF52_NVMC_ERASEALL_ADDR (NRF52_NVMC_BASE_ADDR | 0x50C) -+#define NRF52_NVMC_ERASEUICR_ADDR (NRF52_NVMC_BASE_ADDR | 0x514) -+ -+/* nRF52 bit fields. */ -+enum nrf52_nvmc_config_bits { -+ NRF52_NVMC_CONFIG_REN = 0x0, -+ NRF52_NVMC_CONFIG_WEN = 0x01, -+ NRF52_NVMC_CONFIG_EEN = 0x02 -+}; -+ -+enum nrf52_nvmc_ready_bits { -+ NRF52_NVMC_BUSY = 0x0, -+ NRF52_NVMC_READY = 0x01 -+}; -+ -+/* nRF52 state information. */ -+struct nrf52_info { -+ uint32_t code_page_size; /* Size of FLASH page in bytes. */ -+ uint32_t code_memory_size; /* Size of Code FLASH region in bytes. */ -+ -+ struct { -+ bool probed; -+ int (*write) (struct flash_bank *bank, -+ struct nrf52_info *chip, -+ const uint8_t *buffer, uint32_t offset, uint32_t count); -+ } bank[2]; /* There are two regions in nRF52 FLASH - Code and UICR. */ -+ struct target *target; -+}; -+ -+static int nrf52_protect_check(struct flash_bank *bank); -+ -+static int nrf52_probe(struct flash_bank *bank) -+{ -+ int res; -+ struct nrf52_info *chip = bank->driver_priv; -+ assert(chip != NULL); -+ -+ res = target_read_u32(chip->target, -+ NRF52_FICR_CODEPAGESIZE_ADDR, -+ &chip->code_page_size); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Couldn't read code page size"); -+ return res; -+ } -+ -+ res = target_read_u32(chip->target, -+ NRF52_FICR_CODESIZE_ADDR, -+ &chip->code_memory_size); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Couldn't read code memory size"); -+ return res; -+ } -+ -+ chip->code_memory_size = chip->code_memory_size * chip->code_page_size; -+ -+ if (bank->base == NRF52_FLASH_BASE_ADDR) { -+ bank->size = chip->code_memory_size; -+ bank->num_sectors = bank->size / chip->code_page_size; -+ bank->sectors = calloc(bank->num_sectors, -+ sizeof((bank->sectors)[0])); -+ if (!bank->sectors) -+ return ERROR_FLASH_BANK_NOT_PROBED; -+ -+ /* Fill out the sector information: All nRF51 sectors are the same size. */ -+ for (int i = 0; i < bank->num_sectors; i++) { -+ bank->sectors[i].size = chip->code_page_size; -+ bank->sectors[i].offset = i * chip->code_page_size; -+ -+ /* Mark as unknown. */ -+ bank->sectors[i].is_erased = -1; -+ bank->sectors[i].is_protected = -1; -+ } -+ -+ nrf52_protect_check(bank); -+ -+ chip->bank[0].probed = true; -+ } else { /* This is the UICR bank. */ -+ bank->size = chip->code_page_size; -+ bank->num_sectors = 1; -+ bank->sectors = calloc(bank->num_sectors, -+ sizeof((bank->sectors)[0])); -+ if (!bank->sectors) -+ return ERROR_FLASH_BANK_NOT_PROBED; -+ -+ bank->sectors[0].size = bank->size; -+ bank->sectors[0].offset = 0; -+ -+ bank->sectors[0].is_erased = -1; -+ bank->sectors[0].is_protected = -1; -+ -+ chip->bank[1].probed = true; -+ } -+ -+ return ERROR_OK; -+} -+ -+static int nrf52_bank_is_probed(struct flash_bank *bank) -+{ -+ struct nrf52_info *chip = bank->driver_priv; -+ assert(chip != NULL); -+ -+ return chip->bank[bank->bank_number].probed; -+} -+ -+static int nrf52_auto_probe(struct flash_bank *bank) -+{ -+ if (!nrf52_bank_is_probed(bank)) -+ return nrf52_probe(bank); -+ else -+ return ERROR_OK; -+} -+ -+static int nrf52_wait_for_nvmc(struct nrf52_info *chip) -+{ -+ int res; -+ uint32_t ready; -+ int timeout = 100; -+ -+ do { -+ res = target_read_u32(chip->target, NRF52_NVMC_READY_ADDR, &ready); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Couldn't read NVMC_READY register"); -+ return res; -+ } -+ -+ if (ready == NRF52_NVMC_READY) -+ return ERROR_OK; -+ -+ alive_sleep(1); -+ } while (timeout--); -+ -+ LOG_DEBUG("Timed out waiting for the NVMC to be ready"); -+ return ERROR_FLASH_BUSY; -+} -+ -+static int nrf52_nvmc_erase_enable(struct nrf52_info *chip) -+{ -+ int res; -+ -+ res = nrf52_wait_for_nvmc(chip); -+ if (res != ERROR_OK) -+ return res; -+ -+ res = target_write_u32(chip->target, -+ NRF52_NVMC_CONFIG_ADDR, -+ NRF52_NVMC_CONFIG_EEN); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Failed to configure the NVMC for erasing"); -+ return res; -+ } -+ -+ return res; -+} -+ -+static int nrf52_nvmc_write_enable(struct nrf52_info *chip) -+{ -+ int res; -+ -+ res = nrf52_wait_for_nvmc(chip); -+ if (res != ERROR_OK) -+ return res; -+ -+ res = target_write_u32(chip->target, -+ NRF52_NVMC_CONFIG_ADDR, -+ NRF52_NVMC_CONFIG_WEN); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Failed to configure the NVMC for writing"); -+ return res; -+ } -+ -+ return res; -+} -+ -+static int nrf52_nvmc_read_only(struct nrf52_info *chip) -+{ -+ int res; -+ -+ res = nrf52_wait_for_nvmc(chip); -+ if (res != ERROR_OK) -+ return res; -+ -+ res = target_write_u32(chip->target, -+ NRF52_NVMC_CONFIG_ADDR, -+ NRF52_NVMC_CONFIG_REN); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Failed to configure the NVMC for read-only"); -+ return res; -+ } -+ -+ return res; -+} -+ -+static int nrf52_nvmc_generic_erase(struct nrf52_info *chip, -+ uint32_t erase_register, -+ uint32_t erase_value) -+{ -+ int res; -+ -+ res = nrf52_nvmc_erase_enable(chip); -+ if (res != ERROR_OK) -+ return res; -+ -+ res = target_write_u32(chip->target, -+ erase_register, -+ erase_value); -+ if (res != ERROR_OK) -+ LOG_ERROR("Failed to write NVMC erase register"); -+ -+ return nrf52_nvmc_read_only(chip); -+} -+ -+static int nrf52_protect_check(struct flash_bank *bank) -+{ -+ LOG_WARNING("nrf52_protect_check() is not implemented for nRF52 series devices yet"); -+ return ERROR_OK; -+} -+ -+static int nrf52_protect(struct flash_bank *bank, int set, int first, int last) -+{ -+ LOG_WARNING("nrf52_protect() is not implemented for nRF52 series devices yet"); -+ return ERROR_OK; -+} -+ -+static struct flash_sector *nrf52_find_sector_by_address(struct flash_bank *bank, uint32_t address) -+{ -+ struct nrf52_info *chip = bank->driver_priv; -+ assert(chip != NULL); -+ -+ for (int i = 0; i < bank->num_sectors; i++) -+ if (bank->sectors[i].offset <= address && -+ address < (bank->sectors[i].offset + chip->code_page_size)) { -+ return &bank->sectors[i]; -+ } -+ -+ return NULL; -+} -+ -+static int nrf52_erase_all(struct nrf52_info *chip) -+{ -+ LOG_DEBUG("Erasing all non-volatile memory"); -+ return nrf52_nvmc_generic_erase(chip, -+ NRF52_NVMC_ERASEALL_ADDR, -+ 0x01); -+} -+ -+static int nrf52_erase_page(struct flash_bank *bank, -+ struct nrf52_info *chip, -+ struct flash_sector *sector) -+{ -+ int res; -+ -+ LOG_DEBUG("Erasing page at 0x%"PRIx32, sector->offset); -+ if (sector->is_protected == 1) { -+ LOG_ERROR("Cannot erase protected sector at 0x%" PRIx32, sector->offset); -+ return ERROR_FAIL; -+ } -+ -+ if (bank->base == NRF52_UICR_BASE_ADDR) { -+ res = nrf52_nvmc_generic_erase(chip, -+ NRF52_NVMC_ERASEUICR_ADDR, -+ 0x00000001); -+ } else { -+ res = nrf52_nvmc_generic_erase(chip, -+ NRF52_NVMC_ERASEPAGE_ADDR, -+ sector->offset); -+ } -+ -+ if (res == ERROR_OK) -+ sector->is_erased = 1; -+ return res; -+} -+ -+static const uint8_t nrf52_flash_write_code[] = { -+ /* See contrib/loaders/flash/cortex-m0.S */ -+ /* <wait_fifo>: */ -+ 0x0d, 0x68, /* ldr r5, [r1, #0] */ -+ 0x00, 0x2d, /* cmp r5, #0 */ -+ 0x0b, 0xd0, /* beq.n 1e <exit> */ -+ 0x4c, 0x68, /* ldr r4, [r1, #4] */ -+ 0xac, 0x42, /* cmp r4, r5 */ -+ 0xf9, 0xd0, /* beq.n 0 <wait_fifo> */ -+ 0x20, 0xcc, /* ldmia r4!, {r5} */ -+ 0x20, 0xc3, /* stmia r3!, {r5} */ -+ 0x94, 0x42, /* cmp r4, r2 */ -+ 0x01, 0xd3, /* bcc.n 18 <no_wrap> */ -+ 0x0c, 0x46, /* mov r4, r1 */ -+ 0x08, 0x34, /* adds r4, #8 */ -+ /* <no_wrap>: */ -+ 0x4c, 0x60, /* str r4, [r1, #4] */ -+ 0x04, 0x38, /* subs r0, #4 */ -+ 0xf0, 0xd1, /* bne.n 0 <wait_fifo> */ -+ /* <exit>: */ -+ 0x00, 0xbe /* bkpt 0x0000 */ -+}; -+ -+ -+/* Start a low level flash write for the specified region */ -+static int nrf52_ll_flash_write(struct nrf52_info *chip, uint32_t offset, const uint8_t *buffer, uint32_t bytes) -+{ -+ struct target *target = chip->target; -+ uint32_t buffer_size = 8192; -+ struct working_area *write_algorithm; -+ struct working_area *source; -+ uint32_t address = NRF52_FLASH_BASE_ADDR + offset; -+ struct reg_param reg_params[4]; -+ struct armv7m_algorithm armv7m_info; -+ int retval = ERROR_OK; -+ -+ LOG_DEBUG("Writing buffer to flash offset=0x%"PRIx32" bytes=0x%"PRIx32, offset, bytes); -+ assert(bytes % 4 == 0); -+ -+ /* allocate working area with flash programming code */ -+ if (target_alloc_working_area(target, sizeof(nrf52_flash_write_code), -+ &write_algorithm) != ERROR_OK) { -+ LOG_WARNING("no working area available, falling back to slow memory writes"); -+ -+ for (; bytes > 0; bytes -= 4) { -+ retval = target_write_memory(chip->target, -+ offset, 4, 1, buffer); -+ if (retval != ERROR_OK) -+ return retval; -+ -+ retval = nrf52_wait_for_nvmc(chip); -+ if (retval != ERROR_OK) -+ return retval; -+ -+ offset += 4; -+ buffer += 4; -+ } -+ -+ return ERROR_OK; -+ } -+ -+ LOG_WARNING("using fast async flash loader. This is currently supported"); -+ LOG_WARNING("only with ST-Link and CMSIS-DAP. If you have issues, add"); -+ LOG_WARNING("\"set WORKAREASIZE 0\" before sourcing nrf52.cfg to disable it"); -+ -+ retval = target_write_buffer(target, write_algorithm->address, -+ sizeof(nrf52_flash_write_code), -+ nrf52_flash_write_code); -+ if (retval != ERROR_OK) -+ return retval; -+ -+ /* memory buffer */ -+ while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) { -+ buffer_size /= 2; -+ buffer_size &= ~3UL; /* Make sure it's 4 byte aligned */ -+ if (buffer_size <= 256) { -+ /* free working area, write algorithm already allocated */ -+ target_free_working_area(target, write_algorithm); -+ -+ LOG_WARNING("No large enough working area available, can't do block memory writes"); -+ return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; -+ } -+ } -+ -+ armv7m_info.common_magic = ARMV7M_COMMON_MAGIC; -+ armv7m_info.core_mode = ARM_MODE_THREAD; -+ -+ init_reg_param(®_params[0], "r0", 32, PARAM_IN_OUT); /* byte count */ -+ init_reg_param(®_params[1], "r1", 32, PARAM_OUT); /* buffer start */ -+ init_reg_param(®_params[2], "r2", 32, PARAM_OUT); /* buffer end */ -+ init_reg_param(®_params[3], "r3", 32, PARAM_IN_OUT); /* target address */ -+ -+ buf_set_u32(reg_params[0].value, 0, 32, bytes); -+ buf_set_u32(reg_params[1].value, 0, 32, source->address); -+ buf_set_u32(reg_params[2].value, 0, 32, source->address + source->size); -+ buf_set_u32(reg_params[3].value, 0, 32, address); -+ -+ retval = target_run_flash_async_algorithm(target, buffer, bytes/4, 4, -+ 0, NULL, -+ 4, reg_params, -+ source->address, source->size, -+ write_algorithm->address, 0, -+ &armv7m_info); -+ -+ target_free_working_area(target, source); -+ target_free_working_area(target, write_algorithm); -+ -+ destroy_reg_param(®_params[0]); -+ destroy_reg_param(®_params[1]); -+ destroy_reg_param(®_params[2]); -+ destroy_reg_param(®_params[3]); -+ -+ return retval; -+} -+ -+/* Check and erase flash sectors in specified range, then start a low level page write. -+ start/end must be sector aligned. -+*/ -+static int nrf52_write_pages(struct flash_bank *bank, uint32_t start, uint32_t end, const uint8_t *buffer) -+{ -+ int res; -+ uint32_t offset; -+ struct flash_sector *sector; -+ struct nrf52_info *chip = bank->driver_priv; -+ assert(chip != NULL); -+ -+ assert(start % chip->code_page_size == 0); -+ assert(end % chip->code_page_size == 0); -+ -+ /* Erase all sectors */ -+ for (offset = start; offset < end; offset += chip->code_page_size) { -+ sector = nrf52_find_sector_by_address(bank, offset); -+ -+ if (sector == NULL) { -+ LOG_ERROR("Invalid sector @ 0x%08"PRIx32, offset); -+ return ERROR_FLASH_SECTOR_INVALID; -+ } -+ -+ if (sector->is_protected == 1) { -+ LOG_ERROR("Can't erase protected sector @ 0x%08"PRIx32, offset); -+ return ERROR_FAIL; -+ } -+ -+ if (sector->is_erased != 1) { /* 1 = erased, 0= not erased, -1 = unknown */ -+ res = nrf52_erase_page(bank, chip, sector); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Failed to erase sector @ 0x%08"PRIx32, sector->offset); -+ return res; -+ } -+ } -+ sector->is_erased = 1; -+ } -+ -+ res = nrf52_nvmc_write_enable(chip); -+ if (res != ERROR_OK) -+ return res; -+ -+ res = nrf52_ll_flash_write(chip, start, buffer, (end - start)); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Failed to write FLASH"); -+ nrf52_nvmc_read_only(chip); -+ return res; -+ } -+ -+ return nrf52_nvmc_read_only(chip); -+} -+ -+static int nrf52_erase(struct flash_bank *bank, int first, int last) -+{ -+ int res = ERROR_OK; -+ struct nrf52_info *chip = bank->driver_priv; -+ assert(chip != NULL); -+ -+ /* For each sector to be erased */ -+ for (int s = first; s <= last && res == ERROR_OK; s++) -+ res = nrf52_erase_page(bank, chip, &bank->sectors[s]); -+ -+ return res; -+} -+ -+static int nrf52_code_flash_write(struct flash_bank *bank, -+ struct nrf52_info *chip, -+ const uint8_t *buffer, uint32_t offset, uint32_t count) -+{ -+ int res; -+ /* Need to perform reads to fill any gaps we need to preserve in the first page, -+ before the start of buffer, or in the last page, after the end of buffer */ -+ uint32_t first_page = offset / chip->code_page_size; -+ uint32_t last_page = DIV_ROUND_UP(offset+count, chip->code_page_size); -+ -+ uint32_t first_page_offset = first_page * chip->code_page_size; -+ uint32_t last_page_offset = last_page * chip->code_page_size; -+ -+ LOG_DEBUG("Padding write from 0x%08"PRIx32"-0x%08"PRIx32" as 0x%08"PRIx32"-0x%08"PRIx32, -+ offset, offset+count, first_page_offset, last_page_offset); -+ -+ uint32_t page_cnt = last_page - first_page; -+ uint8_t buffer_to_flash[page_cnt * chip->code_page_size]; -+ -+ /* Fill in any space between start of first page and start of buffer */ -+ uint32_t pre = offset - first_page_offset; -+ if (pre > 0) { -+ res = target_read_memory(bank->target, first_page_offset, 1, pre, buffer_to_flash); -+ if (res != ERROR_OK) -+ return res; -+ } -+ -+ /* Fill in main contents of buffer */ -+ memcpy(buffer_to_flash + pre, buffer, count); -+ -+ /* Fill in any space between end of buffer and end of last page */ -+ uint32_t post = last_page_offset - (offset + count); -+ if (post > 0) { -+ /* Retrieve the full row contents from Flash */ -+ res = target_read_memory(bank->target, offset + count, 1, post, buffer_to_flash + pre + count); -+ if (res != ERROR_OK) -+ return res; -+ } -+ -+ return nrf52_write_pages(bank, first_page_offset, last_page_offset, buffer_to_flash); -+} -+ -+static int nrf52_uicr_flash_write(struct flash_bank *bank, -+ struct nrf52_info *chip, -+ const uint8_t *buffer, uint32_t offset, uint32_t count) -+{ -+ int res; -+ uint32_t nrf52_uicr_size = chip->code_page_size; -+ uint8_t uicr[nrf52_uicr_size]; -+ struct flash_sector *sector = &bank->sectors[0]; -+ -+ if ((offset + count) > nrf52_uicr_size) -+ return ERROR_FAIL; -+ -+ res = target_read_memory(bank->target, NRF52_UICR_BASE_ADDR, 1, nrf52_uicr_size, uicr); -+ -+ if (res != ERROR_OK) -+ return res; -+ -+ if (sector->is_erased != 1) { -+ res = nrf52_erase_page(bank, chip, sector); -+ if (res != ERROR_OK) -+ return res; -+ } -+ -+ memcpy(&uicr[offset], buffer, count); -+ -+ res = nrf52_nvmc_write_enable(chip); -+ if (res != ERROR_OK) -+ return res; -+ -+ res = nrf52_ll_flash_write(chip, NRF52_UICR_BASE_ADDR, uicr, nrf52_uicr_size); -+ if (res != ERROR_OK) { -+ nrf52_nvmc_read_only(chip); -+ return res; -+ } -+ -+ return nrf52_nvmc_read_only(chip); -+} -+ -+ -+static int nrf52_write(struct flash_bank *bank, const uint8_t *buffer, -+ uint32_t offset, uint32_t count) -+{ -+ struct nrf52_info *chip = bank->driver_priv; -+ assert(chip != NULL); -+ -+ return chip->bank[bank->bank_number].write(bank, chip, buffer, offset, count); -+} -+ -+ -+FLASH_BANK_COMMAND_HANDLER(nrf52_flash_bank_command) -+{ -+ static struct nrf52_info *chip; -+ -+ assert(bank != NULL); -+ -+ switch (bank->base) { -+ case NRF52_FLASH_BASE_ADDR: -+ bank->bank_number = 0; -+ break; -+ case NRF52_UICR_BASE_ADDR: -+ bank->bank_number = 1; -+ break; -+ default: -+ LOG_ERROR("Invalid bank address 0x%08" PRIx32, bank->base); -+ return ERROR_FAIL; -+ } -+ -+ if (!chip) { -+ /* Create a new chip */ -+ chip = calloc(1, sizeof(*chip)); -+ assert(chip != NULL); -+ -+ chip->target = bank->target; -+ } -+ -+ switch (bank->base) { -+ case NRF52_FLASH_BASE_ADDR: -+ chip->bank[bank->bank_number].write = nrf52_code_flash_write; -+ break; -+ case NRF52_UICR_BASE_ADDR: -+ chip->bank[bank->bank_number].write = nrf52_uicr_flash_write; -+ break; -+ } -+ -+ chip->bank[bank->bank_number].probed = false; -+ bank->driver_priv = chip; -+ -+ return ERROR_OK; -+} -+ -+COMMAND_HANDLER(nrf52_handle_mass_erase_command) -+{ -+ int res; -+ struct flash_bank *bank = NULL; -+ struct target *target = get_current_target(CMD_CTX); -+ -+ res = get_flash_bank_by_addr(target, NRF52_FLASH_BASE_ADDR, true, &bank); -+ if (res != ERROR_OK) -+ return res; -+ -+ assert(bank != NULL); -+ -+ struct nrf52_info *chip = bank->driver_priv; -+ assert(chip != NULL); -+ -+ res = nrf52_erase_all(chip); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Failed to erase the chip"); -+ nrf52_protect_check(bank); -+ return res; -+ } -+ -+ for (int i = 0; i < bank->num_sectors; i++) -+ bank->sectors[i].is_erased = 1; -+ -+ res = nrf52_protect_check(bank); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Failed to check chip's write protection"); -+ return res; -+ } -+ -+ res = get_flash_bank_by_addr(target, NRF52_UICR_BASE_ADDR, true, &bank); -+ if (res != ERROR_OK) -+ return res; -+ -+ bank->sectors[0].is_erased = 1; -+ -+ return ERROR_OK; -+} -+ -+static int nrf52_info(struct flash_bank *bank, char *buf, int buf_size) -+{ -+ int res; -+ uint32_t ficr[2]; -+ struct nrf52_info *chip = bank->driver_priv; -+ assert(chip != NULL); -+ -+ res = target_read_u32(chip->target, NRF52_FICR_CODEPAGESIZE_ADDR, &ficr[0]); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Couldn't read NVMC_READY register"); -+ return res; -+ } -+ -+ res = target_read_u32(chip->target, NRF52_FICR_CODESIZE_ADDR, &ficr[1]); -+ if (res != ERROR_OK) { -+ LOG_ERROR("Couldn't read NVMC_READY register"); -+ return res; -+ } -+ -+ snprintf(buf, buf_size, -+ "\n--------nRF52 Series Device--------\n\n" -+ "\n[factory information control block]\n" -+ "code page size: %"PRIu32"B\n" -+ "code memory size: %"PRIu32"kB\n", -+ ficr[0], -+ (ficr[1] * ficr[0]) / 1024); -+ -+ return ERROR_OK; -+} -+ -+static const struct command_registration nrf52_exec_command_handlers[] = { -+ { -+ .name = "mass_erase", -+ .handler = nrf52_handle_mass_erase_command, -+ .mode = COMMAND_EXEC, -+ .help = "Erase all flash contents of the chip.", -+ }, -+ COMMAND_REGISTRATION_DONE -+}; -+ -+static const struct command_registration nrf52_command_handlers[] = { -+ { -+ .name = "nrf52", -+ .mode = COMMAND_ANY, -+ .help = "nrf52 flash command group", -+ .usage = "", -+ .chain = nrf52_exec_command_handlers, -+ }, -+ COMMAND_REGISTRATION_DONE -+}; -+ -+struct flash_driver nrf52_flash = { -+ .name = "nrf52", -+ .commands = nrf52_command_handlers, -+ .flash_bank_command = nrf52_flash_bank_command, -+ .info = nrf52_info, -+ .erase = nrf52_erase, -+ .protect = nrf52_protect, -+ .write = nrf52_write, -+ .read = default_flash_read, -+ .probe = nrf52_probe, -+ .auto_probe = nrf52_auto_probe, -+ .erase_check = default_flash_blank_check, -+ .protect_check = nrf52_protect_check, -+}; -diff --git a/tcl/target/nrf52.cfg b/tcl/target/nrf52.cfg -index c1cbf1a..41a22ff 100644 ---- a/tcl/target/nrf52.cfg -+++ b/tcl/target/nrf52.cfg -@@ -10,6 +10,13 @@ if { [info exists CHIPNAME] } { - set _CHIPNAME nrf52 - } - -+# Work-area is a space in RAM used for flash programming, by default use 16kB. -+if { [info exists WORKAREASIZE] } { -+ set _WORKAREASIZE $WORKAREASIZE -+} else { -+ set _WORKAREASIZE 0x4000 -+} -+ - if { [info exists CPUTAPID] } { - set _CPUTAPID $CPUTAPID - } else { -@@ -22,7 +29,15 @@ set _TARGETNAME $_CHIPNAME.cpu - target create $_TARGETNAME cortex_m -chain-position $_TARGETNAME - - adapter_khz 10000 -+$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 - - if { ![using_hla] } { - cortex_m reset_config sysresetreq - } -+ -+flash bank $_CHIPNAME.flash nrf52 0x00000000 0 1 1 $_TARGETNAME -+flash bank $_CHIPNAME.uicr nrf52 0x10001000 0 1 1 $_TARGETNAME -+ -+adapter_khz 1000 -+ -+$_TARGETNAME configure -event reset-end {} diff --git a/gnu/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch b/gnu/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch new file mode 100644 index 0000000000..bd55d512cf --- /dev/null +++ b/gnu/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch @@ -0,0 +1,25 @@ +From ff5ed26f21d304e867ab57781878069567deb23d Mon Sep 17 00:00:00 2001 +From: Hartmut Goebel <h.goebel@crazy-compilers.com> +Date: Mon, 3 Aug 2020 19:49:58 +0000 +Subject: [PATCH] Fix build errors if PREFIX is different from ECM's PREFIX. + +See <https://bugs.kde.org/424483> for details +--- + KF5PlasmaMacros.cmake | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/KF5PlasmaMacros.cmake b/KF5PlasmaMacros.cmake +index 494b42d56..80b3fd8dd 100644 +--- a/KF5PlasmaMacros.cmake ++++ b/KF5PlasmaMacros.cmake +@@ -1,6 +1,5 @@ + +-find_package(ECM 1.6.0 CONFIG REQUIRED) +-include(${ECM_KDE_MODULE_DIR}/KDEInstallDirs.cmake) ++include(KDEInstallDirs) + + set(PLASMA_RELATIVE_DATA_INSTALL_DIR "plasma") + set(PLASMA_DATA_INSTALL_DIR "${KDE_INSTALL_DATADIR}/${PLASMA_RELATIVE_DATA_INSTALL_DIR}") +-- +GitLab + diff --git a/gnu/packages/patches/python-robotframework-honor-source-date-epoch.patch b/gnu/packages/patches/python-robotframework-source-date-epoch.patch index ccd87911d8..ccd87911d8 100644 --- a/gnu/packages/patches/python-robotframework-honor-source-date-epoch.patch +++ b/gnu/packages/patches/python-robotframework-source-date-epoch.patch diff --git a/gnu/packages/patches/rcs-5.10.0-no-stdin.patch b/gnu/packages/patches/rcs-5.10.0-no-stdin.patch new file mode 100644 index 0000000000..56edfe7b65 --- /dev/null +++ b/gnu/packages/patches/rcs-5.10.0-no-stdin.patch @@ -0,0 +1,57 @@ +http://git.savannah.gnu.org/cgit/rcs.git/patch/?id=8883c4f5a29be18e9ea09bd27a7b660830de45bb + + +From 8883c4f5a29be18e9ea09bd27a7b660830de45bb Mon Sep 17 00:00:00 2001 +From: Thien-Thi Nguyen <ttn@gnu.org> +Date: Fri, 23 Oct 2020 09:23:49 -0400 +Subject: [v] Don't test signal handling if stdin not ok. + +<https://mail.gnu.org/archive/html/bug-rcs/2020-10/msg00014.html> + +* tests/t632: If stdin is not open and connected to +a tty, skip the signal handling portion of the test. +--- + tests/ChangeLog | 9 +++++++++ + tests/t632 | 9 +++++++++ + 2 files changed, 18 insertions(+) + +diff --git a/tests/ChangeLog b/tests/ChangeLog +index c3715c0..0565058 100644 +--- a/tests/ChangeLog ++++ b/tests/ChangeLog +@@ -1,3 +1,12 @@ ++2020-10-23 Thien-Thi Nguyen <ttn@gnu.org> ++ ++ [v] Don't test signal handling if stdin not ok. ++ ++ <https://mail.gnu.org/archive/html/bug-rcs/2020-10/msg00014.html> ++ ++ * t632: If stdin is not open and connected to ++ a tty, skip the signal handling portion of the test. ++ + 2020-10-20 Thien-Thi Nguyen <ttn@gnu.org> + + Release: 5.10.0 +diff --git a/tests/t632 b/tests/t632 +index df6acc9..677ec8c 100644 +--- a/tests/t632 ++++ b/tests/t632 +@@ -40,6 +40,15 @@ echo | co -l -I $w \ + # (This is skipped if GNU coreutils timeout(1) is not available.) + ## + ++# <https://mail.gnu.org/archive/html/bug-rcs/2020-10/msg00014.html> ++# The timeout test needs co(1) to block on input. ++# If stdin is not open and connected to a tty, skip out. ++if test -t 0 ; then ++ echo STDIN OK ++else ++ exit 0 ++fi ++ + # TODO: Don't be lame! Pick one: + # (a) Mimic timeout(1) w/ sh commands. + # (b) Incorporate heart of timeout(1) into ./btdt and use that. +-- +cgit v1.2.1 + diff --git a/gnu/packages/patches/rcs-5.9.4-noreturn.patch b/gnu/packages/patches/rcs-5.9.4-noreturn.patch deleted file mode 100644 index 0c0c044ed5..0000000000 --- a/gnu/packages/patches/rcs-5.9.4-noreturn.patch +++ /dev/null @@ -1,94 +0,0 @@ -Builds with GCC-5 failed due to misplaced `_Noreturn (__attribute__((noreturn)))` -statement. - -Patch copied from upstream source repository: - -http://git.savannah.gnu.org/cgit/rcs.git/commit/?h=p&id=260704a9164dd34cf7128d6b1e88075ffa3be054 - -Upstream bug URL: - -https://savannah.gnu.org/bugs/?49568 - -commit 260704a9164dd34cf7128d6b1e88075ffa3be054 -Author: Thien-Thi Nguyen <ttn@gnu.org> -Date: Thu Jun 18 21:25:53 2015 +0200 - - [C slog] Move ‘exiting’ to beginning of func decl. - - Apparently, ‘gcc --std=c11’ does not abide the ‘exiting’ - attribute appearing at the end of the func decl. - Reported by Romain Francoise. - See also <https://bugs.debian.org/778100>. - - * src/b-complain.h (generic_fatal, fatal_syntax, fatal_sys) - * src/b-fb.h (Ierror, Oerror) - * src/base.h (unexpected_EOF, thank_you_and_goodnight): - Move ‘exiting’ attribute to beginning of func decl. - -diff --git a/src/b-complain.h b/src/b-complain.h -index 0ffd157..ea0ffc5 100644 ---- a/src/b-complain.h -+++ b/src/b-complain.h -@@ -32,12 +32,14 @@ extern void generic_warn (char const *who, char const *fmt, ...) - printf_string (2, 3); - extern void generic_error (char const *who, char const *fmt, ...) - printf_string (2, 3); -+exiting - extern void generic_fatal (char const *who, char const *fmt, ...) -- printf_string (2, 3) exiting; -+ printf_string (2, 3); -+exiting - extern void fatal_syntax (size_t lno, char const *fmt, ...) -- printf_string (2, 3) exiting; --extern void fatal_sys (char const *who) -- exiting; -+ printf_string (2, 3); -+exiting -+extern void fatal_sys (char const *who); - - /* Idioms. Here, prefix P stands for "program" (general operation); - M for "manifestation"; R for "repository". */ -diff --git a/src/b-fb.h b/src/b-fb.h -index c9850e7..bf5eaf8 100644 ---- a/src/b-fb.h -+++ b/src/b-fb.h -@@ -21,9 +21,11 @@ - */ - - extern int change_mode (int fd, mode_t mode); --extern void Ierror (void) exiting; -+exiting -+extern void Ierror (void); - extern void testIerror (FILE *f); --extern void Oerror (void) exiting; -+exiting -+extern void Oerror (void); - extern void testOerror (FILE *o); - extern FILE *fopen_safer (char const *filename, char const *type); - extern void Ozclose (FILE **p); -diff --git a/src/base.h b/src/base.h -index 163ee09..5e7a9f8 100644 ---- a/src/base.h -+++ b/src/base.h -@@ -755,8 +755,8 @@ int dorewrite (bool lockflag, int changed); - int donerewrite (int changed, time_t newRCStime); - void ORCSclose (void); - void ORCSerror (void); --void unexpected_EOF (void) -- exiting; -+exiting -+void unexpected_EOF (void); - void initdiffcmd (struct diffcmd *dc); - int getdiffcmd (struct fro *finfile, bool delimiter, - FILE *foutfile, struct diffcmd *dc); -@@ -831,8 +831,8 @@ char const *date2str (char const date[datesize], - char datebuf[datesize + zonelenmax]); - - /* rcsutil */ --void thank_you_and_goodnight (int const how) -- exiting; -+exiting -+void thank_you_and_goodnight (int const how); - /* These are for ‘thank_you_and_goodnight’. */ - #define TYAG_ORCSERROR (1 << 3) - #define TYAG_DIRTMPUNLINK (1 << 2) diff --git a/gnu/packages/patches/sbcl-geco-fix-organism-class.patch b/gnu/packages/patches/sbcl-geco-fix-organism-class.patch new file mode 100644 index 0000000000..817596241e --- /dev/null +++ b/gnu/packages/patches/sbcl-geco-fix-organism-class.patch @@ -0,0 +1,13 @@ +Fix the ORGANISM class so that SBCL >= 2.0.9 can compile it without error. + +--- a/classes.lisp 2020-10-28 12:11:10.725659464 +0100 ++++ b/classes.lisp 2020-10-31 17:34:36.822752447 +0100 +@@ -148,7 +148,7 @@ + :accessor score + :initarg :score + :initform 'nil +- :type number) ++ :type (or number null)) + (NORMALIZED-SCORE + :accessor normalized-score + :initarg :normalized-score diff --git a/gnu/packages/patches/u-boot-riscv64-fix-extlinux.patch b/gnu/packages/patches/u-boot-riscv64-fix-extlinux.patch index 29dec4f5e9..d6c1987718 100644 --- a/gnu/packages/patches/u-boot-riscv64-fix-extlinux.patch +++ b/gnu/packages/patches/u-boot-riscv64-fix-extlinux.patch @@ -32,9 +32,9 @@ Index: u-boot/configs/sifive_fu540_defconfig =================================================================== --- u-boot.orig/configs/sifive_fu540_defconfig +++ u-boot/configs/sifive_fu540_defconfig -@@ -12,3 +12,5 @@ CONFIG_DISPLAY_BOARDINFO=y - CONFIG_DEFAULT_DEVICE_TREE="hifive-unleashed-a00" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y +@@ -27,3 +27,5 @@ CONFIG_SPL_DM_SEQ_ALIAS=y + CONFIG_SPL_CLK=y CONFIG_DM_MTD=y + CONFIG_DM_RESET=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};" diff --git a/gnu/packages/patches/ungoogled-chromium-extension-search-path.patch b/gnu/packages/patches/ungoogled-chromium-extension-search-path.patch new file mode 100644 index 0000000000..5ce219ccc7 --- /dev/null +++ b/gnu/packages/patches/ungoogled-chromium-extension-search-path.patch @@ -0,0 +1,28 @@ +Look for extensions in $CHROMIUM_EXTENSION_DIRECTORY instead of +/usr/share/chromium/extensions. + +--- a/chrome/common/chrome_paths.cc ++++ b/chrome/common/chrome_paths.cc +@@ -4,6 +4,7 @@ + + #include "chrome/common/chrome_paths.h" + ++#include "base/environment.h" + #include "base/files/file_util.h" + #include "base/logging.h" + #include "base/native_library.h" +@@ -511,7 +512,13 @@ + #endif + #if defined(OS_LINUX) || defined(OS_CHROMEOS) + case chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS: { +- cur = base::FilePath(kFilepathSinglePrefExtensions); ++ std::unique_ptr<base::Environment> environment(base::Environment::Create()); ++ std::string extension_dir; ++ if (environment->GetVar("CHROMIUM_EXTENSION_DIRECTORY", &extension_dir)) { ++ cur = base::FilePath(extension_dir); ++ } else { ++ cur = base::FilePath(kFilepathSinglePrefExtensions); ++ } + break; + } + #endif diff --git a/gnu/packages/patches/yggdrasil-extra-config.patch b/gnu/packages/patches/yggdrasil-extra-config.patch new file mode 100644 index 0000000000..c21ca29a84 --- /dev/null +++ b/gnu/packages/patches/yggdrasil-extra-config.patch @@ -0,0 +1,86 @@ +diff --git a/cmd/yggdrasil/main.go b/cmd/yggdrasil/main.go +index 813e950..08d35cc 100644 +--- a/cmd/yggdrasil/main.go ++++ b/cmd/yggdrasil/main.go +@@ -40,11 +40,12 @@ type node struct { + admin module.Module // admin.AdminSocket + } + +-func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config.NodeConfig { ++func readConfig(useconf *bool, useconffile *string, extraconffile *string, normaliseconf *bool) *config.NodeConfig { + // Use a configuration file. If -useconf, the configuration will be read + // from stdin. If -useconffile, the configuration will be read from the + // filesystem. + var conf []byte ++ var extraconf []byte + var err error + if *useconffile != "" { + // Read the file from the filesystem +@@ -56,6 +57,21 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config + if err != nil { + panic(err) + } ++ if *extraconffile != "" { ++ extraconf, err = ioutil.ReadFile(*extraconffile); ++ } ++ if err != nil { ++ panic(err) ++ } ++ // Generate a new configuration - this gives us a set of sane defaults - ++ // then parse the configuration we loaded above on top of it. The effect ++ // of this is that any configuration item that is missing from the provided ++ // configuration will use a sane default. ++ cfg := config.GenerateConfig() ++ var confs [2][]byte ++ confs[0]=conf ++ confs[1]=extraconf ++ for _, conf := range confs { if len(conf)>0 { + // If there's a byte order mark - which Windows 10 is now incredibly fond of + // throwing everywhere when it's converting things into UTF-16 for the hell + // of it - remove it and decode back down into UTF-8. This is necessary +@@ -69,11 +85,6 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config + panic(err) + } + } +- // Generate a new configuration - this gives us a set of sane defaults - +- // then parse the configuration we loaded above on top of it. The effect +- // of this is that any configuration item that is missing from the provided +- // configuration will use a sane default. +- cfg := config.GenerateConfig() + var dat map[string]interface{} + if err := hjson.Unmarshal(conf, &dat); err != nil { + panic(err) +@@ -112,6 +123,7 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config + if err = mapstructure.Decode(dat, &cfg); err != nil { + panic(err) + } ++ }} + return cfg + } + +@@ -164,6 +176,7 @@ func main() { + genconf := flag.Bool("genconf", false, "print a new config to stdout") + useconf := flag.Bool("useconf", false, "read HJSON/JSON config from stdin") + useconffile := flag.String("useconffile", "", "read HJSON/JSON config from specified file path") ++ extraconffile := flag.String("extraconffile", "", "extra (usually private) HJSON/JSON config from specified file path") + normaliseconf := flag.Bool("normaliseconf", false, "use in combination with either -useconf or -useconffile, outputs your configuration normalised") + confjson := flag.Bool("json", false, "print configuration from -genconf or -normaliseconf as JSON instead of HJSON") + autoconf := flag.Bool("autoconf", false, "automatic mode (dynamic IP, peer with IPv6 neighbors)") +@@ -187,7 +200,7 @@ func main() { + cfg = config.GenerateConfig() + case *useconffile != "" || *useconf: + // Read the configuration from either stdin or from the filesystem +- cfg = readConfig(useconf, useconffile, normaliseconf) ++ cfg = readConfig(useconf, useconffile, extraconffile, normaliseconf) + // If the -normaliseconf option was specified then remarshal the above + // configuration and print it back to stdout. This lets the user update + // their configuration file with newly mapped names (like above) or to +@@ -332,7 +345,7 @@ func main() { + goto exit + case _ = <-r: + if *useconffile != "" { +- cfg = readConfig(useconf, useconffile, normaliseconf) ++ cfg = readConfig(useconf, useconffile, extraconffile, normaliseconf) + logger.Infoln("Reloading configuration from", *useconffile) + n.core.UpdateConfig(cfg) + n.tuntap.UpdateConfig(cfg) |