From 8d77b771139bae1a08fcabc39d106a9555b7470d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camille=20Moni=C3=A8re?= Date: Tue, 8 Feb 2022 18:50:43 +0100 Subject: [PATCH] Add packaging method --- .gitignore | 11 +++++++++++ README.MD | 6 ++++-- packages/debian/control | 7 +++++++ packages/debian/make_deb.sh | 10 ++++++++++ packages/hls-ap-types-arch/PKGBUILD | 28 ++++++++++++++++++++++++++++ packages/tarball/make_tarball.sh | 2 ++ packages/tarball/makefile | 15 +++++++++++++++ 7 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 packages/debian/control create mode 100644 packages/debian/make_deb.sh create mode 100644 packages/hls-ap-types-arch/PKGBUILD create mode 100644 packages/tarball/make_tarball.sh create mode 100644 packages/tarball/makefile diff --git a/.gitignore b/.gitignore index 29638ae..14de5ca 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,14 @@ # test folder test + +# packages +packages/tarball/*.tar.gz + +packages/debian/* +!packages/debian/control +!packages/debian/make_deb.sh +*.deb + +packages/hls-ap-types-arch/* +!packages/hls-ap-types-arch/PKGBUILD \ No newline at end of file diff --git a/README.MD b/README.MD index 662e999..7aff89d 100644 --- a/README.MD +++ b/README.MD @@ -18,7 +18,7 @@ Include the `ap_int.h` or `ap_fixed.h` in C++ code, and set compiler option to add the path of `include` directory in this repo into header search directory list. -``` +``` shell $ cd examples/ap_int $ g++ -I ../../include/ test.cpp $ ./a.out @@ -39,7 +39,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +``` text +http://www.apache.org/licenses/LICENSE-2.0 +``` Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/packages/debian/control b/packages/debian/control new file mode 100644 index 0000000..bcca208 --- /dev/null +++ b/packages/debian/control @@ -0,0 +1,7 @@ +Package: hls-ap-types +Version: 0.0.1 +Maintainer: Camille 'DrasLorus' Monière +Depends: +Architecture: all +Homepage: https://github.com/DrasLorus/HLS_arbitrary_Precision_Types +Description: AP Types for everyone diff --git a/packages/debian/make_deb.sh b/packages/debian/make_deb.sh new file mode 100644 index 0000000..1a12d01 --- /dev/null +++ b/packages/debian/make_deb.sh @@ -0,0 +1,10 @@ +#! /bin/sh +version="$(grep "Version" control | cut -d ' ' -f 2)" + +mkdir -p hls-ap-types_"$version"-1_all/usr/include/ap_types +cp -r ../../include hls-ap-types_"$version"-1_all/usr/include/ap_types + +mkdir -p hls-ap-types_"$version"-1_all/DEBIAN +cp control hls-ap-types_"$version"-1_all/DEBIAN + +dpkg --build hls-ap-types_"$version"-1_all \ No newline at end of file diff --git a/packages/hls-ap-types-arch/PKGBUILD b/packages/hls-ap-types-arch/PKGBUILD new file mode 100644 index 0000000..1e0ef6a --- /dev/null +++ b/packages/hls-ap-types-arch/PKGBUILD @@ -0,0 +1,28 @@ +# This is an example PKGBUILD file. Use this as a start to creating your own, +# and remove these comments. For more information, see 'man PKGBUILD'. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Maintainer: Your Name +pkgname=hls-ap-types +pkgver=0.0.1.rc1 +pkgrel=1 + +pkgdesc="AP types for everyone" +arch=('any') +url="https://github.com/DrasLorus/HLS_arbitrary_Precision_Types" +license=('apache2.0') + +source=("$pkgname-$pkgver::https://github.com/DrasLorus/HLS_arbitrary_Precision_Types/releases/download/v0.0.1-RC1/hls-ap-types-0.0.1-RC1.tar.gz") + +sha256sums=('f3efea6d742bac7cb99d9b4b7ff718ce82a5f9c6d9f7a4334aca9750ad7cd9fd') + + +package() { + cd "$srcdir" + + _files="$(find include -name .h)" + + make PREFIX="${pkgdir}" install + install -dvm644 "${pkgdir}/usr/share/licenses/hls-ap-types/LICENSE" LICENSE.txt +} diff --git a/packages/tarball/make_tarball.sh b/packages/tarball/make_tarball.sh new file mode 100644 index 0000000..1148dce --- /dev/null +++ b/packages/tarball/make_tarball.sh @@ -0,0 +1,2 @@ +#! /bin/sh +tar -cvzf hls-ap-types-0.0.1-RC1.tar.gz ../../include makefile ../../LICENSE.TXT \ No newline at end of file diff --git a/packages/tarball/makefile b/packages/tarball/makefile new file mode 100644 index 0000000..9d6d1f8 --- /dev/null +++ b/packages/tarball/makefile @@ -0,0 +1,15 @@ +files:=$(wildcard include/*.h) +files+=include/etc/ap_private.h + +all: install + +install: + @install -dvm755 $(PREFIX)/usr/include/ap_types + @install -vm644 -t $(PREFIX)/usr/include/ap_types/ $(files) + @ln -vs ap_types/ap_fixed.h $(PREFIX)/usr/include/ap_fixed.h + @ln -vs ap_types/ap_int.h $(PREFIX)/usr/include/ap_int.h + +uninstall: + unlink $(PREFIX)/usr/include/ap_fixed.h + unlink $(PREFIX)/usr/include/ap_int.h + @rm -rv $(PREFIX)/usr/include/ap_types \ No newline at end of file