Skip to content

Commit

Permalink
am part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewc12 committed Nov 14, 2023
1 parent 787db1c commit b0c85ab
Show file tree
Hide file tree
Showing 46 changed files with 1,014 additions and 10 deletions.
9 changes: 8 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ if BUILD_LINUX
include $(srcdir)/%D%/rpm/Makefile.am
endif

if BUILD_MACOS
bin_PROGRAMS=
noinst_PROGRAMS=
include $(srcdir)/%D%/module/os/macos/Makefile.am
endif

if CONFIG_USER
include $(srcdir)/%D%/cmd/Makefile.am
include $(srcdir)/%D%/contrib/Makefile.am
Expand Down Expand Up @@ -194,11 +200,12 @@ cscopelist:
PHONY += tags
tags: ctags etags

PHONY += pkg pkg-dkms pkg-kmod pkg-utils
PHONY += pkg pkg-dkms pkg-kmod pkg-utils pkg-macos
pkg: @DEFAULT_PACKAGE@
pkg-dkms: @DEFAULT_PACKAGE@-dkms
pkg-kmod: @DEFAULT_PACKAGE@-kmod
pkg-utils: @DEFAULT_PACKAGE@-utils
pkg-macos: @DEFAULT_PACKAGE@-macos

include config/rpm.am
include config/deb.am
Expand Down
2 changes: 2 additions & 0 deletions cmd/os/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

include $(srcdir)/%D%/macos/Makefile.am
43 changes: 43 additions & 0 deletions cmd/os/macos/InvariantDisks/InvariantDisks/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
sbin_PROGRAMS += InvariantDisks
CPPCHECKTARGETS += InvariantDisks

AM_LIBTOOLFLAGS += --tag=CXX

InvariantDisks_SOURCES = \
%D%/IDLogUtils.cpp \
%D%/IDLogUtils.hpp \
%D%/IDBaseLinker.cpp \
%D%/IDBaseLinker.hpp \
%D%/IDCLI.cpp \
%D%/IDCLI.hpp \
%D%/IDDAHandlerIdle.cpp \
%D%/IDDAHandlerIdle.hpp \
%D%/IDDiskArbitrationDispatcher.cpp \
%D%/IDDiskArbitrationDispatcher.hpp \
%D%/IDDiskArbitrationHandler.hpp \
%D%/IDDiskArbitrationUtils.cpp \
%D%/IDDiskArbitrationUtils.hpp \
%D%/IDDiskInfoLogger.cpp \
%D%/IDDiskInfoLogger.hpp \
%D%/IDDispatchUtils.cpp \
%D%/IDDispatchUtils.hpp \
%D%/IDException.cpp \
%D%/IDException.hpp \
%D%/IDFileUtils.mm \
%D%/IDFileUtils.hpp \
%D%/IDImagePathLinker.cpp \
%D%/IDImagePathLinker.hpp \
%D%/IDMediaPathLinker.cpp \
%D%/IDMediaPathLinker.hpp \
%D%/IDSerialLinker.cpp \
%D%/IDSerialLinker.hpp \
%D%/IDSymlinkHandle.cpp \
%D%/IDSymlinkHandle.hpp \
%D%/IDUUIDLinker.cpp \
%D%/IDUUIDLinker.hpp \
%D%/git-version.h \
%D%/main.cpp

InvariantDisks_CXXFLAGS = -std=c++11 -stdlib=libc++
InvariantDisks_OBJCXXFLAGS = -std=c++11 -stdlib=libc++
InvariantDisks_LDFLAGS = -static -framework IOKit -framework DiskArbitration -framework CoreFoundation -framework Foundation
1 change: 1 addition & 0 deletions cmd/os/macos/InvariantDisks/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(srcdir)/%D%/InvariantDisks/Makefile.am
8 changes: 8 additions & 0 deletions cmd/os/macos/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FS_BUNDLEPREFIX = /Library/Filesystems
FS_BUNDLEDIR = $(DESTDIR)$(FS_BUNDLEPREFIX)/zfs.fs

include $(srcdir)/%D%/InvariantDisks/Makefile.am
include $(srcdir)/%D%/zconfigd/Makefile.am
include $(srcdir)/%D%/zfs_util/Makefile.am
include $(srcdir)/%D%/zsysctl/Makefile.am
include $(srcdir)/%D%/mount_zfs/Makefile.am
28 changes: 28 additions & 0 deletions cmd/os/macos/mount_zfs/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Linux steals the "mount_zfs" name first, and since it's one
# giant Makefile you can no longer have two tools with the same name.
#
bin_PROGRAMS += macos_mount_zfs
CPPCHECKTARGETS += macos_mount_zfs

