Skip to content

Commit 295bb42

Browse files
Merge pull request #29 from sio2project/Michcioperz-master
Debian packaging v2 Co-authored-by: Michał Sidor <[email protected]>
2 parents 369317c + b9672ba commit 295bb42

16 files changed

+197
-10
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
boxes/

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,17 @@ pin.log
2121
.idea
2222
.cache
2323
__pycache__
24+
25+
debian/.debhelper/
26+
debian/debhelper-build-stamp
27+
debian/files
28+
debian/*.substvars
29+
debian/sio2jail/
30+
obj-*/
31+
ccache/
32+
install/
33+
obj-x86*
34+
out/
35+
36+
.vscode/
37+
.devcontainer/

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ ENDIF()
1313
IF(NOT DEFINED ARCH)
1414
SET(ARCH "NATIVE")
1515
ENDIF()
16-
IF(NOT ARCH MATCHES "i386|x86_64|NATIVE")
17-
MESSAGE(FATAL_ERROR "ARCH should be one of i386, x86_64, NATIVE")
16+
IF(NOT ARCH MATCHES "i386|x86_64|amd64|NATIVE")
17+
MESSAGE(FATAL_ERROR "ARCH should be one of i386, amd64, NATIVE")
1818
ENDIF()
1919

2020
IF(NOT DEFINED WITH_CLANG_TIDY)
@@ -43,7 +43,7 @@ ENDIF()
4343
IF(ARCH STREQUAL "i386")
4444
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
4545
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
46-
ELSEIF(ARCH STREQUAL "x86_64")
46+
ELSEIF(ARCH MATCHES "amd64|x86_64")
4747
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
4848
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
4949
ENDIF()

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM debian:bullseye
2+
3+
RUN apt-get update && \
4+
export DEBIAN_FRONTEND=noninteractive && \
5+
apt-get install -y \
6+
build-essential \
7+
libcap-dev \
8+
libtclap-dev \
9+
libseccomp-dev \
10+
libseccomp2 \
11+
cmake \
12+
g++-multilib \
13+
gcc-multilib \
14+
wget \
15+
devscripts \
16+
lintian \
17+
debhelper \
18+
ccache \
19+
fakeroot
20+
21+
ENV LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
22+
ENV DEB_BUILD_OPTIONS "lang=en-US ccache nocheck"
23+
WORKDIR /app
24+
CMD ["/bin/bash"]

