diff --git a/.gitignore b/.gitignore index db030ca..e04a1b9 100644 --- a/.gitignore +++ b/.gitignore @@ -84,4 +84,11 @@ compile_commands.json # End of https://www.toptal.com/developers/gitignore/api/c++,meson,visualstudiocode -doc/* \ No newline at end of file +doc/* + +debian/.debhelper +debian/.snake-clone +debian/snake-clone.substvars +debian/files +debian/snake-clone +debian/debhelper-build-stamp \ No newline at end of file diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..007917f --- /dev/null +++ b/config.h.in @@ -0,0 +1 @@ +#define PROJECT_NAME_STR string("@name@") \ No newline at end of file diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..3bee26c --- /dev/null +++ b/debian/changelog @@ -0,0 +1,11 @@ +snake-clone (1.0.0-1ubuntu1) hirsute; urgency=medium + + * stage file + + -- Jinseok Kim Wed, 09 Jun 2021 14:06:03 +0900 + +snake-clone (1.0.0-1) hirsute; urgency=medium + + * Initial release + + -- Jinseok Kim Wed, 09 Jun 2021 13:31:15 +0900 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..653c824 --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: snake-clone +Section: unknown +Priority: optional +Maintainer: Jinseok Kim +Build-Depends: debhelper-compat (= 13), libncurses-dev, libncurses5-dev +Standards-Version: 4.5.1 +#Vcs-Browser: https://github.com/fmowl10/snake-clone +Vcs-Git: https://gihtub.com/fmowl10/snake-clone.git +Rules-Requires-Root: no + +Package: snake-clone +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: snake-clone for Kookmin university C++ project diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..0fd42bd --- /dev/null +++ b/debian/copyright @@ -0,0 +1,31 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: snake-clone +Upstream-Contact: +Source: https://gihtub.com/fmowl10/snake-clone.git + +Files: * +Copyright: 2021 Kim Jinseok + 2021 Kim Jeaha +License: MIT + +MIT License + +Copyright (c) 2021 fmowl10 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e462a81 --- /dev/null +++ b/debian/rules @@ -0,0 +1,25 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +%: + dh $@ --buildsystem=meson + + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- \ +# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/meson.build b/meson.build index f9f1ceb..c813e27 100644 --- a/meson.build +++ b/meson.build @@ -2,4 +2,13 @@ project('snake-clone', 'cpp', version:'0.0.1') src=['src/board.cpp', 'src/main.cpp', 'src/snake.cpp',] dep=[dependency('ncurses')] -executable(meson.project_name(), src, dependencies:dep) \ No newline at end of file +conf_data = configuration_data() +conf_data.set('name', meson.project_name()) + +configure_file(input : 'config.h.in', output : 'config.h', configuration: conf_data) +conf_inc = include_directories('.') + + +install_data(['stage-1.map', 'stage-2.map', 'stage-3.map', 'stage-4.map', 'stage-5.map' ]) +executable(meson.project_name(), src, dependencies:dep, install:true, include_directories : conf_inc) + diff --git a/src/main.cpp b/src/main.cpp index aefa397..d82b5a0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,5 @@ #include "board.h" +#include #include #include #include @@ -9,6 +10,15 @@ #define STAGECOUNT 5 using namespace std; +#ifndef DEBUG +const string StageFile[STAGECOUNT] = { + "/usr/share/" + string(PROJECT_NAME_STR) + "/stage-1.map", + "/usr/share/" + string(PROJECT_NAME_STR) + "/stage-2.map", + "/usr/share/" + string(PROJECT_NAME_STR) + "/stage-3.map", + "/usr/share/" + string(PROJECT_NAME_STR) + "/stage-4.map", + "/usr/share/" + string(PROJECT_NAME_STR) + "/stage-5.map", +}; +#else const string StageFile[STAGECOUNT] = { "stage-1.map", "stage-2.map", @@ -16,6 +26,7 @@ const string StageFile[STAGECOUNT] = { "stage-4.map", "stage-5.map", }; +#endif const char *stageClearMessage = "you clear stage %d press any button to start next stage"; const char *gameClearMessage = "you clear the game press any button to exit the game";