# Makefile
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m := $(shell find ../bin/* -type d | xargs basename)
version = 9.5.9
release = 1
DOTUSER = $(shell ls -ld . | sed -e 's/[^ ]* *[^ ]* *\([^ ]*\).*/\1/')
DOTGROUP = $(shell ls -ldg . | sed -e 's/[^ ]* *[^ ]* *\([^ ]*\).*/\1/')
BUILDROOT = $(m)$(version)
RELEASE = csv$(version)
TARBALL = $(RELEASE)-$(m).tar.gz
PKG = $(RELEASE)-$(m)-$(release).pkg
PKGCONTENT =\
$(BUILDROOT)/Resources/en.lproj/Welcome.html\
$(BUILDROOT)/Resources/en.lproj/License.txt\
$(BUILDROOT)/Distribution\
$(BUIDROOT)/Root/bin\
$(BUILDROOT)/Root/lib\
$(BUILDROOT)/Root/man
$(PKG): $(BUILDROOT)/$(PKG)
sudo /usr/bin/productbuild\
--resources $(BUILDROOT)/Resources\
--distribution $(BUILDROOT)/Distribution\
--package-path $(BUILDROOT)\
$(PKG)
sudo chown $(DOTUSER):$(DOTGROUP) $(PKG)
sudo rm -rf $(RELEASE) $(BUILDROOT)
$(BUILDROOT)/$(PKG): $(PKGCONTENT)
sudo /usr/bin/pkgbuild\
--root $(BUILDROOT)/Root\
--identifier chezscheme\
--version $(version)\
--install-location /\
--ownership recommended\
$(BUILDROOT)/$(PKG)
$(BUILDROOT)/Distribution: $(BUILDROOT)
echo '' > $(BUILDROOT)/Distribution
echo '
Copyright © 2022 Cisco Systems, Inc.
' >> $(BUILDROOT)/Resources/en.lproj/Welcome.html echo 'Chez Scheme is a programming language and an implementation of that language, with supporting tools and documentation.
' >> $(BUILDROOT)/Resources/en.lproj/Welcome.html echo '' >> $(BUILDROOT)/Resources/en.lproj/Welcome.html chmod 644 $(BUILDROOT)/Resources/en.lproj/Welcome.html $(BUILDROOT)/Resources/en.lproj/License.txt: $(BUILDROOT)/Resources/en.lproj cat ../../NOTICE ../../LICENSE > $(BUILDROOT)/Resources/en.lproj/License.txt chmod 644 $(BUILDROOT)/Resources/en.lproj/License.txt $(BUILDROOT)/Resources/en.lproj: $(BUILDROOT)/Resources install -d $(BUILDROOT)/Resources/en.lproj $(BUILDROOT)/Resources: $(BUILDROOT) install -d $(BUILDROOT)/Resources $(BUIDROOT)/Root/bin $(BUILDROOT)/Root/lib $(BUILDROOT)/Root/man: $(BUILDROOT)/Root $(RELEASE) ( cd $(RELEASE); sudo make install InstallGroup=wheel TempRoot=../$(BUILDROOT)/Root ) $(BUILDROOT)/Root: $(BUILDROOT) install -d $(BUILDROOT)/Root $(RELEASE): $(BUILDROOT) ../bintar/$(TARBALL) tar -xzf ../bintar/$(TARBALL) $(BUILDROOT): install -d $(BUILDROOT) clean: rm -rf $(PKG) $(BUILDROOT) $(RELEASE)