From a619c16fa72c3c15a198b452e512a08f18251930 Mon Sep 17 00:00:00 2001 From: wbx Date: Tue, 9 Feb 2010 00:17:46 +0100 Subject: add support for netbsd. just minor fixes needed. --- config/Makefile | 9 +++++---- makefile | 35 +++++++++++++++++++++++++++++++++++ mk/package.mk | 4 ++-- mk/pkg-bottom.mk | 10 +++++----- package/Makefile | 1 - scripts/cpio | 12 +++++++++++- scripts/rstrip.sh | 1 + scripts/scan-tools.sh | 20 +++++++------------- 8 files changed, 66 insertions(+), 26 deletions(-) create mode 100644 makefile diff --git a/config/Makefile b/config/Makefile index 97a8f3a3a..1f3143e34 100644 --- a/config/Makefile +++ b/config/Makefile @@ -31,6 +31,7 @@ ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) HOSTNCURSES+= -DCURSES_LOC="" else HOSTNCURSES+= -DCURSES_LOC="" +LIBS= -lcurses endif endif endif @@ -47,16 +48,16 @@ MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC)) SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC)) conf: $(CONF_OBJS) $(SHARED_OBJS) - $(HOSTCC) -DKBUILD_NO_NLS $(NATIVE_LDFLAGS) $^ -o $@ + $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ mconf: $(MCONF_OBJS) $(SHARED_OBJS) - $(HOSTCC) -DKBUILD_NO_NLS $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS) + $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS) $(CONF_OBJS): %.o : %.c $(SHARED_DEPS) - $(HOSTCC) -DKBUILD_NO_NLS $(HOSTCFLAGS) -I. -c $< -o $@ + $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS) - $(HOSTCC) -DKBUILD_NO_NLS $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@ + $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@ glob.o: glob.c $(SHARED_DEPS) $(HOSTCC) $(HOSTCFLAGS) -I. -c glob.c -o $@ diff --git a/makefile b/makefile new file mode 100644 index 000000000..760d123d6 --- /dev/null +++ b/makefile @@ -0,0 +1,35 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +ADKVERSION= 0.1.0 +TOPDIR= ${.CURDIR} +PWD= ${.CURDIR} + +.include "${.CURDIR}/Makefile.inc" + +GMAKE_ENV+= ADKVERSION=${ADKVERSION:Q} + +.if defined(package) && !empty(package) +subdir:= package/${package} +. if !make(clean) +_subdir_dep:= ${TOPDIR}/.ADK_HAVE_DOT_CONFIG +. endif +.endif + +.if defined(subdir) && !empty(subdir) +_subdir:= ${.TARGETS} +${.TARGETS}: _subdir + +_subdir: ${_subdir_dep} + @if test x"$$(umask 2>/dev/null | sed 's/00*22/OK/')" != x"OK"; then \ + echo >&2 Error: you must build with “umask 022”, sorry.; \ + exit 1; \ + fi + cd ${.CURDIR}/${subdir} && TOPDIR=${.CURDIR} DEVELOPER=1 \ + ${GMAKE} VERBOSE=1 ${.MFLAGS} ${_subdir} + +. include "${.CURDIR}/prereq.mk" +. include "${.CURDIR}/mk/split-cfg.mk" +.else +. include "${.CURDIR}/Makefile" +.endif diff --git a/mk/package.mk b/mk/package.mk index dbf383c8b..cd1f47b6d 100644 --- a/mk/package.mk +++ b/mk/package.mk @@ -220,7 +220,7 @@ ifeq (,$(filter noremove,$(7))) fi endif @rm -f '$${STAGING_PARENT}/pkg/$(1)' - @cd $${IDIR_$(1)}; \ + @-cd $${IDIR_$(1)}; \ x=$$$$(find tmp var -mindepth 1 2>/dev/null); if [[ -n $$$$x ]]; then \ echo 'WARNING: $${IPKG_$(1)} installs files into a' \ 'ramdisk location:' >&2; \ @@ -233,7 +233,7 @@ endif find usr ! -type d 2>/dev/null | \ grep -v -e '^usr/share' -e '^usr/man' -e '^usr/info' | \ tee '$${STAGING_PARENT}/pkg/$(1)' | \ - cpio -apdlmu '$${STAGING_DIR}' + cpio -padlmu '$${STAGING_DIR}' @cd '$${STAGING_DIR}'; grep 'usr/lib/.*\.la$$$$' \ '$${STAGING_PARENT}/pkg/$(1)' | while read fn; do \ chmod u+w $$$$fn; \ diff --git a/mk/pkg-bottom.mk b/mk/pkg-bottom.mk index e136392d7..5d6d8cc30 100644 --- a/mk/pkg-bottom.mk +++ b/mk/pkg-bottom.mk @@ -136,6 +136,9 @@ ifneq ($(filter manual,${INSTALL_STYLE}),) else ifeq ($(strip ${INSTALL_STYLE}),) cd ${WRKBUILD} && env ${MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ DESTDIR='${WRKINST}' ${FAKE_FLAGS} ${INSTALL_TARGET} $(MAKE_TRACE) +ifeq (,$(filter libonly,${PKG_OPTS})) + env ${MAKE_ENV} ${MAKE} post-install $(MAKE_TRACE) +endif else @echo "Invalid INSTALL_STYLE '${INSTALL_STYLE}'" >&2 @exit 1 @@ -144,9 +147,6 @@ endif [[ -e $$a ]] || continue; \ $(SED) "s,^prefix=.*,prefix=${STAGING_DIR}/usr," $$a; \ done -ifeq (,$(filter libonly,${PKG_OPTS})) - @env ${MAKE_ENV} ${MAKE} post-install $(MAKE_TRACE) -endif ifeq (,$(filter noremove,${PKG_OPTS})) @if test -s '${STAGING_PARENT}/pkg/${PKG_NAME}'; then \ cd '${STAGING_DIR}'; \ @@ -156,7 +156,7 @@ ifeq (,$(filter noremove,${PKG_OPTS})) fi endif @rm -f '${STAGING_PARENT}/pkg/${PKG_NAME}' - @cd ${WRKINST}; \ + @-cd ${WRKINST}; \ if [ "${PKG_NAME}" != "uClibc" -a "${PKG_NAME}" != "eglibc" -a "${PKG_NAME}" != "glibc" -a "${PKG_NAME}" != "libpthread" -a "${PKG_NAME}" != "libstdcxx" -a "${PKG_NAME}" != "libthread-db" ];then \ find lib \( -name lib\*.so\* -o -name lib\*.a \) \ -exec echo 'WARNING: ${PKG_NAME} installs files in /lib -' \ @@ -164,7 +164,7 @@ endif find usr ! -type d 2>/dev/null | \ grep -v -e '^usr/share' -e '^usr/man' -e '^usr/info' | \ tee '${STAGING_PARENT}/pkg/${PKG_NAME}' | \ - cpio -apdlmu '${STAGING_DIR}' + cpio -padlmuv '${STAGING_DIR}' @cd '${STAGING_DIR}'; grep 'usr/lib/.*\.la$$' \ '${STAGING_PARENT}/pkg/${PKG_NAME}' | while read fn; do \ chmod u+w $$fn; \ diff --git a/package/Makefile b/package/Makefile index 0f8c43a92..4c8e63b92 100644 --- a/package/Makefile +++ b/package/Makefile @@ -56,7 +56,6 @@ $(TARGET_DIR): $(CMD_TRACE) " done" $(END_TRACE) -#%-install: %-compile %-install: @$(START_TRACE) "package/$(patsubst %-install,%,$@)-install: " @$(MAKE) -C $(patsubst %-install,%,$@) install diff --git a/scripts/cpio b/scripts/cpio index 2a12d4ffe..85c12ed18 100755 --- a/scripts/cpio +++ b/scripts/cpio @@ -2,4 +2,14 @@ # This file is part of the OpenADK project. OpenADK is copyrighted # material, please see the LICENCE file in the top-level directory. -/bin/cpio --quiet "$@" +os=$(uname) +case $os in + NetBSD|MirBSD) + quiet="" + ;; + *) + quiet="--quiet" + ;; +esac + +/bin/cpio $quiet "$@" diff --git a/scripts/rstrip.sh b/scripts/rstrip.sh index d897c0ef3..591c5bb07 100644 --- a/scripts/rstrip.sh +++ b/scripts/rstrip.sh @@ -58,3 +58,4 @@ find $TARGETS -type f -a -exec file {} \; | \ echo "-> $T $F" eval "$T $F" done +exit 0 diff --git a/scripts/scan-tools.sh b/scripts/scan-tools.sh index 743f316b0..56b79663d 100644 --- a/scripts/scan-tools.sh +++ b/scripts/scan-tools.sh @@ -47,12 +47,7 @@ CYG*) echo 'See http://www.cygwin.com/1.7/cygwin-ug-net/using-specialnames.html' ;; NetBSD) - echo "Building OpenADK on $os is currently unsupported." - echo "Sorry." - echo - echo There are unresolved issues relating to ncurses not - echo being included in NetBSD®, and these provided by pkgsrc® - echo lack important header files. + # supported with no extra quirks at the moment ;; OpenBSD) # supported with no extra quirks at the moment @@ -191,13 +186,12 @@ if [[ $X != *@(Native compiler works)* ]]; then out=1 fi -[[ -s /usr/include/ncurses.h ]] || if [[ -s /usr/pkg/include/ncurses.h ]]; then - echo 'HOSTCFLAGS+= -isystem /usr/pkg/include' >>$topdir/prereq.mk - echo 'HOSTLDFLAGS+=-L/usr/pkg/lib -Wl,-rpath -Wl,/usr/pkg/lib' >>$topdir/prereq.mk -else - echo Install ncurses header files, please. - echo - out=1 +if [[ ! -s /usr/include/ncurses.h ]]; then + if [[ ! -s /usr/include/curses.h ]]; then + echo Install ncurses header files, please. + echo + out=1 + fi fi if ! which gawk >/dev/null 2>&1; then -- cgit v1.2.3 From 91e7244abc54001dc7b1063cd1b9818d46128bba Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 9 Feb 2010 00:25:56 +0100 Subject: freebsd cpio is in /usr/bin --- scripts/cpio | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/cpio b/scripts/cpio index 2a12d4ffe..fc671ca48 100755 --- a/scripts/cpio +++ b/scripts/cpio @@ -2,4 +2,8 @@ # This file is part of the OpenADK project. OpenADK is copyrighted # material, please see the LICENCE file in the top-level directory. -/bin/cpio --quiet "$@" +if [ -x /usr/bin/cpio ];then + /usr/bin/cpio --quiet "$@" +else + /bin/cpio --quiet "$@" +fi -- cgit v1.2.3