Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Arm #87

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,31 @@ env:
name: Release
jobs:
build:
strategy:
matrix:
arch:
- arm64
- amd64
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/${{ matrix.arch}}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3
- name: build
run: make pkg
- name: donwload ghr
run: |
curl -L -O -s https://github.com/tcnksm/ghr/releases/download/v0.16.0/ghr_v0.16.0_linux_amd64.tar.gz
tar zxf ghr_v0.16.0_linux_amd64.tar.gz
sudo mv ghr_v0.16.0_linux_amd64/ghr /usr/bin
curl -L -O -s https://github.com/tcnksm/ghr/releases/download/v0.16.2/ghr_v0.16.2_linux_amd64.tar.gz
tar zxf ghr_v0.16.2_linux_amd64.tar.gz
sudo mv ghr_v0.16.2_linux_amd64/ghr /usr/bin
- name: release
run: make github_release
33 changes: 14 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# The base of this code is https://github.com/pyama86/stns/blob/master/Makefile
CC=gcc
CFLAGS=-Os -Wall -Wstrict-prototypes -Werror -fPIC -std=c99 -D_GNU_SOURCE -I$(CURL_DIR)/include -I$(OPENSSL_DIR)/include -I$(LIBPSL_DIR)/include

CFLAGS=-Os -Wall -Wstrict-prototypes -Werror -fPIC -std=c99 -D_GNU_SOURCE -I$(CURL_DIR)/include -I$(OPENSSL_DIR)/include
STNS_LDFLAGS=-Wl,--version-script,libstns.map

LIBRARY=libnss_stns.so.2.0
Expand All @@ -20,7 +19,6 @@ CRITERION_VERSION=2.4.2
SHUNIT_VERSION=2.1.8
CURL_VERSION_TAG=8_6_0
CURL_VERSION=$(shell echo $(CURL_VERSION_TAG) | sed -e 's/_/./g')
LIBPSL_VERSION ?= 0.21.5
OPENSSL_VERSION=3.2.1
ZLIB_VERSION=1.3.1

Expand All @@ -33,17 +31,15 @@ STNS_DIR:=$(DIST_DIR)/stns
OPENSSL_DIR:=$(DIST_DIR)/openssl-$(OPENSSL_VERSION)
CURL_DIR:=$(DIST_DIR)/curl-$(CURL_VERSION)
ZLIB_DIR:=$(DIST_DIR)/zlib-$(ZLIB_VERSION)
LIBPSL_DIR:=$(DIST_DIR)/libpsl-$(LIBPSL_VERSION)
SOURCES=Makefile stns.h stns.c stns*.c stns*.h toml.h toml.c parson.h parson.c stns.conf.example test libstns.map

STATIC_LIBS=$(CURL_DIR)/lib/libcurl.a \
$(OPENSSL_DIR)/lib/libssl.a \
$(OPENSSL_DIR)/lib/libcrypto.a \
$(ZLIB_DIR)/lib/libz.a \
$(LIBPSL_DIR)/lib/libpsl.a
$(ZLIB_DIR)/lib/libz.a

LIBS_CFLAGS=-Os -fPIC
CURL_LDFLAGS := -L$(OPENSSL_DIR)/lib -L$(LIBPSL_DIR)/lib $(LIBS_CFLAGS)
CURL_LDFLAGS := -L$(OPENSSL_DIR)/lib

