1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475 |
- #!/bin/bash
- #TODO: Add in perl? Maybe?
- #TODO: Update deb build numbers as needed
- #TODO: Some bins (berkeleydb, readline libs) bitch about not being a vaild file descriptor when attempting to sign them. wtf
- MAINTAINER="Maintainer: Kevin Bradley <maintainer@nito.tv>"
- VERIFY="true"
- ARCH="arm64"
- PLATFORM="AppleTVOS"
- PLATFORM_LOWER="appletvos"
- MIN_VERSION="-mappletvos-version-min=9.0"
- CODESIGN_TOOL="jtool"
- CLANG_PATH="`xcrun -f clang`"
- CLANGPLUS_PATH="`xcrun -f clang++`"
- BUILD_ROOT="`pwd`"
- ROOT_PREFIX="usr"
- SKEL_PREFIX="$BUILD_ROOT/skel"
- PKG_NAME="" #The name of our current package being built
- PKG_VERSION="-1"
- WORKING_DIR="" #This stores the working directory under BUILD_ROOT
- BUILD_BASH="false"
- set -e
- # set trap to help debug any build errors
- trap "echo '** ERROR with build:'; pwd" INT TERM EXIT
- usage() {
- echo "usage: $0 [-c|--codesign-tool] [-b|--build-bash] [-i|--insecure] [-p|--platform] [-s|--sdk-path]"
- trap - INT TERM EXIT
- exit 0
- }
- while test $# -gt 0; do
- case "$1" in
- -h|--help)
- usage
- ;;
- -c|--codesign-tool)
- shift
- if test $# -gt 0; then
- CODESIGN_TOOL="$1"
- if [ ! "$CODESIGN_TOOL" == "ldid" ] && [ ! "$CODESIGN_TOOL" == "ldid2" ] && [ ! "$CODESIGN_TOOL" == "jtool" ]; then
- echo "Error: Invalid codesigning tool"
- trap - INT TERM EXIT
- exit 1
- fi
- else
- echo "Error: No codesigning tool given."
- echo " Try: ldid, jtool or ldid2"
- trap - INT TERM EXIT
- exit 1
- fi
- shift
- ;;
- -b|--build-bash)
- BUILD_BASH="true"
- shift
- ;;
- -i|--insecure|--no-verify)
- VERIFY="false"
- echo "Working without verifying packages..."
- echo "YOU BETTER KNOW WHAT YOU'RE DOING"
- sleep 2 #Give them a couple seconds to think about what they're about to do
- shift
- ;;
- -p|--platform)
- shift
- if test $# -gt 0; then
- PLATFORM="$1"
- else
- echo "No platform given."
- trap - INT TERM EXIT
- exit 1
- fi
- shift
- ;;
- -s|--sdk-path|--sdk)
- shift
- if test $# -gt 0; then
- SDK_PATH="$1"
- else
- echo "No platform given."
- trap - INT TERM EXIT
- exit 1
- fi
- shift
- ;;
- *)
- break
- ;;
- esac
- done
- #Check for required programs
- command -v cmake -j8 >/dev/null 2>&1 || { echo >&2 "Missing cmake.\nRun: brew install cmake" ; }
- command -v gtar >/dev/null 2>&1 || { echo >&2 "Missing gnutar.\nRun: brew install gnu-tar" ; }
- command -v dpkg >/dev/null 2>&1 || { echo >&2 "Missing dpkg.\nRun: brew install dpkg" ; }
- #jtool
- #command -v jtool >/dev/null 2>&1 || { }
- #brew
- #autoconf
- #docbook-xsl
- #One of the two is required
- command -v md5sum >/dev/null 2>&1 || { command -v md5 >/dev/null 2>&1 || { echo >&2 "Missing md5sum" ; } ; }
- if [ "$VERIFY" == "true" ]; then
- command -v gpg2 >/dev/null 2>&1 || { echo >&2 "Missing GPG. Cannot verify. Dying."; exit 127 ; }
- echo "Importing necessary PGP keys"
- gpg2 --recv-key 69184620 7C0135FB088AAF6C66C650B9BB5869F064EA74AB 702353E0F7E48EDB 7FD9FCCB000BEEEE A15B725964A95EE5 D8692123C4065DEA5E0F3AB5249B39D24F25E3B6 031EC2536E580D8EA286A9F22071B08A33BD3F06 9D5EAAF69013B842
- fi
- #Eventually we'll make -j8 this work for any platform
- #For now, this is just scaffolding for the future
- #When the time comes, there are several other places which have hardcoded appletvos in them
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- #Defaults are good
- echo ""
- elif [ "$PLATFORM" == "WatchOS" ]; then
- #Untested
- PLATFORM_LOWER="watchos"
- MIN_VERSION="-mwatchos-version-min=3.0"
- ARCH="armv7k"
- else
- echo "Unsupported Platform."
- trap - INT TERM EXIT
- exit 127
- fi
- if [ -z "$SDK_PATH" ]; then
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- SDK_PATH="`xcrun --sdk appletvos --show-sdk-path`"
- elif [ "$PLATFORM" == "WatchOS" ]; then
- SDK_PATH="`xcrun --sdk watchos --show-sdk-path`"
- fi
- elif [ ${SDK_PATH: -1} == "/" ]; then
- # Some of our sed's require SDK_PATH *not* end with /
- SDK_PATH="`echo $SDK_PATH | sed 's/\/$//g'`"
- fi
- #================
- #Helper Functions
- #----------------
- initDebStructure() {
- rm -rf deb
- mkdir -p deb/DEBIAN
- rm -rf deb-doc
- mkdir -p deb-doc/DEBIAN
- rm -rf deb-dev
- mkdir -p deb-dev/DEBIAN
- }
- prepSDK() {
- #Availability.h patches
- #grep -R "#define __TVOS_UNAVAILABLE " "$SDK_PATH/usr/include/Availability.h"
- #grep -R "#define __TVOS_PROHIBITED " "$SDK_PATH/usr/include/Availability.h"
- #sudo sed -i -- "s|#define __TVOS_UNAVAILABLE __OS_AVAILABILITY(tvos,unavailable)|#define __TVOS_UNAVAILABLE_NOTQUITE __OS_AVAILABILITY(tvos,unavailable)|" /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/Availability.h
- #sudo sed -i -- "s|#define __TVOS_PROHIBITED __OS_AVAILABILITY(tvos,unavailable)|#define __TVOS_PROHIBITED_NOTQUITE __OS_AVAILABILITY(tvos,unavailable)|" /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/Availability.h
- #Fix for ncurses
- if [ ! -e "$SDK_PATH/usr/include/sys/ttydev.h" ]; then
- echo "Missing <sys/ttydev.h>. Moving it in from MacOSX SDK (with sudo)"
- sudo cp "`xcrun --sdk macosx --show-sdk-path`/usr/include/sys/ttydev.h" "$SDK_PATH/usr/include/sys/ttydev.h"
- fi
- #I forget.. Readline perhaps?
- #IOKit
- #~/Library/Developer/Xcode/tvOS\ DeviceSupport
- #9.0 (13T396)
- #9.0.1 (13T402)
- #10.1 (14U593)
- #10.1.1 (14U712a)
- #10.2.1 (14W585a)
- #10.2.2 (14W756)
- #11.1 (15J582)
- #/Users/kevinbradley/Library/Developer/Xcode/tvOS\ DeviceSupport/11.1\ \(15J582\)/Symbols/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
- }
- # this needs to be modified to have the proper spacing, if the spacing is absolutely perfect you can't ever use jtool to change the entitlements without building from scratch
- createEntitlements() {
- if [ ! -e "$BUILD_ROOT/ent.plist" ]; then
- echo "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "$BUILD_ROOT/ent.plist"
- echo "<plist version=\"1.0\">" >> "$BUILD_ROOT/ent.plist"
- echo "<dict>" >> "$BUILD_ROOT/ent.plist"
- echo " <key>platform-application</key>" >> "$BUILD_ROOT/ent.plist"
- echo " <true/>" >> "$BUILD_ROOT/ent.plist"
- echo " <key>com.apple.private.skip-library-validation</key>" >> "$BUILD_ROOT/ent.plist"
- echo " <true/>" >> "$BUILD_ROOT/ent.plist"
- echo "</dict>" >> "$BUILD_ROOT/ent.plist"
- echo "</plist>" >> "$BUILD_ROOT/ent.plist"
- fi
- }
- # for some reason the files signed this way don't run on tvOS 9 anymore
- codesign() {
- #local var=$(ldid -S "$1");
- if [ "$CODESIGN_TOOL" == "jtool" ]; then
- createEntitlements
- jtool --sign platform --ent "$BUILD_ROOT/ent.plist" "$1"
- sudo cp -X out.bin "$1"
- elif [ "$CODESIGN_TOOL" == "ldid" ]; then
- ldid -S "$1"
- elif [ "$CODESIGN_TOOL" == "ldid2" ]; then
- ldid2 -S "$1"
- fi
- }
- notifyProgress() {
- echo "$1"
- #say "$1"
- }
- createListFile() {
- if [ ! -d "$SKEL_PREFIX/var/lib/dpkg/info/" ]; then
- mkdir -p "$SKEL_PREFIX/var/lib/dpkg/info/"
- fi
- #md5 -r == md5sum
- MD5="md5sum"
- command -v md5sum >/dev/null 2>&1 || { MD5="md5 -r" ; }
- find "$BUILD_ROOT/$WORKING_DIR/deb" -type f -not -path "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/*" -exec $MD5 {} \; | awk '{ print $1 " " $2 }' | sed "s|$BUILD_ROOT/$WORKING_DIR/deb/||g" >> "$SKEL_PREFIX/var/lib/dpkg/info/$PKG_NAME.md5sums"
- find "$BUILD_ROOT/$WORKING_DIR/deb" -type f -not -path "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/*" | sed "s|$BUILD_ROOT/$WORKING_DIR/deb||g" >> "$SKEL_PREFIX/var/lib/dpkg/info/$PKG_NAME.list"
- FILES="$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/*"
- for f in $FILES; do
- file=${f##*/}
- if [ "$file" != "control" ]; then
- echo "Processing $file in $PKG_NAME..";
- cp "$f" "$SKEL_PREFIX/var/lib/dpkg/info/$PKG_NAME.$file"
- fi
- done
- }
- #warning: this will process ANY deb file you have in your $BUILD_ROOT
- createStatusFile() {
- cd "$BUILD_ROOT"
- rm -rf status
- rm -rf available
- for f in *.deb; do
- echo "Processing $f..";
- dpkg-deb -f "$f" >> status
- dpkg-deb -f "$f" >> available
- echo "Status: install ok installed" >> status
- echo "" >> status
- echo "" >> available
- done
- mv status "$SKEL_PREFIX/var/lib/dpkg/status"
- mv available "$SKEL_PREFIX/var/lib/dpkg/available"
- }
- checkPGPSig() {
- if [ "$VERIFY" == "true" ]; then
- SIGFILE="$1"
- FILE="$2"
- local VERIFY_TEST="`gpg --verify $SIGFILE $FILE 2>&1 | grep 'Good signature'`"
- if [ "$VERIFY_TEST" == "" ]; then
- echo "Failed to validate PGP signature for $FILE"
- trap - INT TERM EXIT
- exit 127
- fi
- echo "*** VALID SIGNATURE"
- fi
- }
- checkSHA256() {
- if [ "$VERIFY" == "true" ]; then
- FILE="$1"
- VALID_SHA="$2"
- VERIFY_TEST="`shasum -a 256 $FILE | cut -c 1-64`"
- if [ "$VERIFY_TEST" != "$VALID_SHA" ]; then
- echo "Failed to validate SHA256 signature for $FILE"
- trap - INT TERM EXIT
- exit 127
- fi
- echo "*** VALID SIGNATURE"
- fi
- }
- #=====================
- #OSGT10.1
- #---------------------
- #Download readline
- downloadReadline() {
- #http://gnu.askapache.com/readline/readline-7.0.tar.gz
- if [ ! -e readline-7.0.tar.gz ]; then
- echo "Downloading readline-7.0.tar.gz"
- curl -LO http://gnu.askapache.com/readline/readline-7.0.tar.gz
- curl -LO http://gnu.askapache.com/readline/readline-7.0.tar.gz.sig
- checkPGPSig readline-7.0.tar.gz.sig readline-7.0.tar.gz
- else
- echo "Using existing readline"
- fi
- rm -rf readline-7.0
- tar xzvf readline-7.0.tar.gz
- WORKING_DIR="readline-7.0"
- PKG_NAME="readline"
- PKG_VERSION="7.0-1"
- cd "$WORKING_DIR"
- }
- #readline
- #Notes:
- # Doesn't like to build with ncurses.a in any of its linker paths (read: rm -rf skel)
- buildReadline() {
- downloadReadline
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libhistory.7.0.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libreadline.7.0.dylib"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libhistory.7.0.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libreadline.7.0.dylib"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Development" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: bash, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: command-line history management" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://tiswww.cwru.edu/php/chet/readline/rltop.html" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download ncurses
- downloadNcurses() {
- if [ ! -e ncurses-6.0.tar.gz ]; then
- echo "Downlading ncurses-6.0.tar.gz"
- curl -LO http://gnu.mirror.constant.com/ncurses/ncurses-6.0.tar.gz
- curl -LO http://gnu.mirror.constant.com/ncurses/ncurses-6.0.tar.gz.sig
- checkPGPSig ncurses-6.0.tar.gz.sig ncurses-6.0.tar.gz
- else
- echo "Using existing ncurses-6.0"
- fi
- rm -rf ncurses-6.0
- tar xzvf ncurses-6.0.tar.gz
- WORKING_DIR="ncurses-6.0"
- PKG_NAME="ncurses"
- PKG_VERSION="6.0-1"
- cd "$WORKING_DIR"
- }
- patchNcurses() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- if [ "$PKG_VERSION" == "6.0-1" ]; then
- # LEFT ERROR ON environ)' no ;
- # For some reason, building never fails on the error...
- # But still, tput is in /usr/bin... so.... ??
- cat progs/tput.c | head -n 55 > tput.patched.c
- echo "#include <stdint.h>" >> tput.patched.c
- echo "#include <stdio.h>" >> tput.patched.c
- echo "#include <stdlib.h>" >> tput.patched.c
- echo "#include <spawn.h>" >> tput.patched.c
- echo "#include <sys/wait.h>" >> tput.patched.c
- echo "" >> tput.patched.c
- echo "extern char **environ;" >> tput.patched.c
- echo "" >> tput.patched.c
- cat progs/tput.c | tail -n 350 | head -n 50 >> tput.patched.c
- echo "int RunCmd(const char *cmd) {" >> tput.patched.c
- echo " pid_t pid;" >> tput.patched.c
- echo ' char *argv[] = {"sh", "-c", (char*)cmd, NULL};' >> tput.patched.c
- echo ' int status;' >> tput.patched.c
- echo ' status = posix_spawn(&pid, "/bin/sh", NULL, NULL, argv, environ)' >> tput.patched.c
- echo ' if (status == 0) {' >> tput.patched.c
- echo ' if (waitpid(pid, &status, 0) != -1) {' >> tput.patched.c
- echo ' printf("Child exted in ATV Patched RunCmd with status %i\n", status);' >> tput.patched.c
- echo ' } else {' >> tput.patched.c
- echo ' perror("waitpid");' >> tput.patched.c
- echo ' }' >> tput.patched.c
- echo ' } else {' >> tput.patched.c
- echo ' printf("posix_spawn: %s\n", strerror(status));' >> tput.patched.c
- echo ' }' >> tput.patched.c
- echo ' return status;' >> tput.patched.c
- echo '}' >> tput.patched.c
- echo "" >> tput.patched.c
- cat progs/tput.c | tail -n 301 | sed 's/system(init_prog)/RunCmd(init_prog)/g' >> tput.patched.c
- cp tput.patched.c progs/tput.c
- fi
- fi
- }
- #ncurses
- #Notes:
- # Needs DESTDIR in make -j8 to not attempt to build test files (which fail to link)
- # May need the make clean in between to keep out artifacts from the old DESTDIR
- buildNcurses() {
- downloadNcurses
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=aarch64-apple-darwin
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin
- fi
- make -j8 DESTDIR="$SKEL_PREFIX/" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/clear"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/infocmp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tabs"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tic"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/toe"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tput"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tset"
- make clean
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/clear"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/infocmp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tabs"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tic"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/toe"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tput"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tset"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: System" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: feature-complete terminal library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: New Curses" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnu.org/software/ncurses/ncurses.html" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/ncurses6-config" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download bash
- downloadBash() {
- #http://gnu.askapache.com/bash/bash-4.4.12.tar.gz
- if [ ! -e bash-4.4.12.tar.gz ]; then
- echo "Downloading bash-4.4.12.tar.gz"
- curl -LO http://gnu.askapache.com/bash/bash-4.4.12.tar.gz
- curl -LO http://gnu.askapache.com/bash/bash-4.4.12.tar.gz.sig
- checkPGPSig bash-4.4.12.tar.gz.sig bash-4.4.12.tar.gz
- else
- echo "Using existing bash"
- fi
- rm -rf bash-4.4.12
- tar xzvf bash-4.4.12.tar.gz
- WORKING_DIR="bash-4.4.12"
- PKG_NAME="bash"
- PKG_VERSION="4.4.12-1"
- cd "$WORKING_DIR"
- }
- patchBash() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- sed -i -- 's|^#undef HAVE_SYS_SIGLIST$|#define HAVE_SYS_SIGLIST 1|' config.h.in
- fi
- }
- #bash
- #Notes:
- # Requires autoconf
- buildBash() {
- downloadBash
- patchBash
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --disable-nls --with-installed-readline --disable-largefile bash_cv_dev_fd=absent bash_cv_sys_named_pipes=present bash_cv_job_control_missing=present bash_cv_func_sigsetjmp=present bash_cv_func_ctype_nonascii=no bash_cv_must_reinstall_sighandlers=no bash_cv_func_strcoll_broken=yes ac_cv_c_stack_direction=-1 ac_cv_func_mmap_fixed_mapped=yes gt_cv_int_divbyzero_sigfpe=no ac_cv_func_setvbuf_reversed=no ac_cv_func_strcoll_works=yes ac_cv_func_working_mktime=yes ac_cv_type_getgroups=gid_t bash_cv_dup2_broken=no ac_cv_prog_cc_g=no ac_cv_rl_version=6.0
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin --disable-nls --with-installed-readline --disable-largefile bash_cv_dev_fd=absent bash_cv_sys_named_pipes=present bash_cv_job_control_missing=present bash_cv_func_sigsetjmp=present bash_cv_func_ctype_nonascii=no bash_cv_must_reinstall_sighandlers=no bash_cv_func_strcoll_broken=yes ac_cv_c_stack_direction=-1 ac_cv_func_mmap_fixed_mapped=yes gt_cv_int_divbyzero_sigfpe=no ac_cv_func_setvbuf_reversed=no ac_cv_func_strcoll_works=yes ac_cv_func_working_mktime=yes ac_cv_type_getgroups=gid_t bash_cv_dup2_broken=no ac_cv_prog_cc_g=no ac_cv_rl_version=6.0
- fi
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/bash"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/basename"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/dirname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/finfo"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/head"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/id"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/ln"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/logname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/mkdir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/mypid"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/pathchk"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/print"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/printenv"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/push"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/realpath"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/rmdir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/setpgid"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/sleep"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/strftime"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/sync"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/tee"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/truefalse"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/tty"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/uname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/unlink"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/whoami"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$SKEL_PREFIX/$ROOT_PREFIX/bin/bashbug"
- sed -i -- "s|$SKEL_PREFIX||g" "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/Makefile.inc"
- sed -i -- "s|BUILD_DIR = $BUILD_ROOT/$WORKING_DIR|BUILD_DIR = /usr/src/usr.bin/$WORKING_DIR|g" "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/Makefile.inc"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/bashbug--"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/Makefile.inc--"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bash"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/basename"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/dirname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/finfo"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/head"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/id"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/ln"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/logname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/mkdir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/mypid"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/pathchk"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/print"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/printenv"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/push"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/realpath"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/rmdir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/setpgid"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/sleep"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/strftime"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/sync"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/tee"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/truefalse"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/tty"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/uname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/unlink"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/whoami"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bashbug"
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/Makefile.inc"
- sed -i -- "s|BUILD_DIR = $BUILD_ROOT/$WORKING_DIR|BUILD_DIR = /usr/src/usr.bin/$WORKING_DIR|g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/Makefile.inc"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bashbug--"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/Makefile.inc--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Terminal_Support" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- echo "Pre-Depends: dpkg (>= 1.14.25-8), cy+model.appletv" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: grep, readline (>= 6.0-7), sed, firmware (>= 10.2.2)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- else
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: grep, readline (>= 6.0-7), sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- fi
- echo "Description: the best shell ever written by Brian Fox" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Bourne-Again SHell" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/bash/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- #FIXME: Make a $PKG_NAME-staticlibs.deb
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- # DONT USE UNLESS YOU ARE ON 11+; OVERWRITE BASH (or any other apple-signed file, for that matter), LEAD TO BRICK
- # 10.2 and up
- buildBashAndFriends() {
- notifyProgress "Building readline"
- buildReadline
- notifyProgress "Building ncurses"
- buildNcurses
- notifyProgress "Building bash"
- buildBash
- }
- #=====================
- #Basic Utils
- #---------------------
- #Download sed
- downloadSed() {
- if [ ! -e sed-4.4.tar.xz ]; then
- echo "Downloading sed-4.4.tar.xz"
- curl -LO https://ftp.gnu.org/gnu/sed/sed-4.4.tar.xz
- curl -LO https://ftp.gnu.org/gnu/sed/sed-4.4.tar.xz.sig
- checkPGPSig sed-4.4.tar.xz.sig sed-4.4.tar.xz
- else
- echo "Using existing sed"
- fi
- rm -rf sed-4.4/
- tar xJvf sed-4.4.tar.xz
- WORKING_DIR="sed-4.4"
- PKG_NAME="sed"
- PKG_VERSION="4.4-1"
- cd "$WORKING_DIR"
- }
- #sed
- buildSed() {
- downloadSed
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- make -j8 DESTDIR="$SKEL_PREFIX/" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sed"
-
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sed"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 396" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: edits streams of text using patterns" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/sed/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
-
- #Build the dev deb
- #No files
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download grep
- downloadGrep() {
- if [ ! -e grep-3.0.tar.xz ]; then
- echo "Downloading grep-3.0.tar.xz"
- curl -LO https://ftp.gnu.org/gnu/grep/grep-3.0.tar.xz
- curl -LO https://ftp.gnu.org/gnu/grep/grep-3.0.tar.xz.sig
- checkPGPSig grep-3.0.tar.xz.sig grep-3.0.tar.xz
- else
- echo "Using existing grep"
- fi
- rm -rf grep-3.0/
- tar xJvf grep-3.0.tar.xz
- WORKING_DIR="grep-3.0"
- PKG_NAME="grep"
- PKG_VERSION="3.0-1"
- cd "$WORKING_DIR"
- }
- #grep
- buildGrep() {
- downloadGrep
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --without-libiconv-prefix
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin --without-libiconv-prefix
- fi
- #make
-
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/grep"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/grep"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 396" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: searches files for regular expressions" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/grep/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files
- #rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download coreutils
- downloadCoreutils() {
- if [ ! -e coreutils-8.9.tar.xz ]; then
- echo "Downloading coreutils-8.9.tar.xz"
- curl -LO http://gnu.mirror.constant.com/coreutils/coreutils-8.9.tar.xz
- curl -LO http://gnu.mirror.constant.com/coreutils/coreutils-8.9.tar.xz.sig
- checkPGPSig coreutils-8.9.tar.xz.sig coreutils-8.9.tar.xz
- else
- echo "Using existing coreutils"
- fi
- rm -rf coreutils-8.9
- tar xJvf coreutils-8.9.tar.xz
- WORKING_DIR="coreutils-8.9"
- PKG_NAME="coreutils"
- PKG_VERSION="8.9-1"
- cd "$WORKING_DIR"
- }
- patchCoreutils() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' lib/config.hin
- sed -i -- 's|#undef HAVE_CLOCK_SETTIME||' lib/config.hin
- sed -i -- 's|#undef HAVE_FDATASYNC||' lib/config.hin
- sed -i -- 's|# define __stpncpy stpncpy||' lib/stpncpy.c
- if [ ! -d "$SKEL_PREFIX/$ROOT_PREFIX/include" ]; then
- mkdir -p "$SKEL_PREFIX/$ROOT_PREFIX/include"
- fi
- if [ ! -e "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h" ]; then
- echo "#include <sys/cdefs.h>" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "__BEGIN_DECLS" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "extern char ***_NSGetArgv(void);" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "extern int *_NSGetArgc(void);" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "extern char ***_NSGetEnviron(void);" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "extern char **_NSGetProgname(void);" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "extern struct mach_header *_NSGetMachExecuteHeader(void);" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "__END_DECLS" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- fi
- fi
- }
- #coreutils
- buildCoreutils() {
- downloadCoreutils
- patchCoreutils
- # Only builds with arm-apple-darwin, not aarch64
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/["
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/base64"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/basename"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/cat"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/chcon"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/chgrp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/chmod"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/chown"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/chroot"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/cksum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/comm"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/cp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/csplit"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/cut"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/date"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dd"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/df"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dircolors"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dirname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/du"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/echo"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/env"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/expand"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/expr"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/factor"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/false"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/fmt"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/fold"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/groups"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/head"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/hostid"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/id"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/install"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/join"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/kill"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/link"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/ln"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/logname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/ls"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/md5sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mkdir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mkfifo"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mknod"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mktemp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mv"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/nice"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/nl"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/nohup"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/nproc"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/od"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/paste"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/pathchk"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/pinky"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/pr"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/printenv"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/printf"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/ptx"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/pwd"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/readlink"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/rm"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/rmdir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/runcon"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/seq"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sha1sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sha224sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sha256sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sha384sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sha512sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/shred"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/shuf"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sleep"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sort"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/split"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/stat"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/stty"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sync"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tac"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tail"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tee"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/test"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/timeout"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/touch"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tr"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/true"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/truncate"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tsort"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tty"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/uname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/unexpand"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/uniq"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/unlink"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/uptime"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/users"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/vdir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/wc"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/who"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/whoami"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/yes"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/["
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/base64"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/basename"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cat"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/chcon"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/chgrp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/chmod"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/chown"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/chroot"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cksum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/comm"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/csplit"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cut"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/date"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dd"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/df"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dircolors"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dirname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/du"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/echo"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/env"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/expand"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/expr"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/factor"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/false"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/fmt"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/fold"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/groups"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/head"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/hostid"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/id"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/install"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/join"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/kill"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/link"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/ln"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/logname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/ls"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/md5sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mkdir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mkfifo"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mknod"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mktemp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mv"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/nice"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/nl"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/nohup"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/nproc"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/od"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/paste"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/pathchk"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/pinky"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/pr"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/printenv"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/printf"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/ptx"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/pwd"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/readlink"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/rm"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/rmdir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/runcon"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/seq"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sha1sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sha224sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sha256sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sha384sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sha512sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/shred"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/shuf"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sleep"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sort"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/split"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/stat"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/stty"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sync"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tac"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tail"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tee"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/test"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/timeout"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/touch"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tr"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/true"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/truncate"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tsort"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tty"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/uname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/unexpand"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/uniq"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/unlink"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/uptime"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/users"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/vdir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/wc"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/who"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/whoami"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/yes"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: standard" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Provides: md5sum, sha1sum" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: core set of Unix shell utilities from GNU" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Core Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/coreutils/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download findutils
- downloadFindUtils() {
- if [ ! -e findutils-4.6.0.tar.gz ]; then
- echo "Downloading findutils-4.6.0.tar.gz "
- curl -LO http://mirror.keystealth.org/gnu/findutils/findutils-4.6.0.tar.gz
- curl -LO http://mirror.keystealth.org/gnu/findutils/findutils-4.6.0.tar.gz.sig
- # NOT WORKING FOR SOME REASON, we have the signature but it still says theres no public sig, really weird
- #checkPGPSig findutils-4.6.0.tar.gz.sig findutils-4.6.0.tar.gz
- checkSHA256 findutils-4.6.0.tar.gz ded4c9f73731cd48fec3b6bdaccce896473b6d8e337e9612e16cf1431bb1169d
- else
- echo "Using existing findutils"
- fi
- rm -rf findutils-4.6.0
- tar xzvf findutils-4.6.0.tar.gz
- WORKING_DIR="findutils-4.6.0"
- PKG_NAME="findutils"
- PKG_VERSION="4.6.0-1"
- cd "$WORKING_DIR"
- }
- #findutils
- buildFindUtils() {
- downloadFindUtils
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/find"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/locate"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/xargs"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: bash, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: indexes and searches filesystems" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Find Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnu.org/software/findutils/" >> deb/DEBIAN/control
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/find"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/locate"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/xargs"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/var"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download diffutils
- downloadDiffUtils() {
- if [ ! -e diffutils-3.6.tar.xz ]; then
- echo "Downloading diffutils-3.6.tar.xz"
- curl -LO http://ftp.gnu.org/gnu/diffutils/diffutils-3.6.tar.xz
- curl -LO http://ftp.gnu.org/gnu/diffutils/diffutils-3.6.tar.xz.sig
- checkPGPSig diffutils-3.6.tar.xz.sig diffutils-3.6.tar.xz
- else
- echo "Using existing diffutils"
- fi
- rm -rf diffutils-3.6
- tar xJvf diffutils-3.6.tar.xz
- WORKING_DIR="diffutils-3.6"
- PKG_NAME="diffutils"
- PKG_VERSION="3.6-1"
- cd "$WORKING_DIR"
- }
- #diffutils
- buildDiffUtils() {
- downloadDiffUtils
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/cmp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/diff"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/diff3"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sdiff"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cmp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/diff"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/diff3"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sdiff"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Development" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: bash, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: compare two files for differences" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Diff Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/diffutils/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files for this
- #FIXME
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download darwintools
- downloadDarwinTools() {
- if [ ! -d DarwinToolsARM ]; then
- echo "Fetching DarwinTools"
- mkdir -p DarwinToolsARM
- cd DarwinToolsARM
- curl -LO https://opensource.apple.com/source/DarwinTools/DarwinTools-1/sw_vers.c
- #Not built yet
- curl -LO https://opensource.apple.com/source/launchd/launchd-842.92.1/support/launchctl.c
- #sw_vers.c
- checkSHA256 sw_vers.c 55aab510b465f7687b8ebe23f0e51926606fd5316da138778838b2dac3e7c7e0
- else
- echo "Using existing DarwinTools"
- cd DarwinToolsARM
- fi
- WORKING_DIR="DarwinToolsARM"
- PKG_NAME="darwintools"
- PKG_VERSION="1.0-1"
- }
- patchDarwinTools() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- sed -i -- 's|#include <CoreFoundation/CFPriv.h>|extern CFDictionaryRef _CFCopySystemVersionDictionary(void);\
- extern CFDictionaryRef _CFCopyServerVersionDictionary(void);|' sw_vers.c
- sed -i -- 's|_kCFSystemVersionProductNameKey|CFSTR(\"ProductName\")|g' sw_vers.c
- sed -i -- 's|_kCFSystemVersionProductVersionKey|CFSTR(\"ProductVersion\")|g' sw_vers.c
- sed -i -- 's|_kCFSystemVersionBuildVersionKey|CFSTR(\"ProductBuildVersion\")|g' sw_vers.c
- fi
- }
- #darwintools
- #Notes:
- # This only builds a striped down version of the one on iOS
- # If you're building for a non-appletv platform, you may need to fix things here.
- buildDarwinTools() {
- downloadDarwinTools
- patchDarwinTools
-
- "$CLANG_PATH" -arch "$ARCH" -isysroot"$SDK_PATH" -framework CoreFoundation "$MIN_VERSION" -o "sw_vers" sw_vers.c
- codesign "$BUILD_ROOT/$WORKING_DIR/sw_vers"
- cp sw_vers "$SKEL_PREFIX/$ROOT_PREFIX/bin/"
-
- initDebStructure
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/"
- cp sw_vers "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Administration" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Maintainer: $MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: sw_vers" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Darwin Tools" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete #Not that there are any...
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- cd "$BUILD_ROOT"
- }
- #Download uikittools
- downloadUIKitTools() {
- if [ ! -d uikittools ]; then
- echo "Fetching uikittools"
- git clone git://git.saurik.com/uikittools.git
- else
- echo "Using existing uikittools"
- fi
- WORKING_DIR="uikittools"
- PKG_NAME="uikittools"
- PKG_VERSION="1.1.12-1"
- cd "$WORKING_DIR"
- git checkout tags/v1.1.12
- }
- #uikittools
- #Notes:
- # This only builds a striped down version of the one on iOS
- # If you're building for a non-appletv platform, you may need to fix things here.
- buildUIKitTools() {
- downloadUIKitTools
- "$CLANGPLUS_PATH" -arch "$ARCH" -isysroot"$SDK_PATH" -Os -Werror -framework CoreFoundation -framework Foundation "$MIN_VERSION" -o cfversion cfversion.mm
- "$CLANGPLUS_PATH" -arch "$ARCH" -isysroot"$SDK_PATH" -Os -Werror -framework CoreFoundation -framework Foundation "$MIN_VERSION" -o gssc gssc.mm
- "$CLANGPLUS_PATH" -arch "$ARCH" -isysroot"$SDK_PATH" -Os -Werror -framework CoreFoundation -framework Foundation -framework UIKit "$MIN_VERSION" -o uiduid uiduid.mm
- codesign "$BUILD_ROOT/$WORKING_DIR/cfversion"
- codesign "$BUILD_ROOT/$WORKING_DIR/gssc"
- codesign "$BUILD_ROOT/$WORKING_DIR/uiduid"
-
- cp gssc cfversion uiduid "$SKEL_PREFIX/$ROOT_PREFIX/bin/"
- initDebStructure
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/"
- cp gssc cfversion uiduid "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Maintainer: $MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: UIKit/GraphicsServices command line access" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: UIKit Tools" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Author: Jay Freeman (saurik) <saurik@saurik.com>" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depiction: http://cydia.saurik.com/info/uikittools/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- echo "Pre-Depends: cy+model.appletv" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: coreutils, firmware (>= 9.0)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- else
- #FIXME: If you're building for some other platform, you should address this.
- echo "Depends: coreutils" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- fi
- echo "Tag: purpose::console, role::hacker" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete #Not that there are any...
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- cd "$BUILD_ROOT"
- }
- buildBasicUtils() {
- notifyProgress "Building sed"
- buildSed
- notifyProgress "Building grep"
- buildGrep
- notifyProgress "Building coreutils"
- buildCoreutils
- notifyProgress "Building findutils"
- buildFindUtils
- notifyProgress "Building diffutils"
- buildDiffUtils
- notifyProgress "Building DarwinTools"
- buildDarwinTools
- notifyProgress "Building UIKitTools"
- buildUIKitTools
- }
- #=====================
- #DPKG and Dependencies
- #---------------------
- #Download zlib
- downloadZLib() {
- #Download zlib
- if [ ! -d zlib ]; then
- echo "Downloading zlib git"
- git clone https://github.com/madler/zlib.git
- else
- echo "Using existing zlib"
- fi
- WORKING_DIR="zlib"
- PKG_NAME="zlib"
- PKG_VERSION="1.2.11-1"
- cd "$WORKING_DIR"
- git checkout tags/v1.2.11
- rm -rf build
- mkdir build
- cd build
- WORKING_DIR="$WORKING_DIR/build"
- }
- #zlib
- buildZLib() {
- downloadZLib
-
- cmake -j8 -DCMAKE_INSTALL_NAME_DIR="/$ROOT_PREFIX/lib" -DCMAKE_OSX_SYSROOT="$SDK_PATH/" -DCMAKE_C_FLAGS="-arch $ARCH" -DCMAKE_INSTALL_PREFIX="/$ROOT_PREFIX" ..
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/" install
- export COPYFILE_DISABLE
- export COPY_EXTENDED_ATTRIBUTES_DISABLE
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 396" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: Massively spiffy yet delicately unobtrusive compression library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: zlib" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://zlib.net/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download xz
- downloadXZ() {
- if [ ! -e xz-5.2.3.tar.gz ]; then
- echo "Downloading xz-5.2.3.tar.gz"
- curl -LO http://tukaani.org/xz/xz-5.2.3.tar.gz
- curl -LO http://tukaani.org/xz/xz-5.2.3.tar.gz.sig
- checkPGPSig xz-5.2.3.tar.gz.sig xz-5.2.3.tar.gz
- else
- echo "Using xz-5.2.3.tar.gz"
- fi
- rm -rf xz-5.2.3
- tar xzvf xz-5.2.3.tar.gz
- WORKING_DIR="xz-5.2.3"
- PKG_NAME="xz"
- PKG_VERSION="5.2.3-1"
- cd "$WORKING_DIR"
- }
- patchXZ() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' config.h.in
- fi
- }
- #xz
- buildXZ() {
- downloadXZ
- patchXZ
- if [ "$ARCH" == "arm64" ]; then
- ./configure CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXXFLAGS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" CFLAGS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" LIBS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin
- else
- ./configure CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXXFLAGS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" CFLAGS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" LIBS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- make DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/lzmadec"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/lzmainfo"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/xz"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/xzdec"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.5.dylib"
- if [ ! -e "$SKEL_PREFIX/$ROOT_PREFIX/local/lib/liblzma.5.dylib" ]; then
- mkdir -p "$SKEL_PREFIX/$ROOT_PREFIX/local/lib"
- #cp "$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.5.dylib" "$SKEL_PREFIX/$ROOT_PREFIX/local/lib/liblzma.5.dylib"
- ln -s /usr/lib/liblzma.5.dylib "$SKEL_PREFIX/$ROOT_PREFIX/local/lib/liblzma.5.dylib"
- fi
- initDebStructure
- make DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/lzmadec"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/lzmainfo"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/xz"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/xzdec"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/liblzma.5.dylib"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/local/lib"
- ln -s /usr/lib/liblzma.5.dylib "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/local/lib/liblzma.5.dylib"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 396" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: XZ Utils are the successor to LZMA Utils" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: XZ Utils" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://tukaani.org/xz/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/liblzma.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
-
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download bzip2
- downloadBZip2() {
- if [ ! -e bzip2-1.0.6.tar.gz ]; then
- echo "Downloading bzip2-1.0.6.tar.gz"
- curl -LO http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz
- checkSHA256 bzip2-1.0.6.tar.gz a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd
- else
- echo "Using bzip2-1.0.6.tar.gz"
- fi
- rm -rf bzip2-1.0.6
- tar xzvf bzip2-1.0.6.tar.gz
- WORKING_DIR="bzip2-1.0.6"
- PKG_NAME="bzip2"
- PKG_VERSION="1.0.6-1"
- cd "$WORKING_DIR"
- }
- patchBZip2() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- #fix up our makefile...
- sed -i -- 's|CC=gcc|CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang|' Makefile
- sed -i -- 's|AR=ar|AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar|' Makefile
- sed -i -- 's|RANLIB=ranlib|RANLIB=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib|' Makefile
- sed -i -- "s|LDFLAGS=|LDFLAGS=$MIN_VERSION -isysroot \"$SDK_PATH\" -arch $ARCH|" Makefile
- sed -i -- "s|CFLAGS=|CFLAGS=$MIN_VERSION -isysroot \"$SDK_PATH\" -arch $ARCH |" Makefile
- sed -i -- 's|all:\(.*\) test$|all: \1|' Makefile
- sed -i -- 's|ln -s -f \$(PREFIX)/bin/|ln -s -f |g' Makefile
- fi
- }
- #bzip2
- buildBZip2() {
- downloadBZip2
- patchBZip2
- make -j8 install PREFIX="$SKEL_PREFIX/$ROOT_PREFIX"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/bunzip2"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/bzcat"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/bzip2"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/bzip2recover"
- initDebStructure
- make -j8 install PREFIX="$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bunzip2"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bzcat"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bzip2"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bzip2recover"
- export COPYFILE_DISABLE
- export COPY_EXTENDED_ATTRIBUTES_DISABLE
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 148" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: compression that's slightly better than gzip" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.bzip.org/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- #FIXME: Make a $PKG_NAME-staticlibs.deb
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download lz4
- downloadLZ4() {
- if [ ! -e lz4-v1.7.5.tar.gz ]; then
- #echo "Cloning lz4.git"
- #git clone https://github.com/lz4/lz4.git
- #Master = v1.7.5
- curl -LO https://github.com/lz4/lz4/archive/v1.7.5.tar.gz
- mv v1.7.5.tar.gz lz4-v1.7.5.tar.gz
- checkSHA256 lz4-v1.7.5.tar.gz 0190cacd63022ccb86f44fa5041dc6c3804407ad61550ca21c382827319e7e7e
- else
- echo "Using existing lz4"
- fi
- rm -rf lz4-1.7.5/
- tar xzvf lz4-v1.7.5.tar.gz
- WORKING_DIR="lz4-1.7.5/contrib/cmake_unofficial/"
- PKG_NAME="lz4"
- PKG_VERSION="1.7.5-1"
- cd "$WORKING_DIR"
- rm -rf build
- mkdir build
- cd build
- WORKING_DIR="$WORKING_DIR/build"
- }
- #lz4
- buildLZ4() {
- downloadLZ4
-
- initDebStructure
- cmake -j8 -DCMAKE_INSTALL_NAME_DIR="/$ROOT_PREFIX/lib" -DCMAKE_OSX_SYSROOT="$SDK_PATH/" -DCMAKE_C_FLAGS="-arch $ARCH" -DCMAKE_INSTALL_PREFIX="/$ROOT_PREFIX" ..
- make -j8
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/lz4"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/lz4c"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/liblz4.1.7.5.dylib"
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/lz4"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/lz4c"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/liblz4.1.7.5.dylib"
- export COPYFILE_DISABLE
- export COPY_EXTENDED_ATTRIBUTES_DISABLE
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 396" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: Extremely Fast Compression algorithm" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: lz4" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.lz4.org" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download openssl
- downloadOpenSSL() {
- if [ ! -d openssl ]; then
- git clone -b OpenSSL_1_1_0-stable https://github.com/openssl/openssl.git
- else
- echo "Using existing openssl repo"
- fi
- WORKING_DIR="openssl"
- PKG_NAME="openssl"
- PKG_VERSION="1.1.0-1"
- cd "$WORKING_DIR"
- }
- patchOpenSSL() {
- #if [ "$PLATFORM" == "AppleTVOS" ]; then
- sed -i -- "s|-arch $ARCH -mios-version-min=7.0.0|-arch $ARCH $MIN_VERSION|" Configurations/10-main.conf
- #fi
- }
- #openssl
- buildOpenSSL() {
- downloadOpenSSL
- patchOpenSSL
- export PLATFORM="$PLATFORM"
- export BUILD_TOOLS="`xcode-select --print-path`"
- export CC="clang -fembed-bitcode"
- export CROSS_COMPILE="`xcode-select --print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
- export CROSS_TOP="`xcode-select --print-path`/Platforms/$PLATFORM.platform/Developer"
- export CROSS_SDK="`echo $SDK_PATH | sed 's/.*\///g'`"
- #export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH"
- ./Configure ios64-cross no-shared no-dso no-hw no-engine --prefix="/$ROOT_PREFIX"
- #make
- make DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/openssl"
- initDebStructure
- make DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/openssl"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: standard" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Security" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 6164" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: SSL library and cryptographic tools" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: OpenSSL" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.openssl.org" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- #mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download Curl
- downloadCurl() {
- if [ ! -e curl-7.50.1.tar.gz ]; then
- echo "Downloading curl-7.50.1.tar.gz"
- curl -LO https://curl.haxx.se/download/curl-7.50.1.tar.gz
- checkSHA256 curl-7.50.1.tar.gz 3e392cf600822b817be82d9080b377fcbab70538d5a8bf525a1cd66e157b99ea
- else
- echo "Using curl-7.50.1.tar.gz"
- fi
- rm -rf curl-7.50.1
- echo "Unpacking curl"
- tar xzvf "curl-7.50.1.tar.gz"
- WORKING_DIR="curl-7.50.1"
- PKG_NAME="curl"
- PKG_VERSION="7.50.1-1"
- cd "$WORKING_DIR"
- }
- patchCurl() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- #(Forcibly) Remove that dirty clock_gettime
- #TODO: Determine if this is the best way
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME_MONOTONIC||' lib/curl_config.h.in
- fi
- }
- #curl
- buildCurl() {
- downloadCurl
- patchCurl
- export PLATFORM="$PLATFORM"
- export BUILD_TOOLS="`xcode-select --print-path`"
- export CC="clang"
- export CROSS_COMPILE="`xcode-select --print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
- export CROSS_TOP="`xcode-select --print-path`/Platforms/$PLATFORM.platform/Developer"
- export CROSS_SDK="`echo $SDK_PATH | sed 's/.*\///g'`"
- export CFLAGS="-arch $ARCH -pipe -Os -gdwarf-2 -isysroot $SDK_PATH $MIN_VERSION -fembed-bitcode -I$SKEL_PREFIX/$ROOT_PREFIX/include/ "
- export LDFLAGS="-arch $ARCH -isysroot $SDK_PATH -L${SKEL_PREFIX}/$ROOT_PREFIX/lib"
- ./configure --prefix="/$ROOT_PREFIX" --host="arm-apple-darwin" --with-zlib="$SKEL_PREFIX/$ROOT_PREFIX/lib" -with-random=/dev/urandom --disable-ntlm-wb --with-ssl="$SKEL_PREFIX/$ROOT_PREFIX/lib"
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/curl"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libcurl.4.dylib"
-
- make clean
-
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/curl"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libcurl.4.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libcurl.la"
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/curl-config"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libcurl.la--"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/curl-config--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: standard" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Networking" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: openssl" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: flexible multi-protocol file transfers" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: cURL" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://curl.haxx.se/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/curl-config" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libcurl.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/aclocal" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- #FIXME
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download berkeleydb
- downloadBerkeleyDB() {
- if [ ! -e db-6.2.23.tar.gz ]; then
- echo "Downlading db-6.2.23.tar.gz"
- curl -LO http://download.oracle.com/berkeley-db/db-6.2.23.tar.gz
- checkSHA256 db-6.2.23.tar.gz 47612c8991aa9ac2f6be721267c8d3cdccf5ac83105df8e50809daea24e95dc7
- else
- echo "Using existing db-6.2.23"
- fi
- rm -rf db-6.2.23
- tar xzvf db-6.2.23.tar.gz
- WORKING_DIR="db-6.2.23/build_unix/"
- PKG_NAME="berkeleydb"
- PKG_VERSION="6.2.23-1"
- cd "$WORKING_DIR"
- }
- patchBerkeleyDB() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' ../dist/config.hin
- if [ "$PKG_VERSION" == "6.2.23-1" ]; then
- cat ../lang/sql/sqlite/src/shell.c | head -n 14 > shell.patched.c
- echo "#include <stdint.h>" >> shell.patched.c
- echo "#include <stdio.h>" >> shell.patched.c
- echo "#include <stdlib.h>" >> shell.patched.c
- echo "#include <spawn.h>" >> shell.patched.c
- echo "#include <sys/wait.h>" >> shell.patched.c
- echo "" >> shell.patched.c
- echo "extern char **environ;" >> shell.patched.c
- echo "" >> shell.patched.c
- cat ../lang/sql/sqlite/src/shell.c | tail -n 4847 | head -n 2622 >> shell.patched.c
- echo "int RunCmd(const char *cmd) {" >> shell.patched.c
- echo " pid_t pid;" >> shell.patched.c
- echo ' char *argv[] = {"sh", "-c", (char*)cmd, NULL};' >> shell.patched.c
- echo ' int status;' >> shell.patched.c
- echo ' status = posix_spawn(&pid, "/bin/sh", NULL, NULL, argv, environ);' >> shell.patched.c
- echo ' if (status == 0) {' >> shell.patched.c
- echo ' if (waitpid(pid, &status, 0) != -1) {' >> shell.patched.c
- echo ' printf("Child exted in ATV Patched RunCmd with status %i\n", status);' >> shell.patched.c
- echo ' } else {' >> shell.patched.c
- echo ' perror("waitpid");' >> shell.patched.c
- echo ' }' >> shell.patched.c
- echo ' } else {' >> shell.patched.c
- echo ' printf("posix_spawn: %s\n", strerror(status));' >> shell.patched.c
- echo ' }' >> shell.patched.c
- echo ' return status;' >> shell.patched.c
- echo '}' >> shell.patched.c
- echo "" >> shell.patched.c
- cat ../lang/sql/sqlite/src/shell.c | tail -n 2226 | sed 's/system(zCmd)/RunCmd(zCmd)/g' >> shell.patched.c
- cp shell.patched.c ../lang/sql/sqlite/src/shell.c
- fi
- fi
- }
- #berkeleydb
- buildBerkeleyDB() {
- downloadBerkeleyDB
- patchBerkeleyDB
- #Not sure which all we need...
- export PLATFORM="$PLATFORM" #TODO: Maybe necessary? Need to test.
- export BUILD_TOOLS="`xcode-select --print-path`"
- export CC="clang"
- export CROSS_COMPILE="`xcode-select --print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
- export CROSS_TOP="`xcode-select --print-path`/Platforms/$PLATFORM.platform/Developer"
- export CROSS_SDK="`echo $SDK_PATH | sed 's/.*\///g'`"
- export CFLAGS="-arch $ARCH -pipe -Os -gdwarf-2 -isysroot $SDK_PATH $MIN_VERSION"
- export CXXFLAGS="-arch $ARCH -pipe -Os -gdwarf-2 -isysroot $SDK_PATH $MIN_VERSION"
- export LDFLAGS="-arch $ARCH -isysroot $SDK_PATH" # -L${SKEL_PREFIX}/lib"
- #Only builds with arm-apple-darwin, not aarch64
- ../dist/configure --disable-debug --disable-test --disable-atomicsupport --enable-cxx--enable-compact185 --enable-sql --enable-sql_codegen --enable-dbm --enable-slt --disable-java --host=arm-apple-darwin --prefix="/$ROOT_PREFIX"
-
- make DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_archive"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_checkpoint"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_deadlock"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_dump"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_hotbackup"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_load"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_log_verify"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_printlog"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_recover"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_replicate"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_sql_codegen"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_stat"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_tuner"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_upgrade"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_verify"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dbsql"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libdb_sql-6.2.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libdb-6.2.dylib"
- initDebStructure
- make DESTDIR="$BUILD_ROOT/db-6.2.23/build_unix/deb/" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_archive"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_checkpoint"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_deadlock"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_dump"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_hotbackup"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_load"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_log_verify"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_printlog"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_recover"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_replicate"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_sql_codegen"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_stat"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_tuner"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_upgrade"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_verify"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dbsql"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdb_sql-6.2.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdb-6.2.dylib"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Data_Storage" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 1644" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: Oracle's embeddable database engine" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Berkeley DB" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.oracle.com/technology/products/berkeley-db/index.html" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/docs" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdb-6.2.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdb_sql-6.2.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download tar
- downloadTar() {
- if [ ! -e tar-1.30.tar.xz ]; then
- echo "Downloading tar-1.30.tar.xz"
- curl -LO http://ftp.gnu.org/gnu/tar/tar-1.30.tar.xz
- checkSHA256 tar-1.30.tar.xz f1bf92dbb1e1ab27911a861ea8dde8208ee774866c46c0bb6ead41f4d1f4d2d3
- else
- echo "Using existing tar"
- fi
- rm -rf tar-1.30
- tar xJvf tar-1.30.tar.xz
- WORKING_DIR="tar-1.30"
- PKG_NAME="tar"
- PKG_VERSION="1.30-1"
- cd "$WORKING_DIR"
- }
- patchTar() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' config.h.in
- fi
- }
- #tar
- buildTar() {
- downloadTar
- patchTar
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tar"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tar"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: bzip2, xz" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/tar/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: tool for making tape archives" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Tape Archive" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Tag: purpose::console, role::hacker" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
-
- #Build the dev deb
- #No files
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
-
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download dpkg
- downloadDpkg() {
- if [ ! -d dpkg ]; then
- echo "Downlading dpkg"
- git clone https://git.nito.tv/NitoTV/dpkg.git
- else
- echo "Using existing dpkg"
- fi
- WORKING_DIR="dpkg"
- PKG_NAME="dpkg"
- PKG_VERSION="1.18.23-1" #FIXME
- cd "$WORKING_DIR"
- }
- patchDpkg() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- sed -i -- "s|#define ARCHITECTURE \"darwin-arm\"|#define ARCHITECTURE \"$PLATFORM_LOWER-$ARCH\"|" config.h
- sed -i -- 's|gtar|tar|' config.h
- fi
- }
- #dpkg
- buildDpkg() {
- downloadDpkg
- local dont_die_here=$(./autogen.sh)
- if [ "$ARCH" == "arm64" ]; then
- LZMA_LIBS="$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.dylib" CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" CPPFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --disable-start-stop-daemon --host=aarch64-apple-darwin PERL_LIBDIR='$(prefix)/lib/' --disable-dselect --localstatedir="/var/" --sysconfdir="/etc"
- else
- LZMA_LIBS="$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.dylib" CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" CPPFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --disable-start-stop-daemon --host=arm-apple-darwin PERL_LIBDIR='$(prefix)/lib/' --disable-dselect --localstatedir="/var/" --sysconfdir="/etc"
- fi
- patchDpkg #Must be after configure for now. I'll deal with this later
- make -j8 DESTDIR="$SKEL_PREFIX" install
- #lzma conflicts with built in libraries when running in certian conditions.
- #we make -j8 a symlink our version of lzma in the xz build process
- #here we change dpkg-deb to look for this version instead
- #if we do not do this, apt-get/dpkg* will fail from our setuid tool
- install_name_tool -change /usr/lib/liblzma.5.dylib /usr/local/lib/liblzma.5.dylib "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-deb"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-deb"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-divert"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-query"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-split"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-trigger"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-statoverride"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/update-alternatives"
- echo "appletvos-arm64" >> "$SKEL_PREFIX/var/lib/dpkg/arch"
- echo "darwin-arm64" >> "$SKEL_PREFIX/var/lib/dpkg/arch"
- initDebStructure
- make -j8 install DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/"
- install_name_tool -change /usr/lib/liblzma.5.dylib /usr/local/lib/liblzma.5.dylib "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-deb"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-deb"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-divert"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-query"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-split"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-trigger"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-statoverride"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/update-alternatives"
- echo "appletvos-arm64" >> "$BUILD_ROOT/dpkg/deb/var/lib/dpkg/arch"
- echo "darwin-arm64" >> "$BUILD_ROOT/dpkg/deb/var/lib/dpkg/arch"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdpkg.la"
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig/libdpkg.pc"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdpkg.la--"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig/libdpkg.pc--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Packaging" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: bash, bzip2, coreutils-bin, diffutils, findutils, gzip, lzma, ncurses, tar" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: bzip2, coreutils, diffutils, findutils, xz, tar" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: package maintainance tools from Debian" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Debian Packager" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://wiki.debian.org/Teams/Dpkg" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdpkg.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- #FIXME
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/etc"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/var"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- buildDPKGAndDependencies() {
- notifyProgress "Building zlib"
- buildZLib
- notifyProgress "Building xz"
- buildXZ
- notifyProgress "Building bzip2"
- buildBZip2
- notifyProgress "Building lz4"
- buildLZ4
- notifyProgress "Building openSSL"
- buildOpenSSL
- notifyProgress "Building curl"
- buildCurl
- notifyProgress "Building BerkeleyDB"
- buildBerkeleyDB
- notifyProgress "Building tar"
- buildTar
- notifyProgress "Building dpkg"
- buildDpkg
- }
- #====================
- #APT and Dependencies
- #--------------------
- #Download libgpg-error
- downloadGpgError() {
- if [ ! -e libgpg-error-1.27.tar.bz2 ]; then
- echo "Downloading libgpg-error-1.27.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.27.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.27.tar.bz2.sig
- checkPGPSig libgpg-error-1.27.tar.bz2.sig libgpg-error-1.27.tar.bz2
- else
- echo "Using existing libgpg-error"
- fi
- rm -rf libgpg-error-1.27
- tar xjvf libgpg-error-1.27.tar.bz2
- WORKING_DIR="libgpg-error-1.27"
- PKG_NAME="libgpg-error"
- PKG_VERSION="1.27-1"
- cd "$WORKING_DIR"
- }
- patchGpgError() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- echo ""
- #sed -i -- 's|assert (!"lock ABI version");|//assert (!"lock ABI version");|' config.h
- #sed -i -- 's|assert (!"lock ABI version");|//assert (!"lock ABI version");|' config.h
- fi
- }
- #libgpg-error
- buildGpgError() {
- downloadGpgError
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX --host=aarch64-apple-darwin --disable-tests --enable-threads=posix
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX --host=arm-apple-darwin --disable-tests --enable-threads=posix
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libgpg-error.0.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpg-error"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgpg-error.0.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpg-error"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgpg-error.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgpg-error.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Security" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: GnuPG's error management library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: GnuPG Errors" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/related_software/libgpg-error/index.en.html" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/libgpg-error" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpg-error-config" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/aclocal" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/common-lisp" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgpg-error.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
-
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download gcrypt
- downloadGcrypt() {
- if [ ! -e libgcrypt-1.8.2.tar.bz2 ]; then
- echo "Downloading libgcrypt-1.8.2.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.2.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.2.tar.bz2.sig
- checkPGPSig libgcrypt-1.8.2.tar.bz2.sig libgcrypt-1.8.2.tar.bz2
- else
- echo "Using existing gcrypt"
- fi
- rm -rf libgcrypt-1.8.2
- tar xjvf libgcrypt-1.8.2.tar.bz2
- WORKING_DIR="libgcrypt-1.8.2"
- PKG_NAME="libgcrypt"
- PKG_VERSION="1.8.2-1"
- cd "$WORKING_DIR"
- }
- patchGcrypt() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- if [ "$PKG_VERSION" == "1.8.2-1" ]; then
- cat tests/random.c | head -n 39 > random.patched.c
- echo "#include <stdint.h>" >> random.patched.c
- echo "#include <stdio.h>" >> random.patched.c
- echo "#include <stdlib.h>" >> random.patched.c
- echo "#include <spawn.h>" >> random.patched.c
- echo "#include <sys/wait.h>" >> random.patched.c
- echo "" >> random.patched.c
- echo "extern char **environ;" >> random.patched.c
- echo "" >> random.patched.c
- echo "int RunCmd(const char *cmd) {" >> random.patched.c
- echo " pid_t pid;" >> random.patched.c
- echo ' char *argv[] = {"sh", "-c", (char*)cmd, NULL};' >> random.patched.c
- echo ' int status;' >> random.patched.c
- echo ' status = posix_spawn(&pid, "/bin/sh", NULL, NULL, argv, environ);' >> random.patched.c
- echo ' if (status == 0) {' >> random.patched.c
- echo ' if (waitpid(pid, &status, 0) != -1) {' >> random.patched.c
- echo ' printf("Child exted in ATV Patched RunCmd with status %i\n", status);' >> random.patched.c
- echo ' } else {' >> random.patched.c
- echo ' perror("waitpid");' >> random.patched.c
- echo ' }' >> random.patched.c
- echo ' } else {' >> random.patched.c
- echo ' printf("posix_spawn: %s\n", strerror(status));' >> random.patched.c
- echo ' }' >> random.patched.c
- echo ' return status;' >> random.patched.c
- echo '}' >> random.patched.c
- echo "" >> random.patched.c
- cat tests/random.c | tail -n 727 | sed 's/system (cmdline)/RunCmd(cmdline)/g' >> random.patched.c
- cp random.patched.c tests/random.c
- fi
- fi
- }
- #gcrypt
- buildGcrypt() {
- downloadGcrypt
- patchGcrypt
- #TODO: Doesn't like aarch64-apple-darwin, but may build with it with minor changes.
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX/"
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dumpsexp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/hmac256"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mpicalc"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libgcrypt.20.dylib"
- #make clean
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dumpsexp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/hmac256"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mpicalc"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgcrypt.20.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgcrypt.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgcrypt.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Security" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: libgpg-error" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: LGPL cryptographic algorithm library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: GNU Cryptography" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/related_software/libgcrypt/" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/libgcrypt-config" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/aclocal" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgcrypt.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download libkbsa
- downloadKSBA() {
- if [ ! -e libksba-1.3.5.tar.bz2 ]; then
- echo "Downloading libksba-1.3.5.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/libksba/libksba-1.3.5.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/libksba/libksba-1.3.5.tar.bz2.sig
- checkPGPSig libksba-1.3.5.tar.bz2.sig libksba-1.3.5.tar.bz2
- else
- echo "Using existing libksba"
- fi
- rm -rf libksba-1.3.5
- tar xjvf libksba-1.3.5.tar.bz2
- WORKING_DIR="libksba-1.3.5"
- PKG_NAME="libksba"
- PKG_VERSION="1.3.5-1"
- cd "$WORKING_DIR"
- }
- #libkbsa
- buildKSBA() {
- downloadKSBA
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=aarch64-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX"
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX"
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libksba.8.dylib"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/libksba-1.3.5/deb" install
- codesign "deb/$ROOT_PREFIX/lib/libksba.8.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libksba.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libksba.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Security" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: libgpg-error" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: GnuPG's certification management library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: KSBA" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/related_software/libksba/" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/aclocal" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libksba.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download npth
- downloadNpth() {
- if [ ! -e npth-1.5.tar.bz2 ]; then
- echo "Downloading npth-1.5.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/npth/npth-1.5.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/npth/npth-1.5.tar.bz2.sig
- checkPGPSig npth-1.5.tar.bz2.sig npth-1.5.tar.bz2
- else
- echo "Using existing npth"
- fi
- rm -rf npth-1.5
- tar xjvf npth-1.5.tar.bz2
- WORKING_DIR="npth-1.5"
- PKG_NAME="libnpth"
- PKG_VERSION="1.5-1"
- cd "$WORKING_DIR"
- }
- patchNpth() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' config.h.in
- if [ "$PKG_VERSION" == "1.5-1" ]; then
- cat src/npth.c | head -n 19 > npth.patched.c
- echo "#include <stdint.h>" >> npth.patched.c
- echo "#include <stdio.h>" >> npth.patched.c
- echo "#include <stdlib.h>" >> npth.patched.c
- echo "#include <spawn.h>" >> npth.patched.c
- echo "#include <sys/wait.h>" >> npth.patched.c
- echo "" >> npth.patched.c
- echo "extern char **environ;" >> npth.patched.c
- echo "" >> npth.patched.c
- cat src/npth.c | tail -n 757 | head -n 537 >> npth.patched.c
- echo "int RunCmd(const char *cmd) {" >> npth.patched.c
- echo " pid_t pid;" >> npth.patched.c
- echo ' char *argv[] = {"sh", "-c", (char*)cmd, NULL};' >> npth.patched.c
- echo ' int status;' >> npth.patched.c
- echo ' status = posix_spawn(&pid, "/bin/sh", NULL, NULL, argv, environ);' >> npth.patched.c
- echo ' if (status == 0) {' >> npth.patched.c
- echo ' if (waitpid(pid, &status, 0) != -1) {' >> npth.patched.c
- echo ' printf("Child exted in ATV Patched RunCmd with status %i\n", status);' >> npth.patched.c
- echo ' } else {' >> npth.patched.c
- echo ' perror("waitpid");' >> npth.patched.c
- echo ' }' >> npth.patched.c
- echo ' } else {' >> npth.patched.c
- echo ' printf("posix_spawn: %s\n", strerror(status));' >> npth.patched.c
- echo ' }' >> npth.patched.c
- echo ' return status;' >> npth.patched.c
- echo '}' >> npth.patched.c
- echo "" >> npth.patched.c
- cat src/npth.c | tail -n 220 | sed 's/system(cmd)/RunCmd(cmd)/g' >> npth.patched.c
- cp npth.patched.c src/npth.c
- fi
- fi
- }
- #npth
- buildNpth() {
- downloadNpth
- patchNpth
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=aarch64-apple-darwin
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libnpth.0.dylib"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libnpth.0.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libnpth.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libnpth.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Development" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: portable threading library used by X" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: The New GNU Portable Threads Library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/software/npth" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- #No files
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libnpth.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download libassuan
- downloadAssuan() {
- if [ ! -e libassuan-2.5.1.tar.bz2 ]; then
- echo "Downloading libassuan-2.5.1.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-2.5.1.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-2.5.1.tar.bz2.sig
- checkPGPSig libassuan-2.5.1.tar.bz2.sig libassuan-2.5.1.tar.bz2
- else
- echo "Using existing libassuan"
- fi
- rm -rf libassuan-2.5.1
- tar xjvf libassuan-2.5.1.tar.bz2
- WORKING_DIR="libassuan-2.5.1"
- PKG_NAME="libassuan"
- PKG_VERSION="2.5.1-1"
- cd "$WORKING_DIR"
- }
- #libassuan
- buildAssuan() {
- downloadAssuan
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=aarch64-apple-darwin --with-gpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX/"
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin --with-gpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX/"
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libassuan.0.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$SKEL_PREFIX/$ROOT_PREFIX/lib/libassuan.la"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/lib/libassuan.la--"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libassuan.0.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libassuan.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libassuan.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Development" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: gnupth" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: GnuPG's inter-process communication" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Assuan" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/related_software/libassuan/index.en.html" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/aclocal" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libassuan.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download ntbtls
- downloadNtbtls() {
- if [ ! -e ntbtls-0.1.2.tar.bz2 ]; then
- echo "Downloading ntbtls-0.1.2.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/ntbtls/ntbtls-0.1.2.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/ntbtls/ntbtls-0.1.2.tar.bz2.sig
- checkPGPSig ntbtls-0.1.2.tar.bz2.sig ntbtls-0.1.2.tar.bz2
- else
- echo "Using existing ntbtls"
- fi
- rm -rf ntbtls-0.1.2
- tar xjvf ntbtls-0.1.2.tar.bz2
- WORKING_DIR="ntbtls-0.1.2"
- PKG_NAME="libntbtls"
- PKG_VERSION="0.1.2-1"
- cd "$WORKING_DIR"
- }
- patchNtbtls() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- # this is required because prior dependencies write /$ROOT_PREFIX/lib/libgpg-error.la as a dependency in the .la file
- sed -i -- "s|/$ROOT_PREFIX/lib/libgpg-error.la|$SKEL_PREFIX/$ROOT_PREFIX/lib/libgpg-error.la|g" "$SKEL_PREFIX/$ROOT_PREFIX/lib/libgcrypt.la"
- sed -i -- "s|/$ROOT_PREFIX/lib/libgpg-error.la|$SKEL_PREFIX/$ROOT_PREFIX/lib/libgpg-error.la|g" "$SKEL_PREFIX/$ROOT_PREFIX/lib/libksba.la"
- rm -f "$SKEL_PREFIX/$ROOT_PREFIX/lib/libgcrypt.la--"
- rm -f "$SKEL_PREFIX/$ROOT_PREFIX/lib/libksba.la--"
- fi
- }
- #ntbtls
- buildNtbtls() {
- downloadNtbtls
- patchNtbtls
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX" --with-libgcrypt-prefix="$SKEL_PREFIX/$ROOT_PREFIX" --with-ksba-prefix="$SKEL_PREFIX/$ROOT_PREFIX"
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX" --with-libgcrypt-prefix="$SKEL_PREFIX/$ROOT_PREFIX" --with-ksba-prefix="$SKEL_PREFIX/$ROOT_PREFIX"
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libntbtls.0.dylib"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/" install
- codesign "deb/$ROOT_PREFIX/lib/libntbtls.0.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libntbtls.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libntbtls.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Security" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: gcrypt, libksba" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: a tiny TLS 1.2 only implementation designed to be used with Libgcrypt and LibKSBA" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: The Not Too Bad TLS Library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/related_software/ntbtls/index.en.html" >> deb/DEBIAN/control
- #Build the doc deb
- #No files
-
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libntbtls.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download gpg
- downloadGpg() {
- if [ ! -e gnupg-2.2.3.tar.bz2 ]; then
- echo "Downloading gnupg-2.2.3.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.3.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.3.tar.bz2.sig
- checkPGPSig gnupg-2.2.3.tar.bz2.sig gnupg-2.2.3.tar.bz2
- else
- echo "Using existing gpg"
- fi
- rm -rf gnupg-2.2.3
- tar xjvf gnupg-2.2.3.tar.bz2
- WORKING_DIR="gnupg-2.2.3"
- PKG_NAME="gnupg"
- PKG_VERSION="2.2.3-1"
- cd "$WORKING_DIR"
- }
- patchGpg() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- if [ "$PKG_VERSION" == "2.2.3-1" ]; then
- cat "g10/exec.c" | head -n 54 > "exec.patched.c"
- echo "#include <stdint.h>" >> "exec.patched.c"
- echo "#include <stdio.h>" >> "exec.patched.c"
- echo "#include <stdlib.h>" >> "exec.patched.c"
- echo "#include <spawn.h>" >> "exec.patched.c"
- echo "#include <sys/wait.h>" >> "exec.patched.c"
- echo "" >> "exec.patched.c"
- echo "extern char **environ;" >> "exec.patched.c"
- echo "" >> "exec.patched.c"
- cat "g10/exec.c" | head -n 111 | tail -n 57 >> "exec.patched.c"
- echo "int RunCmd(const char *cmd) {" >> "exec.patched.c"
- echo " pid_t pid;" >> "exec.patched.c"
- echo ' char *argv[] = {"sh", "-c", (char*)cmd, NULL};' >> "exec.patched.c"
- echo ' int status;' >> "exec.patched.c"
- echo ' status = posix_spawn(&pid, "/bin/sh", NULL, NULL, argv, environ);' >> "exec.patched.c"
- echo ' if (status == 0) {' >> "exec.patched.c"
- echo ' if (waitpid(pid, &status, 0) != -1) {' >> "exec.patched.c"
- echo ' printf("Child exted in ATV Patched RunCmd with status %i\n", status);' >> "exec.patched.c"
- echo ' } else {' >> "exec.patched.c"
- echo ' perror("waitpid");' >> "exec.patched.c"
- echo ' }' >> "exec.patched.c"
- echo ' } else {' >> "exec.patched.c"
- echo ' printf("posix_spawn: %s\n", strerror(status));' >> "exec.patched.c"
- echo ' }' >> "exec.patched.c"
- echo ' return status;' >> "exec.patched.c"
- echo '}' >> "exec.patched.c"
- echo "" >> "exec.patched.c"
- cat "g10/exec.c" | tail -n 524 | sed 's/=system(info->command)/=RunCmd(info->command)/g' >> "exec.patched.c"
- cp "exec.patched.c" "g10/exec.c"
- fi
- fi
- }
- #gpg
- buildGpg() {
- downloadGpg
- patchGpg
- if [ "$ARCH" == "arm64" ]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=aarch64-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-libgcrypt-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-libassuan-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-ksba-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-npth-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-ntbtls-prefix="$SKEL_PREFIX/$ROOT_PREFIX/"
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-libgcrypt-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-libassuan-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-ksba-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-npth-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-ntbtls-prefix="$SKEL_PREFIX/$ROOT_PREFIX/"
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dirmngr"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dirmngr-client"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpg"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpg-agent"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpg-connect-agent"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgconf"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgparsemail"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgscm"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgsm"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgtar"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgv"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/kbxutil"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/watchgnupg"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/gpg-check-pattern"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/gpg-preset-passphrase"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/gpg-protect-tool"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/gpg-wks-client"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/scdaemon"
- initDebStructure
- make -j8 install DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dirmngr"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dirmngr-client"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpg"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpg-agent"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpg-connect-agent"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgconf"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgparsemail"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgscm"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgsm"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgtar"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgv"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/kbxutil"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/watchgnupg"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/gpg-check-pattern"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/gpg-preset-passphrase"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/gpg-protect-tool"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/gpg-wks-client"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/scdaemon"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: gcrypt, gnupth, libassuan, libksba, gnutbtls" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: newer encryption compatible with OpenPGP" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: GNU Privacy Guard" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnupg.org/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files
- #rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download apt
- downloadApt() {
- if [ ! -d apt ]; then
- echo "Downlading apt"
- git clone https://git.nito.tv/NitoTV/apt.git
- else
- echo "Using existing apt"
- fi
- WORKING_DIR="apt"
- PKG_NAME="apt7"
- PKG_VERSION="0.7.25.3-1"
- cd "$WORKING_DIR"
- rm -rf build
- mkdir build
- cd build
- WORKING_DIR="$WORKING_DIR/build"
- }
- patchAPT() {
- if [ "$PLATFORM" == "AppleTVOS" ]; then
- sed -i -- '/^INCLUDE_DIRECTORIES/d' ../CMakeLists.txt
- sed -i -- '/^LINK_DIRECTORIES/d' ../CMakeLists.txt
- cat ../CMakeLists.txt | head -n 15 > newCmakeLists.txt
- echo "INCLUDE_DIRECTORIES($SKEL_PREFIX/$ROOT_PREFIX/include)" >> newCmakeLists.txt
- echo "LINK_DIRECTORIES($SKEL_PREFIX/$ROOT_PREFIX/lib)" >> newCmakeLists.txt
- echo "" >> newCmakeLists.txt
- cat ../CMakeLists.txt | tail -n 217 >> newCmakeLists.txt
- mv newCmakeLists.txt ../CmakeLists.txt
- #sed -i -- "s|/Users/jaywalker/RnD/ATV/packages/test/skel/|$SKEL_PREFIX/|g" ../CMakeLists.txt
- fi
- }
- #apt
- buildAPT() {
- downloadApt
- patchAPT
- cmake -j8 -DCMAKE_LOCALSTATEDIR="/private/var" -DCMAKE_INSTALL_NAME_DIR="/$ROOT_PREFIX/lib" -DCMAKE_INSTALL_RPATH="/$ROOT_PREFIX/" -DCMAKE_OSX_SYSROOT="$SDK_PATH" -DCMAKE_CXX_FLAGS="-arch $ARCH" -DCMAKE_C_FLAGS="-arch $ARCH" -DCMAKE_INSTALL_PREFIX="/$ROOT_PREFIX/" -DCMAKE_SHARED_LINKER_FLAGS="-lresolv -L$SKEL_PREFIX/$ROOT_PREFIX/lib/" -DCURL_INCLUDE_DIR="$SKEL_PREFIX/$ROOT_PREFIX/include" -DCURL_LIBRARIES="$SKEL_PREFIX/$ROOT_PREFIX/lib/libcurl.4.dylib" -DLZ4_INCLUDE_DIRS="$SKEL_PREFIX/$ROOT_PREFIX/include/" -DLZ4_LIBRARIES="$SKEL_PREFIX/$ROOT_PREFIX/lib/liblz4.dylib" -DLZMA_INCLUDE_DIRS="$SKEL_PREFIX/$ROOT_PREFIX/include/" -DLZMA_LIBRARIES="$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.dylib" -DCURRENT_VENDOR=debian -DUSE_NLS=0 -DWITH_DOC=0 -DBERKELEY_DB_INCLUDE_DIRS="$SKEL_PREFIX/$ROOT_PREFIX/include" -DBERKELEY_DB_LIBRARIES="$SKEL_PREFIX/$ROOT_PREFIX/lib/libdb.dylib" -DCMAKE_FIND_ROOT_PATH="$SKEL_PREFIX" ..
- #FIXME: Use our platform-arch vars
- sed -i -- 's|#define COMMON_ARCH "darwin-amd64"|#define COMMON_ARCH "darwin-arm64"|' include/config.h
- make -j8 DESTDIR="$SKEL_PREFIX" install
- #lzma conflicts with built in libraries we make -j8 an extra copy of our version of lzma in the xz build process
- #here we change libapt-pkg*.dylib to look for this version instead
- #if we do not do this, apt-get will fail from our helper tool
- install_name_tool -change /usr/lib/liblzma.5.dylib /usr/local/lib/liblzma.5.dylib $SKEL_PREFIX/$ROOT_PREFIX/lib/libapt-pkg.5.0.1.dylib
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-cache"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-cdrom"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-config"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-ftparchive"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-get"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-mark"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-sortpkgs"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libapt-inst.2.0.0.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libapt-pkg.5.0.1.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libapt-private.0.0.0.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/apt-helper"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/cdrom"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/copy"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/file"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/ftp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/gpgv"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/http"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/https"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/mirror"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/rred"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/rsh"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/store"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/planners/apt"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/solvers/apt"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/solvers/dump"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- #lzma conflicts with built in libraries we make -j8 an extra copy of our version of lzma in the xz build process
- #here we change libapt-pkg*.dylib to look for this version instead
- #if we do not do this, apt-get will fail from our helper tool
- install_name_tool -change /usr/lib/liblzma.5.dylib /usr/local/lib/liblzma.5.dylib deb/$ROOT_PREFIX/lib/libapt-pkg.5.0.1.dylib
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-cache"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-cdrom"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-config"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-ftparchive"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-get"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-mark"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-sortpkgs"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libapt-inst.2.0.0.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libapt-pkg.5.0.1.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libapt-private.0.0.0.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/apt-helper"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/cdrom"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/copy"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/file"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/ftp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/gpgv"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/http"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/https"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/mirror"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/rred"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/rsh"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/store"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/planners/apt"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/solvers/apt"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/solvers/dump"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: standard" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Packaging" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: the advanced packaging tool from Debian" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: APT 0.7 Strict" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://wiki.debian.org/Apt" >> deb/DEBIAN/control
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/etc"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/var"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- buildAPTAndDependencies() {
- notifyProgress "Building gpg-error"
- buildGpgError
- notifyProgress "Building gcrypt"
- buildGcrypt
- notifyProgress "Building KSBA"
- buildKSBA
- notifyProgress "Building npth"
- buildNpth
- notifyProgress "Building Assuan"
- buildAssuan
- notifyProgress "Building ntbtls"
- buildNtbtls
- notifyProgress "Building gpg"
- buildGpg
- notifyProgress "Building apt"
- buildAPT
- }
- #===============
- #Dead Packages
- #---------------
- downloadGnuTLS() {
- #http://gnu.mirrors.pair.com/gnutls/gnutls-3.1.5.tar.xz
- if [ ! -e gnutls-3.1.5.tar.xz ]; then
- echo "Downloading gnutls-3.1.5.tar.xz"
- curl -LO http://gnu.mirrors.pair.com/gnutls/gnutls-3.1.5.tar.xz
- curl -LO http://gnu.mirrors.pair.com/gnutls/gnutls-3.1.5.tar.xz.sig
- checkPGPSig gnutls-3.1.5.tar.xz.sig gnutls-3.1.5.tar.xz
- else
- echo "Using existing gnutls"
- fi
- rm -rf gnutls-3.1.5
- tar xJvf gnutls-3.1.5.tar.xz
- }
- buildGnuTLS() {
- pthname="gnutls-3.1.5"
- downloadGnuTLS
- cd $pthname
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX/ --host=arm-apple-darwin
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' config.h.in
- make clean
- make -j8 DESTDIR="$SKEL_PREFIX" install
- make clean
- mkdir deb
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX/ --host=arm-apple-darwin
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' config.h.in
- make -j8 DESTDIR="$BUILD_ROOT/$pthname/deb" install
- mkdir -p deb/DEBIAN
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Development" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: portable threading library used by X" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: The New GNU Portable Threads Library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/software/npth" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/gnutls-3.5.1-1_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- cd ..
- }
- downloadGzip() {
- if [ ! -e gzip-1.8.tar.xz]; then
- echo "Downloading gzip-1.8.tar.xz"
- curl -LO http://mirror.keystealth.org/gnu/gzip/gzip-1.8.tar.xz
- curl -LO http://mirror.keystealth.org/gnu/gzip/gzip-1.8.tar.xz.sig
- checkPGPSig gzip-1.8.tar.xz.sig gzip-1.8.tar.xz
- else
- echo "Using existing gzip"
- fi
- rm -rf gzip-1.8
- tar xJvf gzip-1.8.tar.xz
- }
- buildGzip() {
- downloadGzip
- cd gzip-1.8
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX/ --host=arm-apple-darwin
- make -j8 DESTDIR=$SKEL_PREFIX install
- initDebStructure
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX --host=arm-apple-darwin
- make -j8 DESTDIR=$BUILD_ROOT/gzip-1.8/deb install
- mkdir -p deb/DEBIAN
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: the standard Unix compression algorithm" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Name: Diff Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gzip.org/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cmp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/diff"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/diff3"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sdiff"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/gzip-1.8-1_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- ######################################################################################
- # can download and repackage substrate (mostly, still may need a modified extrainst_ script)
- installSubstrate() {
- if [ ! -e mobilesubstrate_0.9.6301_iphoneos-arm.deb ]; then
- curl -LO http://apt.saurik.com/debs/com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb
- checkSHA256 com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb 86515cb9f6832247dbeae8427b996099dc8759bb1ef1d719c293123f2f531ee1
- curl -LO http://apt.saurik.com/debs/mobilesubstrate_0.9.6301_iphoneos-arm.deb
- checkSHA256 mobilesubstrate_0.9.6301_iphoneos-arm.deb 8dc91a066f088632409fecf65613831b8d6802e3b799f2dc87563c3ea2ed06ca
- fi
- initDebStructure
- dpkg-deb -e mobilesubstrate_0.9.6301_iphoneos-arm.deb deb/DEBIAN
- dpkg-deb -x mobilesubstrate_0.9.6301_iphoneos-arm.deb deb
- sed -i -- "s|iphoneos-arm|${PLATFORM_LOWER}-$ARCH|" deb/DEBIAN/control
- createListFile mobilesubstrate
- dpkg -b deb
- mv deb.deb "mobilesubstrate_0.9.6301_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg-deb -e com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb deb/DEBIAN
- initDebStructure
- dpkg-deb -x com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb deb
- sed -i -- "s|iphoneos-arm|${PLATFORM_LOWER}-$ARCH|" deb/DEBIAN/control
- createListFile com.saurik.substrate.safemode
- dpkg -b deb
- mv deb.deb "com.saurik.substrate.safemode_0.9.6001_${PLATFORM_LOWER}-$ARCH.deb"
- rm mobilesubstrate_0.9.6301_iphoneos-arm.deb com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb
- dpkg-deb -x "com.saurik.substrate.safemode_0.9.6001_${PLATFORM_LOWER}-$ARCH.deb" "$SKEL_PREFIX/"
- dpkg-deb -x "mobilesubstrate_0.9.6301_${PLATFORM_LOWER}-$ARCH.deb" "$SKEL_PREFIX/"
- #dpkg-deb -x com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb
- }
- #main functions
- #main
- #Entry Point
- echo "Cleaning the slate"
- rm -rf skel extra_pkg
- mkdir -p skel/etc
- mkdir extra_pkg
- # Ensure our SDK has all the required "extras" installed/setup
- prepSDK
- #Begin Building
- #DO NOT BUILD THE 11 UTILS IN UNTIL YOU ARE BUILDING EXPLICITLY FOR 11+
- #/bin/bash exists on 9 and 10 and if overwritten without unthether will likely brick.
- if [ "$BUILD_BASH" == "true" ]; then
- buildBashAndFriends
- fi
- buildBasicUtils
- buildDPKGAndDependencies
- buildAPTAndDependencies
- #installSubstrate
- #rm -rf deb
- #mkdir -p deb/DEBIAN
- #dpkg-deb -x nitoTVLatest.deb deb
- #dpkg-deb -e nitoTVLatest.deb deb/DEBIAN
- #createListFile "com.nito.nitoTV4"
- #dpkg-deb -x nitoTVLatest.deb "$SKEL_PREFIX"
- createStatusFile
- #clean out frivolous stuff to slim skel down to a reasonable size
- find "$SKEL_PREFIX" -type f -name .DS_Store -delete
- mkdir -p "$SKEL_PREFIX/private"
- mv "$SKEL_PREFIX/etc" "$SKEL_PREFIX/private/"
- mv "$SKEL_PREFIX/var" "$SKEL_PREFIX/private/"
- #clean out symbolic links that you don't want to overwrite
- unlink "$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.dylib"
- unlink "$SKEL_PREFIX/$ROOT_PREFIX/lib/libz.1.dylib"
- unlink "$SKEL_PREFIX/$ROOT_PREFIX/lib/libz.dylib"
- rm "$SKEL_PREFIX/$ROOT_PREFIX/lib/libz.1.2.11.dylib"
- # Get rid of the docs
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/docs"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/doc"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/info"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/man"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/man"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/gnupg" #TODO: See if the keys in this folder are needed
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/readline"
- # Get rid of dev stuff
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/include"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/aclocal"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/pkgconfig"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/common-lisp"
- # remove all the static and libtool libraries from the bootstrap, they take up a LOT of space
- cd "$SKEL_PREFIX/$ROOT_PREFIX/lib"
- rm *.a
- rm *.la
- rmdir "$SKEL_PREFIX/$ROOT_PREFIX/var"
- #Get rid of non-skel packages which were needed to compile
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpg-error-config"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/libgcrypt-config"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/lib/pkgconfig"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/curl-config"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/ncurses6-config"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/npth-config"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/ntbtls-config"
- # for getting permissions right, try to mimic them as closely as possible to the default ones
- # Still need to do this for debs, but oh well. We just won't use the yet :P
- sudo chown -R root:wheel "$SKEL_PREFIX/$ROOT_PREFIX"
- sudo chown root:admin "$SKEL_PREFIX/private"
- #sudo chown root:admin "$SKEL_PREFIX/Applications"
- #sudo chown -R root:wheel "$SKEL_PREFIX/Library"
- sudo chown -R root:wheel "$SKEL_PREFIX/private/etc"
- sudo chown -R root:wheel "$SKEL_PREFIX/private/var"
- #sudo chmod 6755 "$SKEL_PREFIX/usr/bin/nitoHelper"
- #sudo chmod 6755 "$SKEL_PREFIX/usr/bin/nitoUpdate"
- rm -rf skel.tgz
- cd "$SKEL_PREFIX"
- #sudo tar cpz -P --exclude .DS_Store -f ../skel.tgz Applications usr private Library
- sudo tar cpz -P --exclude .DS_Store -f ../skel.tgz usr private
- cd "$BUILD_ROOT"
- #reset trap
- trap - INT TERM EXIT
- ls *.deb
- echo "Done"
|