123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549 |
- #!/bin/bash
- #TODO: Add in perl? Maybe?
- #TODO: Update deb build numbers as needed
- 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() {
- sudo rm -rf deb
- mkdir -p deb/DEBIAN
- sudo rm -rf deb-doc
- mkdir -p deb-doc/DEBIAN
- sudo 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
- }
- fixSystem() {
- FILE="$1"
- echo '#define PROC_PIDPATHINFO_MAXSIZE (1024)' >> "$FILE"
- echo 'static int file_exist(const char *filename) {' >> "$FILE"
- echo ' struct stat buffer;' >> "$FILE"
- echo ' int r = stat(filename, &buffer);' >> "$FILE"
- echo ' return (r == 0);' >> "$FILE"
- echo '}' >> "$FILE"
- echo '' >> "$FILE"
- echo 'static char *searchpath(const char *binaryname){' >> "$FILE"
- echo ' if (strstr(binaryname, "/") != NULL){' >> "$FILE"
- echo ' if (file_exist(binaryname)){' >> "$FILE"
- echo ' char *foundpath = malloc((strlen(binaryname) + 1) * (sizeof(char)));' >> "$FILE"
- echo ' strcpy(foundpath, binaryname);' >> "$FILE"
- echo ' return foundpath;' >> "$FILE"
- echo ' } else {' >> "$FILE"
- echo ' return NULL;' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *pathvar = getenv("PATH");' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *dir = strtok(pathvar,":");' >> "$FILE"
- echo ' while (dir != NULL){' >> "$FILE"
- echo ' char searchpth[PROC_PIDPATHINFO_MAXSIZE];' >> "$FILE"
- echo ' strcpy(searchpth, dir);' >> "$FILE"
- echo ' strcat(searchpth, "/");' >> "$FILE"
- echo ' strcat(searchpth, binaryname);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' if (file_exist(searchpth)){' >> "$FILE"
- echo ' char *foundpath = malloc((strlen(searchpth) + 1) * (sizeof(char)));' >> "$FILE"
- echo ' strcpy(foundpath, searchpth);' >> "$FILE"
- echo ' return foundpath;' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' dir = strtok(NULL, ":");' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' return NULL;' >> "$FILE"
- echo '}' >> "$FILE"
- echo '' >> "$FILE"
- echo 'static int isShellScript(const char *path){' >> "$FILE"
- echo ' FILE *file = fopen(path, "r");' >> "$FILE"
- echo ' uint8_t header[2];' >> "$FILE"
- echo ' if (fread(header, sizeof(uint8_t), 2, file) == 2){' >> "$FILE"
- echo " if (header[0] == '#' && header[1] == '!'){" >> "$FILE"
- echo ' fclose(file);' >> "$FILE"
- echo ' return 1;' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' fclose(file);' >> "$FILE"
- echo ' return -1;' >> "$FILE"
- echo '}' >> "$FILE"
- echo '' >> "$FILE"
- echo 'static char *getInterpreter(char *path){' >> "$FILE"
- echo ' FILE *file = fopen(path, "r");' >> "$FILE"
- echo ' char *interpreterLine = NULL;' >> "$FILE"
- echo ' unsigned long lineSize = 0;' >> "$FILE"
- echo ' getline(&interpreterLine, &lineSize, file);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *rawInterpreter = (interpreterLine+2);' >> "$FILE"
- echo ' rawInterpreter = strtok(rawInterpreter, " ");' >> "$FILE"
- echo ' rawInterpreter = strtok(rawInterpreter, "\n");' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *interpreter = malloc((strlen(rawInterpreter)+1) * sizeof(char));' >> "$FILE"
- echo ' strcpy(interpreter, rawInterpreter);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' free(interpreterLine);' >> "$FILE"
- echo ' fclose(file);' >> "$FILE"
- echo ' return interpreter;' >> "$FILE"
- echo '}' >> "$FILE"
- echo '' >> "$FILE"
- echo 'static char *fixedCmd(const char *cmdStr){' >> "$FILE"
- echo ' char *cmdCpy = malloc((strlen(cmdStr)+1) * sizeof(char));' >> "$FILE"
- echo ' strcpy(cmdCpy, cmdStr);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *cmd = strtok(cmdCpy, " ");' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' uint8_t size = strlen(cmd) + 1;' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *args = cmdCpy + size;' >> "$FILE"
- echo ' if ((strlen(cmdStr) - strlen(cmd)) == 0)' >> "$FILE"
- echo ' args = NULL;' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *abs_path = searchpath(cmd);' >> "$FILE"
- echo ' if (abs_path){' >> "$FILE"
- echo ' int isScript = isShellScript(abs_path);' >> "$FILE"
- echo ' if (isScript == 1){' >> "$FILE"
- echo ' char *interpreter = getInterpreter(abs_path);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' uint8_t commandSize = strlen(interpreter) + 1 + strlen(abs_path);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' if (args){' >> "$FILE"
- echo ' commandSize += 1 + strlen(args);' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *rawCommand = malloc(sizeof(char) * (commandSize + 1));' >> "$FILE"
- echo ' strcpy(rawCommand, interpreter);' >> "$FILE"
- echo ' strcat(rawCommand, " ");' >> "$FILE"
- echo ' strcat(rawCommand, abs_path);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' if (args){' >> "$FILE"
- echo ' strcat(rawCommand, " ");' >> "$FILE"
- echo ' strcat(rawCommand, args);' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' rawCommand[(commandSize)+1] = "\0";' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' free(interpreter);' >> "$FILE"
- echo ' free(abs_path);' >> "$FILE"
- echo ' free(cmdCpy);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' return rawCommand;' >> "$FILE"
- echo ' } else {' >> "$FILE"
- echo ' uint8_t commandSize = strlen(abs_path);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' if (args){' >> "$FILE"
- echo ' commandSize += 1 + strlen(args);' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *rawCommand = malloc(sizeof(char) * (commandSize + 1));' >> "$FILE"
- echo ' strcat(rawCommand, abs_path);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' if (args){' >> "$FILE"
- echo ' strcat(rawCommand, " ");' >> "$FILE"
- echo ' strcat(rawCommand, args);' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' rawCommand[(commandSize)+1] = "\0";' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' free(abs_path);' >> "$FILE"
- echo ' free(cmdCpy);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' return rawCommand;' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' return cmdCpy;' >> "$FILE"
- echo '}' >> "$FILE"
- echo '' >> "$FILE"
- echo 'int RunCmd(const char *cmd) {' >> "$FILE"
- echo ' pid_t pid;' >> "$FILE"
- echo ' char *rawCmd = fixedCmd(cmd);' >> "$FILE"
- echo ' char *argv[] = {"sh", "-c", (char*)rawCmd, NULL};' >> "$FILE"
- echo ' int status;' >> "$FILE"
- echo ' status = posix_spawn(&pid, "/bin/sh", NULL, NULL, argv, environ);' >> "$FILE"
- echo ' if (status == 0) {' >> "$FILE"
- echo ' if (waitpid(pid, &status, 0) == -1) {' >> "$FILE"
- echo ' perror("waitpid");' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' } else {' >> "$FILE"
- echo ' printf("posix_spawn: %s\n", strerror(status));' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' free(rawCmd);' >> "$FILE"
- echo ' return status;' >> "$FILE"
- echo '}' >> "$FILE"
- }
- #=====================
- #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
- sudo 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
- sudo 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
- fixSystem "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
- sudo 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
- sudo 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
- sudo 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
- sudo 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
- sudo 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
- sudo 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
- sudo 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
- sudo 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
- sudo 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
- sudo 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
- sudo 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
- sudo 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 "#include <sys/stat.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
- fixSystem "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
- sudo 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
- sudo 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" 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 --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" 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 --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
- sudo 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 "#include <sys/stat.h>" >> random.patched.c
- echo "" >> random.patched.c
- echo "extern char **environ;" >> random.patched.c
- echo "" >> random.patched.c
- fixSystem "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
- sudo 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
- sudo 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
- fixSystem "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
- sudo 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
- sudo 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
- sudo 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"
- fixSystem "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"
- sudo 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" ..
- sed -i -- "s|#define COMMON_ARCH \"darwin-amd64\"|#define COMMON_ARCH \"$PLATFORM_LOWER-$ARCH\"|" 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"
- sudo 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"
|