MAKE=make -j4
default: build
Expand All @@ -53,7 +49,7 @@ test: cleanup testdev ## Test with dependencies installation
mkdir -p /etc/stns/client/
echo 'api_endpoint = "http://httpbin"' > /etc/stns/client/stns.conf
sudo service cache-stnsd restart
ASAN_OPTIONS=detect_leaks=1:exitcode=1:abort_on_error=true $(CC) -g3 -fsanitize=address -O0 -fno-omit-frame-pointer -I$(CURL_DIR)/include -I$(LIBPSL_DIR)/include \
ASAN_OPTIONS=detect_leaks=1:exitcode=1:abort_on_error=true $(CC) -g3 -fsanitize=address -O0 -fno-omit-frame-pointer -I$(CURL_DIR)/include \
stns.c stns_group.c toml.c parson.c stns_shadow.c stns_passwd.c stns_test.c stns_group_test.c stns_shadow_test.c stns_passwd_test.c \
$(STATIC_LIBS) \
-lcriterion \
Expand All @@ -63,6 +59,11 @@ test: cleanup testdev ## Test with dependencies installation
-o $(DIST_DIR)/test
$(DIST_DIR)/test --verbose

clean:
rm -rf $(DIST_DIR)
rm -rf $(SRC_DIR)
rm -rf $(STNS_DIR)

build_dir: ## Create directory for build
test -d $(DIST_DIR) || mkdir -p $(DIST_DIR)
test -d $(SRC_DIR) || mkdir -p $(SRC_DIR)
Expand All @@ -74,12 +75,6 @@ zlib: build_dir
--prefix=$(ZLIB_DIR) \
&& $(MAKE) && $(MAKE) install)