Makefile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
CC := g++
2+
INSTALL_PREFIX = $(HOME)/.local
3+
CONTAINER_NAME = sio2jail-dev-container
4+
CCACHE := $(shell ccache --version 2>/dev/null)
5+
6+
ifdef CCACHE
7+
CC := ccache
8+
endif
9+
10+
define run_in_docker
11+
docker build -t sio2jail-dev .
12+
- docker run -v $(shell pwd)/ccache:/ccache -v $(shell pwd):/app -e CCACHE_DIR=/ccache --rm --name $(CONTAINER_NAME) -d -it sio2jail-dev bash
13+
docker exec $(CONTAINER_NAME) $(1)
14+
docker exec $(CONTAINER_NAME) rm -rf build
15+
docker stop $(CONTAINER_NAME)
16+
endef
17+
18+
install: clean
19+
mkdir -p ccache
20+
mkdir -p ccache/tmp
21+
cmake -DCMAKE_CXX_COMPILER_LAUNCHER=$(CC) -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) . -B ./build
22+
make -C build
23+
make -C build install
24+
25+
deb:
26+
mkdir -p out
27+
fakeroot debuild -us -uc -b
28+
mv ../*.deb out/
29+
30+
release: install deb
31+
mkdir -p out
32+
mv $(INSTALL_PREFIX)/bin/sio2jail out/
33+
34+
release-docker: clean-docker
35+
$(call run_in_docker,make release)
36+
37+
install-docker: clean-docker
38+
$(call run_in_docker,make install)
39+
40+
deb-docker: clean-docker
41+
$(call run_in_docker,make deb)
42+
43+
test:
44+
make -C build check
45+
46+
clean:
47+
- rm -rf build
48+
- rm -rf out
49+
- rm -rf obj-*
50+
- rm -rf install
51+
- rm -rf bin
52+
- rm -rf debian/.debhelper
53+
- rm -rf debian/sio2jail
54+
- rm debian/files
55+
- rm debian/sio2jail.substvars
56+
57+
clean-docker:
58+
- docker run -v $(shell pwd):/app --rm --name $(CONTAINER_NAME) -d -it sio2jail-dev bash
59+
docker exec $(CONTAINER_NAME) make clean

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
sio2jail
22
========
33

4+
Building in Docker
5+
--------
6+
7+
Available commands:
8+
9+
* `make release-docker ` - build sio2jail binary and
10+
.deb package.
11+
12+
* `make install-docker` - build sio2jail binary.
13+
14+
* `make deb-docker` - build sio2jail .deb package.
415

5-
building
16+
* `make clean-docker` - clean up all temporary files.
17+
18+
The output files are placed in `./out/` directory.
19+
20+
For further reference and configuration see `./Makefile`.
21+
22+
Building manually
623
--------
724

825
You need a CMake, a C/C++ compiler with multilib support and python2. Any
@@ -15,6 +32,9 @@ install files to ~/local directory run:
1532
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/local ..
1633
make && make install
1734

35+
For building with default configuration, see scripts in
36+
`./Makefile`.
37+
1838
Our sio2jail uses some external libraries and programs:
1939
* libcap
2040
* libseccomp (>= 2.3.0)
@@ -55,7 +75,7 @@ option (STATIC by default):
5575
There is also a possibility to control whether output binary should run on other
5676
architecture than the default one (or force given architecture):
5777

58-
-DARCH=i386|x86_64
78+
-DARCH=i386|amd64
5979

6080
Note, that when using ARCH other than build host architecture it may be necessary
6181
(depending on libraries installation) to build sio2jail with custom libseccomp (more
@@ -66,7 +86,7 @@ ignore system libseccomp run:
6686

6787
cmake -DWITH_DOCS=NO -DLIBTCLAP_PREFIX=/opt/tclap -DLIBSECCOMP_BUILD_OWN=YES ..
6888

69-
running
89+
Running
7090
-------
7191

7292
You may need to run
@@ -80,14 +100,14 @@ Additionally, if you want to use sandboxing on older Debian kernels, you'll need
80100
For both settings, you may also put these options in your /etc/sysctl.conf.
81101
This will make the settings persist across reboots.
82102

83-
running tests
103+
Running tests
84104
-------------
85105

86106
To run test suit use 'check' target, e.g in build directory run:
87107

88108
make check
89109

90-
notes for developers
110+
Notes for developers
91111
--------------------
92112

93113
To manually run clang-format on each file run:

debian/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../README.md

debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sio2jail (1.4.3) UNRELEASED; urgency=medium
2+
3+
* Initial Release.
4+
5+
-- Michał Sidor <[email protected]> Sun, 12 Jan 2020 15:24:25 +0100

debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
11

debian/control

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Source: sio2jail
2+
Section: utils
3+
Priority: optional
4+
Maintainer: Oi Admins <[email protected]>
5+
Build-Depends: debhelper (>= 11), cmake
6+
Standards-Version: 4.1.3
7+
Homepage: https://github.com/sio2project/sio2jail
8+
Vcs-Browser: https://github.com/sio2project/sio2jail
9+
Vcs-Git: https://github.com/sio2project/sio2jail.git
10+
11+
Package: sio2jail
12+
Architecture: any
13+
Depends: ${shlibs:Depends}, ${misc:Depends}
14+
Description: Sandbox for programming contests.
15+
A tool for supervising execution of programs
16+
submitted in algorithmic competitions.

debian/copyright

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Wojciech Dubiel, Tadeusz Dudkiewicz, Przemysław Jakub Kozłowski, Maciej Wachulec
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

debian/rules

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/make -f
2+
3+
#export DH_VERBOSE = 1
4+
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
5+
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
6+
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
7+
8+
%:
9+
dh $@ --buildsystem=cmake
10+
11+
CCACHE := $(shell ccache --version 2>/dev/null)
12+
ifdef CCACHE
13+
CC := ccache
14+
endif
15+
16+
OPTIONS = -DCMAKE_BUILD_TYPE=Release -DARCH=$(DEB_TARGET_ARCH) -DCMAKE_CXX_COMPILER_LAUNCHER=$(CC) -DWITH_DOCS=YES
17+
DEPENDENCIES_CONFIG = -DLINK=STATIC -DLIBCAP_BUILD_OWN=YES -DLIBSECCOMP_BUILD_OWN=YES -DLIBTCLAP_BUILD_OWN=YES -DSCDOC_BUILD_OWN=YES
18+
19+
override_dh_auto_configure:
20+
dh_auto_configure -- $(OPTIONS) $(DEPENDENCIES_CONFIG)
21+
22+
override_dh_auto_test:
23+
echo Tests skipped

debian/sio2jail-docs.docs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
README

debian/source/format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (native)

doc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ ADD_CUSTOM_COMMAND(OUTPUT sio2jail.1
44

55
ADD_CUSTOM_TARGET(doc ALL DEPENDS sio2jail.1 scdoc)
66

7-
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sio2jail.1 DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}")
7+
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sio2jail.1 DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}/man1")

src/s2japp/ApplicationSettings.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class StringOutputGenerator : public TCLAP::StdOutput {
8181
namespace s2j {
8282
namespace app {
8383

84-
const std::string ApplicationSettings::VERSION = "1.4.2";
84+
const std::string ApplicationSettings::VERSION = "1.4.3";
8585

8686
const std::string ApplicationSettings::DESCRIPTION =
8787
"SIO2jail, a sandbox for programming contests.";

0 commit comments

Comments
 (0)