AM_CPPFLAGS += -I$(top_srcdir)/lib/libzfs

macos_mount_zfs_SOURCES = \
%D%/mount_zfs.c

macos_mount_zfs_LDADD = \
libzfs.la \
libzfs_core.la \
libnvpair.la

macos_mount_zfs_LDADD += $(LTLIBINTL)


mount_zfs: macos_mount_zfs
cp "$^" "$@"

INSTALL_DATA_HOOKS += mount_zfs-install-exec-hook
mount_zfs-install-exec-hook:
mkdir -p $(FS_BUNDLEDIR)/Contents/Resources
cp -f $(DESTDIR)/$(sbindir)/macos_mount_zfs $(DESTDIR)/$(sbindir)/mount_zfs
cp -f $(DESTDIR)/$(sbindir)/mount_zfs $(FS_BUNDLEDIR)/Contents/Resources/mount_zfs
8 changes: 8 additions & 0 deletions cmd/os/macos/zconfigd/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sbin_PROGRAMS += zconfigd
CPPCHECKTARGETS += zconfigd

zconfigd_SOURCES = \
%D%/zconfigd.c \
%D%/zconfigd.h

zconfigd_LDFLAGS = -framework IOKit -framework Foundation
59 changes: 59 additions & 0 deletions cmd/os/macos/zfs_util/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
sbin_PROGRAMS += zfs_util
CPPCHECKTARGETS += zfs_util

INFO_PLIST = %D%/Info.plist
INFOPLIST_STRINGS = %D%/English.lproj/InfoPlist.strings
PKGINFO = %D%/PkgInfo

zfs_util_SOURCES = \
%D%/zfs_util.c

zfs_util_LDADD = \
libzfs.la

zfs_util_LDFLAGS = -static -framework IOKit

# build the /Library/Filesystems/zfs.fs/ bundle

noinst_zfs_fs_SOURCES =

bin_PROGRAMS += noinst_zfs.fs

dist_noinst_DATA += $(INFO_PLIST) $(INFOPLIST_STRINGS) $(PKGINFO)

noinst_zfs.fs$(EXEEXT): zfs_util
mkdir -p zfs.fs/Contents/Resources/English.lproj
cp -f $(PKGINFO) zfs.fs/Contents/
cp -f $(INFO_PLIST) zfs.fs/Contents/
cp -f zfs_util zfs.fs/Contents/Resources/
cp -f $(INFOPLIST_STRINGS) zfs.fs/Contents/Resources/English.lproj/
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $(ZFS_META_VERSION)" zfs.fs/Contents/Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $(ZFS_META_VERSION)" zfs.fs/Contents/Info.plist
plutil -convert binary1 zfs.fs/Contents/Resources/English.lproj/InfoPlist.strings

INSTALL_DATA_HOOKS += fs-install-exec-local
fs-install-exec-local: noinst_zfs.fs
rm -f $(FS_BUNDLEDIR)/Contents/$(PKGINFO)
rm -f $(FS_BUNDLEDIR)/Contents/$(INFO_PLIST)
rm -f $(FS_BUNDLEDIR)/Contents/Resources/English.lproj/$(INFOPLIST_STRINGS)
mkdir -p $(FS_BUNDLEDIR)
rsync -aH zfs.fs/ $(FS_BUNDLEDIR)/
ln -fs /usr/bin/true $(FS_BUNDLEDIR)/Contents/Resources/fsck_zfs
ln -fs /usr/bin/true $(FS_BUNDLEDIR)/Contents/Resources/newfs_zfs
chown -R root:wheel $(FS_BUNDLEDIR) || echo "Unable to chown root:wheel in $(FS_BUNDLEDIR)"


CLEANFILES += zfs.fs/Contents/Resources/English.lproj/InfoPlist.strings \
zfs.fs/Contents/Resources/zfs_util \
zfs.fs/Contents/Info.plist \
zfs.fs/Contents/PkgInfo \
zfs.fs/Contents/Resources/English.lproj/InfoPlist.strings \
zfs.fs/Contents/Resources/fsck_zfs \
zfs.fs/Contents/Resources/newfs_zfs

