Initially packaging works for syzkaller

Signed-off-by: Yunseong Kim <ysk...@gmail.com>
---
 debian/.gitignore    |  3 ++
 debian/changelog     |  5 +++
 debian/compat        |  1 +
 debian/control       | 12 +++++++
 debian/copyright     | 26 ++++++++++++++
 debian/files         |  2 ++
 debian/rules         | 84 ++++++++++++++++++++++++++++++++++++++++++++
 debian/source/format |  1 +
 8 files changed, 134 insertions(+)
 create mode 100644 debian/.gitignore
 create mode 100644 debian/changelog
 create mode 100644 debian/compat
 create mode 100644 debian/control
 create mode 100644 debian/copyright
 create mode 100644 debian/files
 create mode 100755 debian/rules
 create mode 100644 debian/source/format

diff --git a/debian/.gitignore b/debian/.gitignore
new file mode 100644
index 000000000..29aca38cb
--- /dev/null
+++ b/debian/.gitignore
@@ -0,0 +1,3 @@
+syzkaller/
+syzkaller.substvars
+syzkaller.debhelper.log
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 000000000..e4d028bb5
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+syzkaller (20240826+e4f3ea1bc2e0) unstable; urgency=medium
+
+  * New upstream release)
+
+ -- Yunseong Kim <ysk...@gmail.com>  Sat, 24 Aug 2024 14:47:08 +0800
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 000000000..ec635144f
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 000000000..8cc29056b
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,12 @@
+Source: syzkaller
+Section: main
+Priority: optional
+Maintainer: Yunseong Kim <ysk...@gmail.com>
+Build-Depends: debhelper (>= 9), dh-golang, golang-go:native (>= 1.3.0)
+Standards-Version: 3.9.6
+
+Package: syzkaller
+Architecture: arm64
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Built-Using: ${misc:Built-Using}
+Description: syzkaller is an unsupervised coverage-guided kernel fuzzer
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 000000000..855f4c5bf
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,26 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: syzkaller
+Source: https://github.com/google/syzkaller
+
+Files: *
+Copyright: 2024 Yunseong Kim
+License: Apache License 2.0
+ Copyright (c) 2024 Yunseong Kim
+ .
+ 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/files b/debian/files
new file mode 100644
index 000000000..d77937778
--- /dev/null
+++ b/debian/files
@@ -0,0 +1,2 @@
+syzkaller_20240826+e4f3ea1bc2e0_arm64.buildinfo main optional
+syzkaller_20240826+e4f3ea1bc2e0_arm64.deb main optional
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 000000000..eacb4e9a5
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,84 @@
+#!/usr/bin/make -f
+
+export DH_OPTIONS
+
+##
+# From git-lfs/git-lfs repo:
+# Looks like dh_golang doesn't set diffrent archs, so you have to do them 
semi-manually.
+##
+
+## This if-structure is decided on what is passed by the -a flag by 
dpkg-buildpackage command.
+ifeq ($(DEB_HOST_ARCH), i386)
+       export GOARCH := 386
+else ifeq ($(DEB_HOST_ARCH), amd64)
+       export GOARCH := amd64
+else ifeq ($(DEB_HOST_ARCH), armhf)
+       export GOARCH := arm
+       # May need to set GOARM as well if your going to target ARM. But for 
now this works.
+else ifeq ($(DEB_HOST_ARCH), arm64)
+       export GOARCH := arm64
+endif
+
+# Or add your arch that your targeting, these are just examples.
+
+# Directory where compiled binary is placed + debian setup files. 
+# Note: If your doing building thru git, you may want to add obj-* to 
.gitignore
+BUILD_DIR := obj-$(DEB_HOST_GNU_TYPE)
+
+# Required: Put the url (without http://) of your git repo.
+export DH_GOPKG := github.com/google/syzkaller
+
+# Required: Put the name of your git repo below. 
+GIT_REPO_NAME := syzkaller
+
+export PATH := $(CURDIR)/$(BUILD_DIR)/bin:$(PATH)
+
+##
+# by-default, dh_golang only copies *.go and other source - this upsets a 
bunch of vendor test routines
+##
+export DH_GOLANG_INSTALL_ALL := 1
+
+%:
+       dh $@ --buildsystem=golang --with=golang 
+
+override_dh_clean:
+       rm -f debian/debhelper.log
+       dh_clean
+
+override_dh_auto_build:
+       #dh_auto_build
+       make CFLAGS=""
+       ##
+       # From git-lfs/git-lfs repo:
+       # dh_golang doesn't do anything here in deb 8, and it's needed in both
+       ##
+       if [ "$(DEB_HOST_GNU_TYPE)" != "$(DEB_BUILD_GNU_TYPE)" ]; then\
+               cp -rf $(BUILD_DIR)/bin/*/* $(BUILD_DIR)/bin/; \
+       fi
+
+override_dh_strip:
+       ##
+       # From git-lfs/git-lfs repo:
+       # strip disabled as golang upstream doesn't support it and it makes go 
crash.
+       # See https://launchpad.net/bugs/1200255.
+       ##
+
+override_dh_golang:
+       ##
+       # From git-lfs/git-lfs repo:
+       # The dh_golang is used to add the Built-using field to the deb.  This 
is only for reference.
+       # As of 
https://anonscm.debian.org/cgit/collab-maint/dh-golang.git/commit/script/dh_golang?id=7c3fbec6ea92294477fa8910264fe9bd823f21c3
+       # dh_golang errors out because the go compiler used was not installed 
via a package.  Therefore the step is skipped
+       ##
+
+override_dh_auto_test:
+       make -j1 test
+
+override_dh_auto_install:
+       # This is making a "fakeroot" so that when the deb is installed the 
binary will be placed in /usr/bin.
+       mkdir -p debian/$(GIT_REPO_NAME)/usr/bin/
+       mkdir -p debian/$(GIT_REPO_NAME)/usr/share/doc/syzkaller/
+       # This is copying the binary and placing it in the fake root path.
+       cp -r docs/ debian/$(GIT_REPO_NAME)/usr/share/doc/syzkaller/
+       cp bin/*_*/syz-* bin/syz-* debian/$(GIT_REPO_NAME)/usr/bin/
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 000000000..89ae9db8f
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
-- 
2.43.0

Reply via email to