apk packages and minor changes
parent
fb51215cbc
commit
9fdb5bd957
3
Makefile
3
Makefile
|
@ -1,9 +1,10 @@
|
|||
|
||||
name = xz
|
||||
version = 5.2.4
|
||||
version = 5.2.5
|
||||
URL = https://tukaani.org/xz/xz-$(version).tar.xz
|
||||
|
||||
patches = file1.patch file2.patch
|
||||
conflicts =
|
||||
|
||||
# for test purposes
|
||||
SYSCONF=.
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# This script creates:
|
||||
# - a control.tar.gz containing the .PKGINFO file
|
||||
# - compressed data in the file 'data.tar.gz'
|
||||
# - a signature file
|
||||
# remember to create your own RSA keys with "abuild-keygen -a"
|
||||
# - the final .apk package
|
||||
|
||||
msg(){
|
||||
echo -e "\e[31m>>\e[0m $*"
|
||||
}
|
||||
|
||||
apk="$1"
|
||||
gzip="gzip"
|
||||
|
||||
set -e
|
||||
|
||||
# (in case of multiple runs of this script within the same directory)
|
||||
sed "/datahash =/d" .PKGINFO > .PKGINFO.new
|
||||
mv .PKGINFO.new .PKGINFO
|
||||
|
||||
# data.tar.gz
|
||||
set -- *
|
||||
|
||||
SOURCE_DATE_EPOCH=$(date -u "+%s")
|
||||
# normalize timestamps
|
||||
find . -exec touch -h -d "@$SOURCE_DATE_EPOCH" {} +
|
||||
|
||||
file_list=$(ls | grep -vE "(data.*|control.*)")
|
||||
tar --xattrs -f - -c ${file_list} | abuild-tar --hash | $gzip -9 >data.tar.gz
|
||||
|
||||
msg "Create checksum..."
|
||||
# append the hash for data.tar.gz
|
||||
sha256=$(sha256sum data.tar.gz | cut -f1 -d' ')
|
||||
echo "datahash = $sha256" >> .PKGINFO
|
||||
|
||||
# control.tar.gz
|
||||
tar \
|
||||
--format=posix \
|
||||
--pax-option=exthdr.name=%d/PaxHeaders/%f,atime:=0,ctime:=0 \
|
||||
--mtime="@${SOURCE_DATE_EPOCH}" \
|
||||
-f - -c .PKGINFO | abuild-tar --cut \
|
||||
| $gzip -n -9 > control.tar.gz
|
||||
abuild-sign -q control.tar.gz || exit 1
|
||||
|
||||
msg "Create $apk"
|
||||
cat control.tar.gz data.tar.gz > $apk
|
||||
|
||||
rm data.* 2>/dev/null || :
|
||||
rm control.* 2>/dev/null || :
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This script creates the .PKGINFO file required by apk.
|
||||
|
||||
du_sk=$(du -sk . | sed "s/[ \t].*//g")
|
||||
size=$(echo "$du_sk * 1000" | bc)
|
||||
|
||||
cat <<END >.PKGINFO
|
||||
# Generated by 'create-package'.
|
||||
pkgname = ${name}
|
||||
pkgver = ${version}-r${release}
|
||||
url = ${URL}
|
||||
size = $size
|
||||
origin =
|
||||
buildtype = host
|
||||
builddate = $(date "+%s")
|
||||
END
|
||||
|
||||
for atom in ${dependencies}; do
|
||||
echo "depend = ${atom}" >> .PKGINFO
|
||||
done
|
||||
|
||||
for atom in ${provides}; do
|
||||
echo "provides = ${atom}" >> .PKGINFO
|
||||
done
|
||||
|
||||
for atom in ${conflicts}; do
|
||||
echo "conflicts = ${atom}" >> .PKGINFO
|
||||
done
|
|
@ -2,9 +2,29 @@
|
|||
|
||||
package=$1
|
||||
|
||||
tar cvf data.tar .
|
||||
zstd --ultra data.tar
|
||||
rm data.tar
|
||||
create-manifest > package-manifest
|
||||
create-meta > package-info
|
||||
tar cvf $package package-manifest package-info data.tar.zst
|
||||
# These functions transform the current directory into a full-blown baguette or apk package.
|
||||
baguette(){
|
||||
package=$1
|
||||
|
||||
tar cvf data.tar .
|
||||
zstd --ultra data.tar
|
||||
rm data.tar
|
||||
create-manifest > package-manifest
|
||||
create-meta > package-info
|
||||
tar cvf $package package-manifest package-info data.tar.zst
|
||||
}
|
||||
|
||||
apk(){
|
||||
create-apk-pkginfo
|
||||
create-apk-package $1
|
||||
}
|
||||
|
||||
case x-$PACKAGE_MANAGER in
|
||||
x-baguette) echo "Create Baguette package '${package}'" ; baguette "${package}" ;;
|
||||
x-apk) echo "Create apk package '${package}'" ; apk "${package}" ;;
|
||||
x-*)
|
||||
echo "package manager '${PACKAGE_MANAGER}' not recognized" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Usage: create-split-src
|
||||
|
||||
# Currently in ${pkg_fake_root_dir}
|
||||
# Should send files in ${pkg_fake_root_src_dir}
|
||||
|
||||
# First, list files
|
||||
find . | while read F; do
|
||||
done
|
78
package.mk
78
package.mk
|
@ -1,5 +1,9 @@
|
|||
# Preferences, default environment.
|
||||
|
||||
# TODO:
|
||||
# - install build dependencies
|
||||
# - chroot build
|
||||
|
||||
# Used by default for working directory and log file names
|
||||
gen_uuid != uuidgen
|
||||
|
||||
|
@ -21,6 +25,8 @@ patches ?=
|
|||
|
||||
Q ?= @
|
||||
|
||||
JOBS ?= 1
|
||||
|
||||
release ?= 0
|
||||
|
||||
export SLOT PREFIX BINDIR LIBDIR SHAREDIR INCLUDEDIR MANDIR
|
||||
|
@ -47,11 +53,7 @@ CMAKE_OPTIONS_USER ?=
|
|||
CMAKE_OPTIONS ?= "-DCMAKE_INSTALL_PREFIX="$(PREFIX) \
|
||||
"-DCMAKE_BUILD_TYPE=Release" \
|
||||
$(CMAKE_OPTIONS_USER) \
|
||||
"-- -j"$(BUILD_CORES)
|
||||
|
||||
PACKAGE_MANAGER ?= baguette # Available: baguette, apk
|
||||
|
||||
BUILD_CORES ?= 1
|
||||
"-- -j"$(JOBS)
|
||||
|
||||
tarballs_directory = /tmp/src# where to store package sources
|
||||
repository_directory = /tmp/pkg# local package repository
|
||||
|
@ -73,7 +75,14 @@ bdir ?= $(pkg_build_dir)
|
|||
auto_ext != echo $(URL) | grep -oE "(zip|tar.xz|tar.gz)$$"
|
||||
ext ?= $(auto_ext)
|
||||
|
||||
baguette_ext := baguette
|
||||
|
||||
PACKAGE_MANAGER ?= baguette # Available: baguette, apk
|
||||
export PACKAGE_MANAGER
|
||||
|
||||
package_ext := baguette
|
||||
ifeq ($(PACKAGE_MANAGER), apk)
|
||||
package_ext := apk
|
||||
endif
|
||||
|
||||
download_tool ?= wget
|
||||
|
||||
|
@ -221,7 +230,7 @@ fake_root_install: create_fake_root_dir pre_fake_root_install fake_root_install_
|
|||
export name version release
|
||||
export URL description dependencies conflicts provides patches
|
||||
|
||||
package_base = $(repository_directory)/$(ARCH)/$(name)-$(version)-r$(release).$(baguette_ext)
|
||||
package_base = $(repository_directory)/$(ARCH)/$(name)-$(version)-r$(release).$(package_ext)
|
||||
package_base: $(package_base)
|
||||
$(package_base):
|
||||
@echo "Packaging $@"
|
||||
|
@ -240,57 +249,70 @@ extract_src_zip:
|
|||
extract_src_tar.%:
|
||||
$(Q)cd $(pkg_fake_root_src_dir) && tar xf $(tarball)
|
||||
|
||||
package_src = $(repository_directory)/$(ARCH)/$(name)-src-$(version)-r$(release).$(baguette_ext)
|
||||
package_src = $(repository_directory)/$(ARCH)/$(name)-src-$(version)-r$(release).$(package_ext)
|
||||
package_src: create_fake_root_src_dir extract_src_$(ext) $(package_src)
|
||||
$(package_src):
|
||||
@echo "Packaging $@"
|
||||
@-cd $(pkg_fake_root_src_dir) ; for F in `ls data* 2>/dev/null` ; do rm $F ; done; :
|
||||
$(Q)cp -v $(patches) $(pkg_fake_root_src_dir)
|
||||
$(Q)[ ! -z "$(patches)" ] && cp -v $(patches) $(pkg_fake_root_src_dir) || :
|
||||
$(Q)cd $(pkg_fake_root_src_dir) && dependencies="" conflicts="" provides="" create-package $@ \
|
||||
>> $(log_file).info 2>> $(log_file).err
|
||||
|
||||
package_doc = $(repository_directory)/$(ARCH)/$(name)-doc-$(version)-r$(release).$(baguette_ext)
|
||||
package_doc = $(repository_directory)/$(ARCH)/$(name)-doc-$(version)-r$(release).$(package_ext)
|
||||
package_doc: $(package_doc)
|
||||
$(package_doc):
|
||||
@echo "Packaging $@"
|
||||
$(Q)cd $(pkg_fake_root_dir) && create-split-doc >> $(log_file).info 2>> $(log_file).err
|
||||
@-cd $(pkg_fake_root_doc_dir) ; for F in `ls data* 2>/dev/null` ; do rm $F ; done; :
|
||||
$(Q)cd $(pkg_fake_root_doc_dir) && dependencies="" conflicts="" provides="" create-package $@ \
|
||||
>> $(log_file).info 2>> $(log_file).err
|
||||
$(Q)[ -d "$(pkg_fake_root_doc_dir)" ] && ( \
|
||||
cd $(pkg_fake_root_doc_dir) ; \
|
||||
for F in `ls data* 2>/dev/null` ; do rm $F ; done; : ; \
|
||||
dependencies="" conflicts="" provides="" create-package $@ \
|
||||
>> $(log_file).info 2>> $(log_file).err \
|
||||
) ; :
|
||||
|
||||
package_man = $(repository_directory)/$(ARCH)/$(name)-man-$(version)-r$(release).$(baguette_ext)
|
||||
package_man = $(repository_directory)/$(ARCH)/$(name)-man-$(version)-r$(release).$(package_ext)
|
||||
package_man: $(package_man)
|
||||
$(package_man):
|
||||
@echo "Packaging $@"
|
||||
$(Q)cd $(pkg_fake_root_dir) && create-split-man >> $(log_file).info 2>> $(log_file).err
|
||||
@-cd $(pkg_fake_root_man_dir) ; for F in `ls data* 2>/dev/null` ; do rm $F ; done; :
|
||||
$(Q)cd $(pkg_fake_root_man_dir) && dependencies="" conflicts="" provides="" create-package $@ \
|
||||
>> $(log_file).info 2>> $(log_file).err
|
||||
$(Q)[ -d "$(pkg_fake_root_man_dir)" ] && ( \
|
||||
cd $(pkg_fake_root_man_dir) ; \
|
||||
for F in `ls data* 2>/dev/null` ; do rm $F ; done; : ; \
|
||||
dependencies="" conflicts="" provides="" create-package $@ \
|
||||
>> $(log_file).info 2>> $(log_file).err \
|
||||
) ; :
|
||||
|
||||
package_dev = $(repository_directory)/$(ARCH)/$(name)-dev-$(version)-r$(release).$(baguette_ext)
|
||||
package_dev = $(repository_directory)/$(ARCH)/$(name)-dev-$(version)-r$(release).$(package_ext)
|
||||
package_dev: $(package_dev)
|
||||
$(package_dev):
|
||||
@echo "Packaging $@"
|
||||
$(Q)cd $(pkg_fake_root_dir) && create-split-dev >> $(log_file).info 2>> $(log_file).err
|
||||
@-cd $(pkg_fake_root_dev_dir) ; for F in `ls data* 2>/dev/null` ; do rm $F ; done; :
|
||||
$(Q)cd $(pkg_fake_root_dev_dir) && dependencies="" conflicts="" provides="" create-package $@ \
|
||||
>> $(log_file).info 2>> $(log_file).err
|
||||
$(Q)[ -d "$(pkg_fake_root_dev_dir)" ] && ( \
|
||||
cd $(pkg_fake_root_dev_dir) ; \
|
||||
for F in `ls data* 2>/dev/null` ; do rm $F ; done; : ; \
|
||||
dependencies="" conflicts="" provides="" create-package $@ \
|
||||
>> $(log_file).info 2>> $(log_file).err \
|
||||
) ; :
|
||||
|
||||
package_libs = $(repository_directory)/$(ARCH)/$(name)-libs-$(version)-r$(release).$(baguette_ext)
|
||||
package_libs = $(repository_directory)/$(ARCH)/$(name)-libs-$(version)-r$(release).$(package_ext)
|
||||
package_libs: $(package_libs)
|
||||
$(package_libs):
|
||||
@echo "Packaging $@"
|
||||
$(Q)cd $(pkg_fake_root_dir) && create-split-libs >> $(log_file).info 2>> $(log_file).err
|
||||
@-cd $(pkg_fake_root_libs_dir) ; for F in `ls data* 2>/dev/null` ; do rm $F ; done; :
|
||||
$(Q)cd $(pkg_fake_root_libs_dir) && dependencies="" conflicts="" provides="" create-package $@ \
|
||||
>> $(log_file).info 2>> $(log_file).err
|
||||
$(Q)[ -d "$(pkg_fake_root_libs_dir)" ] && ( \
|
||||
cd $(pkg_fake_root_libs_dir) ; \
|
||||
for F in `ls data* 2>/dev/null` ; do rm $F ; done; : ; \
|
||||
dependencies="" conflicts="" provides="" create-package $@ \
|
||||
>> $(log_file).info 2>> $(log_file).err \
|
||||
) ; :
|
||||
|
||||
|
||||
check_binaries:
|
||||
@echo "Checking for required binaries (ftp or wget, tar & xz, unzip, zstd, strip)"
|
||||
@which ftp >/dev/null || which wget >/dev/null
|
||||
@which tar >/dev/null && which xz >/dev/null
|
||||
@which unzip zstd strip >/dev/null
|
||||
which ftp >/dev/null || which wget >/dev/null
|
||||
which tar >/dev/null && which xz >/dev/null
|
||||
which unzip zstd strip >/dev/null
|
||||
[ $(PACKAGE_MANAGER) = "apk" ] && which abuild-sign abuild-tar >/dev/null || :
|
||||
@echo "Checking for required binaries (ftp or wget, tar & xz, unzip, zstd, strip): done"
|
||||
|
||||
splits: package_src package_doc package_man package_dev package_libs
|
||||
|
|
Loading…
Reference in New Issue