CLEAN_LOCAL += zfsutil_clean_local
zfsutil_clean_local:
@rmdir zfs.fs/Contents/Resources/English.lproj \
zfs.fs/Contents/Resources \
zfs.fs/Contents \
zfs.fs || true
5 changes: 5 additions & 0 deletions cmd/os/macos/zsysctl/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sbin_PROGRAMS += zsysctl
CPPCHECKTARGETS += zsysctl

zsysctl_SOURCES = \
%D%/zsysctl.c
3 changes: 3 additions & 0 deletions cmd/zed/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ zed_LDADD = \
libnvpair.la \
libuutil.la

if !BUILD_MACOS
zed_LDADD += -lrt $(LIBATOMIC_LIBS) $(LIBUDEV_LIBS) $(LIBUUID_LIBS)
endif

zed_LDFLAGS = -pthread

dist_noinst_DATA += %D%/agents/README.md
12 changes: 10 additions & 2 deletions cmd/zed/zed.d/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ dist_zedexec_SCRIPTS = \
%D%/resilver_finish-notify.sh \
%D%/resilver_finish-start-scrub.sh \
%D%/scrub_finish-notify.sh \
%D%/snapshot_mount.sh \
%D%/snapshot_unmount.sh \
%D%/statechange-led.sh \
%D%/statechange-notify.sh \
%D%/statechange-slot_off.sh \
%D%/trim_finish-notify.sh \
%D%/vdev_attach-led.sh \
%D%/vdev_clear-led.sh
%D%/vdev_clear-led.sh \
%D%/zvol_create.sh \
%D%/zvol_remove.sh

nodist_zedexec_SCRIPTS = \
%D%/history_event-zfs-list-cacher.sh
Expand All @@ -34,11 +38,15 @@ zedconfdefaults = \
resilver_finish-notify.sh \
resilver_finish-start-scrub.sh \
scrub_finish-notify.sh \
snapshot_mount.sh \
snapshot_unmount.sh \
statechange-led.sh \
statechange-notify.sh \
statechange-slot_off.sh \
vdev_attach-led.sh \
vdev_clear-led.sh
vdev_clear-led.sh \
zvol_create.sh \
zvol_remove.sh

dist_noinst_DATA += %D%/README

Expand Down
4 changes: 4 additions & 0 deletions cmd/zfs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ zfs_LDADD += $(LTLIBINTL)
if BUILD_FREEBSD
zfs_LDADD += -lgeom -ljail
endif

if BUILD_MACOS
zfs_LDFLAGS = -sectcreate __TEXT __info_plist %D%/../zpool/os/macos/Info-zfs.plist
endif
10 changes: 10 additions & 0 deletions cmd/zpool/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ zpool_SOURCES += \
%D%/os/linux/zpool_vdev_os.c
endif

if BUILD_MACOS
zpool_SOURCES += %D%/os/macos/zpool_vdev_os.c
endif

zpool_LDADD = \
libzfs.la \
libzfs_core.la \
Expand All @@ -36,6 +40,12 @@ zpool_LDADD += $(LTLIBINTL)
if BUILD_FREEBSD
zpool_LDADD += -lgeom
endif

if BUILD_MACOS
zpool_LDFLAGS = -sectcreate __TEXT __info_plist %D%/os/macos/Info-zpool.plist
zpool_LDFLAGS += -sectcreate __TEXT __entitlements %D%/os/macos/zpool-entitlements.plist
endif

zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS)

dist_noinst_DATA += %D%/zpool.d/README
Expand Down
5 changes: 4 additions & 1 deletion config/Rules.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion
AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h
AM_CFLAGS += -I/usr/include -I/usr/local/include
endif
if BUILD_MACOS
AM_CFLAGS += \
-I$(top_srcdir)/lib/libspl/include/os/macos
endif

AM_CPPFLAGS += -D_GNU_SOURCE
AM_CPPFLAGS += -D_REENTRANT
Expand Down Expand Up @@ -75,7 +79,6 @@ AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
AM_LDFLAGS += -lm
endif


# If a target includes kernel code, generate warnings for large stack frames
KERNEL_CFLAGS = $(FRAME_LARGER_THAN)

Expand Down
6 changes: 6 additions & 0 deletions etc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,9 @@ dist_modulesload_DATA = \
%D%/modules-load.d/zfs.conf
endif
endif

if BUILD_MACOS
include $(srcdir)/%D%/launchd/Makefile.am
include $(srcdir)/%D%/paths.d/Makefile.am
include $(srcdir)/%D%/launchd.d/Makefile.am
endif
19 changes: 19 additions & 0 deletions etc/launchd.d/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

