Initial commit

This commit is contained in:
Nathan Fisher 2022-09-06 23:57:09 -04:00
commit 1a8fefac58
8 changed files with 412 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
config.mk
work
distfiles/*
packages/*.tgz
packages/*.tbz
packages/*.txz

3
lang/gcc12/DESCR Normal file
View File

@ -0,0 +1,3 @@
The GNU Compiler Collection (GCC) includes front ends for C, C++, Objective-C,
Objective-C++, Go and Fortran.

35
lang/gcc12/Makefile Normal file
View File

@ -0,0 +1,35 @@
# Makefile - hhl - /usr/ports/lang/gcc12
# Copyright 2022 Nathan Fisher <nfisher.sr@gmail.com>
#
comment = The Gnu compiler collection
distname = gcc
pkg_name = gcc12
pkg_version = 12.2.0
pkg_homepage = https://gcc.gnu.org/
pkg_license = gnu-gpl-v3
pkg_maintainer = jeang3nie@hitchhiker-linux.org
remote_site = gnu
sha512_sum = e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173
include ../../mk/ports.mk
include config.mk
include provides.mk
ifeq ($(enable_fortran), 1)
fortran = ,fortran
endif
ifeq ($(enable_go), 1)
golang = ,go
endif
ifeq ($(enable_objc), 1)
objc = ,objc
endif
ifeq ($(enable_objcxx), 1)
objcxx = ,obj-c++
endif
config_opts += --enable-languages=c,c++,lto$(fortran)$(golang)$(objc)$(objcxx)
config_opts += --disable-multilib
config_opts += --disable-bootstrap
config_opts += --with-system-zlib
include ../../mk/targets.mk

11
lang/gcc12/config.mk.in Normal file
View File

@ -0,0 +1,11 @@
# uncomment to build the gfortran compiler
# enable_fortran = 1
# uncomment to build the golang compiler
# enable_go = 1
# uncomment to build support for Objective-C
# enable_objc = 1
# uncomment to build support for Objective-C++
# enable_objcxx = 1

87
lang/gcc12/provides.mk Normal file
View File

@ -0,0 +1,87 @@
pkg_provides += /usr/pkg/lib64/liblsan.so.0.0.0
pkg_provides += /usr/pkg/lib64/libubsan.a
pkg_provides += /usr/pkg/lib64/libssp.la
pkg_provides += /usr/pkg/lib64/libasan_preinit.o
pkg_provides += /usr/pkg/lib64/libcc1.so.0.0.0
pkg_provides += /usr/pkg/lib64/libstdc++.so
pkg_provides += /usr/pkg/lib64/libasan.so.8
pkg_provides += /usr/pkg/lib64/libcc1.la
pkg_provides += /usr/pkg/lib64/libgomp.spec
pkg_provides += /usr/pkg/lib64/libstdc++.so.6
pkg_provides += /usr/pkg/lib64/libitm.la
pkg_provides += /usr/pkg/lib64/libgomp.so.1.0.0
pkg_provides += /usr/pkg/lib64/libtsan.a
pkg_provides += /usr/pkg/lib64/libstdc++.so.6.0.30
pkg_provides += /usr/pkg/lib64/libsupc++.la
pkg_provides += /usr/pkg/lib64/libssp.so.0
pkg_provides += /usr/pkg/lib64/libgfortran.so.5
pkg_provides += /usr/pkg/lib64/libatomic.so
pkg_provides += /usr/pkg/lib64/libitm.so.1.0.0
pkg_provides += /usr/pkg/lib64/libquadmath.so
pkg_provides += /usr/pkg/lib64/libssp.so
pkg_provides += /usr/pkg/lib64/libgomp.so.1
pkg_provides += /usr/pkg/lib64/libgolibbegin.a
pkg_provides += /usr/pkg/lib64/libobjc.so
pkg_provides += /usr/pkg/lib64/liblsan.so.0
pkg_provides += /usr/pkg/lib64/libsupc++.a
pkg_provides += /usr/pkg/lib64/libquadmath.a
pkg_provides += /usr/pkg/lib64/liblsan.so
pkg_provides += /usr/pkg/lib64/libtsan.so.2
pkg_provides += /usr/pkg/lib64/libobjc.so.4.0.0
pkg_provides += /usr/pkg/lib64/libtsan.so
pkg_provides += /usr/pkg/lib64/libitm.a
pkg_provides += /usr/pkg/lib64/libgo.so.21
pkg_provides += /usr/pkg/lib64/libcc1.so
pkg_provides += /usr/pkg/lib64/libgo.so.21.0.0
pkg_provides += /usr/pkg/lib64/libgo.so
pkg_provides += /usr/pkg/lib64/libgfortran.la
pkg_provides += /usr/pkg/lib64/libssp_nonshared.la
pkg_provides += /usr/pkg/lib64/libgo.a
pkg_provides += /usr/pkg/lib64/libquadmath.so.0
pkg_provides += /usr/pkg/lib64/libsanitizer.spec
pkg_provides += /usr/pkg/lib64/liblsan.a
pkg_provides += /usr/pkg/lib64/libssp.a
pkg_provides += /usr/pkg/lib64/libasan.a
pkg_provides += /usr/pkg/lib64/libubsan.so.1.0.0
pkg_provides += /usr/pkg/lib64/libgomp.so
pkg_provides += /usr/pkg/lib64/libatomic.so.1.2.0
pkg_provides += /usr/pkg/lib64/liblsan_preinit.o
pkg_provides += /usr/pkg/lib64/libitm.so
pkg_provides += /usr/pkg/lib64/libgfortran.so
pkg_provides += /usr/pkg/lib64/libgomp.la
pkg_provides += /usr/pkg/lib64/libitm.spec
pkg_provides += /usr/pkg/lib64/libatomic.la
pkg_provides += /usr/pkg/lib64/libubsan.so.1
pkg_provides += /usr/pkg/lib64/libasan.so.8.0.0
pkg_provides += /usr/pkg/lib64/libssp_nonshared.a
pkg_provides += /usr/pkg/lib64/libquadmath.la
pkg_provides += /usr/pkg/lib64/libubsan.so
pkg_provides += /usr/pkg/lib64/libgfortran.so.5.0.0
pkg_provides += /usr/pkg/lib64/libubsan.la
pkg_provides += /usr/pkg/lib64/libobjc.la
pkg_provides += /usr/pkg/lib64/libstdc++.la
pkg_provides += /usr/pkg/lib64/libatomic.a
pkg_provides += /usr/pkg/lib64/libobjc.a
pkg_provides += /usr/pkg/lib64/libgfortran.a
pkg_provides += /usr/pkg/lib64/libstdc++fs.la
pkg_provides += /usr/pkg/lib64/libgo.la
pkg_provides += /usr/pkg/lib64/libgcc_s.so.1
pkg_provides += /usr/pkg/lib64/libgobegin.a
pkg_provides += /usr/pkg/lib64/libgfortran.spec
pkg_provides += /usr/pkg/lib64/libasan.la
pkg_provides += /usr/pkg/lib64/libtsan.la
pkg_provides += /usr/pkg/lib64/libobjc.so.4
pkg_provides += /usr/pkg/lib64/libtsan.so.2.0.0
pkg_provides += /usr/pkg/lib64/liblsan.la
pkg_provides += /usr/pkg/lib64/libitm.so.1
pkg_provides += /usr/pkg/lib64/libgomp.a
pkg_provides += /usr/pkg/lib64/libcc1.so.0
pkg_provides += /usr/pkg/lib64/libatomic.so.1
pkg_provides += /usr/pkg/lib64/libtsan_preinit.o
pkg_provides += /usr/pkg/lib64/libstdc++.a
pkg_provides += /usr/pkg/lib64/libasan.so
pkg_provides += /usr/pkg/lib64/libstdc++.so.6.0.30-gdb.py
pkg_provides += /usr/pkg/lib64/libquadmath.so.0.0.0
pkg_provides += /usr/pkg/lib64/libstdc++fs.a
pkg_provides += /usr/pkg/lib64/libssp.so.0.0.0
pkg_provides += /usr/pkg/lib64/libgcc_s.so

4
mk/hhl.colors.mk Normal file
View File

@ -0,0 +1,4 @@
export grn = $(shell tput setaf 2)
export red = $(shell tput setaf 1)
export reset = $(shell tput sgr0)
export colormk = ""

109
mk/ports.mk Normal file
View File

@ -0,0 +1,109 @@
# ports.mk - hhl - /usr/include/mk
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
#
portdir = $(shell pwd)
workdir = $(portdir)/work
DESTDIR = $(workdir)/staged
basedir = $(portdir)/../..
include $(basedir)/config.mk
prefix ?= /usr/pkg
confdir ?= $(prefix)/etc
localstatedir ?= $(prefix)/var
logdir ?= $(localstatedir)/log
default_goal ?= all
install_cmd ?= $(MAKE) $(makeflags) DESTDIR=$(DESTDIR) -C $(objdir) install
export PATH = /usr/pkg/bin:/usr/pkg/sbin:/usr/bin:/usr/sbin:/bin:/sbin
ifndef colormk
include $(basedir)/mk/hhl.colors.mk
endif
exec_prefix ?= $(DESTDIR)$(prefix)
bindir ?= $(exec_prefix)/bin
sbindir ?= $(exec_prefix)/sbin
libdir ?= $(DESTDIR)$(install_prefix)/lib
libexecdir ?= $(DESTDIR)$(install_prefix)/libexec
includedir ?= $(DESTDIR)$(install_prefix)/include
sharedir ?= $(DESTDIR)$(install_prefix)/share
docdir ?= $(sharedir)/doc
infodir ?= $(sharedir)/info
localedir ?= $(sharedir)/locale
mandir ?= $(sharedir)/man
man1dir = $(mandir)/man1
man2dir = $(mandir)/man2
man3dir = $(mandir)/man3
man4dir = $(mandir)/man4
man5dir = $(mandir)/man5
man6dir = $(mandir)/man6
man7dir = $(mandir)/man7
man8dir = $(mandir)/man8
distname ?= $(pkg_name)
pkg_rev ?= 1
pkg_ext ?= tgz
pkgfullname ?= $(pkg_name)-$(pkg_version)_hhl$(pkg_rev)
pkgfile ?= $(pkgfullname).$(pkg_ext)
pkglocal ?= $(pkgdir)/$(pkgfile)
pkgdeps = $(workdir)/.stripped $(workdir)/PLIST $(workdir)/BUILD_INFO
distdir = $(basedir)/distfiles
distfullname ?= $(distname)-$(pkg_version)
distext ?= xz
distfile ?= $(distfullname).tar.$(distext)
distlocal ?= $(distdir)/$(distfile)
pkgdir = $(basedir)/packages
srcdir = $(workdir)/$(distfullname)
objdir = $(workdir)/build
installdirs += $(distdir)
installdirs += $(pkgdir)
installdirs += $(workdir)
installdirs += $(srcdir)
installdirs += $(objdir)
installdirs += $(DESTDIR)
#LDFLAGS += -Wl,-R/usr/lib64
#LDFLAGS += -Wl,R/usr/pkg/lib
#export LDFLAGS
export LC_ALL = POSIX
use_configure ?= 1
no_objdir ?= 0
ifeq ($(use_configure),1)
config_tgt ?= $(objdir)/Makefile
config_deps += $(srcdir)/.dirstamp
config_opts ?= --prefix=$(prefix)
config_cmd ?= cd $(objdir) && $(srcdir)/configure $(config_opts)
build_deps ?= $(config_tgt)
else
build_deps ?= $(config_deps)
build_deps += $(srcdir)/.dirstamp
endif
build_cmd ?= $(MAKE) $(makeflags) -C $(objdir)
install_deps ?= $(portdir)/work/.built
install_cmd ?= $(MAKE) $(makeflags) -C $(objdir) install
all_deps ?= $(portdir)/work/.built
ifeq ($(no_objdir),1)
objdir = $(srcdir)
else
pre_dirs += $(objdir)
endif
ifdef patches
config_deps += $(patches) $(srcdir)/.patched
endif
.DEFAULT_GOAL = $(default_goal)
# Some common remote locations
gnu = https://ftp.gnu.org/gnu
savannah = https://download.savannah.gnu.org/releases
github = https://github.com
sourceforge = https://downloads.sourceforge.net/project
kernel = https://www.kernel.org/pub/linux
ifeq (gnu,$(remote_site))
dist_remote = $(gnu)/$(distname)/$(distfullname)/$(distfile)
endif

157
mk/targets.mk Normal file
View File

@ -0,0 +1,157 @@
# targets.mk - hhl - /usr/include/mk
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
#
ifeq ($(no_objdir),1)
clean_cmd ?= $(MAKE) -C $(srcdir) clean distclean
else
clean_cmd ?= rm -rf $(objdir)
endif
distclean_cmd ?= rm -rf $(objdir) $(srcdir)
ifeq ($(distext),gz)
tarflags += -xzf
endif
ifeq ($(distext),bz2)
tarflags += -xjf
endif
ifeq ($(distext),xz)
tarflags += -xJf
endif
install_cmd ?= $(MAKE) DESTDIR=$(DESTDIR) -C $(objdir) install
all: $(all_deps)
.PHONY: all
install: $(workdir)/.installed
$(info $(grn)=== $(distfullname) installed ===$(reset))
.PHONY: install
package: $(pkglocal)
.PHONY: package
$(info $(grn)=== $(pkgfullname) created ===$(reset))
$(pkglocal): $(pkgdeps) | $(pkgdir)
$(info $(grn)=== creating package $(pkgfullname) ===$(reset))
pkg_create \
-c -"$(comment)" \
-B $(workdir)/BUILD_INFO \
-d $(portdir)/DESCR \
-f $(workdir)/PLIST \
-I / \
-p $(DESTDIR) \
-g root \
-u root \
$@
$(workdir)/.installed: $(pkglocal)
$(info $(grn)=== Installing $(distlocal) ===$(reset))
pkg_add $<
touch $@
$(workdir)/.stripped: $(workdir)/.staged
find $(bindir) -type f -exec strip -s '{}' \; 2>&1 > /dev/null || true
find $(sbindir) -type f -exec strip -s '{}' \; 2>&1 > /dev/null || true
find $(libdir) -type f -exec strip -s '{}' \; 2>&1 > /dev/null || true
find $(libexecdir) -type f -exec strip -s '{}' \; 2>&1 > /dev/null || true
touch $@
$(workdir)/.staged: $(workdir)/.built
$(info $(grn)=== $(distfullname) built ===$(reset))
$(info $(grn)=== Installing for $(distfullname) ===$(reset))
$(pre_install)
$(install_cmd)
$(post_install)
touch $@
$(workdir)/PLIST: $(workdir)/.staged
cd $(DESTDIR) && \
find usr -type f -o -type l | sort -u > $@
$(workdir)/BUILD_INFO: $(workdir)/.staged
@echo ABI=$(ABI) > work/build_info
@echo BUILD_DATE=$$(date -u "+%y-%m-%d %H:%M:%S") +0000 >> work/build_info
@echo BUILD_HOST=$$(uname -a) >> work/build_info
@echo CATEGORIES=$$(basename $$(dirname $(portdir))) >> work/build_info
@echo CC_VERSION=gcc-$$(gcc --version | head -n 1 | awk '{print $$3}') \
>> work/build_info
@echo CFLAGS=$(CFLAGS) >> work/build_info
@echo GLIBC_VERSION=$$(/lib/libc.so.6 | head -n 1 | awk '{print $9}' | \
cut -b 1-4) >> work/build_info
@echo HOMEPAGE=$(pkg_homepage) >> work/build_info
@echo LDFLAGS=$(LDFLAGS) >> work/build_info
@echo LICENSE=$(pkg_license) >> work/build_info
@echo LOCALBASE=/usr/pkg >> work/build_info
@echo MACHINE_ARCH=$$(uname -m) >> work/build_info
@echo MAINTAINER=$(pkg_maintainer) >> work/build_info
@echo OBJECT_FMT=ELF >> work/build_info
@echo OPSYS=Linux >> work/build_info
@echo OS_VERSION=$$(uname -r) >> work/build_info
@echo PKGGNUDIR=gnu >> work/build_info
@echo PKGINFODIR=info >> work/build_info
@echo PKGMANDIR=man >> work/build_info
@echo PKGPATH=$$(basename $$(dirname $(portdir)))/$$(basename $(portdir)) \
>> work/build_info
@echo PKGSYSCONFBASEDIR=/usr/pkg/etc >> work/build_info
@echo PKGSYSCONFDIR=/usr/pkg/etc >> work/build_info
@echo PKGTOOLS_VERSION=$$(pkg_add -V) >> work/build_info
@for provides in $(pkg_provides) ; \
do echo PROVIDES=$${provides} >> work/build_info ; done
@mv work/build_info $@
$(installdirs):
install -d $@
$(workdir)/.built: $(build_deps) | $(pre_dirs)
$(info $(grn)=== Building for $(distfullname)$(reset))
$(pre_build)
$(build_cmd)
$(post_build)
touch $@
$(config_tgt): $(config_deps) | $(pre_dirs)
$(info $(grn)=== Configuring for $(distfullname) ===$(reset))
$(pre_configure)
$(config_cmd)
$(post_configure)
touch $@
$(srcdir)/.patched: $(patches) $(srcdir)/.dirstamp
$(info $(grn)=== Patching $(srcdir) ===$(reset))
for patch in $(patches) ; do cd $(srcdir) && \
patch -p1 < $(wkgdir)/$${patch} ; done
touch $@
$(srcdir)/.dirstamp: $(distlocal) | $(workdir)
$(info $(grn)=== Extracting $(distlocal) ===$(reset))
[ "$$(sha512sum $(distlocal) | awk '{ print $$1 }')" == "$(sha512_sum)" ]
tar $(tarflags) $(distlocal) -C work/
touch $@
ifeq ($(use_configure),1)
show-config_opts:
$(info $(grn)$(config_opts)$(reset))
else
show-config_opts:
$(info $(red)Package does not use configure$(reset))
endif
config.mk: config.mk.in
$(info $(grn)Creating config.mk with default options$(reset))
$(info If you wish to modify the defaults, press Control-C and edit config.mk and then restart the build)
cp config.mk.in config.mk
$(distlocal): | $(distdir)
$(info $(grn)=== Fetching $(distfile) ===$(reset))
wget -c $(dist_remote) -O $@
clean:
$(info $(grn)=== Cleaning for $(distname) ===$(reset))
rm -rf $(portdir)/work
.PHONY: clean