Tweaked Makefile patch target for compatibility with older versions of git. Differentiated bdist and sdist in dist.sh

This commit is contained in:
Joseph Henry
2019-05-10 12:24:00 -07:00
parent eaac3429f0
commit b5c49ebd35
3 changed files with 92 additions and 18 deletions

View File

@@ -511,6 +511,7 @@ set (PUBLIC_ZT_HEADERS
set_target_properties(${STATIC_LIB_NAME} PROPERTIES PUBLIC_HEADER "${PUBLIC_ZT_HEADERS}")
install (TARGETS ${STATIC_LIB_NAME}
LIBRARY DESTINATION "lib"
PUBLIC_HEADER DESTINATION "include"
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include
)

View File

@@ -17,14 +17,14 @@ list:
# Pull all submodules
update:
git submodule update --init
git submodule status
@git submodule update --init
@git submodule status
# Patch submodules (issue update first)
patch:
-git -C ext/lwip apply ../lwip.patch
-git -C ext/lwip-contrib apply ../lwip-contrib.patch
-git -C ext/ZeroTierOne apply ../ZeroTierOne.patch
-cd ext/lwip; git apply ../lwip.patch;
-cd ext/lwip-contrib; git apply ../lwip-contrib.patch;
-cd ext/ZeroTierOne; git apply ../ZeroTierOne.patch;
# Target-specific clean
clean_ios:
@@ -98,7 +98,13 @@ all: host host_jar macos ios android
wrap:
$(DIST_BUILD_SCRIPT) wrap
# [For distribution process only] Marge and package everything into a tarball
dist:
# Binary distribution
bdist:
$(DIST_BUILD_SCRIPT) merge
$(DIST_BUILD_SCRIPT) dist
$(DIST_BUILD_SCRIPT) bdist
# Source distribution
sdist: update patch
$(DIST_BUILD_SCRIPT) sdist
dist: bdist sdist

83
dist.sh
View File

@@ -292,6 +292,7 @@ clean()
prep_android_example()
{
echo "Executing task: " ${FUNCNAME[ 0 ]} "(" $1 ")"
mkdir -p examples/android/ExampleAndroidApp/app/libs/
cp -f lib/$1/android-armeabi-v7a/libzt-$1.aar \
examples/android/ExampleAndroidApp/app/libs/libzt.aar
}
@@ -448,6 +449,19 @@ wrap()
tar --exclude=$PROD_FILENAME -zcvf $PROD_FILENAME -C $ARCH_WRAP_DIR .
}
# Renames and copies licenses for libzt and each of its dependencies
package_licenses()
{
CURR_DIR=$1
DEST_DIR=$2
mkdir -p $DEST_DIR
cp $CURR_DIR/ext/lwip/COPYING $DEST_DIR/LWIP-LICENSE.BSD
cp $CURR_DIR/ext/concurrentqueue/LICENSE.md $DEST_DIR/CONCURRENTQUEUE-LICENSE.BSD
cp $CURR_DIR/LICENSE.GPL-3 $DEST_DIR/ZEROTIER-LICENSE.GPL-3
cp $CURR_DIR/include/net/ROUTE_H-LICENSE.APSL $DEST_DIR/ROUTE_H-LICENSE.APSL
cp $CURR_DIR/include/net/ROUTE_H-LICENSE $DEST_DIR/ROUTE_H-LICENSE
}
# Copies binaries, documentation, licenses, etc into a products
# dir and then tarballs everything together
package_everything()
@@ -457,14 +471,8 @@ package_everything()
PROD_NAME=$LIBZT_VERSION-$(date '+%Y%m%d_%H-%M')-$1
PROD_DIR=$(pwd)/products/$PROD_NAME/
# Make products directory
LICENSE_DIR=$PROD_DIR/licenses
mkdir -p $LICENSE_DIR
# Licenses
cp $(pwd)/ext/lwip/COPYING $LICENSE_DIR/LWIP-LICENSE.BSD
cp $(pwd)/ext/concurrentqueue/LICENSE.md $LICENSE_DIR/CONCURRENTQUEUE-LICENSE.BSD
cp $(pwd)/LICENSE.GPL-3 $LICENSE_DIR/ZEROTIER-LICENSE.GPL-3
cp $(pwd)/include/net/ROUTE_H-LICENSE.APSL $LICENSE_DIR/ROUTE_H-LICENSE.APSL
cp $(pwd)/include/net/ROUTE_H-LICENSE $LICENSE_DIR/ROUTE_H-LICENSE
package_licenses $(pwd) $PROD_DIR/licenses
# Documentation
mkdir -p $PROD_DIR/doc
# Copy the errno header from lwIP for customer reference
@@ -523,8 +531,67 @@ package_everything()
done
}
# Generates a source-only tarball
sdist()
{
VERSION=$(git describe --abbrev=0)
TARBALL_DIR="libzt-${VERSION}"
TARBALL_NAME=libzt-${VERSION}-source.tar.gz
PROD_DIR=$(pwd)/products/
mkdir -p $PROD_DIR
#
mkdir ${TARBALL_DIR}
# primary sources
cp -rf src ${TARBALL_DIR}/src
cp -rf include ${TARBALL_DIR}/include
# important build scripts
cp Makefile ${TARBALL_DIR}
cp CMakeLists.txt ${TARBALL_DIR}
cp *.md ${TARBALL_DIR}
cp *.sh ${TARBALL_DIR}
cp *.bat ${TARBALL_DIR}
# submodules/dependencies
# lwIP
mkdir ${TARBALL_DIR}/ext
mkdir -p ${TARBALL_DIR}/ext/lwip/src
cp -rf ext/lwip/src/api ${TARBALL_DIR}/ext/lwip/src
cp -rf ext/lwip/src/core ${TARBALL_DIR}/ext/lwip/src
cp -rf ext/lwip/src/include ${TARBALL_DIR}/ext/lwip/src
cp -rf ext/lwip/src/netif ${TARBALL_DIR}/ext/lwip/src
# lwIP ports
mkdir -p ${TARBALL_DIR}/ext/lwip-contrib/ports
cp -rf ext/lwip-contrib/ports/unix ${TARBALL_DIR}/ext/lwip-contrib/ports
cp -rf ext/lwip-contrib/ports/win32 ${TARBALL_DIR}/ext/lwip-contrib/ports
# ZeroTierOne
mkdir ${TARBALL_DIR}/ext/ZeroTierOne
cp -rf ext/ZeroTierOne/*.h ${TARBALL_DIR}/ext/ZeroTierOne
cp -rf ext/ZeroTierOne/controller ${TARBALL_DIR}/ext/ZeroTierOne
cp -rf ext/ZeroTierOne/ext ${TARBALL_DIR}/ext/ZeroTierOne
cp -rf ext/ZeroTierOne/include ${TARBALL_DIR}/ext/ZeroTierOne
cp -rf ext/ZeroTierOne/node ${TARBALL_DIR}/ext/ZeroTierOne
cp -rf ext/ZeroTierOne/osdep ${TARBALL_DIR}/ext/ZeroTierOne
#
# Perform selective removal
rm -rf ${TARBALL_DIR}/ext/ZeroTierOne/ext/bin
rm -rf ${TARBALL_DIR}/ext/ZeroTierOne/ext/tap-mac
rm -rf ${TARBALL_DIR}/ext/ZeroTierOne/ext/librethinkdbxx
rm -rf ${TARBALL_DIR}/ext/ZeroTierOne/ext/installfiles
rm -rf ${TARBALL_DIR}/ext/ZeroTierOne/ext/curl-*
rm -rf ${TARBALL_DIR}/ext/ZeroTierOne/ext/http-parser
#
mkdir ${TARBALL_DIR}/ext/concurrentqueue
cp -rf ext/concurrentqueue/*.h ${TARBALL_DIR}/ext/concurrentqueue
# Licenses
package_licenses $(pwd) $TARBALL_DIR/licenses
# Tarball everything and display the results
tar -cvf ${TARBALL_NAME} ${TARBALL_DIR}
tree ${TARBALL_DIR}
rm -rf ${TARBALL_DIR}
mv ${TARBALL_NAME} ${PROD_DIR}
}
# Package both debug and release
dist()
bdist()
{
echo "Executing task: " ${FUNCNAME[ 0 ]} "(" $1 ")"
package_everything "debug"