noinst_launch_d_DATA = \
%D%/zpool-import-all.sh.in
noinst_launch_ddir = \
$(launchdscriptdir)/

do_subst = -$(SED) -e 's,@bindir\@,$(bindir),g' \
-e 's,@runstatedir\@,$(runstatedir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \
-e 's,@launchdscriptdir\@,$(launchdscriptdir),g'

CLEANFILES += %D%/zpool-import-all.sh

INSTALL_DATA_HOOKS += install-zpool-import

install-zpool-import: %D%/zpool-import-all.sh.in
$(do_subst) < %D%/zpool-import-all.sh.in > $(DESTDIR)/$(launchdscriptdir)/zpool-import-all.sh
chmod +x $(DESTDIR)/$(launchdscriptdir)/zpool-import-all.sh
4 changes: 4 additions & 0 deletions etc/launchd/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
launchddaemondir = /Library/LaunchDaemons
launchdscriptdir = ${libexecdir}/zfs/launchd.d

include $(srcdir)/%D%/daemons/Makefile.am
33 changes: 33 additions & 0 deletions etc/launchd/daemons/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

CLEANFILES += $(launchddaemon_DATA)

launchddaemon_DATA = \
$(top_srcdir)/etc/launchd/daemons/org.openzfsonosx.zconfigd.plist \
$(top_srcdir)/etc/launchd/daemons/org.openzfsonosx.zed.plist \
$(top_srcdir)/etc/launchd/daemons/org.openzfsonosx.zpool-import.plist \
$(top_srcdir)/etc/launchd/daemons/org.openzfsonosx.zpool-import-all.plist \
$(top_srcdir)/etc/launchd/daemons/org.openzfsonosx.InvariantDisks.plist

dist_launchddaemon_DATA = \
%D%/org.openzfsonosx.zconfigd.plist.in \
%D%/org.openzfsonosx.zed.plist.in \
%D%/org.openzfsonosx.zpool-import.plist.in \
%D%/org.openzfsonosx.zpool-import-all.plist.in \
%D%/org.openzfsonosx.InvariantDisks.plist.in

%D%/org.openzfsonosx.zconfigd.plist: %D%/org.openzfsonosx.zconfigd.plist.in
%D%/org.openzfsonosx.zed.plist: %D%/org.openzfsonosx.zed.plist.in
%D%/org.openzfsonosx.zpool-import.plist: %D%/org.openzfsonosx.zpool-import.plist.in
%D%/org.openzfsonosx.zpool-import-all.plist: %D%/org.openzfsonosx.zpool-import-all.plist.in
%D%/org.openzfsonosx.InvariantDisks.plist: %D%/org.openzfsonosx.InvariantDisks.plist.in

$(launchddaemon_DATA):
-$(SED) -e 's,@bindir\@,$(bindir),g' \
-e 's,@runstatedir\@,$(runstatedir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \
-e 's,@launchddaemondir\@,$(launchddaemondir),g' \
-e 's,@launchdscriptdir\@,$(launchdscriptdir),g' \
'[email protected]' >'$@'


20 changes: 20 additions & 0 deletions etc/paths.d/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pathsddir = $(sysconfdir)/paths.d
pathsd_DATA = %D%/zfs-path

paths_ddir = $(sysconfdir)/paths.d/
dist_paths_d_DATA = \
%D%/zfs-path

zfs-path: %D%/zfs-path.in

CLEANFILES += $(pathsd_DATA)
CLEANFILES += %D%/zfs-path
INSTALL_DATA_HOOKS += pathsd-data-hook
pathsd-data-hook: %D%/zfs-path.in
-$(SED) -e 's,@bindir\@,$(bindir),g' \
-e 's,@runstatedir\@,$(runstatedir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \
-e 's,@launchddaemondir\@,$(launchddaemondir),g' \
-e 's,@launchdscriptdir\@,$(launchdscriptdir),g' \
%D%/zfs-path.in > $(DESTDIR)/$(sysconfdir)/paths.d/zfs-path
1 change: 1 addition & 0 deletions include/os/macos/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = spl zfs
1 change: 1 addition & 0 deletions include/os/macos/spl/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = sys rpc
3 changes: 3 additions & 0 deletions include/os/macos/spl/rpc/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
KERNEL_H = \
$(top_srcdir)/include/os/macos/spl/rpc/types.h \
$(top_srcdir)/include/os/macos/spl/rpc/xdr.h
Loading

0 comments on commit b0c85ab

Please sign in to comment.