sys-fs/sdformatlinux: New package

Signed-off-by: Esteve Varela Colominas <esteve.varela@gmail.com>
This commit is contained in:
Esteve Varela Colominas committed 2026-10-05 19:44:43 +02:00
1 parent f77ee5c0b7
commit 0dead4c066
5 files changed
+111

No files matched your search

+1
View File
@@ -0,0 +1 @@
DIST sdFormatLinux-0.2.0.tar.gz 35758 BLAKE2B d5be4625ffc25785b19eb8d6bfe6555f389f66419c43d2cd3e0507564a6db9d0575e62b08d15770da67296fdc1076a1c37c1476665339d3599011f7c147bc8fd SHA512 f57327befebe70d74c55ab903bb41516e89dae6b7548be5dfccd51aabaf432f39a502ec10f974a46b145b8ac6f9aa8c2ee0b1ab77c596430c993d0d1e9472971
@@ -0,0 +1,52 @@
Make it possible to specify custom CFLAGS/CXXFLAGS/etc in the environment
Also remove -s from LDFLAGS to allow portage to deal with the debug
information.
--- sdFormatLinux-0.2.0.orig/Makefile
+++ sdFormatLinux-0.2.0/Makefile
@@ -12,25 +12,25 @@
ARCH :=
CFLAGS := $(ARCH) -std=c17 -O2 -g -fPIE -fstrict-aliasing \
-ffunction-sections -fdata-sections -fstack-protector-strong \
- -Wall -Wextra -Wstrict-aliasing=2
+ -Wall -Wextra -Wstrict-aliasing=2 $(CFLAGS)
CXXFLAGS := $(ARCH) -std=c++20 -O2 -g -fPIE -fstrict-aliasing \
-ffunction-sections -fdata-sections -fstack-protector-strong \
- -Wall -Wextra -Wstrict-aliasing=2
-ASFLAGS := $(ARCH) -O2 -g -fPIE -x assembler-with-cpp
+ -Wall -Wextra -Wstrict-aliasing=2 $(CXXFLAGS)
+ASFLAGS := $(ARCH) -O2 -g -fPIE -x assembler-with-cpp $(ASFLAGS)
ARFLAGS := -rcs
-LDFLAGS := $(ARCH) -O2 -s -pie -fPIE -Wl,--gc-sections,-z,relro,-z,now,-z,noexecstack
+LDFLAGS := $(ARCH) -O2 -pie -fPIE -Wl,--gc-sections,-z,relro,-z,now,-z,noexecstack $(LDFLAGS)
PREFIX :=
ifneq ($(strip $(USE_CLANG)),)
-CC := $(PREFIX)clang
-CXX := $(PREFIX)clang++
-AS := $(PREFIX)clang
-AR := $(PREFIX)gcc-ar
+CC ?= $(PREFIX)clang
+CXX ?= $(PREFIX)clang++
+AS ?= $(PREFIX)clang
+AR ?= $(PREFIX)gcc-ar
else
-CC := $(PREFIX)gcc
-CXX := $(PREFIX)g++
-AS := $(PREFIX)gcc
-AR := $(PREFIX)gcc-ar
+CC ?= $(PREFIX)gcc
+CXX ?= $(PREFIX)g++
+AS ?= $(PREFIX)gcc
+AR ?= $(PREFIX)gcc-ar
endif
@@ -107,4 +107,4 @@
@echo $(notdir $@)
$(AR) $(ARFLAGS) $@ $^
-endif
\ No newline at end of file
+endif
@@ -0,0 +1,18 @@
Unhardcode "lsblk" path
On many systems, lsblk might not be available exactly on /usr/bin. Since
popen() respects $PATH, it makes sense to avoid hardcoding this path.
--- sdFormatLinux-0.2.0.orig/source/blockdev.cpp
+++ sdFormatLinux-0.2.0/source/blockdev.cpp
@@ -21,8 +21,8 @@
static int checkDevice(const char *const path)
{
int res = EINVAL; // By default assume the given path is not a suitable device.
- char cmd[64] = "/usr/bin/lsblk -dnr -oTYPE,HOTPLUG,PHY-SEC ";
- strncpy(&cmd[43], path, sizeof(cmd) - 43);
+ char cmd[64] = "lsblk -dnr -oTYPE,HOTPLUG,PHY-SEC ";
+ strncpy(&cmd[34], path, sizeof(cmd) - 34);
cmd[sizeof(cmd) - 1] = '\0';
FILE *const p = ::popen(cmd, "r");
if(p == nullptr)
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>esteve.varela@gmail.com</email>
<name>Esteve Varela Colominas</name>
</maintainer>
<upstream>
<remote-id type="github">profi200/sdFormatLinux</remote-id>
</upstream>
</pkgmetadata>
@@ -0,0 +1,29 @@
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=9
DESCRIPTION="Properly format SD cards under Linux"
HOMEPAGE="https://github.com/profi200/sdFormatLinux/"
MY_PN=sdFormatLinux
SRC_URI="https://github.com/profi200/sdFormatLinux/archive/refs/tags/v${PV}.tar.gz -> ${MY_PN}-${PV}.tar.gz"
S="${WORKDIR}/${MY_PN}-${PV}"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
PATCHES=(
"${FILESDIR}/sdFormatLinux-0.2.0-unhardcode-compiler-flags.patch"
"${FILESDIR}/sdFormatLinux-0.2.0-unhardcode-lsblk-path.patch"
)
src_compile() {
emake TARGET=sdFormatLinux
}
src_install() {
einstalldocs
dobin sdFormatLinux
}