Last active
May 14, 2022 23:30
-
-
Save eddieh/aaed3e4a3f69f74be5d386f1e684fe7b to your computer and use it in GitHub Desktop.
libdispatch.dylib Makefiles for building 32 bit libdispatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Saving these Makefiles in case I ever need the LDFLAGS and other tricks | |
for building and replacing a .dylib in an umbrella framework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SUBDIRS += dispatch | |
SUBDIRS += os | |
SUBDIRS += private | |
SUBDIRS += src | |
SDK_ROOT=/Applications/Xcode9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk | |
libpthread_path=$(abspath ../libpthread-301.50.1) | |
libplatform_path=$(abspath ../libplatform-161.50.1) | |
xnu_path=$(abspath ../xnu-4570.71.2) | |
apple_libpthread_source_path=$(libpthread_path) | |
CPPFLAGS += -isystem $(apple_libpthread_source_path) | |
apple_libplatform_source_include_path=$(libplatform_path)/include | |
CPPFLAGS += -isystem $(apple_libplatform_source_include_path) | |
apple_xnu_source_libsyscall_path=$(xnu_path)/libsyscall | |
apple_xnu_source_libproc_path=$(xnu_path)/libsyscall/wrappers/libproc | |
apple_xnu_source_libkern_path=$(xnu_path)/libkern | |
apple_xnu_source_bsd_path=$(xnu_path)/bsd | |
apple_xnu_source_osfmk_path=$(xnu_path)/osfmk | |
CPPFLAGS += -idirafter $(apple_xnu_source_libkern_path) | |
CPPFLAGS += -isystem $(apple_xnu_source_bsd_path) | |
CPPFLAGS += -isystem $(apple_xnu_source_libsyscall_path) | |
CPPFLAGS += -isystem $(apple_xnu_source_libproc_path) | |
CPPFLAGS += -DPRIVATE=1 | |
CPPFLAGS += -isysroot /Applications/Xcode9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk | |
CBLOCKS_FLAGS = -fblocks | |
CC = clang | |
CFLAGS = -m32 -isysroot $(SDK_ROOT) | |
CXXBLOCKS_FLAGS = -fblocks | |
CXXCPP = clang++ -E | |
CXXFLAGS = -m32 -isysroot $(SDK_ROOT) | |
OBJCFLAGS = -m32 #-lSystem -framework Cocoa | |
OBJCXXFLAGS = | |
LD = /usr/bin/ld | |
LDFLAGS = | |
OMIT_LEAF_FP_FLAGS = -momit-leaf-frame-pointer | |
libdir = /usr/lib/system | |
srcdir = . | |
all: link-private-headers subdirs | |
subdirs: | |
@for dir in $(SUBDIRS); do ${MAKE} all -C $$dir; exit_status=$$?; \ | |
if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done | |
link-private-headers: | |
cd src && ln -fsh $(apple_libpthread_source_path)/private/tsd_private.h pthread_machdep.h | |
cd src && ln -fsh $(apple_libpthread_source_path)/private pthread | |
cd src && ln -fsh $(apple_xnu_source_osfmk_path) System | |
cd src && mkdir -p mach && ln -fsh $(apple_xnu_source_osfmk_path)/mach/coalition.h mach | |
.PHONY: subdirs link-private-headers | |
.EXPORT_ALL_VARIABLES: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIG = /usr/bin/mig | |
firehose_MIG_SOURCES = \ | |
firehoseUser.c \ | |
firehose_replyUser.c \ | |
firehose_reply.h \ | |
firehoseServer.c \ | |
firehoseServer.h \ | |
firehose_replyServer.h \ | |
firehose_replyServer.c | |
firehose_MIG_INCS=-I../../include -I../.. -I../../private -I.. | |
MIG_BOTH= $(MIG) -user $*User.c -header $*.h \ | |
-server $*Server.c -sheader $*Server.h \ | |
-novouchers $(firehose_MIG_INCS) $< | |
MIG_SERVER= $(MIG) -user /dev/null -header /dev/null \ | |
-server $*Server.c -sheader $*Server.h \ | |
-novouchers $(firehose_MIG_INCS) $< | |
MIG_CLIENT= $(MIG) -user $*User.c -header $*.h \ | |
-server /dev/null -sheader /dev/null \ | |
-novouchers $(firehose_MIG_INCS) $< | |
%User.c %.h %Server.c %Server.h: %.defs | |
$(MIG_BOTH) | |
# %User.c %.h: %.defs | |
# $(MIG_CLIENT) | |
# %Server.c %Server.h: %.defs | |
# $(MIG_SERVER) | |
all: $(firehose_MIG_SOURCES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIG = /usr/bin/mig | |
CC = clang | |
CXX = clang++ | |
OBJC = clang | |
OBJCXX = clang++ | |
OBJCFLAGS += -O2 | |
OBJCXXFLAGS += -O2 | |
CBLOCKS_FLAGS = -fblocks | |
CXXBLOCKS_FLAGS = -fblocks | |
DEFS = -DHAVE_CONFIG_H | |
top_build_prefix = ../ | |
top_builddir = .. | |
top_srcdir = .. | |
# abs_builddir = /Users/eddie/AppleDeveloper/libdispatch4wine/libdispatch-913.60.2/src | |
# abs_srcdir = /Users/eddie/AppleDeveloper/libdispatch4wine/libdispatch-913.60.2/src | |
# abs_top_builddir = /Users/eddie/AppleDeveloper/libdispatch4wine/libdispatch-913.60.2 | |
# abs_top_srcdir = /Users/eddie/AppleDeveloper/libdispatch4wine/libdispatch-913.60.2 | |
DEFAULT_INCLUDES = -I. -I$(top_builddir)/config | |
LIBRARIES = libdispatch.dylib | |
INTERNAL_WORKQUEUE_SOURCES= \ | |
event/workqueue.c \ | |
event/workqueue_internal.h | |
libdispatch_SOURCES= \ | |
allocator.c \ | |
apply.c \ | |
benchmark.c \ | |
data.c \ | |
init.c \ | |
introspection.c \ | |
io.c \ | |
mach.c \ | |
object.c \ | |
once.c \ | |
queue.c \ | |
semaphore.c \ | |
source.c \ | |
time.c \ | |
transform.c \ | |
voucher.c \ | |
protocol.defs \ | |
provider.d \ | |
allocator_internal.h \ | |
data_internal.h \ | |
inline_internal.h \ | |
internal.h \ | |
introspection_internal.h \ | |
io_internal.h \ | |
mach_internal.h \ | |
object_internal.h \ | |
queue_internal.h \ | |
semaphore_internal.h \ | |
shims.h \ | |
source_internal.h \ | |
trace.h \ | |
voucher_internal.h \ | |
event/event.c \ | |
event/event_config.h \ | |
event/event_epoll.c \ | |
event/event_internal.h \ | |
event/event_kevent.c \ | |
firehose/firehose_internal.h \ | |
firehose/firehose_buffer.c \ | |
firehose/firehoseUser.c \ | |
firehose/firehose_replyServer.c \ | |
shims/atomic.h \ | |
shims/atomic_sfb.h \ | |
shims/getprogname.h \ | |
shims/hw_config.h \ | |
shims/lock.c \ | |
shims/lock.h \ | |
shims/perfmon.h \ | |
shims/time.h \ | |
shims/tsd.h \ | |
shims/yield.h \ | |
$(INTERNAL_WORKQUEUE_SOURCES) | |
libdispatch_OBJECTS = allocator.o apply.o benchmark.o data.o \ | |
init.o introspection.o io.o mach.o object.o once.o \ | |
queue.o semaphore.o source.o time.o transform.o \ | |
voucher.o firehose/firehose_buffer.o \ | |
firehose/firehoseUser.o \ | |
firehose/firehose_replyServer.o \ | |
event/event.o event/event_epoll.o \ | |
event/event_kevent.o shims/lock.o \ | |
event/workqueue.o \ | |
libdispatch-block.o \ | |
libdispatch-data.o libdispatch-object.o | |
nodist_libdispatch_OBJECTS = protocolUser.o protocolServer.o | |
libdispatch_OBJECTS += $(nodist_libdispatch_OBJECTS) | |
AM_CPPFLAGS=-I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/private | |
DISPATCH_CFLAGS=-Wall $(VISIBILITY_FLAGS) $(OMIT_LEAF_FP_FLAGS) \ | |
$(MARCH_FLAGS) $(BSD_OVERLAY_CFLAGS) | |
# if DISPATCH_ENABLE_ASSERTS | |
# DISPATCH_CFLAGS+=-DDISPATCH_DEBUG=1 | |
# endif | |
AM_CFLAGS= $(PTHREAD_WORKQUEUE_CFLAGS) $(DISPATCH_CFLAGS) $(CBLOCKS_FLAGS) | |
AM_OBJCFLAGS=$(DISPATCH_CFLAGS) $(CBLOCKS_FLAGS) | |
AM_CXXFLAGS=$(PTHREAD_WORKQUEUE_CFLAGS) $(DISPATCH_CFLAGS) $(CXXBLOCKS_FLAGS) | |
AM_OBJCXXFLAGS=$(DISPATCH_CFLAGS) $(CXXBLOCKS_FLAGS) | |
#PTHREAD_WORKQUEUE_LIBS=-lpthread_workqueue | |
PTHREAD_WORKQUEUE_CFLAGS= | |
# if BUILD_OWN_BLOCKS_RUNTIME | |
# libdispatch_la_SOURCES+= BlocksRuntime/data.c BlocksRuntime/runtime.c | |
# CBLOCKS_FLAGS+= -I$(top_srcdir)/src/BlocksRuntime | |
# CXXBLOCKS_FLAGS+= -I$(top_srcdir)/src/BlocksRuntime | |
# if USE_OBJC | |
# BLOCKS_RUNTIME_LIBS=-ldl | |
# endif | |
# endif | |
libdispatch_LDFLAGS= | |
libdispatch_LIBADD=$(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS) $(BLOCKS_RUNTIME_LIBS) | |
# libdispatch_LDFLAGS+=-L/usr/lib/system \ | |
# -umbrella System -nodefaultlibs -ldyld \ | |
# -lcompiler_rt -lsystem_kernel -lsystem_platform \ | |
# -lsystem_pthread -lsystem_malloc -lsystem_c \ | |
# -lsystem_blocks -lunwind | |
# libdispatch_LDFLAGS+=-all_load -nostdlib -L/usr/lib/system -umbrella System \ | |
# -nodefaultlibs -ldyld | |
# libdispatch_LDFLAGS+=-not_for_dyld_shared_cache -add_split_seg_info -L/usr/lib/system -umbrella System \ | |
# -nodefaultlibs -ldyld | |
# libdispatch_LDFLAGS+=-Wl,-compatibility_version,1 \ | |
# -Wl,-current_version,$(VERSION) -Wl,-dead_strip \ | |
# -Wl,-alias_list,$(top_srcdir)/xcodeconfig/libdispatch.aliases | |
libdispatch_LDFLAGS += -dylib -arch i386 -not_for_dyld_shared_cache -no_implicit_dylibs \ | |
-platform_version macos 10.13 10.13 \ | |
-add_split_seg_info \ | |
-umbrella System -needed_library /Users/eddie/HighSierra/usr/lib/system/libdyld.dylib \ | |
-needed_library /Users/eddie/HighSierra/usr/lib/system/libcompiler_rt.dylib \ | |
-needed_library /Users/eddie/HighSierra/usr/lib/system/libsystem_kernel.dylib \ | |
-needed_library /Users/eddie/HighSierra/usr/lib/system/libsystem_platform.dylib \ | |
-needed_library /Users/eddie/HighSierra/usr/lib/system/libsystem_pthread.dylib \ | |
-needed_library /Users/eddie/HighSierra/usr/lib/system/libsystem_malloc.dylib \ | |
-needed_library /Users/eddie/HighSierra/usr/lib/system/libsystem_c.dylib \ | |
-needed_library /Users/eddie/HighSierra/usr/lib/system/libsystem_blocks.dylib \ | |
-needed_library /Users/eddie/HighSierra/usr/lib/system/libunwind.dylib \ | |
-current_version 913.60.3 -compatibility_version 1.0.0 \ | |
-dead_strip \ | |
-alias_list $(top_srcdir)/xcodeconfig/libdispatch.aliases \ | |
-upward_library /Users/eddie/HighSierra/usr/lib/libc.dylib \ | |
-upward_library /Users/eddie/HighSierra/usr/lib/libobjc.dylib \ | |
-upward_library /Users/eddie/HighSierra/usr/lib/libauto.dylib \ | |
-syslibroot /Users/eddie/HighSierra \ | |
-order_file $(top_srcdir)/xcodeconfig/libdispatch.order \ | |
-install_name /usr/lib/system/libdispatch.dylib | |
libdispatch_SOURCES+=block.cpp data.m object.m | |
libdispatch_OBJCFLAGS=$(AM_OBJCFLAGS) # -Wno-switch -fobjc-gc | |
libdispatch_CXXFLAGS=$(AM_CXXFLAGS) -std=gnu++11 -fno-exceptions | |
# libdispatch_LDFLAGS+=-Wl,-upward-lobjc -Wl,-upward-lauto \ | |
# -Wl,-order_file,$(top_srcdir)/xcodeconfig/libdispatch.order | |
MIG_SOURCES= \ | |
protocolUser.c \ | |
protocol.h \ | |
protocolServer.c \ | |
protocolServer.h | |
%User.c %.h %Server.c %Server.h: %.defs | |
$(MIG) -user $*User.c -header $*.h \ | |
-server $*Server.c -sheader $*Server.h $< | |
.c.o: | |
$(COMPILE) -c -o $@ $< | |
.cpp.o: | |
$(CXXCOMPILE) -c -o $@ $< | |
.m.o: | |
$(OBJCCOMPILE) -c -o $@ $< | |
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ | |
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | |
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ | |
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) | |
OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ | |
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) | |
libdispatch_LINK = $(LD) $(libdispatch_LDFLAGS) -o $@ | |
libdispatch-block.o: block.cpp | |
$(CXXCOMPILE) $(libdispatch_CXXFLAGS) -c -o libdispatch-block.o block.cpp | |
libdispatch-data.o: data.m | |
$(OBJCCOMPILE) $(libdispatch_OBJCFLAGS) -c -o libdispatch-data.o data.m | |
libdispatch-object.o: object.m | |
$(OBJCCOMPILE) $(libdispatch_OBJCFLAGS) -c -o libdispatch-object.o object.m | |
libdispatch.dylib: $(libdispatch_OBJECTS) $(libdispatch_DEPENDENCIES) $(EXTRA_libdispatch_DEPENDENCIES) | |
$(libdispatch_LINK) $(libdispatch_OBJECTS) $(libdispatch_LIBADD) $(LIBS) | |
all: $(MIG_SOURCES) $(LIBRARIES) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment