Debianize scripts

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: If168763ced7c37a5816cb10b9cd934dfac1dab87
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..ee8804a
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+modepolicy (2024.10) stable; urgency=medium
+
+  * Initial release. (Closes: #XXXXXX)
+
+ -- Dongjin Kim <tobetter@gmail.com>  Tue, 21 Nov 2023 22:17:12 +0000
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..e2c4c9c
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,31 @@
+Source: modepolicy
+Priority: optional
+Maintainer: Dongjin Kim <tobetter@gmail.com>
+Uploaders: Dongjin Kim <tobetter@gmail.com>
+Build-Depends:
+  cmake,
+  debhelper-compat (= 13),
+  libbsd-dev,
+  libdrm-dev,
+  libdrm-meson-dev,
+  pkg-config
+Standards-Version: 4.6.0
+
+Package: modepolicy
+Section: misc
+Architecture: linux-any
+Depends:
+  libdrm2,
+  libdrm-meson,
+  ${misc:Depends}
+Multi-Arch: same
+Description: ...
+
+Package: modepolicy-dev
+Section: misc
+Architecture: linux-any
+Depends:
+  modepolicy,
+  libdrm-dev,
+  libdrm-meson-dev
+Description: ...
diff --git a/debian/modepolicy-dev.install b/debian/modepolicy-dev.install
new file mode 100644
index 0000000..700b5c8
--- /dev/null
+++ b/debian/modepolicy-dev.install
@@ -0,0 +1,4 @@
+libs/modepolicy/include/*.h	usr/include/modepolicy/
+common/base/include/DrmTypes.h	usr/include/modepolicy/
+#usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/libdrm-helper-client.pc
+#usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/libweston-drm-helper.pc
diff --git a/debian/modepolicy.install b/debian/modepolicy.install
new file mode 100644
index 0000000..6259b67
--- /dev/null
+++ b/debian/modepolicy.install
@@ -0,0 +1 @@
+usr/lib/${DEB_HOST_MULTIARCH}/libmeson_mode_policy.so*
diff --git a/debian/not-installed b/debian/not-installed
new file mode 100644
index 0000000..5b0644d
--- /dev/null
+++ b/debian/not-installed
@@ -0,0 +1 @@
+usr/lib/${DEB_HOST_MULTIARCH}/*.la
diff --git a/debian/patches/0001-Fix-compile-error.patch b/debian/patches/0001-Fix-compile-error.patch
new file mode 100644
index 0000000..a0ef06a
--- /dev/null
+++ b/debian/patches/0001-Fix-compile-error.patch
@@ -0,0 +1,47 @@
+From 2ece756b15ca3b8ec290b1d94962ef95eb7b28bc Mon Sep 17 00:00:00 2001
+From: Dongjin Kim <tobetter@gmail.com>
+Date: Mon, 16 Dec 2024 05:28:05 +0000
+Subject: [PATCH] Fix compile error
+
+Signed-off-by: Dongjin Kim <tobetter@gmail.com>
+---
+ libs/modepolicy/CMakeLists.txt      | 2 +-
+ libs/modepolicy/include/mode_util.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: modepolicy/libs/modepolicy/CMakeLists.txt
+===================================================================
+--- modepolicy.orig/libs/modepolicy/CMakeLists.txt
++++ modepolicy/libs/modepolicy/CMakeLists.txt
+@@ -16,4 +16,4 @@ TARGET_LINK_LIBRARIES(meson_mode_policy
+ SET_TARGET_PROPERTIES(meson_mode_policy PROPERTIES SOVERSION 0 VERSION 0.0.0)
+ 
+ install(TARGETS meson_mode_policy LIBRARY DESTINATION ${LIB_DIR})
+-install(DIRECTORY include/ DESTINATION ${INCLUDE_DIR})
++#install(DIRECTORY include/ DESTINATION ${INCLUDE_DIR})
+Index: modepolicy/libs/modepolicy/include/mode_util.h
+===================================================================
+--- modepolicy.orig/libs/modepolicy/include/mode_util.h
++++ modepolicy/libs/modepolicy/include/mode_util.h
+@@ -88,7 +88,7 @@ extern "C" {
+ #define __unused __attribute__((__unused__))
+ #endif
+ 
+-#include <linux/amlogic/drm/meson_drm.h>
++#include <libdrm_meson/meson_drm.h>
+ #endif
+ 
+ int32_t meson_mode_write_sys(const char *path, const char *val);
+Index: modepolicy/common/base/include/DrmTypes.h
+===================================================================
+--- modepolicy.orig/common/base/include/DrmTypes.h
++++ modepolicy/common/base/include/DrmTypes.h
+@@ -11,7 +11,7 @@
+ #define DRM_TYPES_H
+ 
+ #include <stdint.h>
+-#include <drm/drm_mode.h>
++#include <libdrm_meson/drm_mode.h>
+ #include <xf86drm.h>
+ #include <xf86drmMode.h>
+ #include <string>
diff --git a/debian/patches/0002-add-missing-headers.patch b/debian/patches/0002-add-missing-headers.patch
new file mode 100644
index 0000000..3cba812
--- /dev/null
+++ b/debian/patches/0002-add-missing-headers.patch
@@ -0,0 +1,26 @@
+Index: modepolicy/libs/modepolicy/mode_policy.c
+===================================================================
+--- modepolicy.orig/libs/modepolicy/mode_policy.c
++++ modepolicy/libs/modepolicy/mode_policy.c
+@@ -7,6 +7,8 @@
+  * Description:
+  */
+ 
++#include <bsd/string.h>
++
+ #include "mode_policy.h"
+ #include "mode_private.h"
+ #include "mode_policy_parser.h"
+Index: modepolicy/libs/modepolicy/mode_util.c
+===================================================================
+--- modepolicy.orig/libs/modepolicy/mode_util.c
++++ modepolicy/libs/modepolicy/mode_util.c
+@@ -7,6 +7,8 @@
+  * Description:
+  */
+ 
++#include <sys/ioctl.h>
++
+ #include "mode_util.h"
+ 
+ int32_t meson_mode_write_sys(const char *path, const char *val) {
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..5b2e1eb
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+0001-Fix-compile-error.patch
+0002-add-missing-headers.patch
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..fea23b0
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,12 @@
+#!/usr/bin/make -f
+
+#export DH_VERBOSE=1
+
+override_dh_auto_configure:
+	dh_auto_configure --sourcedirectory=libs/modepolicy
+
+override_dh_auto_build:
+	dh_auto_build --sourcedirectory=libs/modepolicy
+
+%:
+	dh $@ --buildsystem=cmake --builddirectory=build/
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)