libpsl: build_dir
test -d $(SRC_DIR)/libpsl-$(LIBPSL_VERSION) || (curl -sL https://github.com/rockdaboot/libpsl/releases/download/$(LIBPSL_VERSION)/libpsl-$(LIBPSL_VERSION).tar.gz -o $(SRC_DIR)/libpsl-$(LIBPSL_VERSION).tar.gz && cd $(SRC_DIR) && tar -zxf libpsl-$(LIBPSL_VERSION).tar.gz)
test -f $(LIBPSL_DIR)/lib/libpsl.a || (cd $(SRC_DIR)/libpsl-$(LIBPSL_VERSION) && (make clean |true) && ./configure \
--prefix=$(LIBPSL_DIR) \
&& make && make check && make install)

openssl: build_dir zlib
test -d $(SRC_DIR)/openssl-$(OPENSSL_VERSION) || (curl -sL https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz -o $(SRC_DIR)/openssl-$(OPENSSL_VERSION).tar.gz && cd $(SRC_DIR) && tar xf openssl-$(OPENSSL_VERSION).tar.gz)
test -f $(OPENSSL_DIR)/lib/libssl.a || (cd $(SRC_DIR)/openssl-$(OPENSSL_VERSION) && (make clean |true) && CFLAGS='$(LIBS_CFLAGS)' ./config \
Expand All @@ -92,13 +87,14 @@ openssl: build_dir zlib
-Wl,--enable-new-dtags \
&& $(MAKE) depend && $(MAKE) && $(MAKE) install)

curl: build_dir openssl libpsl
curl: build_dir openssl
test -d $(SRC_DIR)/curl-$(CURL_VERSION) || (curl -sL https://curl.haxx.se/download/curl-$(CURL_VERSION).tar.gz -o $(SRC_DIR)/curl-$(CURL_VERSION).tar.gz && cd $(SRC_DIR) && tar xf curl-$(CURL_VERSION).tar.gz)
test -f $(CURL_DIR)/lib/libcurl.a || (cd $(SRC_DIR)/curl-$(CURL_VERSION) && (make clean | true) && \
LIBS="-ldl -lpthread" LDFLAGS="$(CURL_LDFLAGS)" CFLAGS='$(LIBS_CFLAGS) -I$(LIBPSL_DIR)/include' ./configure \
--with-openssl=$(OPENSSL_DIR) \
LIBS="-ldl -lpthread" LDFLAGS="$(CURL_LDFLAGS)" CFLAGS='$(LIBS_CFLAGS)' ./configure \
--with-ssl=$(OPENSSL_DIR) \
--with-zlib=$(ZLIB_DIR) \
--enable-libcurl-option \
--without-libpsl \
--disable-shared \
--enable-static \
--prefix=$(CURL_DIR) \
Expand Down Expand Up @@ -130,7 +126,6 @@ criterion: ## Installing dependencies for development
debug:
@echo "$(INFO_COLOR)==> $(RESET)$(BOLD)Testing$(RESET)"
$(CC) -g -I$(CURL_DIR)/include \
$(CC) -g -I$(LIBPSL_DIR)/include \
test/debug.c stns.c stns_group.c toml.c parson.c stns_shadow.c stns_passwd.c \
$(STATIC_LIBS) \
-lpthread -ldl -o $(DIST_DIR)/debug && \
Expand Down Expand Up @@ -247,7 +242,7 @@ deb: source_for_deb ## Packaging for DEB
rm -rf debian/*.ex debian/*.EX debian/README.Debian && \
cp -v /stns/debian/* debian/ && \
sed -i -e 's/xenial/$(DIST)/g' debian/changelog && \
debuild -e DIST=$(DIST) -uc -us
debuild -e DIST=$(DIST) -uc -us -a`dpkg --print-architecture`
cd $(STNS_DIR) && \
find . -name "*.deb" | sed -e 's/\(\(.*libnss-stns-v2.*\).deb\)/mv \1 \2.$(DIST).deb/g' | sh && \
mkdir -p /stns/builds && \
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Vcs-Browser: https://github.com/STNS/STNS/tree/debian
Vcs-Git: https://github.com/STNS/STNS -b debian

Package: libnss-stns-v2
Architecture: amd64
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libc6
Recommends: cache-stnsd
Description: We provide name resolution of Linux user group using STNS.
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile.debian-10
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM debian:buster
MAINTAINER pyama86 <[email protected]>

RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
RUN apt-get -qqy update && \
apt-get install -qqy glibc-source \
gcc \
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile.debian-11
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM debian:bullseye
MAINTAINER pyama86 <[email protected]>

RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
RUN apt-get -qqy update && \
apt-get install -qqy \
glibc-source \
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile.ubuntu-20
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ubuntu:focal
MAINTAINER pyama86 <[email protected]>

RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
RUN apt-get -qqy update && \
apt-get install -qqy \
tzdata \
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile.ubuntu-22
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ubuntu:jammy
MAINTAINER pyama86 <[email protected]>

RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
RUN apt-get -qqy update && \
apt-get install -qqy \
tzdata \
Expand Down
6 changes: 3 additions & 3 deletions rpm/stns.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Requires: glibc cache-stnsd
BuildRequires: gcc make
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: i386, x86_64
BuildArch: i386, x86_64, aarch64

%define debug_package %{nil}

Expand Down Expand Up @@ -61,15 +61,15 @@ sed -i "s/^IPAddressDeny=any/#IPAddressDeny=any/" /lib/systemd/system/systemd-lo
%config(noreplace) /etc/stns/client/stns.conf

%changelog
* Thu Dec 05 2023 pyama86 <[email protected]> - 2.6.6-3
* Tue Dec 05 2023 pyama86 <[email protected]> - 2.6.6-3
- Allow uppercase letters in usernames and group names
* Mon Nov 06 2023 pyama86 <[email protected]> - 2.6.6-2
- Add Validation for Query with username
* Fri Nov 03 2023 pyama86 <[email protected]> - 2.6.6-1
- I have fixed primarily memory leaks and buffer overflow vulnerabilities that were detected by the Continuous Integration (CI) system.
* Thu Nov 02 2023 pyama86 <[email protected]> - 2.6.5-1
- Check User/Group Name Before Query
* Sun Oct 11 2023 pyama86 <[email protected]> - 2.6.4-1
* Wed Oct 11 2023 pyama86 <[email protected]> - 2.6.4-1
- Update dependency curl/curl to v8_4_0
* Sun Jun 18 2023 pyama86 <[email protected]> - 2.6.3-1
- update openssl and curl
Expand Down